aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/kobject.h67
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
77extern int kobject_set_name(struct kobject *, const char *, ...) 76extern int kobject_set_name(struct kobject *kobj, const char *name, ...)
78 __attribute__((format(printf,2,3))); 77 __attribute__((format(printf, 2, 3)));
79 78
80static inline const char * kobject_name(const struct kobject * kobj) 79static 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
94extern void kobject_del(struct kobject *); 93extern void kobject_del(struct kobject *kobj);
95 94
96extern struct kobject * __must_check kobject_create(void); 95extern struct kobject * __must_check kobject_create(void);
97extern struct kobject * __must_check kobject_create_and_add(const char *name, 96extern 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,
100extern int __must_check kobject_rename(struct kobject *, const char *new_name); 99extern int __must_check kobject_rename(struct kobject *, const char *new_name);
101extern int __must_check kobject_move(struct kobject *, struct kobject *); 100extern int __must_check kobject_move(struct kobject *, struct kobject *);
102 101
103extern struct kobject * kobject_get(struct kobject *); 102extern struct kobject *kobject_get(struct kobject *kobj);
104extern void kobject_put(struct kobject *); 103extern void kobject_put(struct kobject *kobj);
105 104
106extern char * kobject_get_path(struct kobject *, gfp_t); 105extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
107 106
108struct kobj_type { 107struct 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
114struct kobj_uevent_env { 113struct kobj_uevent_env {
@@ -153,30 +152,30 @@ extern struct sysfs_ops kobj_sysfs_ops;
153 * desired. 152 * desired.
154 */ 153 */
155struct kset { 154struct 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
162extern void kset_init(struct kset * k); 161extern void kset_init(struct kset *kset);
163extern int __must_check kset_register(struct kset * k); 162extern int __must_check kset_register(struct kset *kset);
164extern void kset_unregister(struct kset * k); 163extern void kset_unregister(struct kset *kset);
165extern struct kset * __must_check kset_create_and_add(const char *name, 164extern 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
169static inline struct kset * to_kset(struct kobject * kobj) 168static 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
174static inline struct kset * kset_get(struct kset * k) 173static 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
179static inline void kset_put(struct kset * k) 178static 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
189extern struct kobject * kset_find_obj(struct kset *, const char *); 188extern 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 */
192extern struct kobject *kernel_kobj; 191extern struct kobject *kernel_kobj;
@@ -208,18 +207,20 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
208int kobject_action_type(const char *buf, size_t count, 207int kobject_action_type(const char *buf, size_t count,
209 enum kobject_action *type); 208 enum kobject_action *type);
210#else 209#else
211static inline int kobject_uevent(struct kobject *kobj, enum kobject_action action) 210static inline int kobject_uevent(struct kobject *kobj,
211 enum kobject_action action)
212{ return 0; } 212{ return 0; }
213static inline int kobject_uevent_env(struct kobject *kobj, 213static 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
218static inline int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) 218static inline int add_uevent_var(struct kobj_uevent_env *env,
219 const char *format, ...)
219{ return 0; } 220{ return 0; }
220 221
221static inline int kobject_action_type(const char *buf, size_t count, 222static 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