diff options
Diffstat (limited to 'include/linux/kobject.h')
-rw-r--r-- | include/linux/kobject.h | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 5b08248fba72..8eb21f2f25e1 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -26,15 +26,14 @@ | |||
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <asm/atomic.h> | 27 | #include <asm/atomic.h> |
28 | 28 | ||
29 | #define KOBJ_NAME_LEN 20 | 29 | #define KOBJ_NAME_LEN 20 |
30 | 30 | #define UEVENT_HELPER_PATH_LEN 256 | |
31 | #define HOTPLUG_PATH_LEN 256 | ||
32 | 31 | ||
33 | /* path to the userspace helper executed on an event */ | 32 | /* path to the userspace helper executed on an event */ |
34 | extern char hotplug_path[]; | 33 | extern char uevent_helper[]; |
35 | 34 | ||
36 | /* counter to tag the hotplug event, read only except for the kobject core */ | 35 | /* counter to tag the uevent, read only except for the kobject core */ |
37 | extern u64 hotplug_seqnum; | 36 | extern u64 uevent_seqnum; |
38 | 37 | ||
39 | /* the actions here must match the proper string in lib/kobject_uevent.c */ | 38 | /* the actions here must match the proper string in lib/kobject_uevent.c */ |
40 | typedef int __bitwise kobject_action_t; | 39 | typedef int __bitwise kobject_action_t; |
@@ -101,15 +100,14 @@ struct kobj_type { | |||
101 | * of object; multiple ksets can belong to one subsystem. All | 100 | * of object; multiple ksets can belong to one subsystem. All |
102 | * ksets of a subsystem share the subsystem's lock. | 101 | * ksets of a subsystem share the subsystem's lock. |
103 | * | 102 | * |
104 | * Each kset can support hotplugging; if it does, it will be given | 103 | * Each kset can support specific event variables; it can |
105 | * the opportunity to filter out specific kobjects from being | 104 | * supress the event generation or add subsystem specific |
106 | * reported, as well as to add its own "data" elements to the | 105 | * variables carried with the event. |
107 | * environment being passed to the hotplug helper. | ||
108 | */ | 106 | */ |
109 | struct kset_hotplug_ops { | 107 | struct kset_uevent_ops { |
110 | int (*filter)(struct kset *kset, struct kobject *kobj); | 108 | int (*filter)(struct kset *kset, struct kobject *kobj); |
111 | const char *(*name)(struct kset *kset, struct kobject *kobj); | 109 | const char *(*name)(struct kset *kset, struct kobject *kobj); |
112 | int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp, | 110 | int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp, |
113 | int num_envp, char *buffer, int buffer_size); | 111 | int num_envp, char *buffer, int buffer_size); |
114 | }; | 112 | }; |
115 | 113 | ||
@@ -119,7 +117,7 @@ struct kset { | |||
119 | struct list_head list; | 117 | struct list_head list; |
120 | spinlock_t list_lock; | 118 | spinlock_t list_lock; |
121 | struct kobject kobj; | 119 | struct kobject kobj; |
122 | struct kset_hotplug_ops * hotplug_ops; | 120 | struct kset_uevent_ops * uevent_ops; |
123 | }; | 121 | }; |
124 | 122 | ||
125 | 123 | ||
@@ -167,20 +165,20 @@ struct subsystem { | |||
167 | struct rw_semaphore rwsem; | 165 | struct rw_semaphore rwsem; |
168 | }; | 166 | }; |
169 | 167 | ||
170 | #define decl_subsys(_name,_type,_hotplug_ops) \ | 168 | #define decl_subsys(_name,_type,_uevent_ops) \ |
171 | struct subsystem _name##_subsys = { \ | 169 | struct subsystem _name##_subsys = { \ |
172 | .kset = { \ | 170 | .kset = { \ |
173 | .kobj = { .name = __stringify(_name) }, \ | 171 | .kobj = { .name = __stringify(_name) }, \ |
174 | .ktype = _type, \ | 172 | .ktype = _type, \ |
175 | .hotplug_ops =_hotplug_ops, \ | 173 | .uevent_ops =_uevent_ops, \ |
176 | } \ | 174 | } \ |
177 | } | 175 | } |
178 | #define decl_subsys_name(_varname,_name,_type,_hotplug_ops) \ | 176 | #define decl_subsys_name(_varname,_name,_type,_uevent_ops) \ |
179 | struct subsystem _varname##_subsys = { \ | 177 | struct subsystem _varname##_subsys = { \ |
180 | .kset = { \ | 178 | .kset = { \ |
181 | .kobj = { .name = __stringify(_name) }, \ | 179 | .kobj = { .name = __stringify(_name) }, \ |
182 | .ktype = _type, \ | 180 | .ktype = _type, \ |
183 | .hotplug_ops =_hotplug_ops, \ | 181 | .uevent_ops =_uevent_ops, \ |
184 | } \ | 182 | } \ |
185 | } | 183 | } |
186 | 184 | ||
@@ -256,16 +254,16 @@ extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); | |||
256 | extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *); | 254 | extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *); |
257 | 255 | ||
258 | #ifdef CONFIG_HOTPLUG | 256 | #ifdef CONFIG_HOTPLUG |
259 | void kobject_hotplug(struct kobject *kobj, enum kobject_action action); | 257 | void kobject_uevent(struct kobject *kobj, enum kobject_action action); |
260 | 258 | ||
261 | int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, | 259 | int add_uevent_var(char **envp, int num_envp, int *cur_index, |
262 | char *buffer, int buffer_size, int *cur_len, | 260 | char *buffer, int buffer_size, int *cur_len, |
263 | const char *format, ...) | 261 | const char *format, ...) |
264 | __attribute__((format (printf, 7, 8))); | 262 | __attribute__((format (printf, 7, 8))); |
265 | #else | 263 | #else |
266 | static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { } | 264 | static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { } |
267 | 265 | ||
268 | static inline int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, | 266 | static inline int add_uevent_var(char **envp, int num_envp, int *cur_index, |
269 | char *buffer, int buffer_size, int *cur_len, | 267 | char *buffer, int buffer_size, int *cur_len, |
270 | const char *format, ...) | 268 | const char *format, ...) |
271 | { return 0; } | 269 | { return 0; } |