Skip to contentSkip to conversation

9p: Constify static struct v9fs_attr_group

PATCH In review Rikard Falkeborn 2 participants 2 messages Jan 8, 2021 9P file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 9p: Constify static struct v9fs_attr_group

The only usage of v9fs_attr_group is to pass its address to sysfs_create_group() and sysfs_create_group(), both which takes pointers to const struct attribute_group. Make it const to allow the compiler to put it in read-only memory.

---
 fs/9p/v9fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/9p/v9fs.c +1 -1
index 39def020a074..cdb99507ef33 100644
@@ -583,7 +583,7 @@ static struct attribute *v9fs_attrs[] = {
 	NULL,
 };
 
-static struct attribute_group v9fs_attr_group = {
+static const struct attribute_group v9fs_attr_group = {
 	.attrs = v9fs_attrs,
 };
 
Signature · 1 line
2.30.0
#1 lore raw

Rikard Falkeborn wrote on Fri, Jan 08, 2021 at 11:46:50PM +0100:

Quoted 6 lines

The only usage of v9fs_attr_group is to pass its address to sysfs_create_group() and sysfs_create_group(), both which takes pointers to const struct attribute_group. Make it const to allow the compiler to put it in read-only memory.

Thanks, taking it.

Signature · 1 line
Dominique