linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ocfs2: cluster: use default_groups in kobj_type
@ 2022-01-06 10:20 Greg Kroah-Hartman
  2022-01-06 11:29 ` Joseph Qi
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kroah-Hartman @ 2022-01-06 10:20 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Mark Fasheh, Joel Becker, Joseph Qi,
	Masahiro Yamada, Andrew Morton, Miguel Ojeda, Geert Uytterhoeven,
	ocfs2-devel

There are currently 2 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 aa30f47cf666 ("kobject: Add
support for default attribute groups to kobj_type") so that we can soon
get rid of the obsolete default_attrs field.

Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: ocfs2-devel@oss.oracle.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/ocfs2/cluster/masklog.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
index 810d32815593..563881ddbf00 100644
--- a/fs/ocfs2/cluster/masklog.c
+++ b/fs/ocfs2/cluster/masklog.c
@@ -120,7 +120,8 @@ static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = {
 	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,
 			 char *buf)
@@ -144,8 +145,8 @@ static const struct sysfs_ops mlog_attr_ops = {
 };
 
 static struct kobj_type mlog_ktype = {
-	.default_attrs = mlog_attr_ptrs,
-	.sysfs_ops     = &mlog_attr_ops,
+	.default_groups = mlog_default_groups,
+	.sysfs_ops      = &mlog_attr_ops,
 };
 
 static struct kset mlog_kset = {
@@ -157,10 +158,10 @@ int mlog_sys_init(struct kset *o2cb_kset)
 	int i = 0;
 
 	while (mlog_attrs[i].attr.mode) {
-		mlog_attr_ptrs[i] = &mlog_attrs[i].attr;
+		mlog_default_attrs[i] = &mlog_attrs[i].attr;
 		i++;
 	}
-	mlog_attr_ptrs[i] = NULL;
+	mlog_default_attrs[i] = NULL;
 
 	kobject_set_name(&mlog_kset.kobj, "logmask");
 	mlog_kset.kobj.kset = o2cb_kset;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ocfs2: cluster: use default_groups in kobj_type
  2022-01-06 10:20 [PATCH] ocfs2: cluster: use default_groups in kobj_type Greg Kroah-Hartman
@ 2022-01-06 11:29 ` Joseph Qi
  0 siblings, 0 replies; 2+ messages in thread
From: Joseph Qi @ 2022-01-06 11:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: Mark Fasheh, Joel Becker, Masahiro Yamada, Andrew Morton,
	Miguel Ojeda, Geert Uytterhoeven, ocfs2-devel

Reviewed-and-Tested-by: Joseph Qi <joseph.qi@linux.alibaba.com>

On 1/6/22 6:20 PM, Greg Kroah-Hartman wrote:
> There are currently 2 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 aa30f47cf666 ("kobject: Add
> support for default attribute groups to kobj_type") so that we can soon
> get rid of the obsolete default_attrs field.
> 
> Cc: Mark Fasheh <mark@fasheh.com>
> Cc: Joel Becker <jlbec@evilplan.org>
> Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Miguel Ojeda <ojeda@kernel.org>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: ocfs2-devel@oss.oracle.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  fs/ocfs2/cluster/masklog.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
> index 810d32815593..563881ddbf00 100644
> --- a/fs/ocfs2/cluster/masklog.c
> +++ b/fs/ocfs2/cluster/masklog.c
> @@ -120,7 +120,8 @@ static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = {
>  	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,
>  			 char *buf)
> @@ -144,8 +145,8 @@ static const struct sysfs_ops mlog_attr_ops = {
>  };
>  
>  static struct kobj_type mlog_ktype = {
> -	.default_attrs = mlog_attr_ptrs,
> -	.sysfs_ops     = &mlog_attr_ops,
> +	.default_groups = mlog_default_groups,
> +	.sysfs_ops      = &mlog_attr_ops,
>  };
>  
>  static struct kset mlog_kset = {
> @@ -157,10 +158,10 @@ int mlog_sys_init(struct kset *o2cb_kset)
>  	int i = 0;
>  
>  	while (mlog_attrs[i].attr.mode) {
> -		mlog_attr_ptrs[i] = &mlog_attrs[i].attr;
> +		mlog_default_attrs[i] = &mlog_attrs[i].attr;
>  		i++;
>  	}
> -	mlog_attr_ptrs[i] = NULL;
> +	mlog_default_attrs[i] = NULL;
>  
>  	kobject_set_name(&mlog_kset.kobj, "logmask");
>  	mlog_kset.kobj.kset = o2cb_kset;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-06 11:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06 10:20 [PATCH] ocfs2: cluster: use default_groups in kobj_type Greg Kroah-Hartman
2022-01-06 11:29 ` Joseph Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).