7 #include <linux/slab.h>
9 #include <linux/ctype.h>
17 #include <linux/module.h>
80 [NFSD_Leasetime] = write_leasetime,
81 [NFSD_Gracetime] = write_gracetime,
82 [NFSD_RecoveryDir] = write_recoverydir,
92 if (ino >=
ARRAY_SIZE(write_op) || !write_op[ino])
107 static ssize_t nfsctl_transaction_read(
struct file *file,
char __user *buf,
size_t size, loff_t *pos)
114 ssize_t rv = nfsctl_transaction_write(file, buf, 0, pos);
122 .write = nfsctl_transaction_write,
123 .read = nfsctl_transaction_read,
128 static int exports_open(
struct inode *
inode,
struct file *file)
144 .open = exports_open,
151 static int export_features_show(
struct seq_file *
m,
void *
v)
157 static int export_features_open(
struct inode *inode,
struct file *file)
163 .open = export_features_open,
169 #if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE)
170 static int supported_enctypes_show(
struct seq_file *
m,
void *
v)
176 static int supported_enctypes_open(
struct inode *inode,
struct file *file)
182 .
open = supported_enctypes_open,
220 static ssize_t write_unlock_ip(
struct file *file,
char *buf,
size_t size)
224 size_t salen =
sizeof(
address);
231 if (buf[size-1] !=
'\n')
258 static ssize_t write_unlock_fs(
struct file *file,
char *buf,
size_t size)
268 if (buf[size-1] !=
'\n')
315 static ssize_t write_filehandle(
struct file *file,
char *buf,
size_t size)
321 struct auth_domain *dom;
327 if (buf[size-1] !=
'\n')
341 len = get_int(&mesg, &maxsize);
365 qword_addhex(&mesg, &len, (
char*)&fh.fh_base, fh.fh_size);
398 static ssize_t write_threads(
struct file *file,
char *buf,
size_t size)
404 rv = get_int(&mesg, &newthreads);
440 static ssize_t write_pool_threads(
struct file *file,
char *buf,
size_t size)
465 nthreads = kcalloc(npools,
sizeof(
int),
GFP_KERNEL);
467 if (nthreads ==
NULL)
471 for (i = 0; i < npools; i++) {
472 rv = get_int(&mesg, &nthreads[i]);
492 for (i = 0; i < npools && size > 0; i++) {
493 snprintf(mesg, size,
"%d%c", nthreads[i], (i == npools-1 ?
'\n' :
' '));
505 static ssize_t __write_versions(
struct file *file,
char *buf,
size_t size)
508 char *vers, *minorp,
sign;
509 int len,
num, remaining;
521 if (buf[size-1] !=
'\n')
527 if (len <= 0)
return -
EINVAL;
530 if (sign ==
'+' || sign ==
'-')
534 if (*minorp ==
'.') {
556 }
while ((len =
qword_get(&mesg, vers, size)) > 0);
567 for (num=2 ; num <= 4 ; num++)
569 len =
snprintf(buf, remaining,
"%s%c%d", sep,
583 len =
snprintf(buf, remaining,
" %c4.%u",
596 len =
snprintf(buf, remaining,
"\n");
634 static ssize_t write_versions(
struct file *file,
char *buf,
size_t size)
639 rv = __write_versions(file, buf, size);
648 static ssize_t __write_ports_names(
char *buf)
660 static ssize_t __write_ports_addfd(
char *buf)
666 err = get_int(&mesg, &fd);
667 if (err != 0 || fd < 0)
689 static ssize_t __write_ports_addxprt(
char *buf)
696 if (
sscanf(buf,
"%15s %5u", transport, &port) != 2)
730 static ssize_t __write_ports(
struct file *file,
char *buf,
size_t size)
733 return __write_ports_names(buf);
736 return __write_ports_addfd(buf);
739 return __write_ports_addxprt(buf);
787 static ssize_t write_ports(
struct file *file,
char *buf,
size_t size)
792 rv = __write_ports(file, buf, size);
821 static ssize_t write_maxblksize(
struct file *file,
char *buf,
size_t size)
826 int rv = get_int(&mesg, &bsize);
842 nfsd_max_blksize = bsize;
850 #ifdef CONFIG_NFSD_V4
851 static ssize_t __nfsd4_write_time(
struct file *file,
char *buf,
size_t size,
time_t *
time)
859 rv = get_int(&mesg, &i);
874 if (i < 10 || i > 3600)
882 static ssize_t nfsd4_write_time(
struct file *file,
char *buf,
size_t size,
time_t *time)
887 rv = __nfsd4_write_time(file, buf, size, time);
913 static ssize_t write_leasetime(
struct file *file,
char *buf,
size_t size)
915 return nfsd4_write_time(file, buf, size, &
nfsd4_lease);
928 static ssize_t write_gracetime(
struct file *file,
char *buf,
size_t size)
930 return nfsd4_write_time(file, buf, size, &
nfsd4_grace);
933 static ssize_t __write_recoverydir(
struct file *file,
char *buf,
size_t size)
942 if (size >
PATH_MAX || buf[size-1] !=
'\n')
981 static ssize_t write_recoverydir(
struct file *file,
char *buf,
size_t size)
986 rv = __write_recoverydir(file, buf, size);
998 static int nfsd_fill_super(
struct super_block *
sb,
void * data,
int silent)
1003 &export_features_operations,
S_IRUGO},
1015 #if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE)
1018 #ifdef CONFIG_NFSD_V4
1019 [NFSD_Leasetime] = {
"nfsv4leasetime", &transaction_ops,
S_IWUSR|
S_IRUSR},
1020 [NFSD_Gracetime] = {
"nfsv4gracetime", &transaction_ops,
S_IWUSR|
S_IRUSR},
1021 [NFSD_RecoveryDir] = {
"nfsv4recoverydir", &transaction_ops,
S_IWUSR|
S_IRUSR},
1029 int flags,
const char *dev_name,
void *data)
1031 return mount_single(fs_type, flags, data, nfsd_fill_super);
1037 .mount = nfsd_mount,
1041 #ifdef CONFIG_PROC_FS
1042 static int create_proc_exports_entry(
void)
1049 entry = proc_create(
"exports", 0, entry, &exports_operations);
1055 static int create_proc_exports_entry(
void)
1063 static __net_init int nfsd_init_net(
struct net *net)
1069 goto out_export_error;
1072 goto out_idmap_error;
1081 static __net_exit void nfsd_exit_net(
struct net *net)
1088 .init = nfsd_init_net,
1089 .exit = nfsd_exit_net,
1094 static int __init init_nfsd(
void)
1104 goto out_unregister_notifier;
1107 goto out_unregister_pernet;
1111 goto out_free_slabs;
1117 retval = create_proc_exports_entry();
1119 goto out_free_lockd;
1135 out_unregister_pernet:
1137 out_unregister_notifier:
1142 static void __exit exit_nfsd(
void)