]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
fuse2fs: rearrange check_inum_access parameters a bit
authorDarrick J. Wong <djwong@kernel.org>
Wed, 21 May 2025 22:38:34 +0000 (15:38 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 23 May 2025 13:39:41 +0000 (09:39 -0400)
Pass the struct fuse2fs pointer to check_inum_access so that we can do
some more rearranging in the next patches.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677801.1383760.3807372754743381596.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/fuse2fs.c

index 3fd42821170d1744591ed63e36d37ca667d61e94..53e0d15191f158862cf4a85863433f1999ed0366 100644 (file)
@@ -519,10 +519,10 @@ static inline int want_check_owner(struct fuse2fs *ff,
        return !is_superuser(ff, ctxt);
 }
 
-static int check_inum_access(ext2_filsys fs, ext2_ino_t ino, mode_t mask)
+static int check_inum_access(struct fuse2fs *ff, ext2_ino_t ino, int mask)
 {
        struct fuse_context *ctxt = fuse_get_context();
-       struct fuse2fs *ff = (struct fuse2fs *)ctxt->private_data;
+       ext2_filsys fs = ff->fs;
        struct ext2_inode inode;
        mode_t perms;
        errcode_t err;
@@ -892,7 +892,7 @@ static int op_mknod(const char *path, mode_t mode, dev_t dev)
                goto out2;
        }
 
-       ret = check_inum_access(fs, parent, W_OK);
+       ret = check_inum_access(ff, parent, W_OK);
        if (ret)
                goto out2;
 
@@ -1023,7 +1023,7 @@ static int op_mkdir(const char *path, mode_t mode)
                goto out2;
        }
 
-       ret = check_inum_access(fs, parent, W_OK);
+       ret = check_inum_access(ff, parent, W_OK);
        if (ret)
                goto out2;
 
@@ -1144,7 +1144,7 @@ static int unlink_file_by_name(struct fuse2fs *ff, const char *path)
                base_name = filename;
        }
 
-       ret = check_inum_access(fs, dir, W_OK);
+       ret = check_inum_access(ff, dir, W_OK);
        if (ret) {
                free(filename);
                return ret;
@@ -1408,7 +1408,7 @@ static int op_symlink(const char *src, const char *dest)
                goto out2;
        }
 
-       ret = check_inum_access(fs, parent, W_OK);
+       ret = check_inum_access(ff, parent, W_OK);
        if (ret)
                goto out2;
 
@@ -1581,7 +1581,7 @@ static int op_rename(const char *from, const char *to
                goto out2;
        }
 
-       ret = check_inum_access(fs, from_dir_ino, W_OK);
+       ret = check_inum_access(ff, from_dir_ino, W_OK);
        if (ret)
                goto out2;
 
@@ -1606,7 +1606,7 @@ static int op_rename(const char *from, const char *to
                goto out2;
        }
 
-       ret = check_inum_access(fs, to_dir_ino, W_OK);
+       ret = check_inum_access(ff, to_dir_ino, W_OK);
        if (ret)
                goto out2;
 
@@ -1773,7 +1773,7 @@ static int op_link(const char *src, const char *dest)
                goto out2;
        }
 
-       ret = check_inum_access(fs, parent, W_OK);
+       ret = check_inum_access(ff, parent, W_OK);
        if (ret)
                goto out2;
 
@@ -2021,7 +2021,7 @@ static int op_truncate(const char *path, off_t len
        }
        dbg_printf(ff, "%s: ino=%d len=%jd\n", __func__, ino, (intmax_t) len);
 
-       ret = check_inum_access(fs, ino, W_OK);
+       ret = check_inum_access(ff, ino, W_OK);
        if (ret)
                goto out;
 
@@ -2096,7 +2096,7 @@ static int __op_open(struct fuse2fs *ff, const char *path,
        }
        dbg_printf(ff, "%s: ino=%d\n", __func__, file->ino);
 
-       ret = check_inum_access(fs, file->ino, check);
+       ret = check_inum_access(ff, file->ino, check);
        if (ret) {
                /*
                 * In a regular (Linux) fs driver, the kernel will open
@@ -2108,7 +2108,7 @@ static int __op_open(struct fuse2fs *ff, const char *path,
                 * also employ undocumented hacks (see above).
                 */
                if (check == R_OK) {
-                       ret = check_inum_access(fs, file->ino, X_OK);
+                       ret = check_inum_access(ff, file->ino, X_OK);
                        if (ret)
                                goto out;
                } else
@@ -2405,7 +2405,7 @@ static int op_getxattr(const char *path, const char *key, char *value,
        }
        dbg_printf(ff, "%s: ino=%d name=%s\n", __func__, ino, key);
 
-       ret = check_inum_access(fs, ino, R_OK);
+       ret = check_inum_access(ff, ino, R_OK);
        if (ret)
                goto out;
 
@@ -2495,7 +2495,7 @@ static int op_listxattr(const char *path, char *names, size_t len)
        }
        dbg_printf(ff, "%s: ino=%d\n", __func__, ino);
 
-       ret = check_inum_access(fs, ino, R_OK);
+       ret = check_inum_access(ff, ino, R_OK);
        if (ret)
                goto out;
 
@@ -2575,7 +2575,7 @@ static int op_setxattr(const char *path EXT2FS_ATTR((unused)),
        }
        dbg_printf(ff, "%s: ino=%d name=%s\n", __func__, ino, key);
 
-       ret = check_inum_access(fs, ino, W_OK);
+       ret = check_inum_access(ff, ino, W_OK);
        if (ret == -EACCES) {
                ret = -EPERM;
                goto out;
@@ -2668,7 +2668,7 @@ static int op_removexattr(const char *path, const char *key)
        }
        dbg_printf(ff, "%s: ino=%d name=%s\n", __func__, ino, key);
 
-       ret = check_inum_access(fs, ino, W_OK);
+       ret = check_inum_access(ff, ino, W_OK);
        if (ret)
                goto out;
 
@@ -2841,7 +2841,7 @@ static int op_access(const char *path, int mask)
                goto out;
        }
 
-       ret = check_inum_access(fs, ino, mask);
+       ret = check_inum_access(ff, ino, mask);
        if (ret)
                goto out;
 
@@ -2893,7 +2893,7 @@ static int op_create(const char *path, mode_t mode, struct fuse_file_info *fp)
                goto out2;
        }
 
-       ret = check_inum_access(fs, parent, W_OK);
+       ret = check_inum_access(ff, parent, W_OK);
        if (ret)
                goto out2;
 
@@ -3081,7 +3081,7 @@ static int op_utimens(const char *path, const struct timespec ctv[2]
                        (long long int)ctv[0].tv_sec, ctv[0].tv_nsec,
                        (long long int)ctv[1].tv_sec, ctv[1].tv_nsec);
 
-       ret = check_inum_access(fs, ino, W_OK);
+       ret = check_inum_access(ff, ino, W_OK);
        if (ret)
                goto out;