From: Alexander Aring <aahringo@redhat.com>
To: trondmy@kernel.org
Cc: anna@kernel.org, bcodding@redhat.com, gregkh@linuxfoundation.org,
rafael@kernel.org, akpm@linux-foundation.org,
linux-nfs@vger.kernel.org, gfs2@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] kobject: export generic helper ops
Date: Thu, 3 Oct 2024 11:14:33 -0400 [thread overview]
Message-ID: <20241003151435.3753959-3-aahringo@redhat.com> (raw)
In-Reply-To: <20241003151435.3753959-1-aahringo@redhat.com>
This patch exports generic helpers like kset_release() and
kset_get_ownership() so users can use them in their own struct kobj_type
implementation instead of implementing their own functions that do the
same.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
include/linux/kobject.h | 2 ++
lib/kobject.c | 6 ++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 7504b7547ed2..5fbc358e2be6 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -181,6 +181,8 @@ kset_type_create_and_add(const char *name, const struct kset_uevent_ops *u,
struct kset * __must_check
kset_create_and_add(const char *name, const struct kset_uevent_ops *u,
struct kobject *parent_kobj);
+void kset_release(struct kobject *kobj);
+void kset_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t *gid);
static inline struct kset *to_kset(struct kobject *kobj)
{
diff --git a/lib/kobject.c b/lib/kobject.c
index 09dd3d4c7f56..ccd2f6282c81 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -920,19 +920,21 @@ struct kobject *kset_find_obj(struct kset *kset, const char *name)
}
EXPORT_SYMBOL_GPL(kset_find_obj);
-static void kset_release(struct kobject *kobj)
+void kset_release(struct kobject *kobj)
{
struct kset *kset = container_of(kobj, struct kset, kobj);
pr_debug("'%s' (%p): %s\n",
kobject_name(kobj), kobj, __func__);
kfree(kset);
}
+EXPORT_SYMBOL_GPL(kset_release);
-static void kset_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t *gid)
+void kset_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t *gid)
{
if (kobj->parent)
kobject_get_ownership(kobj->parent, uid, gid);
}
+EXPORT_SYMBOL_GPL(kset_get_ownership);
static const struct kobj_type kset_ktype = {
.sysfs_ops = &kobj_sysfs_ops,
--
2.43.0
next prev parent reply other threads:[~2024-10-03 15:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-03 15:14 [PATCH 0/4] nfs: kobject: use generic helpers and ownership Alexander Aring
2024-10-03 15:14 ` [PATCH 1/4] kobject: add kset_type_create_and_add() helper Alexander Aring
2024-10-03 15:14 ` Alexander Aring [this message]
2024-10-03 15:14 ` [PATCH 3/4] nfs: sysfs: use kset_type_create_and_add() Alexander Aring
2024-10-03 15:14 ` [PATCH 4/4] nfs: sysfs: use default get_ownership() callback Alexander Aring
2024-10-08 20:09 ` Benjamin Coddington
2024-10-09 14:56 ` Alexander Aring
2024-10-08 17:36 ` [PATCH 0/4] nfs: kobject: use generic helpers and ownership Alexander Aring
2024-10-08 20:12 ` Benjamin Coddington
2024-10-09 20:03 ` Anna Schumaker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241003151435.3753959-3-aahringo@redhat.com \
--to=aahringo@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=anna@kernel.org \
--cc=bcodding@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=trondmy@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox