OSDN Git Service

ANDROID: sdcardfs: make it use new .rename i_op
authorAmit Pundir <amit.pundir@linaro.org>
Sun, 16 Oct 2016 09:54:15 +0000 (15:24 +0530)
committerAmit Pundir <amit.pundir@linaro.org>
Tue, 14 Aug 2018 12:17:11 +0000 (17:47 +0530)
Since commit 2773bf00aeb9 ("fs: rename "rename2" i_op to "rename""),
syscall rename2 is merged with rename syscall and it broke sdcard_fs
build and we get following build error:

  CC [M]  fs/sdcardfs/inode.o
fs/sdcardfs/inode.c:786:13: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
  .rename  = sdcardfs_rename,
             ^
fs/sdcardfs/inode.c:786:13: note: (near initialization for ‘sdcardfs_dir_iops.rename’)

renameat2 syscall is the same as renameat with an added flags argument
and calling renameat2 with flags=0 is equivalent to calling renameat.

Change-Id: I48f3c76c3af481241188253a76f310670de6bd18
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
fs/sdcardfs/inode.c

index 76b57c8..b5a43c1 100644 (file)
@@ -457,7 +457,8 @@ out:
  * superblock-level name-space lock for renames and copy-ups.
  */
 static int sdcardfs_rename(struct inode *old_dir, struct dentry *old_dentry,
-                        struct inode *new_dir, struct dentry *new_dentry)
+                        struct inode *new_dir, struct dentry *new_dentry,
+                        unsigned int flags)
 {
        int err = 0;
        struct dentry *lower_old_dentry = NULL;
@@ -470,6 +471,9 @@ static int sdcardfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        struct path lower_old_path, lower_new_path;
        const struct cred *saved_cred = NULL;
 
+       if (flags)
+               return -EINVAL;
+
        if(!check_caller_access_to_name(old_dir, old_dentry->d_name.name) ||
                !check_caller_access_to_name(new_dir, new_dentry->d_name.name)) {
                printk(KERN_INFO "%s: need to check the caller's gid in packages.list\n"