Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f221e726 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds
Browse files

sysctl: simplify ->strategy



name and nlen parameters passed to ->strategy hook are unused, remove
them.  In general ->strategy hook should know what it's doing, and don't
do something tricky for which, say, pointer to original userspace array
may be needed (name).

Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net> [ networking bits ]
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Matt Mackall <mpm@selenic.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f40cbaa5
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -211,7 +211,7 @@ static int cmode_procctl(ctl_table *ctl, int write, struct file *filp,
	return try_set_cmode(new_cmode)?:*lenp;
	return try_set_cmode(new_cmode)?:*lenp;
}
}


static int cmode_sysctl(ctl_table *table, int __user *name, int nlen,
static int cmode_sysctl(ctl_table *table,
			void __user *oldval, size_t __user *oldlenp,
			void __user *oldval, size_t __user *oldlenp,
			void __user *newval, size_t newlen)
			void __user *newval, size_t newlen)
{
{
@@ -314,7 +314,7 @@ static int p0_procctl(ctl_table *ctl, int write, struct file *filp,
	return try_set_p0(new_p0)?:*lenp;
	return try_set_p0(new_p0)?:*lenp;
}
}


static int p0_sysctl(ctl_table *table, int __user *name, int nlen,
static int p0_sysctl(ctl_table *table,
		     void __user *oldval, size_t __user *oldlenp,
		     void __user *oldval, size_t __user *oldlenp,
		     void __user *newval, size_t newlen)
		     void __user *newval, size_t newlen)
{
{
@@ -358,7 +358,7 @@ static int cm_procctl(ctl_table *ctl, int write, struct file *filp,
	return try_set_cm(new_cm)?:*lenp;
	return try_set_cm(new_cm)?:*lenp;
}
}


static int cm_sysctl(ctl_table *table, int __user *name, int nlen,
static int cm_sysctl(ctl_table *table,
		     void __user *oldval, size_t __user *oldlenp,
		     void __user *oldval, size_t __user *oldlenp,
		     void __user *newval, size_t newlen)
		     void __user *newval, size_t newlen)
{
{
+8 −9
Original line number Original line Diff line number Diff line
@@ -38,14 +38,13 @@
#endif
#endif


/* Strategy function to write EEPROM after changing string entry */
/* Strategy function to write EEPROM after changing string entry */
int sysctl_lasatstring(ctl_table *table, int *name, int nlen,
int sysctl_lasatstring(ctl_table *table,
		void *oldval, size_t *oldlenp,
		void *oldval, size_t *oldlenp,
		void *newval, size_t newlen)
		void *newval, size_t newlen)
{
{
	int r;
	int r;


	r = sysctl_string(table, name,
	r = sysctl_string(table, oldval, oldlenp, newval, newlen);
			  nlen, oldval, oldlenp, newval, newlen);
	if (r < 0)
	if (r < 0)
		return r;
		return r;


@@ -113,13 +112,13 @@ int proc_dolasatrtc(ctl_table *table, int write, struct file *filp,
#endif
#endif


/* Sysctl for setting the IP addresses */
/* Sysctl for setting the IP addresses */
int sysctl_lasat_intvec(ctl_table *table, int *name, int nlen,
int sysctl_lasat_intvec(ctl_table *table,
		    void *oldval, size_t *oldlenp,
		    void *oldval, size_t *oldlenp,
		    void *newval, size_t newlen)
		    void *newval, size_t newlen)
{
{
	int r;
	int r;


	r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen);
	r = sysctl_intvec(table, oldval, oldlenp, newval, newlen);
	if (r < 0)
	if (r < 0)
		return r;
		return r;


@@ -131,7 +130,7 @@ int sysctl_lasat_intvec(ctl_table *table, int *name, int nlen,


#ifdef CONFIG_DS1603
#ifdef CONFIG_DS1603
/* Same for RTC */
/* Same for RTC */
int sysctl_lasat_rtc(ctl_table *table, int *name, int nlen,
int sysctl_lasat_rtc(ctl_table *table,
		    void *oldval, size_t *oldlenp,
		    void *oldval, size_t *oldlenp,
		    void *newval, size_t newlen)
		    void *newval, size_t newlen)
{
{
@@ -140,7 +139,7 @@ int sysctl_lasat_rtc(ctl_table *table, int *name, int nlen,
	rtctmp = read_persistent_clock();
	rtctmp = read_persistent_clock();
	if (rtctmp < 0)
	if (rtctmp < 0)
		rtctmp = 0;
		rtctmp = 0;
	r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen);
	r = sysctl_intvec(table, oldval, oldlenp, newval, newlen);
	if (r < 0)
	if (r < 0)
		return r;
		return r;
	if (newval && newlen)
	if (newval && newlen)
@@ -211,13 +210,13 @@ int proc_lasat_ip(ctl_table *table, int write, struct file *filp,
}
}
#endif
#endif


static int sysctl_lasat_prid(ctl_table *table, int *name, int nlen,
static int sysctl_lasat_prid(ctl_table *table,
				     void *oldval, size_t *oldlenp,
				     void *oldval, size_t *oldlenp,
				     void *newval, size_t newlen)
				     void *newval, size_t newlen)
{
{
	int r;
	int r;


	r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen);
	r = sysctl_intvec(table, oldval, oldlenp, newval, newlen);
	if (r < 0)
	if (r < 0)
		return r;
		return r;
	if (newval && newlen) {
	if (newval && newlen) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -1205,7 +1205,7 @@ static int proc_do_uuid(ctl_table *table, int write, struct file *filp,
	return proc_dostring(&fake_table, write, filp, buffer, lenp, ppos);
	return proc_dostring(&fake_table, write, filp, buffer, lenp, ppos);
}
}


static int uuid_strategy(ctl_table *table, int __user *name, int nlen,
static int uuid_strategy(ctl_table *table,
			 void __user *oldval, size_t __user *oldlenp,
			 void __user *oldval, size_t __user *oldlenp,
			 void __user *newval, size_t newlen)
			 void __user *newval, size_t newlen)
{
{
+1 −1
Original line number Original line Diff line number Diff line
@@ -972,7 +972,7 @@ extern int sysctl_perm(struct ctl_table_root *root,


typedef struct ctl_table ctl_table;
typedef struct ctl_table ctl_table;


typedef int ctl_handler (struct ctl_table *table, int __user *name, int nlen,
typedef int ctl_handler (struct ctl_table *table,
			 void __user *oldval, size_t __user *oldlenp,
			 void __user *oldval, size_t __user *oldlenp,
			 void __user *newval, size_t newlen);
			 void __user *newval, size_t newlen);


+1 −1
Original line number Original line Diff line number Diff line
@@ -396,7 +396,7 @@ extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
int ipv4_doint_and_flush(ctl_table *ctl, int write,
int ipv4_doint_and_flush(ctl_table *ctl, int write,
			 struct file* filp, void __user *buffer,
			 struct file* filp, void __user *buffer,
			 size_t *lenp, loff_t *ppos);
			 size_t *lenp, loff_t *ppos);
int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
int ipv4_doint_and_flush_strategy(ctl_table *table,
				  void __user *oldval, size_t __user *oldlenp,
				  void __user *oldval, size_t __user *oldlenp,
				  void __user *newval, size_t newlen);
				  void __user *newval, size_t newlen);
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
Loading