Commit dd2907bf authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] knfsd cleanups

unused arguments (and dead code) removed from exp_rootfh().
parent 8c06da79
...@@ -380,55 +380,34 @@ exp_unexport(struct nfsctl_export *nxp) ...@@ -380,55 +380,34 @@ exp_unexport(struct nfsctl_export *nxp)
* since its harder to fool a kernel module than a user space program. * since its harder to fool a kernel module than a user space program.
*/ */
int int
exp_rootfh(struct svc_client *clp, kdev_t dev, ino_t ino, exp_rootfh(struct svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
char *path, struct knfsd_fh *f, int maxsize)
{ {
struct svc_export *exp; struct svc_export *exp;
struct nameidata nd; struct nameidata nd;
struct inode *inode; struct inode *inode;
struct svc_fh fh; struct svc_fh fh;
kdev_t dev;
int err; int err;
err = -EPERM; err = -EPERM;
if (path) { /* NB: we probably ought to check that it's NUL-terminated */
if (path_init(path, LOOKUP_POSITIVE, &nd) && if (path_init(path, LOOKUP_POSITIVE, &nd) &&
path_walk(path, &nd)) { path_walk(path, &nd)) {
printk("nfsd: exp_rootfh path not found %s", path); printk("nfsd: exp_rootfh path not found %s", path);
return err; return err;
}
dev = nd.dentry->d_inode->i_dev;
ino = nd.dentry->d_inode->i_ino;
dprintk("nfsd: exp_rootfh(%s [%p] %s:%02x:%02x/%ld)\n",
path, nd.dentry, clp->cl_ident,
major(dev), minor(dev), (long) ino);
exp = exp_parent(clp, dev, nd.dentry);
} else {
dprintk("nfsd: exp_rootfh(%s:%02x:%02x/%ld)\n",
clp->cl_ident, major(dev), minor(dev), (long) ino);
if ((exp = exp_get(clp, dev, ino))) {
nd.mnt = mntget(exp->ex_mnt);
nd.dentry = dget(exp->ex_dentry);
}
} }
inode = nd.dentry->d_inode;
dev = inode->i_dev;
dprintk("nfsd: exp_rootfh(%s [%p] %s:%02x:%02x/%ld)\n",
path, nd.dentry, clp->cl_ident,
major(dev), minor(dev), (long) inode->i_ino);
exp = exp_parent(clp, dev, nd.dentry);
if (!exp) { if (!exp) {
dprintk("nfsd: exp_rootfh export not found.\n"); dprintk("nfsd: exp_rootfh export not found.\n");
goto out; goto out;
} }
inode = nd.dentry->d_inode;
if (!inode) {
printk("exp_rootfh: Aieee, NULL d_inode\n");
goto out;
}
if (!kdev_same(inode->i_dev, dev) || inode->i_ino != ino) {
printk("exp_rootfh: Aieee, ino/dev mismatch\n");
printk("exp_rootfh: arg[dev(%02x:%02x):ino(%ld)]"
" inode[dev(%02x:%02x):ino(%ld)]\n",
major(dev), minor(dev), (long) ino,
major(inode->i_dev), minor(inode->i_dev), (long) inode->i_ino);
}
/* /*
* fh must be initialized before calling fh_compose * fh must be initialized before calling fh_compose
*/ */
......
...@@ -124,7 +124,7 @@ nfsctl_getfs(struct nfsctl_fsparm *data, struct knfsd_fh *res) ...@@ -124,7 +124,7 @@ nfsctl_getfs(struct nfsctl_fsparm *data, struct knfsd_fh *res)
if (!(clp = exp_getclient(sin))) if (!(clp = exp_getclient(sin)))
err = -EPERM; err = -EPERM;
else else
err = exp_rootfh(clp, NODEV, 0, data->gd_path, res, data->gd_maxlen); err = exp_rootfh(clp, data->gd_path, res, data->gd_maxlen);
exp_unlock(); exp_unlock();
return err; return err;
} }
...@@ -147,7 +147,7 @@ nfsctl_getfd(struct nfsctl_fdparm *data, __u8 *res) ...@@ -147,7 +147,7 @@ nfsctl_getfd(struct nfsctl_fdparm *data, __u8 *res)
if (!(clp = exp_getclient(sin))) if (!(clp = exp_getclient(sin)))
err = -EPERM; err = -EPERM;
else else
err = exp_rootfh(clp, NODEV, 0, data->gd_path, &fh, NFS_FHSIZE); err = exp_rootfh(clp, data->gd_path, &fh, NFS_FHSIZE);
exp_unlock(); exp_unlock();
if (err == 0) { if (err == 0) {
......
...@@ -90,7 +90,7 @@ void exp_unlock(void); ...@@ -90,7 +90,7 @@ void exp_unlock(void);
struct svc_client * exp_getclient(struct sockaddr_in *sin); struct svc_client * exp_getclient(struct sockaddr_in *sin);
void exp_putclient(struct svc_client *clp); void exp_putclient(struct svc_client *clp);
struct svc_export * exp_get(struct svc_client *clp, kdev_t dev, ino_t ino); struct svc_export * exp_get(struct svc_client *clp, kdev_t dev, ino_t ino);
int exp_rootfh(struct svc_client *, kdev_t, ino_t, int exp_rootfh(struct svc_client *,
char *path, struct knfsd_fh *, int maxsize); char *path, struct knfsd_fh *, int maxsize);
int nfserrno(int errno); int nfserrno(int errno);
void exp_nlmdetach(void); void exp_nlmdetach(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment