aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2009-08-09 15:06:19 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-08-09 15:06:19 -0400
commitcbf1107126af2950623fafdaa5c9df43ab00f046 (patch)
tree101e9a26fc86218f567e5c99aad3ddadfdab2691 /net/sunrpc/xprtsock.c
parent80e52aced138bb41b045a8595a87510f27d8d8c5 (diff)
SUNRPC: convert some sysctls into module parameters
Parameters like the minimum reserved port, and the number of slot entries should really be module parameters rather than sysctls. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 83c73c4d017a..585a864c1c4c 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2412,3 +2412,55 @@ void cleanup_socket_xprt(void)
2412 xprt_unregister_transport(&xs_udp_transport); 2412 xprt_unregister_transport(&xs_udp_transport);
2413 xprt_unregister_transport(&xs_tcp_transport); 2413 xprt_unregister_transport(&xs_tcp_transport);
2414} 2414}
2415
2416static int param_set_uint_minmax(const char *val, struct kernel_param *kp,
2417 unsigned int min, unsigned int max)
2418{
2419 unsigned long num;
2420 int ret;
2421
2422 if (!val)
2423 return -EINVAL;
2424 ret = strict_strtoul(val, 0, &num);
2425 if (ret == -EINVAL || num < min || num > max)
2426 return -EINVAL;
2427 *((unsigned int *)kp->arg) = num;
2428 return 0;
2429}
2430
2431static int param_set_portnr(const char *val, struct kernel_param *kp)
2432{
2433 return param_set_uint_minmax(val, kp,
2434 RPC_MIN_RESVPORT,
2435 RPC_MAX_RESVPORT);
2436}
2437
2438static int param_get_portnr(char *buffer, struct kernel_param *kp)
2439{
2440 return param_get_uint(buffer, kp);
2441}
2442#define param_check_portnr(name, p) \
2443 __param_check(name, p, unsigned int);
2444
2445module_param_named(min_resvport, xprt_min_resvport, portnr, 0644);
2446module_param_named(max_resvport, xprt_max_resvport, portnr, 0644);
2447
2448static int param_set_slot_table_size(const char *val, struct kernel_param *kp)
2449{
2450 return param_set_uint_minmax(val, kp,
2451 RPC_MIN_SLOT_TABLE,
2452 RPC_MAX_SLOT_TABLE);
2453}
2454
2455static int param_get_slot_table_size(char *buffer, struct kernel_param *kp)
2456{
2457 return param_get_uint(buffer, kp);
2458}
2459#define param_check_slot_table_size(name, p) \
2460 __param_check(name, p, unsigned int);
2461
2462module_param_named(tcp_slot_table_entries, xprt_tcp_slot_table_entries,
2463 slot_table_size, 0644);
2464module_param_named(udp_slot_table_entries, xprt_udp_slot_table_entries,
2465 slot_table_size, 0644);
2466