Skip to content

Commit eae324c

Browse files
richardweinbergerAndreas Hindborg
authored andcommitted
configfs: Add CONFIGFS_ATTR_PERM helper
This new helper allows creating rw files with custom permissions. Signed-off-by: Richard Weinberger <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Andreas Hindborg <[email protected]>
1 parent 8ffd015 commit eae324c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

include/linux/configfs.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,19 @@ struct configfs_attribute {
120120
ssize_t (*store)(struct config_item *, const char *, size_t);
121121
};
122122

123-
#define CONFIGFS_ATTR(_pfx, _name) \
123+
#define CONFIGFS_ATTR_PERM(_pfx, _name, _perm) \
124124
static struct configfs_attribute _pfx##attr_##_name = { \
125125
.ca_name = __stringify(_name), \
126-
.ca_mode = S_IRUGO | S_IWUSR, \
126+
.ca_mode = _perm, \
127127
.ca_owner = THIS_MODULE, \
128128
.show = _pfx##_name##_show, \
129129
.store = _pfx##_name##_store, \
130130
}
131131

132+
#define CONFIGFS_ATTR(_pfx, _name) CONFIGFS_ATTR_PERM( \
133+
_pfx, _name, S_IRUGO | S_IWUSR \
134+
)
135+
132136
#define CONFIGFS_ATTR_RO(_pfx, _name) \
133137
static struct configfs_attribute _pfx##attr_##_name = { \
134138
.ca_name = __stringify(_name), \

0 commit comments

Comments
 (0)