sh: convert /proc/cpu/aligmnent, /proc/cpu/kernel_alignment to seq_file
[safe/jmp/linux-2.6] / fs / nfsctl.c
index a5a18d4..8f9a205 100644 (file)
@@ -4,13 +4,14 @@
  *     This should eventually move to userland.
  *
  */
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/file.h>
 #include <linux/fs.h>
 #include <linux/sunrpc/svc.h>
 #include <linux/nfsd/nfsd.h>
 #include <linux/nfsd/syscall.h>
+#include <linux/cred.h>
+#include <linux/sched.h>
 #include <linux/linkage.h>
 #include <linux/namei.h>
 #include <linux/mount.h>
 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);
 
        if (flags == O_RDWR)
-               error = may_open(&nd,MAY_READ|MAY_WRITE,FMODE_READ|FMODE_WRITE);
+               error = may_open(&nd.path, MAY_READ|MAY_WRITE,
+                                          FMODE_READ|FMODE_WRITE);
        else
-               error = may_open(&nd, MAY_WRITE, FMODE_WRITE);
+               error = may_open(&nd.path, MAY_WRITE, FMODE_WRITE);
 
        if (!error)
-               return dentry_open(nd.dentry, nd.mnt, flags);
+               return dentry_open(nd.path.dentry, nd.path.mnt, flags,
+                                  current_cred());
 
-       path_release(&nd);
+       path_put(&nd.path);
        return ERR_PTR(error);
 }
 
@@ -87,8 +86,8 @@ static struct {
        },
 };
 
-long
-asmlinkage sys_nfsservctl(int cmd, struct nfsctl_arg __user *arg, void __user *res)
+SYSCALL_DEFINE3(nfsservctl, int, cmd, struct nfsctl_arg __user *, arg,
+               void __user *, res)
 {
        struct file *file;
        void __user *p = &arg->u;