From e92ae03ef75c92865c2a7178a74e194aadbe1073 Mon Sep 17 00:00:00 2001 From: lvyuanyuan Date: Mon, 29 May 2023 12:45:09 +0000 Subject: [PATCH] =?UTF-8?q?sharefs=E5=91=8A=E8=AD=A6=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lvyuanyuan Change-Id: I74748689b3ef812acc4546e53b3bb53c7885bc29 --- fs/sharefs/authentication.c | 3 +-- fs/sharefs/authentication.h | 6 ++++-- fs/sharefs/config.c | 4 ++-- fs/sharefs/file.c | 10 ++++++---- fs/sharefs/inode.c | 6 +++--- fs/sharefs/lookup.c | 3 +-- fs/sharefs/main.c | 8 ++++---- fs/sharefs/sharefs.h | 4 ++-- fs/sharefs/super.c | 2 +- 9 files changed, 24 insertions(+), 22 deletions(-) diff --git a/fs/sharefs/authentication.c b/fs/sharefs/authentication.c index 71bd2d7275fd..2c79cb0a7765 100644 --- a/fs/sharefs/authentication.c +++ b/fs/sharefs/authentication.c @@ -30,8 +30,7 @@ void fixup_perm_from_level(struct inode *dir, struct dentry *dentry) return; dinode->i_uid = dir->i_uid; dinode->i_gid = dir->i_gid; - switch (level) - { + switch (level) { case SHAREFS_PERM_MNT: bid = get_bundle_uid(SHAREFS_SB(dentry->d_sb), dentry->d_name.name); diff --git a/fs/sharefs/authentication.h b/fs/sharefs/authentication.h index 84a1a8dcd660..73e35a461b13 100644 --- a/fs/sharefs/authentication.h +++ b/fs/sharefs/authentication.h @@ -48,14 +48,16 @@ static inline bool is_read_write_auth(__u16 perm) return (perm & SHAREFS_DIR_TYPE_MASK) == SHAREFS_DIR_TYPE_READWRITE; } -static inline void sharefs_set_read_perm(struct inode *inode) { +static inline void sharefs_set_read_perm(struct inode *inode) +{ if (S_ISDIR(inode->i_mode)) inode->i_mode = (inode->i_mode & S_IFMT) | SHAREFS_PERM_READONLY_DIR; else inode->i_mode = (inode->i_mode & S_IFMT) | SHAREFS_PERM_READONLY_FILE; } -static inline void sharefs_set_read_write_perm(struct inode *inode) { +static inline void sharefs_set_read_write_perm(struct inode *inode) +{ if (S_ISDIR(inode->i_mode)) inode->i_mode = (inode->i_mode & S_IFMT) | SHAREFS_PERM_READWRITE_DIR; else diff --git a/fs/sharefs/config.c b/fs/sharefs/config.c index 874574c4e58f..fe30eeeff0f0 100644 --- a/fs/sharefs/config.c +++ b/fs/sharefs/config.c @@ -316,8 +316,8 @@ static struct configfs_group_operations sharefs_group_ops = { }; static struct config_item_type sharefs_group_type = { - .ct_group_ops = &sharefs_group_ops, - .ct_owner = THIS_MODULE, + .ct_group_ops = &sharefs_group_ops, + .ct_owner = THIS_MODULE, }; static struct configfs_subsystem sharefs_subsystem = { diff --git a/fs/sharefs/file.c b/fs/sharefs/file.c index 5e62122f98b2..af108f75519f 100644 --- a/fs/sharefs/file.c +++ b/fs/sharefs/file.c @@ -45,9 +45,9 @@ static int sharefs_open(struct inode *inode, struct file *file) sharefs_set_lower_file(file, lower_file); } - if (err) + if (err) { kfree(SHAREFS_F(file)); - else { + } else { kuid_t uid = inode->i_uid; kgid_t gid = inode->i_gid; mode_t mode = inode->i_mode; @@ -149,7 +149,8 @@ ssize_t sharefs_read_iter(struct kiocb *iocb, struct iov_iter *iter) { int err; - struct file *file = iocb->ki_filp, *lower_file; + struct file *file = iocb->ki_filp; + struct file *lower_file; lower_file = sharefs_lower_file(file); if (!lower_file->f_op->read_iter) { @@ -179,7 +180,8 @@ ssize_t sharefs_write_iter(struct kiocb *iocb, struct iov_iter *iter) { int err; - struct file *file = iocb->ki_filp, *lower_file; + struct file *file = iocb->ki_filp; + struct file *lower_file; lower_file = sharefs_lower_file(file); if (!lower_file->f_op->write_iter) { diff --git a/fs/sharefs/inode.c b/fs/sharefs/inode.c index 1ffee295b2f3..c4944f0afb88 100644 --- a/fs/sharefs/inode.c +++ b/fs/sharefs/inode.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * fs/sharefs/inode.c - * + * * Copyright (c) 1998-2022 Erez Zadok * Copyright (c) 2009 Shrikar Archak * Copyright (c) 2003-2022 Stony Brook University @@ -55,8 +55,8 @@ static const char *sharefs_get_link(struct dentry *dentry, struct inode *inode, return buf; } -static int sharefs_getattr(const struct path *path, struct kstat *stat, - u32 request_mask, unsigned int flags) +static int sharefs_getattr(const struct path *path, struct kstat *stat, + u32 request_mask, unsigned int flags) { struct path lower_path; int ret; diff --git a/fs/sharefs/lookup.c b/fs/sharefs/lookup.c index d45cb28dd994..315900c03fd2 100644 --- a/fs/sharefs/lookup.c +++ b/fs/sharefs/lookup.c @@ -83,7 +83,7 @@ struct inode *sharefs_iget(struct super_block *sb, struct inode *lower_inode) * instead. */ lower_inode->i_ino, /* hashval */ - sharefs_inode_test, /* inode comparison function */ + sharefs_inode_test, /* inode comparison function */ sharefs_inode_set, /* inode init function */ lower_inode); /* data passed to test+set fxns */ if (!inode) { @@ -225,7 +225,6 @@ static struct dentry *__sharefs_lookup(struct dentry *dentry, /* Use vfs_path_lookup to check if the dentry exists or not */ err = vfs_path_lookup(lower_dir_dentry, lower_dir_mnt, name, 0, &lower_path); - /* no error: handle positive dentries */ if (!err) { sharefs_set_lower_path(dentry, &lower_path); diff --git a/fs/sharefs/main.c b/fs/sharefs/main.c index 9bb2a66f3732..6a858b49f73b 100644 --- a/fs/sharefs/main.c +++ b/fs/sharefs/main.c @@ -15,8 +15,8 @@ struct sharefs_mount_priv { - const char *dev_name; - const char *raw_data; + const char *dev_name; + const char *raw_data; }; /* @@ -27,8 +27,8 @@ static int sharefs_fill_super(struct super_block *sb, void *data, int silent) { struct sharefs_mount_priv *priv = (struct sharefs_mount_priv *)data; - const char *dev_name = priv->dev_name; - const char *raw_data = priv->raw_data; + const char *dev_name = priv->dev_name; + const char *raw_data = priv->raw_data; int err = 0; struct super_block *lower_sb; diff --git a/fs/sharefs/sharefs.h b/fs/sharefs/sharefs.h index 1f40b3ad0a36..143f047b235f 100644 --- a/fs/sharefs/sharefs.h +++ b/fs/sharefs/sharefs.h @@ -54,7 +54,7 @@ struct sharefs_inode_info { /* sharefs dentry data in memory */ struct sharefs_dentry_info { - spinlock_t lock; /* protects lower_path */ + spinlock_t lock; /* protects lower_path */ struct path lower_path; }; @@ -239,4 +239,4 @@ __printf(4, 5) void __sharefs_log(const char *level, const bool ratelimited, #define sharefs_info_ratelimited(fmt, ...) \ __sharefs_log(KERN_INFO, true, __func__, fmt, ##__VA_ARGS__) -#endif /* not _SHAREFS_H_ */ +#endif /* not _SHAREFS_H_ */ diff --git a/fs/sharefs/super.c b/fs/sharefs/super.c index e0645dcd91fd..bbe65944647f 100644 --- a/fs/sharefs/super.c +++ b/fs/sharefs/super.c @@ -158,7 +158,7 @@ static struct inode *sharefs_alloc_inode(struct super_block *sb) /* memset everything up to the inode to 0 */ memset(i, 0, offsetof(struct sharefs_inode_info, vfs_inode)); - atomic64_set(&i->vfs_inode.i_version, 1); + atomic64_set(&i->vfs_inode.i_version, 1); return &i->vfs_inode; } -- Gitee