2022-12-07 07:21:33

by yebin

[permalink] [raw]
Subject: [PATCH v2 5/6] ext4: rename xattr_find_entry() and __xattr_check_inode()

From: Ye Bin <[email protected]>

xattr_find_entry() and __xattr_check_inode() is in EXT4 xattr module. so
add 'ext4' prefix to unify name style.

Signed-off-by: Ye Bin <[email protected]>
---
fs/ext4/xattr.c | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index efa623658c12..5c0476ff62c8 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -290,8 +290,9 @@ __ext4_xattr_check_block(struct inode *inode, struct buffer_head *bh,


static int
-__xattr_check_inode(struct inode *inode, struct ext4_xattr_ibody_header *header,
- void *end, const char *function, unsigned int line)
+__ext4_xattr_check_inode(struct inode *inode,
+ struct ext4_xattr_ibody_header *header, void *end,
+ const char *function, unsigned int line)
{
int error = -EFSCORRUPTED;

@@ -307,12 +308,12 @@ __xattr_check_inode(struct inode *inode, struct ext4_xattr_ibody_header *header,
return error;
}

-#define xattr_check_inode(inode, header, end) \
- __xattr_check_inode((inode), (header), (end), __func__, __LINE__)
+#define ext4_xattr_check_inode(inode, header, end) \
+ __ext4_xattr_check_inode((inode), (header), (end), __func__, __LINE__)

static int
-xattr_find_entry(struct inode *inode, struct ext4_xattr_entry **pentry,
- void *end, int name_index, const char *name, int sorted)
+ext4_xattr_find_entry(struct inode *inode, struct ext4_xattr_entry **pentry,
+ void *end, int name_index, const char *name, int sorted)
{
struct ext4_xattr_entry *entry, *next;
size_t name_len;
@@ -577,7 +578,7 @@ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name,
ext4_xattr_block_cache_insert(ea_block_cache, bh);
entry = BFIRST(bh);
end = bh->b_data + bh->b_size;
- error = xattr_find_entry(inode, &entry, end, name_index, name, 1);
+ error = ext4_xattr_find_entry(inode, &entry, end, name_index, name, 1);
if (error)
goto cleanup;
size = le32_to_cpu(entry->e_value_size);
@@ -628,11 +629,11 @@ ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name,
raw_inode = ext4_raw_inode(&iloc);
header = IHDR(inode, raw_inode);
end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
- error = xattr_check_inode(inode, header, end);
+ error = ext4_xattr_check_inode(inode, header, end);
if (error)
goto cleanup;
entry = IFIRST(header);
- error = xattr_find_entry(inode, &entry, end, name_index, name, 0);
+ error = ext4_xattr_find_entry(inode, &entry, end, name_index, name, 0);
if (error)
goto cleanup;
size = le32_to_cpu(entry->e_value_size);
@@ -773,7 +774,7 @@ ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
raw_inode = ext4_raw_inode(&iloc);
header = IHDR(inode, raw_inode);
end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
- error = xattr_check_inode(inode, header, end);
+ error = ext4_xattr_check_inode(inode, header, end);
if (error)
goto cleanup;
error = ext4_xattr_list_entries(dentry, IFIRST(header),
@@ -859,7 +860,7 @@ int ext4_get_inode_usage(struct inode *inode, qsize_t *usage)
raw_inode = ext4_raw_inode(&iloc);
header = IHDR(inode, raw_inode);
end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
- ret = xattr_check_inode(inode, header, end);
+ ret = ext4_xattr_check_inode(inode, header, end);
if (ret)
goto out;

@@ -1862,8 +1863,8 @@ ext4_xattr_block_find(struct inode *inode, struct ext4_xattr_info *i,
bs->s.first = BFIRST(bs->bh);
bs->s.end = bs->bh->b_data + bs->bh->b_size;
bs->s.here = bs->s.first;
- error = xattr_find_entry(inode, &bs->s.here, bs->s.end,
- i->name_index, i->name, 1);
+ error = ext4_xattr_find_entry(inode, &bs->s.here, bs->s.end,
+ i->name_index, i->name, 1);
if (error && error != -ENODATA)
return error;
bs->s.not_found = error;
@@ -2222,12 +2223,12 @@ int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
is->s.here = is->s.first;
is->s.end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
if (ext4_test_inode_state(inode, EXT4_STATE_XATTR)) {
- error = xattr_check_inode(inode, header, is->s.end);
+ error = ext4_xattr_check_inode(inode, header, is->s.end);
if (error)
return error;
/* Find the named attribute. */
- error = xattr_find_entry(inode, &is->s.here, is->s.end,
- i->name_index, i->name, 0);
+ error = ext4_xattr_find_entry(inode, &is->s.here, is->s.end,
+ i->name_index, i->name, 0);
if (error && error != -ENODATA)
return error;
is->s.not_found = error;
@@ -2742,7 +2743,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
min_offs = end - base;
total_ino = sizeof(struct ext4_xattr_ibody_header) + sizeof(u32);

- error = xattr_check_inode(inode, header, end);
+ error = ext4_xattr_check_inode(inode, header, end);
if (error)
goto cleanup;

--
2.31.1


2022-12-07 07:38:13

by Bagas Sanjaya

[permalink] [raw]
Subject: Re: [PATCH v2 5/6] ext4: rename xattr_find_entry() and __xattr_check_inode()

On Wed, Dec 07, 2022 at 03:40:42PM +0800, Ye Bin wrote:
> From: Ye Bin <[email protected]>
>
> xattr_find_entry() and __xattr_check_inode() is in EXT4 xattr module. so
> add 'ext4' prefix to unify name style.

What about "Prepend ext4 prefix to xattr_find_entry() and
__xattr_check_inode(), since these functions are in ext4 xattr module."?

--
An old man doll... just what I always wanted! - Clara


Attachments:
(No filename) (413.00 B)
signature.asc (235.00 B)
Download all attachments

2022-12-07 07:43:46

by Bagas Sanjaya

[permalink] [raw]
Subject: Re: [PATCH v2 5/6] ext4: rename xattr_find_entry() and __xattr_check_inode()

On Wed, Dec 07, 2022 at 02:35:02PM +0700, Bagas Sanjaya wrote:
> On Wed, Dec 07, 2022 at 03:40:42PM +0800, Ye Bin wrote:
> > From: Ye Bin <[email protected]>
> >
> > xattr_find_entry() and __xattr_check_inode() is in EXT4 xattr module. so
> > add 'ext4' prefix to unify name style.
>
> What about "Prepend ext4 prefix to xattr_find_entry() and
> __xattr_check_inode(), since these functions are in ext4 xattr module."?
>

Oops, I mean "Prepend ext4 prefix to function names of
xattr_find_entry() and __xattr_check_inode() for consistency with other
functions in ext4 xattr module."

Sorry for inconvenience.

--
An old man doll... just what I always wanted! - Clara


Attachments:
(No filename) (690.00 B)
signature.asc (235.00 B)
Download all attachments

2022-12-07 11:00:39

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH v2 5/6] ext4: rename xattr_find_entry() and __xattr_check_inode()

On Wed 07-12-22 15:40:42, Ye Bin wrote:
> From: Ye Bin <[email protected]>
>
> xattr_find_entry() and __xattr_check_inode() is in EXT4 xattr module. so
> add 'ext4' prefix to unify name style.
>
> Signed-off-by: Ye Bin <[email protected]>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> fs/ext4/xattr.c | 35 ++++++++++++++++++-----------------
> 1 file changed, 18 insertions(+), 17 deletions(-)
>
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index efa623658c12..5c0476ff62c8 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -290,8 +290,9 @@ __ext4_xattr_check_block(struct inode *inode, struct buffer_head *bh,
>
>
> static int
> -__xattr_check_inode(struct inode *inode, struct ext4_xattr_ibody_header *header,
> - void *end, const char *function, unsigned int line)
> +__ext4_xattr_check_inode(struct inode *inode,
> + struct ext4_xattr_ibody_header *header, void *end,
> + const char *function, unsigned int line)
> {
> int error = -EFSCORRUPTED;
>
> @@ -307,12 +308,12 @@ __xattr_check_inode(struct inode *inode, struct ext4_xattr_ibody_header *header,
> return error;
> }
>
> -#define xattr_check_inode(inode, header, end) \
> - __xattr_check_inode((inode), (header), (end), __func__, __LINE__)
> +#define ext4_xattr_check_inode(inode, header, end) \
> + __ext4_xattr_check_inode((inode), (header), (end), __func__, __LINE__)
>
> static int
> -xattr_find_entry(struct inode *inode, struct ext4_xattr_entry **pentry,
> - void *end, int name_index, const char *name, int sorted)
> +ext4_xattr_find_entry(struct inode *inode, struct ext4_xattr_entry **pentry,
> + void *end, int name_index, const char *name, int sorted)
> {
> struct ext4_xattr_entry *entry, *next;
> size_t name_len;
> @@ -577,7 +578,7 @@ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name,
> ext4_xattr_block_cache_insert(ea_block_cache, bh);
> entry = BFIRST(bh);
> end = bh->b_data + bh->b_size;
> - error = xattr_find_entry(inode, &entry, end, name_index, name, 1);
> + error = ext4_xattr_find_entry(inode, &entry, end, name_index, name, 1);
> if (error)
> goto cleanup;
> size = le32_to_cpu(entry->e_value_size);
> @@ -628,11 +629,11 @@ ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name,
> raw_inode = ext4_raw_inode(&iloc);
> header = IHDR(inode, raw_inode);
> end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
> - error = xattr_check_inode(inode, header, end);
> + error = ext4_xattr_check_inode(inode, header, end);
> if (error)
> goto cleanup;
> entry = IFIRST(header);
> - error = xattr_find_entry(inode, &entry, end, name_index, name, 0);
> + error = ext4_xattr_find_entry(inode, &entry, end, name_index, name, 0);
> if (error)
> goto cleanup;
> size = le32_to_cpu(entry->e_value_size);
> @@ -773,7 +774,7 @@ ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
> raw_inode = ext4_raw_inode(&iloc);
> header = IHDR(inode, raw_inode);
> end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
> - error = xattr_check_inode(inode, header, end);
> + error = ext4_xattr_check_inode(inode, header, end);
> if (error)
> goto cleanup;
> error = ext4_xattr_list_entries(dentry, IFIRST(header),
> @@ -859,7 +860,7 @@ int ext4_get_inode_usage(struct inode *inode, qsize_t *usage)
> raw_inode = ext4_raw_inode(&iloc);
> header = IHDR(inode, raw_inode);
> end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
> - ret = xattr_check_inode(inode, header, end);
> + ret = ext4_xattr_check_inode(inode, header, end);
> if (ret)
> goto out;
>
> @@ -1862,8 +1863,8 @@ ext4_xattr_block_find(struct inode *inode, struct ext4_xattr_info *i,
> bs->s.first = BFIRST(bs->bh);
> bs->s.end = bs->bh->b_data + bs->bh->b_size;
> bs->s.here = bs->s.first;
> - error = xattr_find_entry(inode, &bs->s.here, bs->s.end,
> - i->name_index, i->name, 1);
> + error = ext4_xattr_find_entry(inode, &bs->s.here, bs->s.end,
> + i->name_index, i->name, 1);
> if (error && error != -ENODATA)
> return error;
> bs->s.not_found = error;
> @@ -2222,12 +2223,12 @@ int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
> is->s.here = is->s.first;
> is->s.end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
> if (ext4_test_inode_state(inode, EXT4_STATE_XATTR)) {
> - error = xattr_check_inode(inode, header, is->s.end);
> + error = ext4_xattr_check_inode(inode, header, is->s.end);
> if (error)
> return error;
> /* Find the named attribute. */
> - error = xattr_find_entry(inode, &is->s.here, is->s.end,
> - i->name_index, i->name, 0);
> + error = ext4_xattr_find_entry(inode, &is->s.here, is->s.end,
> + i->name_index, i->name, 0);
> if (error && error != -ENODATA)
> return error;
> is->s.not_found = error;
> @@ -2742,7 +2743,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
> min_offs = end - base;
> total_ino = sizeof(struct ext4_xattr_ibody_header) + sizeof(u32);
>
> - error = xattr_check_inode(inode, header, end);
> + error = ext4_xattr_check_inode(inode, header, end);
> if (error)
> goto cleanup;
>
> --
> 2.31.1
>
--
Jan Kara <[email protected]>
SUSE Labs, CR