|
@@ -24,15 +24,6 @@
|
|
*/
|
|
*/
|
|
enum {
|
|
enum {
|
|
NFSD_Root = 1,
|
|
NFSD_Root = 1,
|
|
-#ifdef CONFIG_NFSD_DEPRECATED
|
|
|
|
- NFSD_Svc,
|
|
|
|
- NFSD_Add,
|
|
|
|
- NFSD_Del,
|
|
|
|
- NFSD_Export,
|
|
|
|
- NFSD_Unexport,
|
|
|
|
- NFSD_Getfd,
|
|
|
|
- NFSD_Getfs,
|
|
|
|
-#endif
|
|
|
|
NFSD_List,
|
|
NFSD_List,
|
|
NFSD_Export_features,
|
|
NFSD_Export_features,
|
|
NFSD_Fh,
|
|
NFSD_Fh,
|
|
@@ -59,15 +50,6 @@ enum {
|
|
/*
|
|
/*
|
|
* write() for these nodes.
|
|
* write() for these nodes.
|
|
*/
|
|
*/
|
|
-#ifdef CONFIG_NFSD_DEPRECATED
|
|
|
|
-static ssize_t write_svc(struct file *file, char *buf, size_t size);
|
|
|
|
-static ssize_t write_add(struct file *file, char *buf, size_t size);
|
|
|
|
-static ssize_t write_del(struct file *file, char *buf, size_t size);
|
|
|
|
-static ssize_t write_export(struct file *file, char *buf, size_t size);
|
|
|
|
-static ssize_t write_unexport(struct file *file, char *buf, size_t size);
|
|
|
|
-static ssize_t write_getfd(struct file *file, char *buf, size_t size);
|
|
|
|
-static ssize_t write_getfs(struct file *file, char *buf, size_t size);
|
|
|
|
-#endif
|
|
|
|
static ssize_t write_filehandle(struct file *file, char *buf, size_t size);
|
|
static ssize_t write_filehandle(struct file *file, char *buf, size_t size);
|
|
static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size);
|
|
static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size);
|
|
static ssize_t write_unlock_fs(struct file *file, char *buf, size_t size);
|
|
static ssize_t write_unlock_fs(struct file *file, char *buf, size_t size);
|
|
@@ -83,15 +65,6 @@ static ssize_t write_recoverydir(struct file *file, char *buf, size_t size);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
static ssize_t (*write_op[])(struct file *, char *, size_t) = {
|
|
static ssize_t (*write_op[])(struct file *, char *, size_t) = {
|
|
-#ifdef CONFIG_NFSD_DEPRECATED
|
|
|
|
- [NFSD_Svc] = write_svc,
|
|
|
|
- [NFSD_Add] = write_add,
|
|
|
|
- [NFSD_Del] = write_del,
|
|
|
|
- [NFSD_Export] = write_export,
|
|
|
|
- [NFSD_Unexport] = write_unexport,
|
|
|
|
- [NFSD_Getfd] = write_getfd,
|
|
|
|
- [NFSD_Getfs] = write_getfs,
|
|
|
|
-#endif
|
|
|
|
[NFSD_Fh] = write_filehandle,
|
|
[NFSD_Fh] = write_filehandle,
|
|
[NFSD_FO_UnlockIP] = write_unlock_ip,
|
|
[NFSD_FO_UnlockIP] = write_unlock_ip,
|
|
[NFSD_FO_UnlockFS] = write_unlock_fs,
|
|
[NFSD_FO_UnlockFS] = write_unlock_fs,
|
|
@@ -130,16 +103,6 @@ static ssize_t nfsctl_transaction_write(struct file *file, const char __user *bu
|
|
|
|
|
|
static ssize_t nfsctl_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos)
|
|
static ssize_t nfsctl_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos)
|
|
{
|
|
{
|
|
-#ifdef CONFIG_NFSD_DEPRECATED
|
|
|
|
- static int warned;
|
|
|
|
- if (file->f_dentry->d_name.name[0] == '.' && !warned) {
|
|
|
|
- printk(KERN_INFO
|
|
|
|
- "Warning: \"%s\" uses deprecated NFSD interface: %s."
|
|
|
|
- " This will be removed in 2.6.40\n",
|
|
|
|
- current->comm, file->f_dentry->d_name.name);
|
|
|
|
- warned = 1;
|
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
if (! file->private_data) {
|
|
if (! file->private_data) {
|
|
/* An attempt to read a transaction file without writing
|
|
/* An attempt to read a transaction file without writing
|
|
* causes a 0-byte write so that the file can return
|
|
* causes a 0-byte write so that the file can return
|
|
@@ -226,303 +189,6 @@ static const struct file_operations pool_stats_operations = {
|
|
* payload - write methods
|
|
* payload - write methods
|
|
*/
|
|
*/
|
|
|
|
|
|
-#ifdef CONFIG_NFSD_DEPRECATED
|
|
|
|
-/**
|
|
|
|
- * write_svc - Start kernel's NFSD server
|
|
|
|
- *
|
|
|
|
- * Deprecated. /proc/fs/nfsd/threads is preferred.
|
|
|
|
- * Function remains to support old versions of nfs-utils.
|
|
|
|
- *
|
|
|
|
- * Input:
|
|
|
|
- * buf: struct nfsctl_svc
|
|
|
|
- * svc_port: port number of this
|
|
|
|
- * server's listener
|
|
|
|
- * svc_nthreads: number of threads to start
|
|
|
|
- * size: size in bytes of passed in nfsctl_svc
|
|
|
|
- * Output:
|
|
|
|
- * On success: returns zero
|
|
|
|
- * On error: return code is negative errno value
|
|
|
|
- */
|
|
|
|
-static ssize_t write_svc(struct file *file, char *buf, size_t size)
|
|
|
|
-{
|
|
|
|
- struct nfsctl_svc *data;
|
|
|
|
- int err;
|
|
|
|
- if (size < sizeof(*data))
|
|
|
|
- return -EINVAL;
|
|
|
|
- data = (struct nfsctl_svc*) buf;
|
|
|
|
- err = nfsd_svc(data->svc_port, data->svc_nthreads);
|
|
|
|
- if (err < 0)
|
|
|
|
- return err;
|
|
|
|
- return 0;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * write_add - Add or modify client entry in auth unix cache
|
|
|
|
- *
|
|
|
|
- * Deprecated. /proc/net/rpc/auth.unix.ip is preferred.
|
|
|
|
- * Function remains to support old versions of nfs-utils.
|
|
|
|
- *
|
|
|
|
- * Input:
|
|
|
|
- * buf: struct nfsctl_client
|
|
|
|
- * cl_ident: '\0'-terminated C string
|
|
|
|
- * containing domain name
|
|
|
|
- * of client
|
|
|
|
- * cl_naddr: no. of items in cl_addrlist
|
|
|
|
- * cl_addrlist: array of client addresses
|
|
|
|
- * cl_fhkeytype: ignored
|
|
|
|
- * cl_fhkeylen: ignored
|
|
|
|
- * cl_fhkey: ignored
|
|
|
|
- * size: size in bytes of passed in nfsctl_client
|
|
|
|
- * Output:
|
|
|
|
- * On success: returns zero
|
|
|
|
- * On error: return code is negative errno value
|
|
|
|
- *
|
|
|
|
- * Note: Only AF_INET client addresses are passed in, since
|
|
|
|
- * nfsctl_client.cl_addrlist contains only in_addr fields for addresses.
|
|
|
|
- */
|
|
|
|
-static ssize_t write_add(struct file *file, char *buf, size_t size)
|
|
|
|
-{
|
|
|
|
- struct nfsctl_client *data;
|
|
|
|
- if (size < sizeof(*data))
|
|
|
|
- return -EINVAL;
|
|
|
|
- data = (struct nfsctl_client *)buf;
|
|
|
|
- return exp_addclient(data);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * write_del - Remove client from auth unix cache
|
|
|
|
- *
|
|
|
|
- * Deprecated. /proc/net/rpc/auth.unix.ip is preferred.
|
|
|
|
- * Function remains to support old versions of nfs-utils.
|
|
|
|
- *
|
|
|
|
- * Input:
|
|
|
|
- * buf: struct nfsctl_client
|
|
|
|
- * cl_ident: '\0'-terminated C string
|
|
|
|
- * containing domain name
|
|
|
|
- * of client
|
|
|
|
- * cl_naddr: ignored
|
|
|
|
- * cl_addrlist: ignored
|
|
|
|
- * cl_fhkeytype: ignored
|
|
|
|
- * cl_fhkeylen: ignored
|
|
|
|
- * cl_fhkey: ignored
|
|
|
|
- * size: size in bytes of passed in nfsctl_client
|
|
|
|
- * Output:
|
|
|
|
- * On success: returns zero
|
|
|
|
- * On error: return code is negative errno value
|
|
|
|
- *
|
|
|
|
- * Note: Only AF_INET client addresses are passed in, since
|
|
|
|
- * nfsctl_client.cl_addrlist contains only in_addr fields for addresses.
|
|
|
|
- */
|
|
|
|
-static ssize_t write_del(struct file *file, char *buf, size_t size)
|
|
|
|
-{
|
|
|
|
- struct nfsctl_client *data;
|
|
|
|
- if (size < sizeof(*data))
|
|
|
|
- return -EINVAL;
|
|
|
|
- data = (struct nfsctl_client *)buf;
|
|
|
|
- return exp_delclient(data);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * write_export - Export part or all of a local file system
|
|
|
|
- *
|
|
|
|
- * Deprecated. /proc/net/rpc/{nfsd.export,nfsd.fh} are preferred.
|
|
|
|
- * Function remains to support old versions of nfs-utils.
|
|
|
|
- *
|
|
|
|
- * Input:
|
|
|
|
- * buf: struct nfsctl_export
|
|
|
|
- * ex_client: '\0'-terminated C string
|
|
|
|
- * containing domain name
|
|
|
|
- * of client allowed to access
|
|
|
|
- * this export
|
|
|
|
- * ex_path: '\0'-terminated C string
|
|
|
|
- * containing pathname of
|
|
|
|
- * directory in local file system
|
|
|
|
- * ex_dev: fsid to use for this export
|
|
|
|
- * ex_ino: ignored
|
|
|
|
- * ex_flags: export flags for this export
|
|
|
|
- * ex_anon_uid: UID to use for anonymous
|
|
|
|
- * requests
|
|
|
|
- * ex_anon_gid: GID to use for anonymous
|
|
|
|
- * requests
|
|
|
|
- * size: size in bytes of passed in nfsctl_export
|
|
|
|
- * Output:
|
|
|
|
- * On success: returns zero
|
|
|
|
- * On error: return code is negative errno value
|
|
|
|
- */
|
|
|
|
-static ssize_t write_export(struct file *file, char *buf, size_t size)
|
|
|
|
-{
|
|
|
|
- struct nfsctl_export *data;
|
|
|
|
- if (size < sizeof(*data))
|
|
|
|
- return -EINVAL;
|
|
|
|
- data = (struct nfsctl_export*)buf;
|
|
|
|
- return exp_export(data);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * write_unexport - Unexport a previously exported file system
|
|
|
|
- *
|
|
|
|
- * Deprecated. /proc/net/rpc/{nfsd.export,nfsd.fh} are preferred.
|
|
|
|
- * Function remains to support old versions of nfs-utils.
|
|
|
|
- *
|
|
|
|
- * Input:
|
|
|
|
- * buf: struct nfsctl_export
|
|
|
|
- * ex_client: '\0'-terminated C string
|
|
|
|
- * containing domain name
|
|
|
|
- * of client no longer allowed
|
|
|
|
- * to access this export
|
|
|
|
- * ex_path: '\0'-terminated C string
|
|
|
|
- * containing pathname of
|
|
|
|
- * directory in local file system
|
|
|
|
- * ex_dev: ignored
|
|
|
|
- * ex_ino: ignored
|
|
|
|
- * ex_flags: ignored
|
|
|
|
- * ex_anon_uid: ignored
|
|
|
|
- * ex_anon_gid: ignored
|
|
|
|
- * size: size in bytes of passed in nfsctl_export
|
|
|
|
- * Output:
|
|
|
|
- * On success: returns zero
|
|
|
|
- * On error: return code is negative errno value
|
|
|
|
- */
|
|
|
|
-static ssize_t write_unexport(struct file *file, char *buf, size_t size)
|
|
|
|
-{
|
|
|
|
- struct nfsctl_export *data;
|
|
|
|
-
|
|
|
|
- if (size < sizeof(*data))
|
|
|
|
- return -EINVAL;
|
|
|
|
- data = (struct nfsctl_export*)buf;
|
|
|
|
- return exp_unexport(data);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * write_getfs - Get a variable-length NFS file handle by path
|
|
|
|
- *
|
|
|
|
- * Deprecated. /proc/fs/nfsd/filehandle is preferred.
|
|
|
|
- * Function remains to support old versions of nfs-utils.
|
|
|
|
- *
|
|
|
|
- * Input:
|
|
|
|
- * buf: struct nfsctl_fsparm
|
|
|
|
- * gd_addr: socket address of client
|
|
|
|
- * gd_path: '\0'-terminated C string
|
|
|
|
- * containing pathname of
|
|
|
|
- * directory in local file system
|
|
|
|
- * gd_maxlen: maximum size of returned file
|
|
|
|
- * handle
|
|
|
|
- * size: size in bytes of passed in nfsctl_fsparm
|
|
|
|
- * Output:
|
|
|
|
- * On success: passed-in buffer filled with a knfsd_fh structure
|
|
|
|
- * (a variable-length raw NFS file handle);
|
|
|
|
- * return code is the size in bytes of the file handle
|
|
|
|
- * On error: return code is negative errno value
|
|
|
|
- *
|
|
|
|
- * Note: Only AF_INET client addresses are passed in, since gd_addr
|
|
|
|
- * is the same size as a struct sockaddr_in.
|
|
|
|
- */
|
|
|
|
-static ssize_t write_getfs(struct file *file, char *buf, size_t size)
|
|
|
|
-{
|
|
|
|
- struct nfsctl_fsparm *data;
|
|
|
|
- struct sockaddr_in *sin;
|
|
|
|
- struct auth_domain *clp;
|
|
|
|
- int err = 0;
|
|
|
|
- struct knfsd_fh *res;
|
|
|
|
- struct in6_addr in6;
|
|
|
|
-
|
|
|
|
- if (size < sizeof(*data))
|
|
|
|
- return -EINVAL;
|
|
|
|
- data = (struct nfsctl_fsparm*)buf;
|
|
|
|
- err = -EPROTONOSUPPORT;
|
|
|
|
- if (data->gd_addr.sa_family != AF_INET)
|
|
|
|
- goto out;
|
|
|
|
- sin = (struct sockaddr_in *)&data->gd_addr;
|
|
|
|
- if (data->gd_maxlen > NFS3_FHSIZE)
|
|
|
|
- data->gd_maxlen = NFS3_FHSIZE;
|
|
|
|
-
|
|
|
|
- res = (struct knfsd_fh*)buf;
|
|
|
|
-
|
|
|
|
- exp_readlock();
|
|
|
|
-
|
|
|
|
- ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6);
|
|
|
|
-
|
|
|
|
- clp = auth_unix_lookup(&init_net, &in6);
|
|
|
|
- if (!clp)
|
|
|
|
- err = -EPERM;
|
|
|
|
- else {
|
|
|
|
- err = exp_rootfh(clp, data->gd_path, res, data->gd_maxlen);
|
|
|
|
- auth_domain_put(clp);
|
|
|
|
- }
|
|
|
|
- exp_readunlock();
|
|
|
|
- if (err == 0)
|
|
|
|
- err = res->fh_size + offsetof(struct knfsd_fh, fh_base);
|
|
|
|
- out:
|
|
|
|
- return err;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * write_getfd - Get a fixed-length NFS file handle by path (used by mountd)
|
|
|
|
- *
|
|
|
|
- * Deprecated. /proc/fs/nfsd/filehandle is preferred.
|
|
|
|
- * Function remains to support old versions of nfs-utils.
|
|
|
|
- *
|
|
|
|
- * Input:
|
|
|
|
- * buf: struct nfsctl_fdparm
|
|
|
|
- * gd_addr: socket address of client
|
|
|
|
- * gd_path: '\0'-terminated C string
|
|
|
|
- * containing pathname of
|
|
|
|
- * directory in local file system
|
|
|
|
- * gd_version: fdparm structure version
|
|
|
|
- * size: size in bytes of passed in nfsctl_fdparm
|
|
|
|
- * Output:
|
|
|
|
- * On success: passed-in buffer filled with nfsctl_res
|
|
|
|
- * (a fixed-length raw NFS file handle);
|
|
|
|
- * return code is the size in bytes of the file handle
|
|
|
|
- * On error: return code is negative errno value
|
|
|
|
- *
|
|
|
|
- * Note: Only AF_INET client addresses are passed in, since gd_addr
|
|
|
|
- * is the same size as a struct sockaddr_in.
|
|
|
|
- */
|
|
|
|
-static ssize_t write_getfd(struct file *file, char *buf, size_t size)
|
|
|
|
-{
|
|
|
|
- struct nfsctl_fdparm *data;
|
|
|
|
- struct sockaddr_in *sin;
|
|
|
|
- struct auth_domain *clp;
|
|
|
|
- int err = 0;
|
|
|
|
- struct knfsd_fh fh;
|
|
|
|
- char *res;
|
|
|
|
- struct in6_addr in6;
|
|
|
|
-
|
|
|
|
- if (size < sizeof(*data))
|
|
|
|
- return -EINVAL;
|
|
|
|
- data = (struct nfsctl_fdparm*)buf;
|
|
|
|
- err = -EPROTONOSUPPORT;
|
|
|
|
- if (data->gd_addr.sa_family != AF_INET)
|
|
|
|
- goto out;
|
|
|
|
- err = -EINVAL;
|
|
|
|
- if (data->gd_version < 2 || data->gd_version > NFSSVC_MAXVERS)
|
|
|
|
- goto out;
|
|
|
|
-
|
|
|
|
- res = buf;
|
|
|
|
- sin = (struct sockaddr_in *)&data->gd_addr;
|
|
|
|
- exp_readlock();
|
|
|
|
-
|
|
|
|
- ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6);
|
|
|
|
-
|
|
|
|
- clp = auth_unix_lookup(&init_net, &in6);
|
|
|
|
- if (!clp)
|
|
|
|
- err = -EPERM;
|
|
|
|
- else {
|
|
|
|
- err = exp_rootfh(clp, data->gd_path, &fh, NFS_FHSIZE);
|
|
|
|
- auth_domain_put(clp);
|
|
|
|
- }
|
|
|
|
- exp_readunlock();
|
|
|
|
-
|
|
|
|
- if (err == 0) {
|
|
|
|
- memset(res,0, NFS_FHSIZE);
|
|
|
|
- memcpy(res, &fh.fh_base, fh.fh_size);
|
|
|
|
- err = NFS_FHSIZE;
|
|
|
|
- }
|
|
|
|
- out:
|
|
|
|
- return err;
|
|
|
|
-}
|
|
|
|
-#endif /* CONFIG_NFSD_DEPRECATED */
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* write_unlock_ip - Release all locks used by a client
|
|
* write_unlock_ip - Release all locks used by a client
|
|
@@ -1397,15 +1063,6 @@ static ssize_t write_recoverydir(struct file *file, char *buf, size_t size)
|
|
static int nfsd_fill_super(struct super_block * sb, void * data, int silent)
|
|
static int nfsd_fill_super(struct super_block * sb, void * data, int silent)
|
|
{
|
|
{
|
|
static struct tree_descr nfsd_files[] = {
|
|
static struct tree_descr nfsd_files[] = {
|
|
-#ifdef CONFIG_NFSD_DEPRECATED
|
|
|
|
- [NFSD_Svc] = {".svc", &transaction_ops, S_IWUSR},
|
|
|
|
- [NFSD_Add] = {".add", &transaction_ops, S_IWUSR},
|
|
|
|
- [NFSD_Del] = {".del", &transaction_ops, S_IWUSR},
|
|
|
|
- [NFSD_Export] = {".export", &transaction_ops, S_IWUSR},
|
|
|
|
- [NFSD_Unexport] = {".unexport", &transaction_ops, S_IWUSR},
|
|
|
|
- [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR},
|
|
|
|
- [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR},
|
|
|
|
-#endif
|
|
|
|
[NFSD_List] = {"exports", &exports_operations, S_IRUGO},
|
|
[NFSD_List] = {"exports", &exports_operations, S_IRUGO},
|
|
[NFSD_Export_features] = {"export_features",
|
|
[NFSD_Export_features] = {"export_features",
|
|
&export_features_operations, S_IRUGO},
|
|
&export_features_operations, S_IRUGO},
|