History

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).

Alexey Dobriyan committed 18 years ago

Commit f221e721 parent f40cbaa16 files · +56 −73Browse files

Showing the changes to kernel/sysctl.c (1 of 16 files). Show all

Unified · Split

kernel/sysctl.c+13−16
@@ -1500,7 +1500,6 @@ void register_sysctl_root(struct ctl_table_root *root) · 1499 unmodified lines
15001500 /* Perform the actual read/write of a sysctl table entry. */
15011501 static int do_sysctl_strategy(struct ctl_table_root *root,
15021502 struct ctl_table *table,
1503− int __user *name, int nlen,
15041503 void __user *oldval, size_t __user *oldlenp,
15051504 void __user *newval, size_t newlen)
15061505 {
@@ -1514,8 +1513,7 @@ static int do_sysctl_strategy(struct ctl_table_root *root, · 7 unmodified lines
15141513 return -EPERM;
15151514
15161515 if (table->strategy) {
1517− rc = table->strategy(table, name, nlen, oldval, oldlenp,
1518− newval, newlen);
1516+ rc = table->strategy(table, oldval, oldlenp, newval, newlen);
15191517 if (rc < 0)
15201518 return rc;
15211519 if (rc > 0)
@@ -1525,8 +1523,7 @@ static int do_sysctl_strategy(struct ctl_table_root *root, · 3 unmodified lines
15251523 /* If there is no strategy routine, or if the strategy returns
15261524 * zero, proceed with automatic r/w */
15271525 if (table->data && table->maxlen) {
1528− rc = sysctl_data(table, name, nlen, oldval, oldlenp,
1529− newval, newlen);
1526+ rc = sysctl_data(table, oldval, oldlenp, newval, newlen);
15301527 if (rc < 0)
15311528 return rc;
15321529 }
@@ -1558,7 +1555,7 @@ repeat: · 25 unmodified lines
15581555 table = table->child;
15591556 goto repeat;
15601557 }
1561− error = do_sysctl_strategy(root, table, name, nlen,
1558+ error = do_sysctl_strategy(root, table,
15621559 oldval, oldlenp,
15631560 newval, newlen);
15641561 return error;
@@ -2707,7 +2704,7 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, · 1142 unmodified lines
27072704 */
27082705
27092706 /* The generic sysctl data routine (used if no strategy routine supplied) */
2710−int sysctl_data(struct ctl_table *table, int __user *name, int nlen,
2707+int sysctl_data(struct ctl_table *table,
27112708 void __user *oldval, size_t __user *oldlenp,
27122709 void __user *newval, size_t newlen)
27132710 {
@@ -2741,7 +2738,7 @@ int sysctl_data(struct ctl_table *table, int __user *name, int nlen, · 27 unmodified lines
27412738 }
27422739
27432740 /* The generic string strategy routine: */
2744−int sysctl_string(struct ctl_table *table, int __user *name, int nlen,
2741+int sysctl_string(struct ctl_table *table,
27452742 void __user *oldval, size_t __user *oldlenp,
27462743 void __user *newval, size_t newlen)
27472744 {
@@ -2787,7 +2784,7 @@ int sysctl_string(struct ctl_table *table, int __user *name, int nlen, · 39 unmodified lines
27872784 * are between the minimum and maximum values given in the arrays
27882785 * table->extra1 and table->extra2, respectively.
27892786 */
2790−int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen,
2787+int sysctl_intvec(struct ctl_table *table,
27912788 void __user *oldval, size_t __user *oldlenp,
27922789 void __user *newval, size_t newlen)
27932790 {
@@ -2823,7 +2820,7 @@ int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen, · 29 unmodified lines
28232820 }
28242821
28252822 /* Strategy function to convert jiffies to seconds */
2826−int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen,
2823+int sysctl_jiffies(struct ctl_table *table,
28272824 void __user *oldval, size_t __user *oldlenp,
28282825 void __user *newval, size_t newlen)
28292826 {
@@ -2857,7 +2854,7 @@ int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen, · 27 unmodified lines
28572854 }
28582855
28592856 /* Strategy function to convert jiffies to seconds */
2860−int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen,
2857+int sysctl_ms_jiffies(struct ctl_table *table,
28612858 void __user *oldval, size_t __user *oldlenp,
28622859 void __user *newval, size_t newlen)
28632860 {
@@ -2912,35 +2909,35 @@ asmlinkage long sys_sysctl(struct __sysctl_args __user *args) · 48 unmodified lines
29122909 return error;
29132910 }
29142911
2915−int sysctl_data(struct ctl_table *table, int __user *name, int nlen,
2912+int sysctl_data(struct ctl_table *table,
29162913 void __user *oldval, size_t __user *oldlenp,
29172914 void __user *newval, size_t newlen)
29182915 {
29192916 return -ENOSYS;
29202917 }
29212918
2922−int sysctl_string(struct ctl_table *table, int __user *name, int nlen,
2919+int sysctl_string(struct ctl_table *table,
29232920 void __user *oldval, size_t __user *oldlenp,
29242921 void __user *newval, size_t newlen)
29252922 {
29262923 return -ENOSYS;
29272924 }
29282925
2929−int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen,
2926+int sysctl_intvec(struct ctl_table *table,
29302927 void __user *oldval, size_t __user *oldlenp,
29312928 void __user *newval, size_t newlen)
29322929 {
29332930 return -ENOSYS;
29342931 }
29352932
2936−int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen,
2933+int sysctl_jiffies(struct ctl_table *table,
29372934 void __user *oldval, size_t __user *oldlenp,
29382935 void __user *newval, size_t newlen)
29392936 {
29402937 return -ENOSYS;
29412938 }
29422939
2943−int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen,
2940+int sysctl_ms_jiffies(struct ctl_table *table,
29442941 void __user *oldval, size_t __user *oldlenp,
29452942 void __user *newval, size_t newlen)
29462943 {