393668b8af4869ca98614508ee1a240b06ef91ff
[openwrt.git] / target / linux / generic / patches-2.6.32 / 223-kobject-add-broadcast_uevent.patch
1 --- a/include/linux/kobject.h
2 +++ b/include/linux/kobject.h
3 @@ -30,6 +30,8 @@
4 #define UEVENT_NUM_ENVP 32 /* number of env pointers */
5 #define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */
6
7 +struct sk_buff;
8 +
9 /* path to the userspace helper executed on an event */
10 extern char uevent_helper[];
11
12 @@ -208,6 +210,10 @@ int add_uevent_var(struct kobj_uevent_en
13
14 int kobject_action_type(const char *buf, size_t count,
15 enum kobject_action *type);
16 +
17 +int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
18 + gfp_t allocation);
19 +
20 #else
21 static inline int kobject_uevent(struct kobject *kobj,
22 enum kobject_action action)
23 @@ -224,6 +230,16 @@ static inline int add_uevent_var(struct
24 static inline int kobject_action_type(const char *buf, size_t count,
25 enum kobject_action *type)
26 { return -EINVAL; }
27 +
28 +void kfree_skb(struct sk_buff *);
29 +
30 +static inline int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
31 + gfp_t allocation)
32 +{
33 + kfree_skb(skb);
34 + return 0;
35 +}
36 +
37 #endif
38
39 #endif /* _KOBJECT_H_ */
40 --- a/lib/kobject_uevent.c
41 +++ b/lib/kobject_uevent.c
42 @@ -330,6 +330,27 @@ int add_uevent_var(struct kobj_uevent_en
43 EXPORT_SYMBOL_GPL(add_uevent_var);
44
45 #if defined(CONFIG_NET)
46 +int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
47 + gfp_t allocation)
48 +{
49 + if (!uevent_sock) {
50 + kfree_skb(skb);
51 + return -ENODEV;
52 + }
53 +
54 + return netlink_broadcast(uevent_sock, skb, pid, group, allocation);;
55 +}
56 +#else
57 +int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
58 + gfp_t allocation)
59 +{
60 + kfree_skb(skb);
61 + return 0;
62 +}
63 +#endif
64 +EXPORT_SYMBOL_GPL(broadcast_uevent);
65 +
66 +#if defined(CONFIG_NET)
67 static int __init kobject_uevent_init(void)
68 {
69 uevent_sock = netlink_kernel_create(&init_net, NETLINK_KOBJECT_UEVENT,
This page took 0.051455 seconds and 3 git commands to generate.