fs: add ksys_fchmod() and do_fchmodat() helpers and ksys_chmod() wrapper; remove...
[linux-block.git] / fs / open.c
index a19b8277c4391aad8d80654330f6dd8ecd7c0902..6037f2bf418ce6477a54db0ed425fcf12b4fb02e 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -551,7 +551,7 @@ out_unlock:
        return error;
 }
 
-SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode)
+int ksys_fchmod(unsigned int fd, umode_t mode)
 {
        struct fd f = fdget(fd);
        int err = -EBADF;
@@ -564,7 +564,12 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode)
        return err;
 }
 
-SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, umode_t, mode)
+SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode)
+{
+       return ksys_fchmod(fd, mode);
+}
+
+int do_fchmodat(int dfd, const char __user *filename, umode_t mode)
 {
        struct path path;
        int error;
@@ -582,9 +587,15 @@ retry:
        return error;
 }
 
+SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename,
+               umode_t, mode)
+{
+       return do_fchmodat(dfd, filename, mode);
+}
+
 SYSCALL_DEFINE2(chmod, const char __user *, filename, umode_t, mode)
 {
-       return sys_fchmodat(AT_FDCWD, filename, mode);
+       return do_fchmodat(AT_FDCWD, filename, mode);
 }
 
 static int chown_common(const struct path *path, uid_t user, gid_t group)