[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK-6q+gvhDSrzUyHB=KAw=hMco5BAHxbXuhVYLdzHm12JEJG1g@mail.gmail.com>
Date: Tue, 16 Jul 2024 09:10:09 -0400
From: Alexander Aring <aahringo@...hat.com>
To: Lk Sii <lk_sii@....com>
Cc: Greg KH <gregkh@...uxfoundation.org>, rafael@...nel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, gfs2 <gfs2@...ts.linux.dev>,
David Teigland <teigland@...hat.com>
Subject: Re: udev kset_create_and_add() with own struct kobj_type?
Hi,
On Tue, Jul 16, 2024 at 8:15 AM Lk Sii <lk_sii@....com> wrote:
>
> On 2024/7/15 23:27, Alexander Aring wrote:
> > Hi,
> >
> > I am currently implementing namespace support into the fs/dlm
> > subsystem. The DLM subsystem uses kset_create_and_add("dlm",
> > &dlm_uevent_ops, kernel_kobj); to create the "dlm" sysfs directory.
> > Underneath it creates for each lockspace a subdirectory using
> > kobject_init_and_add() with a non-static name and being known during
> > runtime.
> >
> > Now I want to add namespace support and need to change the "default"
> > kset->kobj.ktype = &kset_ktype; that is set by
> > kset_create_and_add()->kset_create() to my own kobj_type because I
> > need to implement a different ".child_ns_type" callback before
> > kset_register() is called.
> >
> you maybe use kset_register() instead of kset_create_and_add().
> you maybe find example codes from below kernel files:
> fs/nfs/sysfs.c
> fs/f2fs/sysfs.c
> fs/ubifs/sysfs.c
looked into the first one, it looks like potential new users for such
a new helper. This is what I am currently doing and it works, but I
mostly copy&paste the code of kset_create_and_add() just to set a
different "kobj.ktype" in the kset and feeling bad about it.
Thanks.
- Alex
Powered by blists - more mailing lists