Message ID | 1294659524-22509-3-git-send-email-ddvlad@rosedu.org |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
From: Vlad Dogaru <ddvlad@rosedu.org> Date: Mon, 10 Jan 2011 13:38:43 +0200 > When inserting the dummy module, the user can specify the group of the > dummy devices. This avoids manually moving the newly created pseudo > devices to a different group. > > Signed-off-by: Vlad Dogaru <ddvlad@rosedu.org> The amount of hacks people wish to add to the dummy driver is one step away from amazing. Just use the standard APIs to add dummy devices to the group you want, instead of these ad-hoc device specific module parameters. Thanks. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Jan 10, 2011 at 01:37:48PM -0800, David Miller wrote: > From: Vlad Dogaru <ddvlad@rosedu.org> > Date: Mon, 10 Jan 2011 13:38:43 +0200 > > > When inserting the dummy module, the user can specify the group of the > > dummy devices. This avoids manually moving the newly created pseudo > > devices to a different group. > > > > Signed-off-by: Vlad Dogaru <ddvlad@rosedu.org> > > The amount of hacks people wish to add to the dummy driver is one step > away from amazing. > > Just use the standard APIs to add dummy devices to the group you want, > instead of these ad-hoc device specific module parameters. Sorry for attempting to bloat the dummy module. The intention was to be able to add many dummy interfaces directly into a group without much user-kernel communication. However, I think that can be done by moving the existing (hopefully few) interfaces to another group prior to adding the dummies to group 0 and using that to manipulate them. Vlad -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index ff2d29b..a974c05 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c @@ -39,6 +39,7 @@ #include <linux/u64_stats_sync.h> static int numdummies = 1; +static int ingroup; static int dummy_set_address(struct net_device *dev, void *p) { @@ -158,6 +159,9 @@ static struct rtnl_link_ops dummy_link_ops __read_mostly = { /* Number of dummy devices to be set up by this module. */ module_param(numdummies, int, 0); MODULE_PARM_DESC(numdummies, "Number of dummy pseudo devices"); +/* Group to add the dummy devices to. */ +module_param(ingroup, int, 0); +MODULE_PARM_DESC(ingroup, "Group the dummy devices belong to"); static int __init dummy_init_one(void) { @@ -167,6 +171,7 @@ static int __init dummy_init_one(void) dev_dummy = alloc_netdev(0, "dummy%d", dummy_setup); if (!dev_dummy) return -ENOMEM; + dev_set_group(dev_dummy, ingroup); err = dev_alloc_name(dev_dummy, dev_dummy->name); if (err < 0)
When inserting the dummy module, the user can specify the group of the dummy devices. This avoids manually moving the newly created pseudo devices to a different group. Signed-off-by: Vlad Dogaru <ddvlad@rosedu.org> --- drivers/net/dummy.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)