mm/slub: use helper macro __ATTR_XX_MODE for SLAB_ATTR(_RO)
authorLianjie Zhang <zhanglianjie@uniontech.com>
Sun, 6 Mar 2022 07:38:18 +0000 (15:38 +0800)
committerVlastimil Babka <vbabka@suse.cz>
Mon, 7 Mar 2022 17:08:35 +0000 (18:08 +0100)
This allows more concise code, and VERIFY_OCTAL_PERMISSIONS() can help
validate any future change.

Signed-off-by: Lianjie Zhang <zhanglianjie@uniontech.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Link: https://lore.kernel.org/r/20220306073818.15089-1-zhanglianjie@uniontech.com
mm/slub.c

index 261474092e43e48eaa1fc1a1809b98485e2d87d9..d33aada17985815df4d45f552771867be910263f 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5344,12 +5344,10 @@ struct slab_attribute {
 };
 
 #define SLAB_ATTR_RO(_name) \
-       static struct slab_attribute _name##_attr = \
-       __ATTR(_name, 0400, _name##_show, NULL)
+       static struct slab_attribute _name##_attr = __ATTR_RO_MODE(_name, 0400)
 
 #define SLAB_ATTR(_name) \
-       static struct slab_attribute _name##_attr =  \
-       __ATTR(_name, 0600, _name##_show, _name##_store)
+       static struct slab_attribute _name##_attr = __ATTR_RW_MODE(_name, 0600)
 
 static ssize_t slab_size_show(struct kmem_cache *s, char *buf)
 {