From 67d7e0a712af2be608ff4602b99ece0064d86a03 Mon Sep 17 00:00:00 2001 From: Panchajanya1999 Date: Wed, 16 Feb 2022 00:48:53 +0530 Subject: [PATCH] f2fs/sysfs: Introduce a Read-Only attribute macro Useful when we need to set a node RO to avoid Android over-riding the custom set values. Change-Id: Iad8cf81504d55b8ed75e6b5563f7cf397595ec1a Signed-off-by: Panchajanya1999 --- fs/f2fs/sysfs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 9e84c3ce6a27..b31b85f01fdc 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -772,6 +772,11 @@ static struct f2fs_attr f2fs_attr_##_name = { \ f2fs_sbi_show, f2fs_sbi_store, \ offsetof(struct struct_name, elname)) +#define F2FS_RO_ATTR(struct_type, struct_name, name, elname) \ + F2FS_ATTR_OFFSET(struct_type, name, 0444, \ + f2fs_sbi_show, f2fs_sbi_store, \ + offsetof(struct struct_name, elname)) + #define F2FS_GENERAL_RO_ATTR(name) \ static struct f2fs_attr f2fs_attr_##name = __ATTR(name, 0444, name##_show, NULL)