kernel: split patches folder up into backport, pending and hack folders
[openwrt/staging/wigyori.git] / target / linux / generic / pending-4.4 / 911-kobject_add_broadcast_uevent.patch
1 --- a/include/linux/kobject.h
2 +++ b/include/linux/kobject.h
3 @@ -32,6 +32,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 #ifdef CONFIG_UEVENT_HELPER
10 /* path to the userspace helper executed on an event */
11 extern char uevent_helper[];
12 @@ -222,4 +224,7 @@ int add_uevent_var(struct kobj_uevent_en
13 int kobject_action_type(const char *buf, size_t count,
14 enum kobject_action *type);
15
16 +int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
17 + gfp_t allocation);
18 +
19 #endif /* _KOBJECT_H_ */
20 --- a/lib/kobject_uevent.c
21 +++ b/lib/kobject_uevent.c
22 @@ -423,6 +423,43 @@ int add_uevent_var(struct kobj_uevent_en
23 EXPORT_SYMBOL_GPL(add_uevent_var);
24
25 #if defined(CONFIG_NET)
26 +int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
27 + gfp_t allocation)
28 +{
29 + struct uevent_sock *ue_sk;
30 + int err = 0;
31 +
32 + /* send netlink message */
33 + mutex_lock(&uevent_sock_mutex);
34 + list_for_each_entry(ue_sk, &uevent_sock_list, list) {
35 + struct sock *uevent_sock = ue_sk->sk;
36 + struct sk_buff *skb2;
37 +
38 + skb2 = skb_clone(skb, allocation);
39 + if (!skb2)
40 + break;
41 +
42 + err = netlink_broadcast(uevent_sock, skb2, pid, group,
43 + allocation);
44 + if (err)
45 + break;
46 + }
47 + mutex_unlock(&uevent_sock_mutex);
48 +
49 + kfree_skb(skb);
50 + return err;
51 +}
52 +#else
53 +int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
54 + gfp_t allocation)
55 +{
56 + kfree_skb(skb);
57 + return 0;
58 +}
59 +#endif
60 +EXPORT_SYMBOL_GPL(broadcast_uevent);
61 +
62 +#if defined(CONFIG_NET)
63 static int uevent_net_init(struct net *net)
64 {
65 struct uevent_sock *ue_sk;