Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 196070
b: refs/heads/master
c: a1b3f59
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman authored and Greg Kroah-Hartman committed May 21, 2010
1 parent 158ae68 commit 74f1db7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 40 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 417daa1e8f893fbac88fd395340ba7779fd3926c
refs/heads/master: a1b3f594dc5faab91d3a218c7019e9b5edd9fe1a
28 changes: 5 additions & 23 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,15 +1002,10 @@ int dev_change_name(struct net_device *dev, const char *newname)
return err;

rollback:
/* For now only devices in the initial network namespace
* are in sysfs.
*/
if (net_eq(net, &init_net)) {
ret = device_rename(&dev->dev, dev->name);
if (ret) {
memcpy(dev->name, oldname, IFNAMSIZ);
return ret;
}
ret = device_rename(&dev->dev, dev->name);
if (ret) {
memcpy(dev->name, oldname, IFNAMSIZ);
return ret;
}

write_lock_bh(&dev_base_lock);
Expand Down Expand Up @@ -4994,8 +4989,6 @@ int register_netdevice(struct net_device *dev)
if (dev->features & NETIF_F_SG)
dev->features |= NETIF_F_GSO;

netdev_initialize_kobject(dev);

ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev);
ret = notifier_to_errno(ret);
if (ret)
Expand Down Expand Up @@ -5547,15 +5540,6 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
if (dev->features & NETIF_F_NETNS_LOCAL)
goto out;

#ifdef CONFIG_SYSFS
/* Don't allow real devices to be moved when sysfs
* is enabled.
*/
err = -EINVAL;
if (dev->dev.parent)
goto out;
#endif

/* Ensure the device has been registrered */
err = -EINVAL;
if (dev->reg_state != NETREG_REGISTERED)
Expand Down Expand Up @@ -5606,8 +5590,6 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
dev_uc_flush(dev);
dev_mc_flush(dev);

netdev_unregister_kobject(dev);

/* Actually switch the network namespace */
dev_net_set(dev, net);

Expand All @@ -5620,7 +5602,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
}

/* Fixup kobjects */
err = netdev_register_kobject(dev);
err = device_rename(&dev->dev, dev->name);
WARN_ON(err);

/* Add the device back in the hashes */
Expand Down
16 changes: 1 addition & 15 deletions trunk/net/core/net-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,9 +808,6 @@ static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
struct net_device *dev = to_net_dev(d);
int retval;

if (!net_eq(dev_net(dev), &init_net))
return 0;

/* pass interface to uevent. */
retval = add_uevent_var(env, "INTERFACE=%s", dev->name);
if (retval)
Expand Down Expand Up @@ -869,9 +866,6 @@ void netdev_unregister_kobject(struct net_device * net)

kobject_get(&dev->kobj);

if (!net_eq(dev_net(net), &init_net))
return;

#ifdef CONFIG_RPS
rx_queue_remove_kobjects(net);
#endif
Expand All @@ -886,6 +880,7 @@ int netdev_register_kobject(struct net_device *net)
const struct attribute_group **groups = net->sysfs_groups;
int error = 0;

device_initialize(dev);
dev->class = &net_class;
dev->platform_data = net;
dev->groups = groups;
Expand All @@ -908,9 +903,6 @@ int netdev_register_kobject(struct net_device *net)
#endif
#endif /* CONFIG_SYSFS */

if (!net_eq(dev_net(net), &init_net))
return 0;

error = device_add(dev);
if (error)
return error;
Expand Down Expand Up @@ -939,12 +931,6 @@ void netdev_class_remove_file(struct class_attribute *class_attr)
EXPORT_SYMBOL(netdev_class_create_file);
EXPORT_SYMBOL(netdev_class_remove_file);

void netdev_initialize_kobject(struct net_device *net)
{
struct device *device = &(net->dev);
device_initialize(device);
}

int netdev_kobject_init(void)
{
kobj_ns_type_register(&net_ns_type_operations);
Expand Down
1 change: 0 additions & 1 deletion trunk/net/core/net-sysfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
int netdev_kobject_init(void);
int netdev_register_kobject(struct net_device *);
void netdev_unregister_kobject(struct net_device *);
void netdev_initialize_kobject(struct net_device *);
#endif

0 comments on commit 74f1db7

Please sign in to comment.