Commit 0296b2281352e4794e174b393c37f131502e09f0
Committed by
Greg Kroah-Hartman
1 parent
0343821177
Exists in
master
and in
4 other branches
[PATCH] remove CONFIG_KOBJECT_UEVENT option
It makes zero sense to have hotplug, but not the netlink events enabled today. Remove this option and merge the kobject_uevent.h header into the kobject.h header file. Signed-off-by: Kay Sievers <kay.sievers@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Showing 8 changed files with 40 additions and 107 deletions Side-by-side Diff
MAINTAINERS
... | ... | @@ -1476,12 +1476,6 @@ |
1476 | 1476 | W: http://www.cse.unsw.edu.au/~neilb/patches/linux-devel/ |
1477 | 1477 | S: Maintained |
1478 | 1478 | |
1479 | -KERNEL EVENT LAYER (KOBJECT_UEVENT) | |
1480 | -P: Robert Love | |
1481 | -M: rml@novell.com | |
1482 | -L: linux-kernel@vger.kernel.org | |
1483 | -S: Maintained | |
1484 | - | |
1485 | 1479 | KEXEC |
1486 | 1480 | P: Eric Biederman |
1487 | 1481 | P: Randy Dunlap |
drivers/input/input.c
drivers/s390/crypto/z90main.c
include/linux/kobject.h
... | ... | @@ -23,15 +23,31 @@ |
23 | 23 | #include <linux/spinlock.h> |
24 | 24 | #include <linux/rwsem.h> |
25 | 25 | #include <linux/kref.h> |
26 | -#include <linux/kobject_uevent.h> | |
27 | 26 | #include <linux/kernel.h> |
28 | 27 | #include <asm/atomic.h> |
29 | 28 | |
30 | 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 | 36 | /* counter to tag the hotplug event, read only except for the kobject core */ |
33 | 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 | 51 | struct kobject { |
36 | 52 | const char * k_name; |
37 | 53 | char name[KOBJ_NAME_LEN]; |
38 | 54 | |
39 | 55 | |
... | ... | @@ -243,15 +259,32 @@ |
243 | 259 | |
244 | 260 | #ifdef CONFIG_HOTPLUG |
245 | 261 | void kobject_hotplug(struct kobject *kobj, enum kobject_action action); |
262 | + | |
246 | 263 | int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, |
247 | 264 | char *buffer, int buffer_size, int *cur_len, |
248 | 265 | const char *format, ...) |
249 | 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 | 275 | #else |
251 | 276 | static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { } |
252 | 277 | static inline int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, |
253 | 278 | char *buffer, int buffer_size, int *cur_len, |
254 | 279 | const char *format, ...) |
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) | |
255 | 288 | { return 0; } |
256 | 289 | #endif |
257 | 290 |
include/linux/kobject_uevent.h
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 |
init/Kconfig
... | ... | @@ -205,25 +205,6 @@ |
205 | 205 | modules require HOTPLUG functionality, but a module built |
206 | 206 | outside the kernel tree does. Such modules require Y here. |
207 | 207 | |
208 | -config KOBJECT_UEVENT | |
209 | - bool "Kernel Userspace Events" if EMBEDDED | |
210 | - depends on NET | |
211 | - default y | |
212 | - help | |
213 | - This option enables the kernel userspace event layer, which is a | |
214 | - simple mechanism for kernel-to-user communication over a netlink | |
215 | - socket. | |
216 | - The goal of the kernel userspace events layer is to provide a simple | |
217 | - and efficient events system, that notifies userspace about kobject | |
218 | - state changes. This will enable applications to just listen for | |
219 | - events instead of polling system devices and files. | |
220 | - Hotplug events (kobject addition and removal) are also available on | |
221 | - the netlink socket in addition to the execution of /sbin/hotplug if | |
222 | - CONFIG_HOTPLUG is enabled. | |
223 | - | |
224 | - Say Y, unless you are building a system requiring minimal memory | |
225 | - consumption. | |
226 | - | |
227 | 208 | config IKCONFIG |
228 | 209 | bool "Kernel .config support" |
229 | 210 | ---help--- |
kernel/sysctl.c
... | ... | @@ -31,6 +31,7 @@ |
31 | 31 | #include <linux/smp_lock.h> |
32 | 32 | #include <linux/init.h> |
33 | 33 | #include <linux/kernel.h> |
34 | +#include <linux/kobject.h> | |
34 | 35 | #include <linux/net.h> |
35 | 36 | #include <linux/sysrq.h> |
36 | 37 | #include <linux/highuid.h> |
... | ... | @@ -82,9 +83,6 @@ |
82 | 83 | |
83 | 84 | #ifdef CONFIG_KMOD |
84 | 85 | extern char modprobe_path[]; |
85 | -#endif | |
86 | -#ifdef CONFIG_HOTPLUG | |
87 | -extern char hotplug_path[]; | |
88 | 86 | #endif |
89 | 87 | #ifdef CONFIG_CHR_DEV_SG |
90 | 88 | extern int sg_big_buff; |
lib/kobject_uevent.c
... | ... | @@ -19,14 +19,17 @@ |
19 | 19 | #include <linux/skbuff.h> |
20 | 20 | #include <linux/netlink.h> |
21 | 21 | #include <linux/string.h> |
22 | -#include <linux/kobject_uevent.h> | |
23 | 22 | #include <linux/kobject.h> |
24 | 23 | #include <net/sock.h> |
25 | 24 | |
26 | 25 | #define BUFFER_SIZE 1024 /* buffer for the hotplug env */ |
27 | 26 | #define NUM_ENVP 32 /* number of env pointers */ |
28 | 27 | |
29 | -#if defined(CONFIG_KOBJECT_UEVENT) || defined(CONFIG_HOTPLUG) | |
28 | +#if defined(CONFIG_HOTPLUG) | |
29 | +char hotplug_path[HOTPLUG_PATH_LEN] = "/sbin/hotplug"; | |
30 | +u64 hotplug_seqnum; | |
31 | +static DEFINE_SPINLOCK(sequence_lock); | |
32 | + | |
30 | 33 | static char *action_to_string(enum kobject_action action) |
31 | 34 | { |
32 | 35 | switch (action) { |
33 | 36 | |
... | ... | @@ -48,9 +51,7 @@ |
48 | 51 | return NULL; |
49 | 52 | } |
50 | 53 | } |
51 | -#endif | |
52 | 54 | |
53 | -#ifdef CONFIG_KOBJECT_UEVENT | |
54 | 55 | static struct sock *uevent_sock; |
55 | 56 | |
56 | 57 | /** |
... | ... | @@ -167,21 +168,6 @@ |
167 | 168 | } |
168 | 169 | |
169 | 170 | postcore_initcall(kobject_uevent_init); |
170 | - | |
171 | -#else | |
172 | -static inline int send_uevent(const char *signal, const char *obj, | |
173 | - char **envp, int gfp_mask) | |
174 | -{ | |
175 | - return 0; | |
176 | -} | |
177 | - | |
178 | -#endif /* CONFIG_KOBJECT_UEVENT */ | |
179 | - | |
180 | - | |
181 | -#ifdef CONFIG_HOTPLUG | |
182 | -char hotplug_path[HOTPLUG_PATH_LEN] = "/sbin/hotplug"; | |
183 | -u64 hotplug_seqnum; | |
184 | -static DEFINE_SPINLOCK(sequence_lock); | |
185 | 171 | |
186 | 172 | /** |
187 | 173 | * kobject_hotplug - notify userspace by executing /sbin/hotplug |