compat-wireless-2010-03-10
[pandora-wifi.git] / patches / 04-netns.patch
1 The only other namespace change. Note that pach 01-netdev.patch
2 also has some other namespace changes there, look at that file
3 for the other changes. It'd be nice to figure out a way to
4 bring thise here cleanly and seprately but they touch the same
5 files...
6
7 --- a/net/wireless/nl80211.c
8 +++ b/net/wireless/nl80211.c
9 @@ -29,7 +29,9 @@ static struct genl_family nl80211_fam = 
10         .hdrsize = 0,           /* no private header */
11         .version = 1,           /* no particular meaning now */
12         .maxattr = NL80211_ATTR_MAX,
13 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
14         .netnsok = true,
15 +#endif
16  };
17  
18  /* internal helper: get rdev and dev */
19 @@ -4187,7 +4189,9 @@ static int nl80211_wiphy_netns(struct sk
20  
21         err = cfg80211_switch_netns(rdev, net);
22   out_put_net:
23 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
24         put_net(net);
25 +#endif
26   out:
27         cfg80211_unlock_rdev(rdev);
28   out_rtnl:
29 --- a/net/wireless/core.c
30 +++ b/net/wireless/core.c
31 @@ -223,6 +223,7 @@ int cfg80211_dev_rename(struct cfg80211_
32         return 0;
33  }
34  
35 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
36  int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
37                           struct net *net)
38  {
39 @@ -258,6 +259,7 @@ int cfg80211_switch_netns(struct cfg8021
40  
41         return err;
42  }
43 +#endif
44  
45  static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data)
46  {
47 @@ -370,7 +372,9 @@ struct wiphy *wiphy_new(const struct cfg
48         rdev->wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
49  #endif
50  
51 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
52         wiphy_net_set(&rdev->wiphy, &init_net);
53 +#endif
54  
55         rdev->rfkill_ops.set_block = cfg80211_rfkill_set_block;
56         rdev->rfkill = rfkill_alloc(dev_name(&rdev->wiphy.dev),
57 @@ -683,8 +687,10 @@ static int cfg80211_netdev_notifier_call
58                 mutex_lock(&rdev->devlist_mtx);
59                 list_add_rcu(&wdev->list, &rdev->netdev_list);
60                 rdev->devlist_generation++;
61 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
62                 /* can only change netns with wiphy */
63                 dev->features |= NETIF_F_NETNS_LOCAL;
64 +#endif
65  
66                 if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj,
67                                       "phy80211")) {
68 @@ -827,6 +833,7 @@ static struct notifier_block cfg80211_ne
69         .notifier_call = cfg80211_netdev_notifier_call,
70  };
71  
72 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
73  static void __net_exit cfg80211_pernet_exit(struct net *net)
74  {
75         struct cfg80211_registered_device *rdev;
76 @@ -844,14 +851,17 @@ static void __net_exit cfg80211_pernet_e
77  static struct pernet_operations cfg80211_pernet_ops = {
78         .exit = cfg80211_pernet_exit,
79  };
80 +#endif
81  
82  static int __init cfg80211_init(void)
83  {
84         int err;
85  
86 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
87         err = register_pernet_device(&cfg80211_pernet_ops);
88         if (err)
89                 goto out_fail_pernet;
90 +#endif
91  
92         err = wiphy_sysfs_init();
93         if (err)
94 @@ -886,8 +896,10 @@ out_fail_nl80211:
95  out_fail_notifier:
96         wiphy_sysfs_exit();
97  out_fail_sysfs:
98 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
99         unregister_pernet_device(&cfg80211_pernet_ops);
100  out_fail_pernet:
101 +#endif
102         return err;
103  }
104  subsys_initcall(cfg80211_init);
105 @@ -899,7 +911,9 @@ static void cfg80211_exit(void)
106         unregister_netdevice_notifier(&cfg80211_netdev_notifier);
107         wiphy_sysfs_exit();
108         regulatory_exit();
109 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
110         unregister_pernet_device(&cfg80211_pernet_ops);
111 +#endif
112         destroy_workqueue(cfg80211_wq);
113  }
114  module_exit(cfg80211_exit);
115 --- a/net/wireless/wext-core.c
116 +++ b/net/wireless/wext-core.c
117 @@ -399,7 +399,11 @@ static void wireless_nlevent_process(uns
118  {
119         struct sk_buff *skb;
120         while ((skb = skb_dequeue(&wireless_nlevent_queue)))
121 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
122                 rtnl_notify(skb, &init_net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
123 +#else
124 +               rtnl_notify(skb, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
125 +#endif
126  }
127  
128  static DECLARE_TASKLET(wireless_nlevent_tasklet, wireless_nlevent_process, 0);
129 --- a/net/wireless/wext-proc.c
130 +++ b/net/wireless/wext-proc.c
131 @@ -98,7 +98,11 @@ static void *wireless_dev_seq_start(stru
132                 return SEQ_START_TOKEN;
133  
134         off = 1;
135 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
136         for_each_netdev(net, dev)
137 +#else
138 +       for_each_netdev(net)
139 +#endif
140                 if (off++ == *pos)
141                         return dev;
142         return NULL;