From: Stephen Hemminger <shemminger@vyatta.com>
To: Jay Vousburgh <fubar@us.ibm.com>
Cc: bonding-devel@lists.sourceforge.net, netdev@vger.kernel.org
Subject: [PATCH 1/6] bonding: allow configuration without sysfs
Date: Fri, 17 Oct 2008 21:32:53 -0700 [thread overview]
Message-ID: <20081018043323.385249409@vyatta.com> (raw)
In-Reply-To: 20081018043252.968940967@vyatta.com
[-- Attachment #1: bonding-no-sysfs.patch --]
[-- Type: text/plain, Size: 3348 bytes --]
In embedded environments sysfs is optional, so stub out and remove
code if not needed.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
drivers/net/bonding/Makefile | 5 ++++-
drivers/net/bonding/bond_main.c | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
--- a/drivers/net/bonding/Makefile 2008-10-09 14:05:35.000000000 +0200
+++ b/drivers/net/bonding/Makefile 2008-10-09 15:20:52.000000000 +0200
@@ -4,5 +4,8 @@
obj-$(CONFIG_BONDING) += bonding.o
-bonding-objs := bond_main.o bond_3ad.o bond_alb.o bond_sysfs.o
+bonding-y := bond_main.o bond_3ad.o bond_alb.o
+
+bonding-$(CONFIG_SYSFS) += bond_sysfs.o
+
--- a/drivers/net/bonding/bond_main.c 2008-10-11 13:46:05.000000000 +0200
+++ b/drivers/net/bonding/bond_main.c 2008-10-11 13:53:32.000000000 +0200
@@ -150,7 +150,15 @@ LIST_HEAD(bond_dev_list);
static struct proc_dir_entry *bond_proc_dir = NULL;
#endif
-extern struct rw_semaphore bonding_rwsem;
+/* Bonding sysfs lock. Why can't we just use the subsystem lock?
+ * Because kobject_register tries to acquire the subsystem lock. If
+ * we already hold the lock (which we would if the user was creating
+ * a new bond through the sysfs interface), we deadlock.
+ * This lock is only needed when deleting a bond - we need to make sure
+ * that we don't collide with an ongoing ioctl.
+ */
+struct rw_semaphore bonding_rwsem;
+
static __be32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ;
static int arp_ip_count = 0;
static int bond_mode = BOND_MODE_ROUNDROBIN;
@@ -3474,10 +3482,12 @@ static int bond_event_changename(struct
bond_remove_proc_entry(bond);
bond_create_proc_entry(bond);
#endif
+#ifdef CONFIG_SYSFS
down_write(&(bonding_rwsem));
bond_destroy_sysfs_entry(bond);
bond_create_sysfs_entry(bond);
up_write(&(bonding_rwsem));
+#endif
return NOTIFY_DONE;
}
--- a/drivers/net/bonding/bond_sysfs.c 2008-10-11 13:50:00.000000000 +0200
+++ b/drivers/net/bonding/bond_sysfs.c 2008-10-11 13:53:22.000000000 +0200
@@ -53,22 +53,6 @@ extern struct bond_parm_tbl arp_validate
extern struct bond_parm_tbl fail_over_mac_tbl[];
static int expected_refcount = -1;
-/*--------------------------- Data Structures -----------------------------*/
-
-/* Bonding sysfs lock. Why can't we just use the subsystem lock?
- * Because kobject_register tries to acquire the subsystem lock. If
- * we already hold the lock (which we would if the user was creating
- * a new bond through the sysfs interface), we deadlock.
- * This lock is only needed when deleting a bond - we need to make sure
- * that we don't collide with an ongoing ioctl.
- */
-
-struct rw_semaphore bonding_rwsem;
-
-
-
-
-/*------------------------------ Functions --------------------------------*/
/*
* "show" function for the bond_masters attribute.
--- a/drivers/net/bonding/bonding.h 2008-10-11 13:51:18.000000000 +0200
+++ b/drivers/net/bonding/bonding.h 2008-10-11 13:51:30.000000000 +0200
@@ -310,6 +310,8 @@ static inline void bond_unset_master_alb
bond->dev->priv_flags &= ~IFF_MASTER_ALB;
}
+extern struct rw_semaphore bonding_rwsem;
+
struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr);
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);
--
next prev parent reply other threads:[~2008-10-18 4:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-18 4:32 [PATCH 0/6] bonding related patches Stephen Hemminger
2008-10-18 4:32 ` Stephen Hemminger [this message]
2008-10-18 4:32 ` [PATCH 2/6] bonding: fix sparse warnings Stephen Hemminger
2008-10-18 4:32 ` [PATCH 3/6] bonding: event driven carrier detection Stephen Hemminger
2008-10-18 4:32 ` [PATCH 4/6] netdev: allow rejecting MTU changes from notifiers Stephen Hemminger
2008-10-18 4:32 ` [PATCH 5/6] bonding: prevent MTU changes in slave devices Stephen Hemminger
2008-10-18 4:32 ` [PATCH 6/6] bonding: remove change name TODO Stephen Hemminger
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=20081018043323.385249409@vyatta.com \
--to=shemminger@vyatta.com \
--cc=bonding-devel@lists.sourceforge.net \
--cc=fubar@us.ibm.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).