diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/kobject.h | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 4adbe1d83081..caa3f411f15d 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
| @@ -3,15 +3,14 @@ | |||
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2002-2003 Patrick Mochel | 4 | * Copyright (c) 2002-2003 Patrick Mochel |
| 5 | * Copyright (c) 2002-2003 Open Source Development Labs | 5 | * Copyright (c) 2002-2003 Open Source Development Labs |
| 6 | * Copyright (c) 2006-2007 Greg Kroah-Hartman <greg@kroah.com> | 6 | * Copyright (c) 2006-2008 Greg Kroah-Hartman <greg@kroah.com> |
| 7 | * Copyright (c) 2006-2007 Novell Inc. | 7 | * Copyright (c) 2006-2008 Novell Inc. |
| 8 | * | 8 | * |
| 9 | * This file is released under the GPLv2. | 9 | * This file is released under the GPLv2. |
| 10 | * | 10 | * |
| 11 | * | ||
| 12 | * Please read Documentation/kobject.txt before using the kobject | 11 | * Please read Documentation/kobject.txt before using the kobject |
| 13 | * interface, ESPECIALLY the parts about reference counts and object | 12 | * interface, ESPECIALLY the parts about reference counts and object |
| 14 | * destructors. | 13 | * destructors. |
| 15 | */ | 14 | */ |
| 16 | 15 | ||
| 17 | #ifndef _KOBJECT_H_ | 16 | #ifndef _KOBJECT_H_ |
| @@ -64,20 +63,20 @@ struct kobject { | |||
| 64 | const char *name; | 63 | const char *name; |
| 65 | struct kref kref; | 64 | struct kref kref; |
| 66 | struct list_head entry; | 65 | struct list_head entry; |
| 67 | struct kobject * parent; | 66 | struct kobject *parent; |
| 68 | struct kset * kset; | 67 | struct kset *kset; |
| 69 | struct kobj_type * ktype; | 68 | struct kobj_type *ktype; |
| 70 | struct sysfs_dirent * sd; | 69 | struct sysfs_dirent *sd; |
| 71 | unsigned int state_initialized:1; | 70 | unsigned int state_initialized:1; |
| 72 | unsigned int state_in_sysfs:1; | 71 | unsigned int state_in_sysfs:1; |
| 73 | unsigned int state_add_uevent_sent:1; | 72 | unsigned int state_add_uevent_sent:1; |
| 74 | unsigned int state_remove_uevent_sent:1; | 73 | unsigned int state_remove_uevent_sent:1; |
| 75 | }; | 74 | }; |
| 76 | 75 | ||
| 77 | extern int kobject_set_name(struct kobject *, const char *, ...) | 76 | extern int kobject_set_name(struct kobject *kobj, const char *name, ...) |
| 78 | __attribute__((format(printf,2,3))); | 77 | __attribute__((format(printf, 2, 3))); |
| 79 | 78 | ||
| 80 | static inline const char * kobject_name(const struct kobject * kobj) | 79 | static inline const char *kobject_name(const struct kobject *kobj) |
| 81 | { | 80 | { |
| 82 | return kobj->name; | 81 | return kobj->name; |
| 83 | } | 82 | } |
| @@ -91,7 +90,7 @@ extern int __must_check kobject_init_and_add(struct kobject *kobj, | |||
| 91 | struct kobject *parent, | 90 | struct kobject *parent, |
| 92 | const char *fmt, ...); | 91 | const char *fmt, ...); |
| 93 | 92 | ||
| 94 | extern void kobject_del(struct kobject *); | 93 | extern void kobject_del(struct kobject *kobj); |
| 95 | 94 | ||
| 96 | extern struct kobject * __must_check kobject_create(void); | 95 | extern struct kobject * __must_check kobject_create(void); |
| 97 | extern struct kobject * __must_check kobject_create_and_add(const char *name, | 96 | extern struct kobject * __must_check kobject_create_and_add(const char *name, |
| @@ -100,15 +99,15 @@ extern struct kobject * __must_check kobject_create_and_add(const char *name, | |||
| 100 | extern int __must_check kobject_rename(struct kobject *, const char *new_name); | 99 | extern int __must_check kobject_rename(struct kobject *, const char *new_name); |
| 101 | extern int __must_check kobject_move(struct kobject *, struct kobject *); | 100 | extern int __must_check kobject_move(struct kobject *, struct kobject *); |
| 102 | 101 | ||
| 103 | extern struct kobject * kobject_get(struct kobject *); | 102 | extern struct kobject *kobject_get(struct kobject *kobj); |
| 104 | extern void kobject_put(struct kobject *); | 103 | extern void kobject_put(struct kobject *kobj); |
| 105 | 104 | ||
| 106 | extern char * kobject_get_path(struct kobject *, gfp_t); | 105 | extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); |
| 107 | 106 | ||
| 108 | struct kobj_type { | 107 | struct kobj_type { |
| 109 | void (*release)(struct kobject *); | 108 | void (*release)(struct kobject *kobj); |
| 110 | struct sysfs_ops * sysfs_ops; | 109 | struct sysfs_ops *sysfs_ops; |
| 111 | struct attribute ** default_attrs; | 110 | struct attribute **default_attrs; |
| 112 | }; | 111 | }; |
| 113 | 112 | ||
| 114 | struct kobj_uevent_env { | 113 | struct kobj_uevent_env { |
| @@ -153,30 +152,30 @@ extern struct sysfs_ops kobj_sysfs_ops; | |||
| 153 | * desired. | 152 | * desired. |
| 154 | */ | 153 | */ |
| 155 | struct kset { | 154 | struct kset { |
| 156 | struct list_head list; | 155 | struct list_head list; |
| 157 | spinlock_t list_lock; | 156 | spinlock_t list_lock; |
| 158 | struct kobject kobj; | 157 | struct kobject kobj; |
| 159 | struct kset_uevent_ops *uevent_ops; | 158 | struct kset_uevent_ops *uevent_ops; |
| 160 | }; | 159 | }; |
| 161 | 160 | ||
| 162 | extern void kset_init(struct kset * k); | 161 | extern void kset_init(struct kset *kset); |
| 163 | extern int __must_check kset_register(struct kset * k); | 162 | extern int __must_check kset_register(struct kset *kset); |
| 164 | extern void kset_unregister(struct kset * k); | 163 | extern void kset_unregister(struct kset *kset); |
| 165 | extern struct kset * __must_check kset_create_and_add(const char *name, | 164 | extern struct kset * __must_check kset_create_and_add(const char *name, |
| 166 | struct kset_uevent_ops *u, | 165 | struct kset_uevent_ops *u, |
| 167 | struct kobject *parent_kobj); | 166 | struct kobject *parent_kobj); |
| 168 | 167 | ||
| 169 | static inline struct kset * to_kset(struct kobject * kobj) | 168 | static inline struct kset *to_kset(struct kobject *kobj) |
| 170 | { | 169 | { |
| 171 | return kobj ? container_of(kobj,struct kset,kobj) : NULL; | 170 | return kobj ? container_of(kobj, struct kset, kobj) : NULL; |
| 172 | } | 171 | } |
| 173 | 172 | ||
| 174 | static inline struct kset * kset_get(struct kset * k) | 173 | static inline struct kset *kset_get(struct kset *k) |
| 175 | { | 174 | { |
| 176 | return k ? to_kset(kobject_get(&k->kobj)) : NULL; | 175 | return k ? to_kset(kobject_get(&k->kobj)) : NULL; |
| 177 | } | 176 | } |
| 178 | 177 | ||
| 179 | static inline void kset_put(struct kset * k) | 178 | static inline void kset_put(struct kset *k) |
| 180 | { | 179 | { |
| 181 | kobject_put(&k->kobj); | 180 | kobject_put(&k->kobj); |
| 182 | } | 181 | } |
| @@ -186,7 +185,7 @@ static inline struct kobj_type *get_ktype(struct kobject *kobj) | |||
| 186 | return kobj->ktype; | 185 | return kobj->ktype; |
| 187 | } | 186 | } |
| 188 | 187 | ||
| 189 | extern struct kobject * kset_find_obj(struct kset *, const char *); | 188 | extern struct kobject *kset_find_obj(struct kset *, const char *); |
| 190 | 189 | ||
| 191 | /* The global /sys/kernel/ kobject for people to chain off of */ | 190 | /* The global /sys/kernel/ kobject for people to chain off of */ |
| 192 | extern struct kobject *kernel_kobj; | 191 | extern struct kobject *kernel_kobj; |
| @@ -208,18 +207,20 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) | |||
| 208 | int kobject_action_type(const char *buf, size_t count, | 207 | int kobject_action_type(const char *buf, size_t count, |
| 209 | enum kobject_action *type); | 208 | enum kobject_action *type); |
| 210 | #else | 209 | #else |
| 211 | static inline int kobject_uevent(struct kobject *kobj, enum kobject_action action) | 210 | static inline int kobject_uevent(struct kobject *kobj, |
| 211 | enum kobject_action action) | ||
| 212 | { return 0; } | 212 | { return 0; } |
| 213 | static inline int kobject_uevent_env(struct kobject *kobj, | 213 | static inline int kobject_uevent_env(struct kobject *kobj, |
| 214 | enum kobject_action action, | 214 | enum kobject_action action, |
| 215 | char *envp[]) | 215 | char *envp[]) |
| 216 | { return 0; } | 216 | { return 0; } |
| 217 | 217 | ||
| 218 | static inline int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) | 218 | static inline int add_uevent_var(struct kobj_uevent_env *env, |
| 219 | const char *format, ...) | ||
| 219 | { return 0; } | 220 | { return 0; } |
| 220 | 221 | ||
| 221 | static inline int kobject_action_type(const char *buf, size_t count, | 222 | static inline int kobject_action_type(const char *buf, size_t count, |
| 222 | enum kobject_action *type) | 223 | enum kobject_action *type) |
| 223 | { return -EINVAL; } | 224 | { return -EINVAL; } |
| 224 | #endif | 225 | #endif |
| 225 | 226 | ||
