diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/kobject.h | 35 | ||||
-rw-r--r-- | include/linux/kobject_uevent.h | 57 |
2 files changed, 34 insertions, 58 deletions
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 7f7403aa4a41..baf5251d9f63 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -23,15 +23,31 @@ | |||
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/rwsem.h> | 24 | #include <linux/rwsem.h> |
25 | #include <linux/kref.h> | 25 | #include <linux/kref.h> |
26 | #include <linux/kobject_uevent.h> | ||
27 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
28 | #include <asm/atomic.h> | 27 | #include <asm/atomic.h> |
29 | 28 | ||
30 | #define KOBJ_NAME_LEN 20 | 29 | #define KOBJ_NAME_LEN 20 |
31 | 30 | ||
31 | #define HOTPLUG_PATH_LEN 256 | ||
32 | |||
33 | /* path to the userspace helper executed on an event */ | ||
34 | extern char hotplug_path[]; | ||
35 | |||
32 | /* counter to tag the hotplug event, read only except for the kobject core */ | 36 | /* counter to tag the hotplug event, read only except for the kobject core */ |
33 | extern u64 hotplug_seqnum; | 37 | extern u64 hotplug_seqnum; |
34 | 38 | ||
39 | /* the actions here must match the proper string in lib/kobject_uevent.c */ | ||
40 | typedef int __bitwise kobject_action_t; | ||
41 | enum kobject_action { | ||
42 | KOBJ_ADD = (__force kobject_action_t) 0x01, /* add event, for hotplug */ | ||
43 | KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* remove event, for hotplug */ | ||
44 | KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* a sysfs attribute file has changed */ | ||
45 | KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices */ | ||
46 | KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices */ | ||
47 | KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* offline event for hotplug devices */ | ||
48 | KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* online event for hotplug devices */ | ||
49 | }; | ||
50 | |||
35 | struct kobject { | 51 | struct kobject { |
36 | const char * k_name; | 52 | const char * k_name; |
37 | char name[KOBJ_NAME_LEN]; | 53 | char name[KOBJ_NAME_LEN]; |
@@ -243,16 +259,33 @@ extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *); | |||
243 | 259 | ||
244 | #ifdef CONFIG_HOTPLUG | 260 | #ifdef CONFIG_HOTPLUG |
245 | void kobject_hotplug(struct kobject *kobj, enum kobject_action action); | 261 | void kobject_hotplug(struct kobject *kobj, enum kobject_action action); |
262 | |||
246 | int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, | 263 | int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, |
247 | char *buffer, int buffer_size, int *cur_len, | 264 | char *buffer, int buffer_size, int *cur_len, |
248 | const char *format, ...) | 265 | const char *format, ...) |
249 | __attribute__((format (printf, 7, 8))); | 266 | __attribute__((format (printf, 7, 8))); |
267 | |||
268 | int kobject_uevent(struct kobject *kobj, | ||
269 | enum kobject_action action, | ||
270 | struct attribute *attr); | ||
271 | int kobject_uevent_atomic(struct kobject *kobj, | ||
272 | enum kobject_action action, | ||
273 | struct attribute *attr); | ||
274 | |||
250 | #else | 275 | #else |
251 | static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { } | 276 | static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { } |
252 | static inline int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, | 277 | static inline int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, |
253 | char *buffer, int buffer_size, int *cur_len, | 278 | char *buffer, int buffer_size, int *cur_len, |
254 | const char *format, ...) | 279 | const char *format, ...) |
255 | { return 0; } | 280 | { return 0; } |
281 | int kobject_uevent(struct kobject *kobj, | ||
282 | enum kobject_action action, | ||
283 | struct attribute *attr) | ||
284 | { return 0; } | ||
285 | int kobject_uevent_atomic(struct kobject *kobj, | ||
286 | enum kobject_action action, | ||
287 | struct attribute *attr) | ||
288 | { return 0; } | ||
256 | #endif | 289 | #endif |
257 | 290 | ||
258 | #endif /* __KERNEL__ */ | 291 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/kobject_uevent.h b/include/linux/kobject_uevent.h deleted file mode 100644 index aa664fe7e561..000000000000 --- a/include/linux/kobject_uevent.h +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /* | ||
2 | * kobject_uevent.h - list of kobject user events that can be generated | ||
3 | * | ||
4 | * Copyright (C) 2004 IBM Corp. | ||
5 | * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com> | ||
6 | * | ||
7 | * This file is released under the GPLv2. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #ifndef _KOBJECT_EVENT_H_ | ||
12 | #define _KOBJECT_EVENT_H_ | ||
13 | |||
14 | #define HOTPLUG_PATH_LEN 256 | ||
15 | |||
16 | /* path to the hotplug userspace helper executed on an event */ | ||
17 | extern char hotplug_path[]; | ||
18 | |||
19 | /* | ||
20 | * If you add an action here, you must also add the proper string to the | ||
21 | * lib/kobject_uevent.c file. | ||
22 | */ | ||
23 | typedef int __bitwise kobject_action_t; | ||
24 | enum kobject_action { | ||
25 | KOBJ_ADD = (__force kobject_action_t) 0x01, /* add event, for hotplug */ | ||
26 | KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* remove event, for hotplug */ | ||
27 | KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* a sysfs attribute file has changed */ | ||
28 | KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices */ | ||
29 | KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices */ | ||
30 | KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* offline event for hotplug devices */ | ||
31 | KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* online event for hotplug devices */ | ||
32 | }; | ||
33 | |||
34 | |||
35 | #ifdef CONFIG_KOBJECT_UEVENT | ||
36 | int kobject_uevent(struct kobject *kobj, | ||
37 | enum kobject_action action, | ||
38 | struct attribute *attr); | ||
39 | int kobject_uevent_atomic(struct kobject *kobj, | ||
40 | enum kobject_action action, | ||
41 | struct attribute *attr); | ||
42 | #else | ||
43 | static inline int kobject_uevent(struct kobject *kobj, | ||
44 | enum kobject_action action, | ||
45 | struct attribute *attr) | ||
46 | { | ||
47 | return 0; | ||
48 | } | ||
49 | static inline int kobject_uevent_atomic(struct kobject *kobj, | ||
50 | enum kobject_action action, | ||
51 | struct attribute *attr) | ||
52 | { | ||
53 | return 0; | ||
54 | } | ||
55 | #endif | ||
56 | |||
57 | #endif | ||