aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/net-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r--net/core/net-sysfs.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 11b98bc2aa8f..1683e5db2f27 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -100,7 +100,6 @@ NETDEVICE_SHOW(addr_assign_type, fmt_dec);
100NETDEVICE_SHOW(addr_len, fmt_dec); 100NETDEVICE_SHOW(addr_len, fmt_dec);
101NETDEVICE_SHOW(iflink, fmt_dec); 101NETDEVICE_SHOW(iflink, fmt_dec);
102NETDEVICE_SHOW(ifindex, fmt_dec); 102NETDEVICE_SHOW(ifindex, fmt_dec);
103NETDEVICE_SHOW(features, fmt_hex);
104NETDEVICE_SHOW(type, fmt_dec); 103NETDEVICE_SHOW(type, fmt_dec);
105NETDEVICE_SHOW(link_mode, fmt_dec); 104NETDEVICE_SHOW(link_mode, fmt_dec);
106 105
@@ -312,7 +311,6 @@ static struct device_attribute net_class_attributes[] = {
312 __ATTR(ifalias, S_IRUGO | S_IWUSR, show_ifalias, store_ifalias), 311 __ATTR(ifalias, S_IRUGO | S_IWUSR, show_ifalias, store_ifalias),
313 __ATTR(iflink, S_IRUGO, show_iflink, NULL), 312 __ATTR(iflink, S_IRUGO, show_iflink, NULL),
314 __ATTR(ifindex, S_IRUGO, show_ifindex, NULL), 313 __ATTR(ifindex, S_IRUGO, show_ifindex, NULL),
315 __ATTR(features, S_IRUGO, show_features, NULL),
316 __ATTR(type, S_IRUGO, show_type, NULL), 314 __ATTR(type, S_IRUGO, show_type, NULL),
317 __ATTR(link_mode, S_IRUGO, show_link_mode, NULL), 315 __ATTR(link_mode, S_IRUGO, show_link_mode, NULL),
318 __ATTR(address, S_IRUGO, show_address, NULL), 316 __ATTR(address, S_IRUGO, show_address, NULL),
@@ -1179,9 +1177,14 @@ static void remove_queue_kobjects(struct net_device *net)
1179#endif 1177#endif
1180} 1178}
1181 1179
1182static const void *net_current_ns(void) 1180static void *net_grab_current_ns(void)
1183{ 1181{
1184 return current->nsproxy->net_ns; 1182 struct net *ns = current->nsproxy->net_ns;
1183#ifdef CONFIG_NET_NS
1184 if (ns)
1185 atomic_inc(&ns->passive);
1186#endif
1187 return ns;
1185} 1188}
1186 1189
1187static const void *net_initial_ns(void) 1190static const void *net_initial_ns(void)
@@ -1196,22 +1199,13 @@ static const void *net_netlink_ns(struct sock *sk)
1196 1199
1197struct kobj_ns_type_operations net_ns_type_operations = { 1200struct kobj_ns_type_operations net_ns_type_operations = {
1198 .type = KOBJ_NS_TYPE_NET, 1201 .type = KOBJ_NS_TYPE_NET,
1199 .current_ns = net_current_ns, 1202 .grab_current_ns = net_grab_current_ns,
1200 .netlink_ns = net_netlink_ns, 1203 .netlink_ns = net_netlink_ns,
1201 .initial_ns = net_initial_ns, 1204 .initial_ns = net_initial_ns,
1205 .drop_ns = net_drop_ns,
1202}; 1206};
1203EXPORT_SYMBOL_GPL(net_ns_type_operations); 1207EXPORT_SYMBOL_GPL(net_ns_type_operations);
1204 1208
1205static void net_kobj_ns_exit(struct net *net)
1206{
1207 kobj_ns_exit(KOBJ_NS_TYPE_NET, net);
1208}
1209
1210static struct pernet_operations kobj_net_ops = {
1211 .exit = net_kobj_ns_exit,
1212};
1213
1214
1215#ifdef CONFIG_HOTPLUG 1209#ifdef CONFIG_HOTPLUG
1216static int netdev_uevent(struct device *d, struct kobj_uevent_env *env) 1210static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
1217{ 1211{
@@ -1339,6 +1333,5 @@ EXPORT_SYMBOL(netdev_class_remove_file);
1339int netdev_kobject_init(void) 1333int netdev_kobject_init(void)
1340{ 1334{
1341 kobj_ns_type_register(&net_ns_type_operations); 1335 kobj_ns_type_register(&net_ns_type_operations);
1342 register_pernet_subsys(&kobj_net_ops);
1343 return class_register(&net_class); 1336 return class_register(&net_class);
1344} 1337}