X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=fs%2Fnfsctl.c;h=aed8145d9087e053a9349a46c07bd03ac6b02ed5;hb=1bf99477226963d84b182b3995e355d3091199be;hp=1c72c7f85ddc183ae24103baa80dafeee7a47a04;hpb=11ed56fb7899f9eb9eaef8e5919db1bf08f1b07e;p=linux-2.6-omap-h63xx.git diff --git a/fs/nfsctl.c b/fs/nfsctl.c index 1c72c7f85dd..aed8145d908 100644 --- a/fs/nfsctl.c +++ b/fs/nfsctl.c @@ -4,7 +4,6 @@ * This should eventually move to userland. * */ -#include #include #include #include @@ -24,19 +23,15 @@ static struct file *do_open(char *name, int flags) { struct nameidata nd; + struct vfsmount *mnt; int error; - nd.mnt = do_kern_mount("nfsd", 0, "nfsd", NULL); + mnt = do_kern_mount("nfsd", 0, "nfsd", NULL); + if (IS_ERR(mnt)) + return (struct file *)mnt; - if (IS_ERR(nd.mnt)) - return (struct file *)nd.mnt; - - nd.dentry = dget(nd.mnt->mnt_root); - nd.last_type = LAST_ROOT; - nd.flags = 0; - nd.depth = 0; - - error = path_walk(name, &nd); + error = vfs_path_lookup(mnt->mnt_root, mnt, name, 0, &nd); + mntput(mnt); /* drop do_kern_mount reference */ if (error) return ERR_PTR(error); @@ -46,9 +41,9 @@ static struct file *do_open(char *name, int flags) error = may_open(&nd, MAY_WRITE, FMODE_WRITE); if (!error) - return dentry_open(nd.dentry, nd.mnt, flags); + return dentry_open(nd.path.dentry, nd.path.mnt, flags); - path_release(&nd); + path_put(&nd.path); return ERR_PTR(error); } @@ -101,7 +96,7 @@ asmlinkage sys_nfsservctl(int cmd, struct nfsctl_arg __user *arg, void __user *r if (version != NFSCTL_VERSION) return -EINVAL; - if (cmd < 0 || cmd >= sizeof(map)/sizeof(map[0]) || !map[cmd].name) + if (cmd < 0 || cmd >= ARRAY_SIZE(map) || !map[cmd].name) return -EINVAL; file = do_open(map[cmd].name, map[cmd].rsize ? O_RDWR : O_WRONLY);