Blame view

fs/nfs/sysctl.c 1.91 KB
a72b44222   Trond Myklebust   NFSv4: Allow user...
1
2
3
4
5
  /*
   * linux/fs/nfs/sysctl.c
   *
   * Sysctl interface to NFS parameters
   */
a72b44222   Trond Myklebust   NFSv4: Allow user...
6
7
8
9
10
11
12
  #include <linux/types.h>
  #include <linux/linkage.h>
  #include <linux/ctype.h>
  #include <linux/fs.h>
  #include <linux/sysctl.h>
  #include <linux/module.h>
  #include <linux/nfs4.h>
58df095b7   Trond Myklebust   NFSv4: Allow entr...
13
  #include <linux/nfs_idmap.h>
51d8fa6a1   Trond Myklebust   NFS: Add timeout ...
14
  #include <linux/nfs_fs.h>
a72b44222   Trond Myklebust   NFSv4: Allow user...
15
16
  
  #include "callback.h"
b0706ca41   David Howells   NFS: Avoid warnin...
17
  #ifdef CONFIG_NFS_V4
a72b44222   Trond Myklebust   NFSv4: Allow user...
18
19
  static const int nfs_set_port_min = 0;
  static const int nfs_set_port_max = 65535;
b0706ca41   David Howells   NFS: Avoid warnin...
20
  #endif
a72b44222   Trond Myklebust   NFSv4: Allow user...
21
  static struct ctl_table_header *nfs_callback_sysctl_table;
a72b44222   Trond Myklebust   NFSv4: Allow user...
22
23
24
25
  
  static ctl_table nfs_cb_sysctls[] = {
  #ifdef CONFIG_NFS_V4
  	{
a72b44222   Trond Myklebust   NFSv4: Allow user...
26
27
28
29
  		.procname = "nfs_callback_tcpport",
  		.data = &nfs_callback_set_tcpport,
  		.maxlen = sizeof(int),
  		.mode = 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
30
  		.proc_handler = proc_dointvec_minmax,
a72b44222   Trond Myklebust   NFSv4: Allow user...
31
32
33
  		.extra1 = (int *)&nfs_set_port_min,
  		.extra2 = (int *)&nfs_set_port_max,
  	},
955a857e0   Bryan Schumaker   NFS: new idmapper
34
  #ifndef CONFIG_NFS_USE_NEW_IDMAPPER
58df095b7   Trond Myklebust   NFSv4: Allow entr...
35
  	{
58df095b7   Trond Myklebust   NFSv4: Allow entr...
36
37
38
39
  		.procname = "idmap_cache_timeout",
  		.data = &nfs_idmap_cache_timeout,
  		.maxlen = sizeof(int),
  		.mode = 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
40
  		.proc_handler = proc_dointvec_jiffies,
58df095b7   Trond Myklebust   NFSv4: Allow entr...
41
  	},
955a857e0   Bryan Schumaker   NFS: new idmapper
42
  #endif /* CONFIG_NFS_USE_NEW_IDMAPPER */
a72b44222   Trond Myklebust   NFSv4: Allow user...
43
  #endif
51d8fa6a1   Trond Myklebust   NFS: Add timeout ...
44
  	{
51d8fa6a1   Trond Myklebust   NFS: Add timeout ...
45
46
47
48
  		.procname	= "nfs_mountpoint_timeout",
  		.data		= &nfs_mountpoint_expiry_timeout,
  		.maxlen		= sizeof(nfs_mountpoint_expiry_timeout),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
49
  		.proc_handler	= proc_dointvec_jiffies,
51d8fa6a1   Trond Myklebust   NFS: Add timeout ...
50
  	},
89a09141d   Peter Zijlstra   [PATCH] nfs: fix ...
51
  	{
89a09141d   Peter Zijlstra   [PATCH] nfs: fix ...
52
53
54
55
  		.procname	= "nfs_congestion_kb",
  		.data		= &nfs_congestion_kb,
  		.maxlen		= sizeof(nfs_congestion_kb),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
56
  		.proc_handler	= proc_dointvec,
89a09141d   Peter Zijlstra   [PATCH] nfs: fix ...
57
  	},
ab09203e3   Eric W. Biederman   sysctl fs: Remove...
58
  	{ }
a72b44222   Trond Myklebust   NFSv4: Allow user...
59
60
61
62
  };
  
  static ctl_table nfs_cb_sysctl_dir[] = {
  	{
a72b44222   Trond Myklebust   NFSv4: Allow user...
63
64
65
66
  		.procname = "nfs",
  		.mode = 0555,
  		.child = nfs_cb_sysctls,
  	},
ab09203e3   Eric W. Biederman   sysctl fs: Remove...
67
  	{ }
a72b44222   Trond Myklebust   NFSv4: Allow user...
68
69
70
71
  };
  
  static ctl_table nfs_cb_sysctl_root[] = {
  	{
a72b44222   Trond Myklebust   NFSv4: Allow user...
72
73
74
75
  		.procname = "fs",
  		.mode = 0555,
  		.child = nfs_cb_sysctl_dir,
  	},
ab09203e3   Eric W. Biederman   sysctl fs: Remove...
76
  	{ }
a72b44222   Trond Myklebust   NFSv4: Allow user...
77
78
79
80
  };
  
  int nfs_register_sysctl(void)
  {
0b4d41471   Eric W. Biederman   [PATCH] sysctl: r...
81
  	nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root);
a72b44222   Trond Myklebust   NFSv4: Allow user...
82
83
84
85
86
87
88
89
90
91
  	if (nfs_callback_sysctl_table == NULL)
  		return -ENOMEM;
  	return 0;
  }
  
  void nfs_unregister_sysctl(void)
  {
  	unregister_sysctl_table(nfs_callback_sysctl_table);
  	nfs_callback_sysctl_table = NULL;
  }