2008-05-23 09:31:35

by Shen Feng

[permalink] [raw]
Subject: [PATCH] ext4: remove double definitions of xattr macros

remove the definitions of macros:
XATTR_TRUSTED_PREFIX
XATTR_USER_PREFIX
since they are defined in linux/xattr.h

Signed-off-by: Shen Feng <[email protected]>
---
fs/ext4/xattr_trusted.c | 4 +---
fs/ext4/xattr_user.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/xattr_trusted.c b/fs/ext4/xattr_trusted.c
index fff3338..ac1a52c 100644
--- a/fs/ext4/xattr_trusted.c
+++ b/fs/ext4/xattr_trusted.c
@@ -13,13 +13,11 @@
#include "ext4.h"
#include "xattr.h"

-#define XATTR_TRUSTED_PREFIX "trusted."
-
static size_t
ext4_xattr_trusted_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len)
{
- const size_t prefix_len = sizeof(XATTR_TRUSTED_PREFIX)-1;
+ const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN;
const size_t total_len = prefix_len + name_len + 1;

if (!capable(CAP_SYS_ADMIN))
diff --git a/fs/ext4/xattr_user.c b/fs/ext4/xattr_user.c
index 67be723..d91aa61 100644
--- a/fs/ext4/xattr_user.c
+++ b/fs/ext4/xattr_user.c
@@ -12,13 +12,11 @@
#include "ext4.h"
#include "xattr.h"

-#define XATTR_USER_PREFIX "user."


2008-05-28 21:19:05

by Mingming Cao

[permalink] [raw]
Subject: Re: [PATCH] ext4: remove double definitions of xattr macros

On Fri, 2008-05-23 at 17:28 +0800, Shen Feng wrote:
> remove the definitions of macros:
> XATTR_TRUSTED_PREFIX
> XATTR_USER_PREFIX
> since they are defined in linux/xattr.h
>
> Signed-off-by: Shen Feng <[email protected]>

Signed-off-by: Mingming Cao <[email protected]>

BTW, the similar duplication also appear in in ext2/3/reiserfs, clean up
should also done there too?

> ---
> fs/ext4/xattr_trusted.c | 4 +---
> fs/ext4/xattr_user.c | 4 +---
> 2 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/fs/ext4/xattr_trusted.c b/fs/ext4/xattr_trusted.c
> index fff3338..ac1a52c 100644
> --- a/fs/ext4/xattr_trusted.c
> +++ b/fs/ext4/xattr_trusted.c
> @@ -13,13 +13,11 @@
> #include "ext4.h"
> #include "xattr.h"
>
> -#define XATTR_TRUSTED_PREFIX "trusted."
> -
> static size_t
> ext4_xattr_trusted_list(struct inode *inode, char *list, size_t list_size,
> const char *name, size_t name_len)
> {
> - const size_t prefix_len = sizeof(XATTR_TRUSTED_PREFIX)-1;
> + const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN;
> const size_t total_len = prefix_len + name_len + 1;
>
> if (!capable(CAP_SYS_ADMIN))
> diff --git a/fs/ext4/xattr_user.c b/fs/ext4/xattr_user.c
> index 67be723..d91aa61 100644
> --- a/fs/ext4/xattr_user.c
> +++ b/fs/ext4/xattr_user.c
> @@ -12,13 +12,11 @@
> #include "ext4.h"
> #include "xattr.h"
>
> -#define XATTR_USER_PREFIX "user."
> -
> static size_t
> ext4_xattr_user_list(struct inode *inode, char *list, size_t list_size,
> const char *name, size_t name_len)
> {
> - const size_t prefix_len = sizeof(XATTR_USER_PREFIX)-1;
> + const size_t prefix_len = XATTR_USER_PREFIX_LEN;
> const size_t total_len = prefix_len + name_len + 1;
>
> if (!test_opt(inode->i_sb, XATTR_USER))


2008-05-29 02:08:43

by Shen Feng

[permalink] [raw]
Subject: Re: [PATCH] ext4: remove double definitions of xattr macros



Mingming Cao Wrote:
> On Fri, 2008-05-23 at 17:28 +0800, Shen Feng wrote:
>> remove the definitions of macros:
>> XATTR_TRUSTED_PREFIX
>> XATTR_USER_PREFIX
>> since they are defined in linux/xattr.h
>>
>> Signed-off-by: Shen Feng <[email protected]>
>
> Signed-off-by: Mingming Cao <[email protected]>
>
> BTW, the similar duplication also appear in in ext2/3/reiserfs, clean up
> should also done there too?

Yes. I will send a patch series to fix this.

>
>> ---
>> fs/ext4/xattr_trusted.c | 4 +---
>> fs/ext4/xattr_user.c | 4 +---
>> 2 files changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/fs/ext4/xattr_trusted.c b/fs/ext4/xattr_trusted.c
>> index fff3338..ac1a52c 100644
>> --- a/fs/ext4/xattr_trusted.c
>> +++ b/fs/ext4/xattr_trusted.c
>> @@ -13,13 +13,11 @@
>> #include "ext4.h"
>> #include "xattr.h"
>>
>> -#define XATTR_TRUSTED_PREFIX "trusted."
>> -
>> static size_t
>> ext4_xattr_trusted_list(struct inode *inode, char *list, size_t list_size,
>> const char *name, size_t name_len)
>> {
>> - const size_t prefix_len = sizeof(XATTR_TRUSTED_PREFIX)-1;
>> + const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN;
>> const size_t total_len = prefix_len + name_len + 1;
>>
>> if (!capable(CAP_SYS_ADMIN))
>> diff --git a/fs/ext4/xattr_user.c b/fs/ext4/xattr_user.c
>> index 67be723..d91aa61 100644
>> --- a/fs/ext4/xattr_user.c
>> +++ b/fs/ext4/xattr_user.c
>> @@ -12,13 +12,11 @@
>> #include "ext4.h"
>> #include "xattr.h"
>>
>> -#define XATTR_USER_PREFIX "user."
>> -
>> static size_t
>> ext4_xattr_user_list(struct inode *inode, char *list, size_t list_size,
>> const char *name, size_t name_len)
>> {
>> - const size_t prefix_len = sizeof(XATTR_USER_PREFIX)-1;
>> + const size_t prefix_len = XATTR_USER_PREFIX_LEN;
>> const size_t total_len = prefix_len + name_len + 1;
>>
>> if (!test_opt(inode->i_sb, XATTR_USER))
>
>
>