diff options
-rw-r--r-- | drivers/input/misc/ati_remote2.c | 26 | ||||
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 14 | ||||
-rw-r--r-- | drivers/video/uvesafb.c | 7 | ||||
-rw-r--r-- | fs/nfs/callback.c | 11 | ||||
-rw-r--r-- | include/linux/moduleparam.h | 123 | ||||
-rw-r--r-- | kernel/params.c | 90 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 26 |
7 files changed, 186 insertions, 111 deletions
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c index e148749b5851..23257652b8e8 100644 --- a/drivers/input/misc/ati_remote2.c +++ b/drivers/input/misc/ati_remote2.c | |||
@@ -38,7 +38,8 @@ enum { | |||
38 | }; | 38 | }; |
39 | 39 | ||
40 | static int ati_remote2_set_mask(const char *val, | 40 | static int ati_remote2_set_mask(const char *val, |
41 | struct kernel_param *kp, unsigned int max) | 41 | const struct kernel_param *kp, |
42 | unsigned int max) | ||
42 | { | 43 | { |
43 | unsigned long mask; | 44 | unsigned long mask; |
44 | int ret; | 45 | int ret; |
@@ -59,28 +60,31 @@ static int ati_remote2_set_mask(const char *val, | |||
59 | } | 60 | } |
60 | 61 | ||
61 | static int ati_remote2_set_channel_mask(const char *val, | 62 | static int ati_remote2_set_channel_mask(const char *val, |
62 | struct kernel_param *kp) | 63 | const struct kernel_param *kp) |
63 | { | 64 | { |
64 | pr_debug("%s()\n", __func__); | 65 | pr_debug("%s()\n", __func__); |
65 | 66 | ||
66 | return ati_remote2_set_mask(val, kp, ATI_REMOTE2_MAX_CHANNEL_MASK); | 67 | return ati_remote2_set_mask(val, kp, ATI_REMOTE2_MAX_CHANNEL_MASK); |
67 | } | 68 | } |
68 | 69 | ||
69 | static int ati_remote2_get_channel_mask(char *buffer, struct kernel_param *kp) | 70 | static int ati_remote2_get_channel_mask(char *buffer, |
71 | const struct kernel_param *kp) | ||
70 | { | 72 | { |
71 | pr_debug("%s()\n", __func__); | 73 | pr_debug("%s()\n", __func__); |
72 | 74 | ||
73 | return sprintf(buffer, "0x%04x", *(unsigned int *)kp->arg); | 75 | return sprintf(buffer, "0x%04x", *(unsigned int *)kp->arg); |
74 | } | 76 | } |
75 | 77 | ||
76 | static int ati_remote2_set_mode_mask(const char *val, struct kernel_param *kp) | 78 | static int ati_remote2_set_mode_mask(const char *val, |
79 | const struct kernel_param *kp) | ||
77 | { | 80 | { |
78 | pr_debug("%s()\n", __func__); | 81 | pr_debug("%s()\n", __func__); |
79 | 82 | ||
80 | return ati_remote2_set_mask(val, kp, ATI_REMOTE2_MAX_MODE_MASK); | 83 | return ati_remote2_set_mask(val, kp, ATI_REMOTE2_MAX_MODE_MASK); |
81 | } | 84 | } |
82 | 85 | ||
83 | static int ati_remote2_get_mode_mask(char *buffer, struct kernel_param *kp) | 86 | static int ati_remote2_get_mode_mask(char *buffer, |
87 | const struct kernel_param *kp) | ||
84 | { | 88 | { |
85 | pr_debug("%s()\n", __func__); | 89 | pr_debug("%s()\n", __func__); |
86 | 90 | ||
@@ -89,15 +93,19 @@ static int ati_remote2_get_mode_mask(char *buffer, struct kernel_param *kp) | |||
89 | 93 | ||
90 | static unsigned int channel_mask = ATI_REMOTE2_MAX_CHANNEL_MASK; | 94 | static unsigned int channel_mask = ATI_REMOTE2_MAX_CHANNEL_MASK; |
91 | #define param_check_channel_mask(name, p) __param_check(name, p, unsigned int) | 95 | #define param_check_channel_mask(name, p) __param_check(name, p, unsigned int) |
92 | #define param_set_channel_mask ati_remote2_set_channel_mask | 96 | static struct kernel_param_ops param_ops_channel_mask = { |
93 | #define param_get_channel_mask ati_remote2_get_channel_mask | 97 | .set = ati_remote2_set_channel_mask, |
98 | .get = ati_remote2_get_channel_mask, | ||
99 | }; | ||
94 | module_param(channel_mask, channel_mask, 0644); | 100 | module_param(channel_mask, channel_mask, 0644); |
95 | MODULE_PARM_DESC(channel_mask, "Bitmask of channels to accept <15:Channel16>...<1:Channel2><0:Channel1>"); | 101 | MODULE_PARM_DESC(channel_mask, "Bitmask of channels to accept <15:Channel16>...<1:Channel2><0:Channel1>"); |
96 | 102 | ||
97 | static unsigned int mode_mask = ATI_REMOTE2_MAX_MODE_MASK; | 103 | static unsigned int mode_mask = ATI_REMOTE2_MAX_MODE_MASK; |
98 | #define param_check_mode_mask(name, p) __param_check(name, p, unsigned int) | 104 | #define param_check_mode_mask(name, p) __param_check(name, p, unsigned int) |
99 | #define param_set_mode_mask ati_remote2_set_mode_mask | 105 | static struct kernel_param_ops param_ops_mode_mask = { |
100 | #define param_get_mode_mask ati_remote2_get_mode_mask | 106 | .set = ati_remote2_set_mode_mask, |
107 | .get = ati_remote2_get_mode_mask, | ||
108 | }; | ||
101 | module_param(mode_mask, mode_mask, 0644); | 109 | module_param(mode_mask, mode_mask, 0644); |
102 | MODULE_PARM_DESC(mode_mask, "Bitmask of modes to accept <4:PC><3:AUX4><2:AUX3><1:AUX2><0:AUX1>"); | 110 | MODULE_PARM_DESC(mode_mask, "Bitmask of modes to accept <4:PC><3:AUX4><2:AUX3><1:AUX2><0:AUX1>"); |
103 | 111 | ||
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 979c50215282..73a7af2542a8 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -39,11 +39,13 @@ MODULE_DESCRIPTION(DRIVER_DESC); | |||
39 | MODULE_LICENSE("GPL"); | 39 | MODULE_LICENSE("GPL"); |
40 | 40 | ||
41 | static unsigned int psmouse_max_proto = PSMOUSE_AUTO; | 41 | static unsigned int psmouse_max_proto = PSMOUSE_AUTO; |
42 | static int psmouse_set_maxproto(const char *val, struct kernel_param *kp); | 42 | static int psmouse_set_maxproto(const char *val, const struct kernel_param *); |
43 | static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp); | 43 | static int psmouse_get_maxproto(char *buffer, const struct kernel_param *kp); |
44 | static struct kernel_param_ops param_ops_proto_abbrev = { | ||
45 | .set = psmouse_set_maxproto, | ||
46 | .get = psmouse_get_maxproto, | ||
47 | }; | ||
44 | #define param_check_proto_abbrev(name, p) __param_check(name, p, unsigned int) | 48 | #define param_check_proto_abbrev(name, p) __param_check(name, p, unsigned int) |
45 | #define param_set_proto_abbrev psmouse_set_maxproto | ||
46 | #define param_get_proto_abbrev psmouse_get_maxproto | ||
47 | module_param_named(proto, psmouse_max_proto, proto_abbrev, 0644); | 49 | module_param_named(proto, psmouse_max_proto, proto_abbrev, 0644); |
48 | MODULE_PARM_DESC(proto, "Highest protocol extension to probe (bare, imps, exps, any). Useful for KVM switches."); | 50 | MODULE_PARM_DESC(proto, "Highest protocol extension to probe (bare, imps, exps, any). Useful for KVM switches."); |
49 | 51 | ||
@@ -1679,7 +1681,7 @@ static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, void *data, | |||
1679 | } | 1681 | } |
1680 | 1682 | ||
1681 | 1683 | ||
1682 | static int psmouse_set_maxproto(const char *val, struct kernel_param *kp) | 1684 | static int psmouse_set_maxproto(const char *val, const struct kernel_param *kp) |
1683 | { | 1685 | { |
1684 | const struct psmouse_protocol *proto; | 1686 | const struct psmouse_protocol *proto; |
1685 | 1687 | ||
@@ -1696,7 +1698,7 @@ static int psmouse_set_maxproto(const char *val, struct kernel_param *kp) | |||
1696 | return 0; | 1698 | return 0; |
1697 | } | 1699 | } |
1698 | 1700 | ||
1699 | static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp) | 1701 | static int psmouse_get_maxproto(char *buffer, const struct kernel_param *kp) |
1700 | { | 1702 | { |
1701 | int type = *((unsigned int *)kp->arg); | 1703 | int type = *((unsigned int *)kp->arg); |
1702 | 1704 | ||
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index 7b8839ebf3c4..52ec0959d462 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c | |||
@@ -1977,8 +1977,7 @@ static void __devexit uvesafb_exit(void) | |||
1977 | 1977 | ||
1978 | module_exit(uvesafb_exit); | 1978 | module_exit(uvesafb_exit); |
1979 | 1979 | ||
1980 | #define param_get_scroll NULL | 1980 | static int param_set_scroll(const char *val, const struct kernel_param *kp) |
1981 | static int param_set_scroll(const char *val, struct kernel_param *kp) | ||
1982 | { | 1981 | { |
1983 | ypan = 0; | 1982 | ypan = 0; |
1984 | 1983 | ||
@@ -1993,7 +1992,9 @@ static int param_set_scroll(const char *val, struct kernel_param *kp) | |||
1993 | 1992 | ||
1994 | return 0; | 1993 | return 0; |
1995 | } | 1994 | } |
1996 | 1995 | static struct kernel_param_ops param_ops_scroll = { | |
1996 | .set = param_set_scroll, | ||
1997 | }; | ||
1997 | #define param_check_scroll(name, p) __param_check(name, p, void) | 1998 | #define param_check_scroll(name, p) __param_check(name, p, void) |
1998 | 1999 | ||
1999 | module_param_named(scroll, ypan, scroll, 0); | 2000 | module_param_named(scroll, ypan, scroll, 0); |
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 36dfdae95123..e17b49e2eabd 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -45,7 +45,7 @@ unsigned short nfs_callback_tcpport; | |||
45 | unsigned short nfs_callback_tcpport6; | 45 | unsigned short nfs_callback_tcpport6; |
46 | #define NFS_CALLBACK_MAXPORTNR (65535U) | 46 | #define NFS_CALLBACK_MAXPORTNR (65535U) |
47 | 47 | ||
48 | static int param_set_portnr(const char *val, struct kernel_param *kp) | 48 | static int param_set_portnr(const char *val, const struct kernel_param *kp) |
49 | { | 49 | { |
50 | unsigned long num; | 50 | unsigned long num; |
51 | int ret; | 51 | int ret; |
@@ -58,11 +58,10 @@ static int param_set_portnr(const char *val, struct kernel_param *kp) | |||
58 | *((unsigned int *)kp->arg) = num; | 58 | *((unsigned int *)kp->arg) = num; |
59 | return 0; | 59 | return 0; |
60 | } | 60 | } |
61 | 61 | static struct kernel_param_ops param_ops_portnr = { | |
62 | static int param_get_portnr(char *buffer, struct kernel_param *kp) | 62 | .set = param_set_portnr, |
63 | { | 63 | .get = param_get_uint, |
64 | return param_get_uint(buffer, kp); | 64 | }; |
65 | } | ||
66 | #define param_check_portnr(name, p) __param_check(name, p, unsigned int); | 65 | #define param_check_portnr(name, p) __param_check(name, p, unsigned int); |
67 | 66 | ||
68 | module_param_named(callback_tcpport, nfs_callback_set_tcpport, portnr, 0644); | 67 | module_param_named(callback_tcpport, nfs_callback_set_tcpport, portnr, 0644); |
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 82a9124f7d75..02e5090ce32f 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -31,20 +31,21 @@ static const char __module_cat(name,__LINE__)[] \ | |||
31 | 31 | ||
32 | struct kernel_param; | 32 | struct kernel_param; |
33 | 33 | ||
34 | /* Returns 0, or -errno. arg is in kp->arg. */ | 34 | struct kernel_param_ops { |
35 | typedef int (*param_set_fn)(const char *val, struct kernel_param *kp); | 35 | /* Returns 0, or -errno. arg is in kp->arg. */ |
36 | /* Returns length written or -errno. Buffer is 4k (ie. be short!) */ | 36 | int (*set)(const char *val, const struct kernel_param *kp); |
37 | typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp); | 37 | /* Returns length written or -errno. Buffer is 4k (ie. be short!) */ |
38 | int (*get)(char *buffer, const struct kernel_param *kp); | ||
39 | }; | ||
38 | 40 | ||
39 | /* Flag bits for kernel_param.flags */ | 41 | /* Flag bits for kernel_param.flags */ |
40 | #define KPARAM_ISBOOL 2 | 42 | #define KPARAM_ISBOOL 2 |
41 | 43 | ||
42 | struct kernel_param { | 44 | struct kernel_param { |
43 | const char *name; | 45 | const char *name; |
46 | const struct kernel_param_ops *ops; | ||
44 | u16 perm; | 47 | u16 perm; |
45 | u16 flags; | 48 | u16 flags; |
46 | param_set_fn set; | ||
47 | param_get_fn get; | ||
48 | union { | 49 | union { |
49 | void *arg; | 50 | void *arg; |
50 | const struct kparam_string *str; | 51 | const struct kparam_string *str; |
@@ -63,8 +64,7 @@ struct kparam_array | |||
63 | { | 64 | { |
64 | unsigned int max; | 65 | unsigned int max; |
65 | unsigned int *num; | 66 | unsigned int *num; |
66 | param_set_fn set; | 67 | const struct kernel_param_ops *ops; |
67 | param_get_fn get; | ||
68 | unsigned int elemsize; | 68 | unsigned int elemsize; |
69 | void *elem; | 69 | void *elem; |
70 | }; | 70 | }; |
@@ -83,7 +83,7 @@ struct kparam_array | |||
83 | parameters. perm sets the visibility in sysfs: 000 means it's | 83 | parameters. perm sets the visibility in sysfs: 000 means it's |
84 | not there, read bits mean it's readable, write bits mean it's | 84 | not there, read bits mean it's readable, write bits mean it's |
85 | writable. */ | 85 | writable. */ |
86 | #define __module_param_call(prefix, name, set, get, arg, isbool, perm) \ | 86 | #define __module_param_call(prefix, name, ops, arg, isbool, perm) \ |
87 | /* Default value instead of permissions? */ \ | 87 | /* Default value instead of permissions? */ \ |
88 | static int __param_perm_check_##name __attribute__((unused)) = \ | 88 | static int __param_perm_check_##name __attribute__((unused)) = \ |
89 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ | 89 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ |
@@ -92,20 +92,37 @@ struct kparam_array | |||
92 | static struct kernel_param __moduleparam_const __param_##name \ | 92 | static struct kernel_param __moduleparam_const __param_##name \ |
93 | __used \ | 93 | __used \ |
94 | __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ | 94 | __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ |
95 | = { __param_str_##name, perm, isbool ? KPARAM_ISBOOL : 0, \ | 95 | = { __param_str_##name, ops, perm, isbool ? KPARAM_ISBOOL : 0, \ |
96 | set, get, { arg } } | 96 | { arg } } |
97 | |||
98 | /* Obsolete - use module_param_cb() */ | ||
99 | #define module_param_call(name, set, get, arg, perm) \ | ||
100 | static struct kernel_param_ops __param_ops_##name = \ | ||
101 | { (void *)set, (void *)get }; \ | ||
102 | __module_param_call(MODULE_PARAM_PREFIX, \ | ||
103 | name, &__param_ops_##name, arg, \ | ||
104 | __same_type(*(arg), bool), \ | ||
105 | (perm) + sizeof(__check_old_set_param(set))*0) | ||
106 | |||
107 | /* We don't get oldget: it's often a new-style param_get_uint, etc. */ | ||
108 | static inline int | ||
109 | __check_old_set_param(int (*oldset)(const char *, struct kernel_param *)) | ||
110 | { | ||
111 | return 0; | ||
112 | } | ||
97 | 113 | ||
98 | #define module_param_call(name, set, get, arg, perm) \ | 114 | #define module_param_cb(name, ops, arg, perm) \ |
99 | __module_param_call(MODULE_PARAM_PREFIX, \ | 115 | __module_param_call(MODULE_PARAM_PREFIX, \ |
100 | name, set, get, arg, \ | 116 | name, ops, arg, __same_type(*(arg), bool), perm) |
101 | __same_type(*(arg), bool), perm) | ||
102 | 117 | ||
103 | /* Helper functions: type is byte, short, ushort, int, uint, long, | 118 | /* |
104 | ulong, charp, bool or invbool, or XXX if you define param_get_XXX, | 119 | * Helper functions: type is byte, short, ushort, int, uint, long, |
105 | param_set_XXX and param_check_XXX. */ | 120 | * ulong, charp, bool or invbool, or XXX if you define param_ops_XXX |
121 | * and param_check_XXX. | ||
122 | */ | ||
106 | #define module_param_named(name, value, type, perm) \ | 123 | #define module_param_named(name, value, type, perm) \ |
107 | param_check_##type(name, &(value)); \ | 124 | param_check_##type(name, &(value)); \ |
108 | module_param_call(name, param_set_##type, param_get_##type, &value, perm); \ | 125 | module_param_cb(name, ¶m_ops_##type, &value, perm); \ |
109 | __MODULE_PARM_TYPE(name, #type) | 126 | __MODULE_PARM_TYPE(name, #type) |
110 | 127 | ||
111 | #define module_param(name, type, perm) \ | 128 | #define module_param(name, type, perm) \ |
@@ -126,7 +143,7 @@ struct kparam_array | |||
126 | */ | 143 | */ |
127 | #define core_param(name, var, type, perm) \ | 144 | #define core_param(name, var, type, perm) \ |
128 | param_check_##type(name, &(var)); \ | 145 | param_check_##type(name, &(var)); \ |
129 | __module_param_call("", name, param_set_##type, param_get_##type, \ | 146 | __module_param_call("", name, ¶m_ops_##type, \ |
130 | &var, __same_type(var, bool), perm) | 147 | &var, __same_type(var, bool), perm) |
131 | #endif /* !MODULE */ | 148 | #endif /* !MODULE */ |
132 | 149 | ||
@@ -135,7 +152,7 @@ struct kparam_array | |||
135 | static const struct kparam_string __param_string_##name \ | 152 | static const struct kparam_string __param_string_##name \ |
136 | = { len, string }; \ | 153 | = { len, string }; \ |
137 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | 154 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
138 | param_set_copystring, param_get_string, \ | 155 | ¶m_ops_string, \ |
139 | .str = &__param_string_##name, 0, perm); \ | 156 | .str = &__param_string_##name, 0, perm); \ |
140 | __MODULE_PARM_TYPE(name, "string") | 157 | __MODULE_PARM_TYPE(name, "string") |
141 | 158 | ||
@@ -162,41 +179,50 @@ static inline void destroy_params(const struct kernel_param *params, | |||
162 | #define __param_check(name, p, type) \ | 179 | #define __param_check(name, p, type) \ |
163 | static inline type *__check_##name(void) { return(p); } | 180 | static inline type *__check_##name(void) { return(p); } |
164 | 181 | ||
165 | extern int param_set_byte(const char *val, struct kernel_param *kp); | 182 | extern struct kernel_param_ops param_ops_byte; |
166 | extern int param_get_byte(char *buffer, struct kernel_param *kp); | 183 | extern int param_set_byte(const char *val, const struct kernel_param *kp); |
184 | extern int param_get_byte(char *buffer, const struct kernel_param *kp); | ||
167 | #define param_check_byte(name, p) __param_check(name, p, unsigned char) | 185 | #define param_check_byte(name, p) __param_check(name, p, unsigned char) |
168 | 186 | ||
169 | extern int param_set_short(const char *val, struct kernel_param *kp); | 187 | extern struct kernel_param_ops param_ops_short; |
170 | extern int param_get_short(char *buffer, struct kernel_param *kp); | 188 | extern int param_set_short(const char *val, const struct kernel_param *kp); |
189 | extern int param_get_short(char *buffer, const struct kernel_param *kp); | ||
171 | #define param_check_short(name, p) __param_check(name, p, short) | 190 | #define param_check_short(name, p) __param_check(name, p, short) |
172 | 191 | ||
173 | extern int param_set_ushort(const char *val, struct kernel_param *kp); | 192 | extern struct kernel_param_ops param_ops_ushort; |
174 | extern int param_get_ushort(char *buffer, struct kernel_param *kp); | 193 | extern int param_set_ushort(const char *val, const struct kernel_param *kp); |
194 | extern int param_get_ushort(char *buffer, const struct kernel_param *kp); | ||
175 | #define param_check_ushort(name, p) __param_check(name, p, unsigned short) | 195 | #define param_check_ushort(name, p) __param_check(name, p, unsigned short) |
176 | 196 | ||
177 | extern int param_set_int(const char *val, struct kernel_param *kp); | 197 | extern struct kernel_param_ops param_ops_int; |
178 | extern int param_get_int(char *buffer, struct kernel_param *kp); | 198 | extern int param_set_int(const char *val, const struct kernel_param *kp); |
199 | extern int param_get_int(char *buffer, const struct kernel_param *kp); | ||
179 | #define param_check_int(name, p) __param_check(name, p, int) | 200 | #define param_check_int(name, p) __param_check(name, p, int) |
180 | 201 | ||
181 | extern int param_set_uint(const char *val, struct kernel_param *kp); | 202 | extern struct kernel_param_ops param_ops_uint; |
182 | extern int param_get_uint(char *buffer, struct kernel_param *kp); | 203 | extern int param_set_uint(const char *val, const struct kernel_param *kp); |
204 | extern int param_get_uint(char *buffer, const struct kernel_param *kp); | ||
183 | #define param_check_uint(name, p) __param_check(name, p, unsigned int) | 205 | #define param_check_uint(name, p) __param_check(name, p, unsigned int) |
184 | 206 | ||
185 | extern int param_set_long(const char *val, struct kernel_param *kp); | 207 | extern struct kernel_param_ops param_ops_long; |
186 | extern int param_get_long(char *buffer, struct kernel_param *kp); | 208 | extern int param_set_long(const char *val, const struct kernel_param *kp); |
209 | extern int param_get_long(char *buffer, const struct kernel_param *kp); | ||
187 | #define param_check_long(name, p) __param_check(name, p, long) | 210 | #define param_check_long(name, p) __param_check(name, p, long) |
188 | 211 | ||
189 | extern int param_set_ulong(const char *val, struct kernel_param *kp); | 212 | extern struct kernel_param_ops param_ops_ulong; |
190 | extern int param_get_ulong(char *buffer, struct kernel_param *kp); | 213 | extern int param_set_ulong(const char *val, const struct kernel_param *kp); |
214 | extern int param_get_ulong(char *buffer, const struct kernel_param *kp); | ||
191 | #define param_check_ulong(name, p) __param_check(name, p, unsigned long) | 215 | #define param_check_ulong(name, p) __param_check(name, p, unsigned long) |
192 | 216 | ||
193 | extern int param_set_charp(const char *val, struct kernel_param *kp); | 217 | extern struct kernel_param_ops param_ops_charp; |
194 | extern int param_get_charp(char *buffer, struct kernel_param *kp); | 218 | extern int param_set_charp(const char *val, const struct kernel_param *kp); |
219 | extern int param_get_charp(char *buffer, const struct kernel_param *kp); | ||
195 | #define param_check_charp(name, p) __param_check(name, p, char *) | 220 | #define param_check_charp(name, p) __param_check(name, p, char *) |
196 | 221 | ||
197 | /* For historical reasons "bool" parameters can be (unsigned) "int". */ | 222 | /* For historical reasons "bool" parameters can be (unsigned) "int". */ |
198 | extern int param_set_bool(const char *val, struct kernel_param *kp); | 223 | extern struct kernel_param_ops param_ops_bool; |
199 | extern int param_get_bool(char *buffer, struct kernel_param *kp); | 224 | extern int param_set_bool(const char *val, const struct kernel_param *kp); |
225 | extern int param_get_bool(char *buffer, const struct kernel_param *kp); | ||
200 | #define param_check_bool(name, p) \ | 226 | #define param_check_bool(name, p) \ |
201 | static inline void __check_##name(void) \ | 227 | static inline void __check_##name(void) \ |
202 | { \ | 228 | { \ |
@@ -205,17 +231,18 @@ extern int param_get_bool(char *buffer, struct kernel_param *kp); | |||
205 | !__same_type(*(p), int)); \ | 231 | !__same_type(*(p), int)); \ |
206 | } | 232 | } |
207 | 233 | ||
208 | extern int param_set_invbool(const char *val, struct kernel_param *kp); | 234 | extern struct kernel_param_ops param_ops_invbool; |
209 | extern int param_get_invbool(char *buffer, struct kernel_param *kp); | 235 | extern int param_set_invbool(const char *val, const struct kernel_param *kp); |
236 | extern int param_get_invbool(char *buffer, const struct kernel_param *kp); | ||
210 | #define param_check_invbool(name, p) __param_check(name, p, bool) | 237 | #define param_check_invbool(name, p) __param_check(name, p, bool) |
211 | 238 | ||
212 | /* Comma-separated array: *nump is set to number they actually specified. */ | 239 | /* Comma-separated array: *nump is set to number they actually specified. */ |
213 | #define module_param_array_named(name, array, type, nump, perm) \ | 240 | #define module_param_array_named(name, array, type, nump, perm) \ |
214 | static const struct kparam_array __param_arr_##name \ | 241 | static const struct kparam_array __param_arr_##name \ |
215 | = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\ | 242 | = { ARRAY_SIZE(array), nump, ¶m_ops_##type, \ |
216 | sizeof(array[0]), array }; \ | 243 | sizeof(array[0]), array }; \ |
217 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | 244 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
218 | param_array_set, param_array_get, \ | 245 | ¶m_array_ops, \ |
219 | .arr = &__param_arr_##name, \ | 246 | .arr = &__param_arr_##name, \ |
220 | __same_type(array[0], bool), perm); \ | 247 | __same_type(array[0], bool), perm); \ |
221 | __MODULE_PARM_TYPE(name, "array of " #type) | 248 | __MODULE_PARM_TYPE(name, "array of " #type) |
@@ -223,11 +250,11 @@ extern int param_get_invbool(char *buffer, struct kernel_param *kp); | |||
223 | #define module_param_array(name, type, nump, perm) \ | 250 | #define module_param_array(name, type, nump, perm) \ |
224 | module_param_array_named(name, name, type, nump, perm) | 251 | module_param_array_named(name, name, type, nump, perm) |
225 | 252 | ||
226 | extern int param_array_set(const char *val, struct kernel_param *kp); | 253 | extern struct kernel_param_ops param_array_ops; |
227 | extern int param_array_get(char *buffer, struct kernel_param *kp); | ||
228 | 254 | ||
229 | extern int param_set_copystring(const char *val, struct kernel_param *kp); | 255 | extern struct kernel_param_ops param_ops_string; |
230 | extern int param_get_string(char *buffer, struct kernel_param *kp); | 256 | extern int param_set_copystring(const char *val, const struct kernel_param *); |
257 | extern int param_get_string(char *buffer, const struct kernel_param *kp); | ||
231 | 258 | ||
232 | /* for exporting parameters in /sys/parameters */ | 259 | /* for exporting parameters in /sys/parameters */ |
233 | 260 | ||
@@ -235,13 +262,13 @@ struct module; | |||
235 | 262 | ||
236 | #if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES) | 263 | #if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES) |
237 | extern int module_param_sysfs_setup(struct module *mod, | 264 | extern int module_param_sysfs_setup(struct module *mod, |
238 | struct kernel_param *kparam, | 265 | const struct kernel_param *kparam, |
239 | unsigned int num_params); | 266 | unsigned int num_params); |
240 | 267 | ||
241 | extern void module_param_sysfs_remove(struct module *mod); | 268 | extern void module_param_sysfs_remove(struct module *mod); |
242 | #else | 269 | #else |
243 | static inline int module_param_sysfs_setup(struct module *mod, | 270 | static inline int module_param_sysfs_setup(struct module *mod, |
244 | struct kernel_param *kparam, | 271 | const struct kernel_param *kparam, |
245 | unsigned int num_params) | 272 | unsigned int num_params) |
246 | { | 273 | { |
247 | return 0; | 274 | return 0; |
diff --git a/kernel/params.c b/kernel/params.c index 3e78fdb445e7..a550698ae02d 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -59,11 +59,11 @@ static int parse_one(char *param, | |||
59 | for (i = 0; i < num_params; i++) { | 59 | for (i = 0; i < num_params; i++) { |
60 | if (parameq(param, params[i].name)) { | 60 | if (parameq(param, params[i].name)) { |
61 | /* Noone handled NULL, so do it here. */ | 61 | /* Noone handled NULL, so do it here. */ |
62 | if (!val && params[i].set != param_set_bool) | 62 | if (!val && params[i].ops->set != param_set_bool) |
63 | return -EINVAL; | 63 | return -EINVAL; |
64 | DEBUGP("They are equal! Calling %p\n", | 64 | DEBUGP("They are equal! Calling %p\n", |
65 | params[i].set); | 65 | params[i].ops->set); |
66 | return params[i].set(val, ¶ms[i]); | 66 | return params[i].ops->set(val, ¶ms[i]); |
67 | } | 67 | } |
68 | } | 68 | } |
69 | 69 | ||
@@ -179,7 +179,7 @@ int parse_args(const char *name, | |||
179 | 179 | ||
180 | /* Lazy bastard, eh? */ | 180 | /* Lazy bastard, eh? */ |
181 | #define STANDARD_PARAM_DEF(name, type, format, tmptype, strtolfn) \ | 181 | #define STANDARD_PARAM_DEF(name, type, format, tmptype, strtolfn) \ |
182 | int param_set_##name(const char *val, struct kernel_param *kp) \ | 182 | int param_set_##name(const char *val, const struct kernel_param *kp) \ |
183 | { \ | 183 | { \ |
184 | tmptype l; \ | 184 | tmptype l; \ |
185 | int ret; \ | 185 | int ret; \ |
@@ -190,12 +190,18 @@ int parse_args(const char *name, | |||
190 | *((type *)kp->arg) = l; \ | 190 | *((type *)kp->arg) = l; \ |
191 | return 0; \ | 191 | return 0; \ |
192 | } \ | 192 | } \ |
193 | int param_get_##name(char *buffer, struct kernel_param *kp) \ | 193 | int param_get_##name(char *buffer, const struct kernel_param *kp) \ |
194 | { \ | 194 | { \ |
195 | return sprintf(buffer, format, *((type *)kp->arg)); \ | 195 | return sprintf(buffer, format, *((type *)kp->arg)); \ |
196 | } \ | 196 | } \ |
197 | struct kernel_param_ops param_ops_##name = { \ | ||
198 | .set = param_set_##name, \ | ||
199 | .get = param_get_##name, \ | ||
200 | }; \ | ||
197 | EXPORT_SYMBOL(param_set_##name); \ | 201 | EXPORT_SYMBOL(param_set_##name); \ |
198 | EXPORT_SYMBOL(param_get_##name) | 202 | EXPORT_SYMBOL(param_get_##name); \ |
203 | EXPORT_SYMBOL(param_ops_##name) | ||
204 | |||
199 | 205 | ||
200 | STANDARD_PARAM_DEF(byte, unsigned char, "%c", unsigned long, strict_strtoul); | 206 | STANDARD_PARAM_DEF(byte, unsigned char, "%c", unsigned long, strict_strtoul); |
201 | STANDARD_PARAM_DEF(short, short, "%hi", long, strict_strtol); | 207 | STANDARD_PARAM_DEF(short, short, "%hi", long, strict_strtol); |
@@ -205,7 +211,7 @@ STANDARD_PARAM_DEF(uint, unsigned int, "%u", unsigned long, strict_strtoul); | |||
205 | STANDARD_PARAM_DEF(long, long, "%li", long, strict_strtol); | 211 | STANDARD_PARAM_DEF(long, long, "%li", long, strict_strtol); |
206 | STANDARD_PARAM_DEF(ulong, unsigned long, "%lu", unsigned long, strict_strtoul); | 212 | STANDARD_PARAM_DEF(ulong, unsigned long, "%lu", unsigned long, strict_strtoul); |
207 | 213 | ||
208 | int param_set_charp(const char *val, struct kernel_param *kp) | 214 | int param_set_charp(const char *val, const struct kernel_param *kp) |
209 | { | 215 | { |
210 | if (strlen(val) > 1024) { | 216 | if (strlen(val) > 1024) { |
211 | printk(KERN_ERR "%s: string parameter too long\n", | 217 | printk(KERN_ERR "%s: string parameter too long\n", |
@@ -226,14 +232,20 @@ int param_set_charp(const char *val, struct kernel_param *kp) | |||
226 | } | 232 | } |
227 | EXPORT_SYMBOL(param_set_charp); | 233 | EXPORT_SYMBOL(param_set_charp); |
228 | 234 | ||
229 | int param_get_charp(char *buffer, struct kernel_param *kp) | 235 | int param_get_charp(char *buffer, const struct kernel_param *kp) |
230 | { | 236 | { |
231 | return sprintf(buffer, "%s", *((char **)kp->arg)); | 237 | return sprintf(buffer, "%s", *((char **)kp->arg)); |
232 | } | 238 | } |
233 | EXPORT_SYMBOL(param_get_charp); | 239 | EXPORT_SYMBOL(param_get_charp); |
234 | 240 | ||
241 | struct kernel_param_ops param_ops_charp = { | ||
242 | .set = param_set_charp, | ||
243 | .get = param_get_charp, | ||
244 | }; | ||
245 | EXPORT_SYMBOL(param_ops_charp); | ||
246 | |||
235 | /* Actually could be a bool or an int, for historical reasons. */ | 247 | /* Actually could be a bool or an int, for historical reasons. */ |
236 | int param_set_bool(const char *val, struct kernel_param *kp) | 248 | int param_set_bool(const char *val, const struct kernel_param *kp) |
237 | { | 249 | { |
238 | bool v; | 250 | bool v; |
239 | 251 | ||
@@ -260,7 +272,7 @@ int param_set_bool(const char *val, struct kernel_param *kp) | |||
260 | } | 272 | } |
261 | EXPORT_SYMBOL(param_set_bool); | 273 | EXPORT_SYMBOL(param_set_bool); |
262 | 274 | ||
263 | int param_get_bool(char *buffer, struct kernel_param *kp) | 275 | int param_get_bool(char *buffer, const struct kernel_param *kp) |
264 | { | 276 | { |
265 | bool val; | 277 | bool val; |
266 | if (kp->flags & KPARAM_ISBOOL) | 278 | if (kp->flags & KPARAM_ISBOOL) |
@@ -273,8 +285,14 @@ int param_get_bool(char *buffer, struct kernel_param *kp) | |||
273 | } | 285 | } |
274 | EXPORT_SYMBOL(param_get_bool); | 286 | EXPORT_SYMBOL(param_get_bool); |
275 | 287 | ||
288 | struct kernel_param_ops param_ops_bool = { | ||
289 | .set = param_set_bool, | ||
290 | .get = param_get_bool, | ||
291 | }; | ||
292 | EXPORT_SYMBOL(param_ops_bool); | ||
293 | |||
276 | /* This one must be bool. */ | 294 | /* This one must be bool. */ |
277 | int param_set_invbool(const char *val, struct kernel_param *kp) | 295 | int param_set_invbool(const char *val, const struct kernel_param *kp) |
278 | { | 296 | { |
279 | int ret; | 297 | int ret; |
280 | bool boolval; | 298 | bool boolval; |
@@ -289,18 +307,24 @@ int param_set_invbool(const char *val, struct kernel_param *kp) | |||
289 | } | 307 | } |
290 | EXPORT_SYMBOL(param_set_invbool); | 308 | EXPORT_SYMBOL(param_set_invbool); |
291 | 309 | ||
292 | int param_get_invbool(char *buffer, struct kernel_param *kp) | 310 | int param_get_invbool(char *buffer, const struct kernel_param *kp) |
293 | { | 311 | { |
294 | return sprintf(buffer, "%c", (*(bool *)kp->arg) ? 'N' : 'Y'); | 312 | return sprintf(buffer, "%c", (*(bool *)kp->arg) ? 'N' : 'Y'); |
295 | } | 313 | } |
296 | EXPORT_SYMBOL(param_get_invbool); | 314 | EXPORT_SYMBOL(param_get_invbool); |
297 | 315 | ||
316 | struct kernel_param_ops param_ops_invbool = { | ||
317 | .set = param_set_invbool, | ||
318 | .get = param_get_invbool, | ||
319 | }; | ||
320 | EXPORT_SYMBOL(param_ops_invbool); | ||
321 | |||
298 | /* We break the rule and mangle the string. */ | 322 | /* We break the rule and mangle the string. */ |
299 | static int param_array(const char *name, | 323 | static int param_array(const char *name, |
300 | const char *val, | 324 | const char *val, |
301 | unsigned int min, unsigned int max, | 325 | unsigned int min, unsigned int max, |
302 | void *elem, int elemsize, | 326 | void *elem, int elemsize, |
303 | int (*set)(const char *, struct kernel_param *kp), | 327 | int (*set)(const char *, const struct kernel_param *kp), |
304 | u16 flags, | 328 | u16 flags, |
305 | unsigned int *num) | 329 | unsigned int *num) |
306 | { | 330 | { |
@@ -345,18 +369,17 @@ static int param_array(const char *name, | |||
345 | return 0; | 369 | return 0; |
346 | } | 370 | } |
347 | 371 | ||
348 | int param_array_set(const char *val, struct kernel_param *kp) | 372 | static int param_array_set(const char *val, const struct kernel_param *kp) |
349 | { | 373 | { |
350 | const struct kparam_array *arr = kp->arr; | 374 | const struct kparam_array *arr = kp->arr; |
351 | unsigned int temp_num; | 375 | unsigned int temp_num; |
352 | 376 | ||
353 | return param_array(kp->name, val, 1, arr->max, arr->elem, | 377 | return param_array(kp->name, val, 1, arr->max, arr->elem, |
354 | arr->elemsize, arr->set, kp->flags, | 378 | arr->elemsize, arr->ops->set, kp->flags, |
355 | arr->num ?: &temp_num); | 379 | arr->num ?: &temp_num); |
356 | } | 380 | } |
357 | EXPORT_SYMBOL(param_array_set); | ||
358 | 381 | ||
359 | int param_array_get(char *buffer, struct kernel_param *kp) | 382 | static int param_array_get(char *buffer, const struct kernel_param *kp) |
360 | { | 383 | { |
361 | int i, off, ret; | 384 | int i, off, ret; |
362 | const struct kparam_array *arr = kp->arr; | 385 | const struct kparam_array *arr = kp->arr; |
@@ -367,7 +390,7 @@ int param_array_get(char *buffer, struct kernel_param *kp) | |||
367 | if (i) | 390 | if (i) |
368 | buffer[off++] = ','; | 391 | buffer[off++] = ','; |
369 | p.arg = arr->elem + arr->elemsize * i; | 392 | p.arg = arr->elem + arr->elemsize * i; |
370 | ret = arr->get(buffer + off, &p); | 393 | ret = arr->ops->get(buffer + off, &p); |
371 | if (ret < 0) | 394 | if (ret < 0) |
372 | return ret; | 395 | return ret; |
373 | off += ret; | 396 | off += ret; |
@@ -375,9 +398,14 @@ int param_array_get(char *buffer, struct kernel_param *kp) | |||
375 | buffer[off] = '\0'; | 398 | buffer[off] = '\0'; |
376 | return off; | 399 | return off; |
377 | } | 400 | } |
378 | EXPORT_SYMBOL(param_array_get); | ||
379 | 401 | ||
380 | int param_set_copystring(const char *val, struct kernel_param *kp) | 402 | struct kernel_param_ops param_array_ops = { |
403 | .set = param_array_set, | ||
404 | .get = param_array_get, | ||
405 | }; | ||
406 | EXPORT_SYMBOL(param_array_ops); | ||
407 | |||
408 | int param_set_copystring(const char *val, const struct kernel_param *kp) | ||
381 | { | 409 | { |
382 | const struct kparam_string *kps = kp->str; | 410 | const struct kparam_string *kps = kp->str; |
383 | 411 | ||
@@ -391,13 +419,19 @@ int param_set_copystring(const char *val, struct kernel_param *kp) | |||
391 | } | 419 | } |
392 | EXPORT_SYMBOL(param_set_copystring); | 420 | EXPORT_SYMBOL(param_set_copystring); |
393 | 421 | ||
394 | int param_get_string(char *buffer, struct kernel_param *kp) | 422 | int param_get_string(char *buffer, const struct kernel_param *kp) |
395 | { | 423 | { |
396 | const struct kparam_string *kps = kp->str; | 424 | const struct kparam_string *kps = kp->str; |
397 | return strlcpy(buffer, kps->string, kps->maxlen); | 425 | return strlcpy(buffer, kps->string, kps->maxlen); |
398 | } | 426 | } |
399 | EXPORT_SYMBOL(param_get_string); | 427 | EXPORT_SYMBOL(param_get_string); |
400 | 428 | ||
429 | struct kernel_param_ops param_ops_string = { | ||
430 | .set = param_set_copystring, | ||
431 | .get = param_get_string, | ||
432 | }; | ||
433 | EXPORT_SYMBOL(param_ops_string); | ||
434 | |||
401 | /* sysfs output in /sys/modules/XYZ/parameters/ */ | 435 | /* sysfs output in /sys/modules/XYZ/parameters/ */ |
402 | #define to_module_attr(n) container_of(n, struct module_attribute, attr) | 436 | #define to_module_attr(n) container_of(n, struct module_attribute, attr) |
403 | #define to_module_kobject(n) container_of(n, struct module_kobject, kobj) | 437 | #define to_module_kobject(n) container_of(n, struct module_kobject, kobj) |
@@ -407,7 +441,7 @@ extern struct kernel_param __start___param[], __stop___param[]; | |||
407 | struct param_attribute | 441 | struct param_attribute |
408 | { | 442 | { |
409 | struct module_attribute mattr; | 443 | struct module_attribute mattr; |
410 | struct kernel_param *param; | 444 | const struct kernel_param *param; |
411 | }; | 445 | }; |
412 | 446 | ||
413 | struct module_param_attrs | 447 | struct module_param_attrs |
@@ -426,10 +460,10 @@ static ssize_t param_attr_show(struct module_attribute *mattr, | |||
426 | int count; | 460 | int count; |
427 | struct param_attribute *attribute = to_param_attr(mattr); | 461 | struct param_attribute *attribute = to_param_attr(mattr); |
428 | 462 | ||
429 | if (!attribute->param->get) | 463 | if (!attribute->param->ops->get) |
430 | return -EPERM; | 464 | return -EPERM; |
431 | 465 | ||
432 | count = attribute->param->get(buf, attribute->param); | 466 | count = attribute->param->ops->get(buf, attribute->param); |
433 | if (count > 0) { | 467 | if (count > 0) { |
434 | strcat(buf, "\n"); | 468 | strcat(buf, "\n"); |
435 | ++count; | 469 | ++count; |
@@ -445,10 +479,10 @@ static ssize_t param_attr_store(struct module_attribute *mattr, | |||
445 | int err; | 479 | int err; |
446 | struct param_attribute *attribute = to_param_attr(mattr); | 480 | struct param_attribute *attribute = to_param_attr(mattr); |
447 | 481 | ||
448 | if (!attribute->param->set) | 482 | if (!attribute->param->ops->set) |
449 | return -EPERM; | 483 | return -EPERM; |
450 | 484 | ||
451 | err = attribute->param->set(buf, attribute->param); | 485 | err = attribute->param->ops->set(buf, attribute->param); |
452 | if (!err) | 486 | if (!err) |
453 | return len; | 487 | return len; |
454 | return err; | 488 | return err; |
@@ -473,7 +507,7 @@ static ssize_t param_attr_store(struct module_attribute *mattr, | |||
473 | * if there's an error. | 507 | * if there's an error. |
474 | */ | 508 | */ |
475 | static __modinit int add_sysfs_param(struct module_kobject *mk, | 509 | static __modinit int add_sysfs_param(struct module_kobject *mk, |
476 | struct kernel_param *kp, | 510 | const struct kernel_param *kp, |
477 | const char *name) | 511 | const char *name) |
478 | { | 512 | { |
479 | struct module_param_attrs *new; | 513 | struct module_param_attrs *new; |
@@ -555,7 +589,7 @@ static void free_module_param_attrs(struct module_kobject *mk) | |||
555 | * /sys/module/[mod->name]/parameters/ | 589 | * /sys/module/[mod->name]/parameters/ |
556 | */ | 590 | */ |
557 | int module_param_sysfs_setup(struct module *mod, | 591 | int module_param_sysfs_setup(struct module *mod, |
558 | struct kernel_param *kparam, | 592 | const struct kernel_param *kparam, |
559 | unsigned int num_params) | 593 | unsigned int num_params) |
560 | { | 594 | { |
561 | int i, err; | 595 | int i, err; |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 7ca65c7005ea..49a62f0c4b87 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -2577,7 +2577,8 @@ void cleanup_socket_xprt(void) | |||
2577 | xprt_unregister_transport(&xs_bc_tcp_transport); | 2577 | xprt_unregister_transport(&xs_bc_tcp_transport); |
2578 | } | 2578 | } |
2579 | 2579 | ||
2580 | static int param_set_uint_minmax(const char *val, struct kernel_param *kp, | 2580 | static int param_set_uint_minmax(const char *val, |
2581 | const struct kernel_param *kp, | ||
2581 | unsigned int min, unsigned int max) | 2582 | unsigned int min, unsigned int max) |
2582 | { | 2583 | { |
2583 | unsigned long num; | 2584 | unsigned long num; |
@@ -2592,34 +2593,37 @@ static int param_set_uint_minmax(const char *val, struct kernel_param *kp, | |||
2592 | return 0; | 2593 | return 0; |
2593 | } | 2594 | } |
2594 | 2595 | ||
2595 | static int param_set_portnr(const char *val, struct kernel_param *kp) | 2596 | static int param_set_portnr(const char *val, const struct kernel_param *kp) |
2596 | { | 2597 | { |
2597 | return param_set_uint_minmax(val, kp, | 2598 | return param_set_uint_minmax(val, kp, |
2598 | RPC_MIN_RESVPORT, | 2599 | RPC_MIN_RESVPORT, |
2599 | RPC_MAX_RESVPORT); | 2600 | RPC_MAX_RESVPORT); |
2600 | } | 2601 | } |
2601 | 2602 | ||
2602 | static int param_get_portnr(char *buffer, struct kernel_param *kp) | 2603 | static struct kernel_param_ops param_ops_portnr = { |
2603 | { | 2604 | .set = param_set_portnr, |
2604 | return param_get_uint(buffer, kp); | 2605 | .get = param_get_uint, |
2605 | } | 2606 | }; |
2607 | |||
2606 | #define param_check_portnr(name, p) \ | 2608 | #define param_check_portnr(name, p) \ |
2607 | __param_check(name, p, unsigned int); | 2609 | __param_check(name, p, unsigned int); |
2608 | 2610 | ||
2609 | module_param_named(min_resvport, xprt_min_resvport, portnr, 0644); | 2611 | module_param_named(min_resvport, xprt_min_resvport, portnr, 0644); |
2610 | module_param_named(max_resvport, xprt_max_resvport, portnr, 0644); | 2612 | module_param_named(max_resvport, xprt_max_resvport, portnr, 0644); |
2611 | 2613 | ||
2612 | static int param_set_slot_table_size(const char *val, struct kernel_param *kp) | 2614 | static int param_set_slot_table_size(const char *val, |
2615 | const struct kernel_param *kp) | ||
2613 | { | 2616 | { |
2614 | return param_set_uint_minmax(val, kp, | 2617 | return param_set_uint_minmax(val, kp, |
2615 | RPC_MIN_SLOT_TABLE, | 2618 | RPC_MIN_SLOT_TABLE, |
2616 | RPC_MAX_SLOT_TABLE); | 2619 | RPC_MAX_SLOT_TABLE); |
2617 | } | 2620 | } |
2618 | 2621 | ||
2619 | static int param_get_slot_table_size(char *buffer, struct kernel_param *kp) | 2622 | static struct kernel_param_ops param_ops_slot_table_size = { |
2620 | { | 2623 | .set = param_set_slot_table_size, |
2621 | return param_get_uint(buffer, kp); | 2624 | .get = param_get_uint, |
2622 | } | 2625 | }; |
2626 | |||
2623 | #define param_check_slot_table_size(name, p) \ | 2627 | #define param_check_slot_table_size(name, p) \ |
2624 | __param_check(name, p, unsigned int); | 2628 | __param_check(name, p, unsigned int); |
2625 | 2629 | ||