aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2010-08-12 01:04:12 -0400
committerRusty Russell <rusty@rustcorp.com.au>2010-08-11 09:34:13 -0400
commit9bbb9e5a33109b2832e2e63dcc7a132924ab374b (patch)
tree87270ed3a61d0d0e654a61c8d44504cdef330192 /net/sunrpc
parenta14fe249a8f74269c9e636bcbaa78f5bdb354ce3 (diff)
param: use ops in struct kernel_param, rather than get and set fns directly
This is more kernel-ish, saves some space, and also allows us to expand the ops without breaking all the callers who are happy for the new members to be NULL. The few places which defined their own param types are changed to the new scheme (more which crept in recently fixed in following patches). Since we're touching them anyway, we change get() and set() to take a const struct kernel_param (which they really are). This causes some harmless warnings until we fix them (in following patches). To reduce churn, module_param_call creates the ops struct so the callers don't have to change (and casts the functions to reduce warnings). The modern version which takes an ops struct is called module_param_cb. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Reviewed-by: Takashi Iwai <tiwai@suse.de> Tested-by: Phil Carmody <ext-phil.2.carmody@nokia.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Ville Syrjala <syrjala@sci.fi> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Alessandro Rubini <rubini@ipvvis.unipv.it> Cc: Michal Januszewski <spock@gentoo.org> Cc: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Neil Brown <neilb@suse.de> Cc: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org Cc: linux-fbdev-devel@lists.sourceforge.net Cc: linux-nfs@vger.kernel.org Cc: netdev@vger.kernel.org
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/xprtsock.c26
1 files changed, 15 insertions, 11 deletions
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
2580static int param_set_uint_minmax(const char *val, struct kernel_param *kp, 2580static 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
2595static int param_set_portnr(const char *val, struct kernel_param *kp) 2596static 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
2602static int param_get_portnr(char *buffer, struct kernel_param *kp) 2603static 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
2609module_param_named(min_resvport, xprt_min_resvport, portnr, 0644); 2611module_param_named(min_resvport, xprt_min_resvport, portnr, 0644);
2610module_param_named(max_resvport, xprt_max_resvport, portnr, 0644); 2612module_param_named(max_resvport, xprt_max_resvport, portnr, 0644);
2611 2613
2612static int param_set_slot_table_size(const char *val, struct kernel_param *kp) 2614static 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
2619static int param_get_slot_table_size(char *buffer, struct kernel_param *kp) 2622static 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