linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] kobject: introduce kobject_is_added()
@ 2023-04-06  9:30 Yangtao Li
  2023-04-06  9:30 ` [PATCH 2/3] erofs: convert to use kobject_is_added() Yangtao Li
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Yangtao Li @ 2023-04-06  9:30 UTC (permalink / raw)
  To: xiang, chao, huyue2, jefflexu, damien.lemoal, naohiro.aota, jth,
	gregkh, rafael
  Cc: linux-erofs, linux-kernel, linux-fsdevel, Yangtao Li

Add kobject_is_added() to avoid consumers from directly accessing
the internal variables of kobject.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 include/linux/kobject.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index bdab370a24f4..b5cdb0c58729 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -203,6 +203,11 @@ static inline const struct kobj_type *get_ktype(const struct kobject *kobj)
 	return kobj->ktype;
 }
 
+static inline int kobject_is_added(struct kobject *kobj)
+{
+	return kobj->state_in_sysfs;
+}
+
 extern struct kobject *kset_find_obj(struct kset *, const char *);
 
 /* The global /sys/kernel/ kobject for people to chain off of */
-- 
2.35.1


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

end of thread, other threads:[~2023-04-07  7:23 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-06  9:30 [PATCH 1/3] kobject: introduce kobject_is_added() Yangtao Li
2023-04-06  9:30 ` [PATCH 2/3] erofs: convert to use kobject_is_added() Yangtao Li
2023-04-06 10:03   ` Greg KH
2023-04-06 10:13     ` Gao Xiang
2023-04-06 10:27       ` Greg KH
2023-04-06 10:55         ` Gao Xiang
2023-04-06 11:19           ` Greg KH
2023-04-06 12:07     ` Yangtao Li
2023-04-06 13:50       ` Yangtao Li
2023-04-06 14:31       ` Greg KH
2023-04-06 17:52         ` Yangtao Li
2023-04-07  6:09         ` Yangtao Li
2023-04-07  7:23         ` Yangtao Li
2023-04-06  9:30 ` [PATCH 3/3] zonefs: " Yangtao Li
2023-04-06 10:05   ` Greg KH
2023-04-06 10:13     ` Damien Le Moal
2023-04-06 10:26       ` Greg KH
2023-04-06 10:58         ` Damien Le Moal
2023-04-06 11:18           ` Greg KH
2023-04-06 11:23             ` Damien Le Moal
2023-04-06  9:59 ` [PATCH 1/3] kobject: introduce kobject_is_added() Greg KH

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).