Skip to contentSkip to conversation

staging: erofs: remove needless CONFIG_EROFS_FS_SECURITY

PATCH New Yue Hu 4 participants 9 messages Jun 20, 2019 – Jun 21, 2019 Staging

lore
Share & tools
lore

Yue Hu

author
#0 lore raw

PATCH 1/1 staging: erofs: remove needless CONFIG_EROFS_FS_SECURITY

From: Yue Hu <[email protected]>

erofs_xattr_security_handler is already marked __maybe_unused, no need to add CONFIG_EROFS_FS_SECURITY condition.

Signed-off-by Yue Hu <huyue2 at yulong.com>
---
 drivers/staging/erofs/xattr.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/erofs/xattr.c +0 -2
index df40654..06024ac 100644
@@ -499,13 +499,11 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
 	.get	= erofs_xattr_generic_get,
 };
 
-#ifdef CONFIG_EROFS_FS_SECURITY
 const struct xattr_handler __maybe_unused erofs_xattr_security_handler = {
 	.prefix	= XATTR_SECURITY_PREFIX,
 	.flags	= EROFS_XATTR_INDEX_SECURITY,
 	.get	= erofs_xattr_generic_get,
 };
-#endif
 
 const struct xattr_handler *erofs_xattr_handlers[] = {
 	&erofs_xattr_user_handler,
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 staging: erofs: remove needless CONFIG_EROFS_FS_SECURITY

Hi Yue,

Quoted 15 lines · Yue Hu

From: Yue Hu <huyue2 at yulong.com>

erofs_xattr_security_handler is already marked __maybe_unused, no need to add CONFIG_EROFS_FS_SECURITY condition.

Signed-off-by Yue Hu <huyue2 at yulong.com>
---
 drivers/staging/erofs/xattr.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/erofs/xattr.c +0 -0
index df40654..06024ac 100644

drivers/staging/erofs/xattr.c static int erofs_xattr_generic_get(const struct xattr_handler *handler, · line 508

Quoted 10 lines
drivers/staging/erofs/xattr.c +0 -2
@@ -499,13 +499,11 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
 	.get	= erofs_xattr_generic_get,
 };
 
-#ifdef CONFIG_EROFS_FS_SECURITY
 const struct xattr_handler __maybe_unused erofs_xattr_security_handler = {
 	.prefix	= XATTR_SECURITY_PREFIX,
 	.flags	= EROFS_XATTR_INDEX_SECURITY,
 	.get	= erofs_xattr_generic_get,
 };
-#endif

Thanks for your patch.

In that case...erofs_xattr_security_handler could be compiled into .rodata section? I am not sure...

Thanks,
Gao Xiang

Quoted 4 lines
drivers/staging/erofs/xattr.c +0 -0
 const struct xattr_handler *erofs_xattr_handlers[] = {
 	&erofs_xattr_user_handler,
 
#2 lore raw

PATCH 1/1 staging: erofs: remove needless CONFIG_EROFS_FS_SECURITY

Quoted 7 lines · Gao Xiang

Hi Yue,

Quoted 4 lines · Yue Hu

From: Yue Hu <huyue2 at yulong.com>

erofs_xattr_security_handler is already marked __maybe_unused, no need to add CONFIG_EROFS_FS_SECURITY condition.

CONFIG_EROFS_FS_SECURITY is used as a control switch of erofs security labels feature, but __maybe_unused is to avoid unneeded compiler warning on unused variable, so I think we can't remove it.

Thanks,

Quoted 36 lines
Quoted 11 lines
Signed-off-by Yue Hu <huyue2 at yulong.com>
---
 drivers/staging/erofs/xattr.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/erofs/xattr.c +0 -0
index df40654..06024ac 100644

drivers/staging/erofs/xattr.c static int erofs_xattr_generic_get(const struct xattr_handler *handler, · line 508

Quoted 10 lines
drivers/staging/erofs/xattr.c +0 -2
@@ -499,13 +499,11 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
 	.get	= erofs_xattr_generic_get,
 };
 
-#ifdef CONFIG_EROFS_FS_SECURITY
 const struct xattr_handler __maybe_unused erofs_xattr_security_handler = {
 	.prefix	= XATTR_SECURITY_PREFIX,
 	.flags	= EROFS_XATTR_INDEX_SECURITY,
 	.get	= erofs_xattr_generic_get,
 };
-#endif

Thanks for your patch.

In that case...erofs_xattr_security_handler could be compiled into .rodata section? I am not sure...

Thanks,
Gao Xiang

drivers/staging/erofs/xattr.c static int erofs_xattr_generic_get(const struct xattr_handler *handler,

Quoted 4 lines
drivers/staging/erofs/xattr.c +0 -0
 const struct xattr_handler *erofs_xattr_handlers[] = {
 	&erofs_xattr_user_handler,
 

.

author
#3 lore raw

PATCH 1/1 staging: erofs: remove needless CONFIG_EROFS_FS_SECURITY

Quoted 4 lines · On Thu, 20 Jun 2019 17:22:48 +0800 Chao Yu <[email protected]> wrote:
Quoted 3 lines · Gao Xiang

Hi Yue,

On 2019/6/20 16:30, Yue Hu wrote:

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

From: Yue Hu <huyue2 at yulong.com>

erofs_xattr_security_handler is already marked __maybe_unused, no need to add CONFIG_EROFS_FS_SECURITY condition.

CONFIG_EROFS_FS_SECURITY is used as a control switch of erofs security labels feature, but __maybe_unused is to avoid unneeded compiler warning on unused variable, so I think we can't remove it.

However, erofs_xattr_security_handler will not unused under CONFIG_EROFS_FS_SECURITY condition, right?

Thx.

Quoted 39 lines

Thanks,

Quoted 36 lines
Quoted 11 lines
Signed-off-by Yue Hu <huyue2 at yulong.com>
---
 drivers/staging/erofs/xattr.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/erofs/xattr.c +0 -0
index df40654..06024ac 100644

drivers/staging/erofs/xattr.c static int erofs_xattr_generic_get(const struct xattr_handler *handler, · line 508

Quoted 10 lines
drivers/staging/erofs/xattr.c +0 -2
@@ -499,13 +499,11 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
 	.get	= erofs_xattr_generic_get,
 };
 
-#ifdef CONFIG_EROFS_FS_SECURITY
 const struct xattr_handler __maybe_unused erofs_xattr_security_handler = {
 	.prefix	= XATTR_SECURITY_PREFIX,
 	.flags	= EROFS_XATTR_INDEX_SECURITY,
 	.get	= erofs_xattr_generic_get,
 };
-#endif  

Thanks for your patch.

In that case...erofs_xattr_security_handler could be compiled into .rodata section? I am not sure...

Thanks,
Gao Xiang

drivers/staging/erofs/xattr.c static int erofs_xattr_generic_get(const struct xattr_handler *handler,

Quoted 4 lines
drivers/staging/erofs/xattr.c +0 -0
 const struct xattr_handler *erofs_xattr_handlers[] = {
 	&erofs_xattr_user_handler,
 

.

#4 lore raw

PATCH 1/1 staging: erofs: remove needless CONFIG_EROFS_FS_SECURITY

Quoted 12 lines · Yue Hu
Quoted 9 lines · On Thu, 20 Jun 2019 17:22:48 +0800 Chao Yu <[email protected]> wrote:
Quoted 7 lines · Gao Xiang

Hi Yue,

Quoted 4 lines · Yue Hu

From: Yue Hu <huyue2 at yulong.com>

erofs_xattr_security_handler is already marked __maybe_unused, no need to add CONFIG_EROFS_FS_SECURITY condition.

Quoted 6 lines
Quoted 3 lines

CONFIG_EROFS_FS_SECURITY is used as a control switch of erofs security labels feature, but __maybe_unused is to avoid unneeded compiler warning on unused variable, so I think we can't remove it.

However, erofs_xattr_security_handler will not unused under CONFIG_EROFS_FS_SECURITY condition, right?

Yes, we will referred it in erofs_xattr_handlers anyway, so, maybe we can remove __maybe_unused instead?

Thanks,

Quoted 45 lines

Thx.

Quoted 39 lines

Thanks,

Quoted 36 lines
Quoted 11 lines
Signed-off-by Yue Hu <huyue2 at yulong.com>
---
 drivers/staging/erofs/xattr.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/erofs/xattr.c +0 -0
index df40654..06024ac 100644

drivers/staging/erofs/xattr.c static int erofs_xattr_generic_get(const struct xattr_handler *handler, · line 508

Quoted 10 lines
drivers/staging/erofs/xattr.c +0 -2
@@ -499,13 +499,11 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
 	.get	= erofs_xattr_generic_get,
 };
 
-#ifdef CONFIG_EROFS_FS_SECURITY
 const struct xattr_handler __maybe_unused erofs_xattr_security_handler = {
 	.prefix	= XATTR_SECURITY_PREFIX,
 	.flags	= EROFS_XATTR_INDEX_SECURITY,
 	.get	= erofs_xattr_generic_get,
 };
-#endif  

Thanks for your patch.

In that case...erofs_xattr_security_handler could be compiled into .rodata section? I am not sure...

Thanks,
Gao Xiang

drivers/staging/erofs/xattr.c static int erofs_xattr_generic_get(const struct xattr_handler *handler,

Quoted 4 lines
drivers/staging/erofs/xattr.c +0 -0
 const struct xattr_handler *erofs_xattr_handlers[] = {
 	&erofs_xattr_user_handler,
 

.

.

author
#5 lore raw

PATCH 1/1 staging: erofs: remove needless CONFIG_EROFS_FS_SECURITY

Quoted 17 lines · On Thu, 20 Jun 2019 17:52:39 +0800 Chao Yu <[email protected]> wrote:
Quoted 16 lines · Yue Hu
Quoted 12 lines · On Thu, 20 Jun 2019 17:22:48 +0800 Chao Yu <[email protected]> wrote:
Quoted 7 lines · Gao Xiang

Hi Yue,

Quoted 4 lines · Yue Hu

From: Yue Hu <huyue2 at yulong.com>

erofs_xattr_security_handler is already marked __maybe_unused, no need to add CONFIG_EROFS_FS_SECURITY condition.

CONFIG_EROFS_FS_SECURITY is used as a control switch of erofs security labels feature, but __maybe_unused is to avoid unneeded compiler warning on unused variable, so I think we can't remove it.

Quoted 5 lines
Quoted 2 lines

However, erofs_xattr_security_handler will not unused under CONFIG_EROFS_FS_SECURITY condition, right?

Yes, we will referred it in erofs_xattr_handlers anyway, so, maybe we can remove __maybe_unused instead?

It's good to me.

Thx.

Quoted 48 lines

Thanks,

Quoted 45 lines

Thx.

Quoted 39 lines

Thanks,

Quoted 36 lines
Quoted 11 lines
Signed-off-by Yue Hu <huyue2 at yulong.com>
---
 drivers/staging/erofs/xattr.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/erofs/xattr.c +0 -0
index df40654..06024ac 100644

drivers/staging/erofs/xattr.c static int erofs_xattr_generic_get(const struct xattr_handler *handler, · line 508

Quoted 10 lines
drivers/staging/erofs/xattr.c +0 -2
@@ -499,13 +499,11 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
 	.get	= erofs_xattr_generic_get,
 };
 
-#ifdef CONFIG_EROFS_FS_SECURITY
 const struct xattr_handler __maybe_unused erofs_xattr_security_handler = {
 	.prefix	= XATTR_SECURITY_PREFIX,
 	.flags	= EROFS_XATTR_INDEX_SECURITY,
 	.get	= erofs_xattr_generic_get,
 };
-#endif    

Thanks for your patch.

In that case...erofs_xattr_security_handler could be compiled into .rodata section? I am not sure...

Thanks,
Gao Xiang

drivers/staging/erofs/xattr.c static int erofs_xattr_generic_get(const struct xattr_handler *handler,

Quoted 4 lines
drivers/staging/erofs/xattr.c +0 -0
 const struct xattr_handler *erofs_xattr_handlers[] = {
 	&erofs_xattr_user_handler,
 

.

.

author
#6 lore raw

PATCH 1/1 staging: erofs: remove needless CONFIG_EROFS_FS_SECURITY

In reply to Gao Xiang
Quoted 31 lines · On Thu, 20 Jun 2019 16:32:01 +0800 Gao Xiang <[email protected]> wrote:

Hi Yue,

Quoted 15 lines · Yue Hu

From: Yue Hu <huyue2 at yulong.com>

erofs_xattr_security_handler is already marked __maybe_unused, no need to add CONFIG_EROFS_FS_SECURITY condition.

Signed-off-by Yue Hu <huyue2 at yulong.com>
---
 drivers/staging/erofs/xattr.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/erofs/xattr.c +0 -0
index df40654..06024ac 100644

drivers/staging/erofs/xattr.c static int erofs_xattr_generic_get(const struct xattr_handler *handler, · line 508

Quoted 10 lines
drivers/staging/erofs/xattr.c +0 -2
@@ -499,13 +499,11 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
 	.get	= erofs_xattr_generic_get,
 };
 
-#ifdef CONFIG_EROFS_FS_SECURITY
 const struct xattr_handler __maybe_unused erofs_xattr_security_handler = {
 	.prefix	= XATTR_SECURITY_PREFIX,
 	.flags	= EROFS_XATTR_INDEX_SECURITY,
 	.get	= erofs_xattr_generic_get,
 };
-#endif  

Thanks for your patch.

Quoted 2 lines

In that case...erofs_xattr_security_handler could be compiled into .rodata section? I am not sure...

Yes, just like erofs_xattr_user_handler as below in System.map.

ffffffff820ec2a0 R erofs_xattr_security_handler
ffffffff820ec2e0 R erofs_xattr_trusted_handler
ffffffff820ec320 R erofs_xattr_user_handler

Thx.

Quoted 8 lines

Thanks,
Gao Xiang

Quoted 4 lines
drivers/staging/erofs/xattr.c +0 -0
 const struct xattr_handler *erofs_xattr_handlers[] = {
 	&erofs_xattr_user_handler,
 
#7 lore raw

PATCH 1/1 staging: erofs: remove needless CONFIG_EROFS_FS_SECURITY

Quoted 34 lines · Yue Hu
Quoted 31 lines · On Thu, 20 Jun 2019 16:32:01 +0800 Gao Xiang <[email protected]> wrote:

Hi Yue,

Quoted 15 lines · Yue Hu

From: Yue Hu <huyue2 at yulong.com>

erofs_xattr_security_handler is already marked __maybe_unused, no need to add CONFIG_EROFS_FS_SECURITY condition.

Signed-off-by Yue Hu <huyue2 at yulong.com>
---
 drivers/staging/erofs/xattr.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/erofs/xattr.c +0 -0
index df40654..06024ac 100644

drivers/staging/erofs/xattr.c static int erofs_xattr_generic_get(const struct xattr_handler *handler, · line 508

Quoted 10 lines
drivers/staging/erofs/xattr.c +0 -2
@@ -499,13 +499,11 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
 	.get	= erofs_xattr_generic_get,
 };
 
-#ifdef CONFIG_EROFS_FS_SECURITY
 const struct xattr_handler __maybe_unused erofs_xattr_security_handler = {
 	.prefix	= XATTR_SECURITY_PREFIX,
 	.flags	= EROFS_XATTR_INDEX_SECURITY,
 	.get	= erofs_xattr_generic_get,
 };
-#endif  

Thanks for your patch.

Quoted 8 lines
Quoted 2 lines

In that case...erofs_xattr_security_handler could be compiled into .rodata section? I am not sure...

Yes, just like erofs_xattr_user_handler as below in System.map.

ffffffff820ec2a0 R erofs_xattr_security_handler
ffffffff820ec2e0 R erofs_xattr_trusted_handler
ffffffff820ec320 R erofs_xattr_user_handler

As a usual practice, CONFIG_{EXT2,EXT4,F2FS,EROFS}_FS_SECURITY are defined as kernel configuations.

It seems that for ext2/ext4 they leave

const struct xattr_handler ext2_xattr_security_handler = {

in xattr_security.c and the Makefiles are similar as

fs/ext2/Makefile
13:ext2-$(CONFIG_EXT2_FS_SECURITY) += xattr_security.o

But for f2fs, f2fs_xattr_security_handler is not wrapped with any configuration.

Actually I think that is not a big deal, I'd like to listen Chao and Greg's idea about this...

Thanks,
Gao Xiang

Quoted 12 lines

Thx.

Quoted 8 lines

Thanks,
Gao Xiang

Quoted 4 lines
drivers/staging/erofs/xattr.c +0 -0
 const struct xattr_handler *erofs_xattr_handlers[] = {
 	&erofs_xattr_user_handler,
 
maintainer
#8 lore raw

PATCH 1/1 staging: erofs: remove needless CONFIG_EROFS_FS_SECURITY

In reply to Yue Hu
Quoted 15 lines · Yue Hu

From: Yue Hu <huyue2 at yulong.com>

erofs_xattr_security_handler is already marked __maybe_unused, no need to add CONFIG_EROFS_FS_SECURITY condition.

Signed-off-by Yue Hu <huyue2 at yulong.com>
---
 drivers/staging/erofs/xattr.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/erofs/xattr.c +0 -0
index df40654..06024ac 100644

drivers/staging/erofs/xattr.c static int erofs_xattr_generic_get(const struct xattr_handler *handler, · line 508

Quoted 10 lines
drivers/staging/erofs/xattr.c +0 -2
@@ -499,13 +499,11 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
 	.get	= erofs_xattr_generic_get,
 };
 
-#ifdef CONFIG_EROFS_FS_SECURITY
 const struct xattr_handler __maybe_unused erofs_xattr_security_handler = {
 	.prefix	= XATTR_SECURITY_PREFIX,
 	.flags	= EROFS_XATTR_INDEX_SECURITY,
 	.get	= erofs_xattr_generic_get,
 };
-#endif

It's nicer just to leave this as-is for now, the memory savings isn't much at all.

thanks,

greg k-h