Commit d141b39b authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Linus Torvalds

ocfs2: cluster: use default_groups in kobj_type

There are currently two ways to create a set of sysfs files for a
kobj_type, through the default_attrs field, and the default_groups
field.

Move the ocfs2 cluster sysfs code to use default_groups field which has
been the preferred way since aa30f47c ("kobject: Add support for
default attribute groups to kobj_type") so that we can soon get rid of
the obsolete default_attrs field.

Link: https://lkml.kernel.org/r/20220106102028.3345634-1-gregkh@linuxfoundation.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
Tested-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f018844f
...@@ -120,7 +120,8 @@ static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = { ...@@ -120,7 +120,8 @@ static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = {
define_mask(KTHREAD), define_mask(KTHREAD),
}; };
static struct attribute *mlog_attr_ptrs[MLOG_MAX_BITS] = {NULL, }; static struct attribute *mlog_default_attrs[MLOG_MAX_BITS] = {NULL, };
ATTRIBUTE_GROUPS(mlog_default);
static ssize_t mlog_show(struct kobject *obj, struct attribute *attr, static ssize_t mlog_show(struct kobject *obj, struct attribute *attr,
char *buf) char *buf)
...@@ -144,7 +145,7 @@ static const struct sysfs_ops mlog_attr_ops = { ...@@ -144,7 +145,7 @@ static const struct sysfs_ops mlog_attr_ops = {
}; };
static struct kobj_type mlog_ktype = { static struct kobj_type mlog_ktype = {
.default_attrs = mlog_attr_ptrs, .default_groups = mlog_default_groups,
.sysfs_ops = &mlog_attr_ops, .sysfs_ops = &mlog_attr_ops,
}; };
...@@ -157,10 +158,10 @@ int mlog_sys_init(struct kset *o2cb_kset) ...@@ -157,10 +158,10 @@ int mlog_sys_init(struct kset *o2cb_kset)
int i = 0; int i = 0;
while (mlog_attrs[i].attr.mode) { while (mlog_attrs[i].attr.mode) {
mlog_attr_ptrs[i] = &mlog_attrs[i].attr; mlog_default_attrs[i] = &mlog_attrs[i].attr;
i++; i++;
} }
mlog_attr_ptrs[i] = NULL; mlog_default_attrs[i] = NULL;
kobject_set_name(&mlog_kset.kobj, "logmask"); kobject_set_name(&mlog_kset.kobj, "logmask");
mlog_kset.kobj.kset = o2cb_kset; mlog_kset.kobj.kset = o2cb_kset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment