Netdev List
 help / color / mirror / Atom feed
From: Radheka Godse <radheka.godse@intel.com>
To: fubar@us.ibm.com, bonding-devel@lists.sourceforge.net
Cc: netdev@oss.sgi.com
Subject: [PATCH 2.6.13-rc1 4/17] bonding: return pointer to slave from enslave
Date: Fri, 1 Jul 2005 13:41:08 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.61.0507011339370.17459@localhost.localdomain> (raw)


This patch changes the bond_enslave function so that it (optionally)
returns a pointer tothe slave struct for a new slave. This
functionality is not used by the existing ioctl interface, but will be
used by the sysfs interface.

This function is also made non-static and a proto is placed in the header.

Signed-off-by: Radheka Godse <radheka.godse@intel.com>
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>


diff -urN -X dontdiff linux-2.6.12post/drivers/net/bonding/bonding.h linux-2.6.12post-sysfs/drivers/net/bonding/bonding.h
--- linux-2.6.12post/drivers/net/bonding/bonding.h	2005-06-28 18:18:03.000000000 -0700
+++ linux-2.6.12post-sysfs/drivers/net/bonding/bonding.h	2005-06-30 13:58:27.000000000 -0700
@@ -262,6 +262,7 @@
  int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
  int bond_create(char *name, struct bond_params *params, struct bonding **newbond);
  void bond_deinit(struct net_device *bond_dev);
+int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, struct slave **vassal);
  int bond_release(struct net_device *bond_dev, struct net_device *slave_dev);
  int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_dev);
  void bond_mii_monitor(struct net_device *bond_dev);
diff -urN -X dontdiff linux-2.6.12post/drivers/net/bonding/bond_main.c linux-2.6.12post-sysfs/drivers/net/bonding/bond_main.c
--- linux-2.6.12post/drivers/net/bonding/bond_main.c	2005-06-28 18:18:03.000000000 -0700
+++ linux-2.6.12post-sysfs/drivers/net/bonding/bond_main.c	2005-06-30 13:53:55.000000000 -0700
@@ -1601,7 +1601,7 @@
  }

  /* enslave device <slave> to bond device <master> */
-static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
+int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, struct slave **vassal)
  {
  	struct bonding *bond = bond_dev->priv;
  	struct slave *new_slave = NULL;
@@ -1992,6 +1992,8 @@
  	       new_slave->link != BOND_LINK_DOWN ? "n up" : " down");

  	/* enslave is successful */
+	if (vassal)
+		*vassal=new_slave;
  	return 0;

  /* Undo stages on error */
@@ -4049,6 +4051,7 @@
  		return -EINVAL;
  	}

+	down_write(&(bonding_rwsem));
  	slave_dev = dev_get_by_name(ifr->ifr_slave);

  	dprintk("slave_dev=%p: \n", slave_dev);
@@ -4060,7 +4063,7 @@
  		switch (cmd) {
  		case BOND_ENSLAVE_OLD:
  		case SIOCBONDENSLAVE:
-			res = bond_enslave(bond_dev, slave_dev);
+			res = bond_enslave(bond_dev, slave_dev, NULL);
  			break;
  		case BOND_RELEASE_OLD:
  		case SIOCBONDRELEASE:

                 reply	other threads:[~2005-07-01 20:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0507011339370.17459@localhost.localdomain \
    --to=radheka.godse@intel.com \
    --cc=bonding-devel@lists.sourceforge.net \
    --cc=fubar@us.ibm.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox