diff options
Diffstat (limited to 'include/linux/kobject.h')
| -rw-r--r-- | include/linux/kobject.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 7f6f93c3df9c..1ab0d624fb36 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/wait.h> | 26 | #include <linux/wait.h> |
| 27 | #include <linux/atomic.h> | 27 | #include <linux/atomic.h> |
| 28 | #include <linux/workqueue.h> | 28 | #include <linux/workqueue.h> |
| 29 | #include <linux/uidgid.h> | ||
| 29 | 30 | ||
| 30 | #define UEVENT_HELPER_PATH_LEN 256 | 31 | #define UEVENT_HELPER_PATH_LEN 256 |
| 31 | #define UEVENT_NUM_ENVP 32 /* number of env pointers */ | 32 | #define UEVENT_NUM_ENVP 32 /* number of env pointers */ |
| @@ -114,14 +115,34 @@ extern struct kobject * __must_check kobject_get_unless_zero( | |||
| 114 | extern void kobject_put(struct kobject *kobj); | 115 | extern void kobject_put(struct kobject *kobj); |
| 115 | 116 | ||
| 116 | extern const void *kobject_namespace(struct kobject *kobj); | 117 | extern const void *kobject_namespace(struct kobject *kobj); |
| 118 | extern void kobject_get_ownership(struct kobject *kobj, | ||
| 119 | kuid_t *uid, kgid_t *gid); | ||
| 117 | extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); | 120 | extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); |
| 118 | 121 | ||
| 122 | /** | ||
| 123 | * kobject_has_children - Returns whether a kobject has children. | ||
| 124 | * @kobj: the object to test | ||
| 125 | * | ||
| 126 | * This will return whether a kobject has other kobjects as children. | ||
| 127 | * | ||
| 128 | * It does NOT account for the presence of attribute files, only sub | ||
| 129 | * directories. It also assumes there is no concurrent addition or | ||
| 130 | * removal of such children, and thus relies on external locking. | ||
| 131 | */ | ||
| 132 | static inline bool kobject_has_children(struct kobject *kobj) | ||
| 133 | { | ||
| 134 | WARN_ON_ONCE(kref_read(&kobj->kref) == 0); | ||
| 135 | |||
| 136 | return kobj->sd && kobj->sd->dir.subdirs; | ||
| 137 | } | ||
| 138 | |||
| 119 | struct kobj_type { | 139 | struct kobj_type { |
| 120 | void (*release)(struct kobject *kobj); | 140 | void (*release)(struct kobject *kobj); |
| 121 | const struct sysfs_ops *sysfs_ops; | 141 | const struct sysfs_ops *sysfs_ops; |
| 122 | struct attribute **default_attrs; | 142 | struct attribute **default_attrs; |
| 123 | const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj); | 143 | const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj); |
| 124 | const void *(*namespace)(struct kobject *kobj); | 144 | const void *(*namespace)(struct kobject *kobj); |
| 145 | void (*get_ownership)(struct kobject *kobj, kuid_t *uid, kgid_t *gid); | ||
| 125 | }; | 146 | }; |
| 126 | 147 | ||
| 127 | struct kobj_uevent_env { | 148 | struct kobj_uevent_env { |
