Commit 93f47055 authored by Amir Noam's avatar Amir Noam Committed by Stephen Hemminger

[bonding 2.6] make each bond device use its own /proc entry

parent d8bf4cb3
...@@ -545,14 +545,6 @@ static int bond_release(struct net_device *master, struct net_device *slave); ...@@ -545,14 +545,6 @@ static int bond_release(struct net_device *master, struct net_device *slave);
static int bond_release_all(struct net_device *master); static int bond_release_all(struct net_device *master);
static int bond_sethwaddr(struct net_device *master, struct net_device *slave); static int bond_sethwaddr(struct net_device *master, struct net_device *slave);
/*
* bond_get_info is the interface into the /proc filesystem. This is
* a different interface than the BOND_INFO_QUERY ioctl. That is done
* through the generic networking ioctl interface, and bond_info_query
* is the internal function which provides that information.
*/
static int bond_get_info(char *buf, char **start, off_t offset, int length);
/* Caller must hold bond->ptrlock for write */ /* Caller must hold bond->ptrlock for write */
static inline struct slave* static inline struct slave*
bond_assign_current_slave(struct bonding *bond,struct slave *newslave) bond_assign_current_slave(struct bonding *bond,struct slave *newslave)
...@@ -3337,18 +3329,19 @@ static struct net_device_stats *bond_get_stats(struct net_device *dev) ...@@ -3337,18 +3329,19 @@ static struct net_device_stats *bond_get_stats(struct net_device *dev)
return stats; return stats;
} }
static int bond_get_info(char *buf, char **start, off_t offset, int length) #ifdef CONFIG_PROC_FS
static int bond_read_proc(char *buf, char **start, off_t off, int count, int *eof, void *data)
{ {
bonding_t *bond; struct bonding *bond = (struct bonding *) data;
int len = 0; int len = 0;
off_t begin = 0;
u16 link; u16 link;
slave_t *slave = NULL; slave_t *slave = NULL;
/* make sure the bond won't be taken away */
read_lock(&dev_base_lock);
len += sprintf(buf + len, "%s\n", version); len += sprintf(buf + len, "%s\n", version);
read_lock(&dev_base_lock);
list_for_each_entry(bond, &bond_dev_list, bond_list) {
/* /*
* This function locks the mutex, so we can't lock it until * This function locks the mutex, so we can't lock it until
* afterwards * afterwards
...@@ -3449,20 +3442,23 @@ static int bond_get_info(char *buf, char **start, off_t offset, int length) ...@@ -3449,20 +3442,23 @@ static int bond_get_info(char *buf, char **start, off_t offset, int length)
/* /*
* Figure out the calcs for the /proc/net interface * Figure out the calcs for the /proc/net interface
*/ */
*start = buf + (offset - begin); if (len <= off + count) {
len -= (offset - begin); *eof = 1;
if (len > length) { }
len = length; *start = buf + off;
len -= off;
if (len > count) {
len = count;
} }
if (len < 0) { if (len < 0) {
len = 0; len = 0;
} }
}
read_unlock(&dev_base_lock); read_unlock(&dev_base_lock);
return len; return len;
} }
#endif /* CONFIG_PROC_FS */
static int bond_event(struct notifier_block *this, unsigned long event, static int bond_event(struct notifier_block *this, unsigned long event,
void *ptr) void *ptr)
...@@ -3594,8 +3590,8 @@ static int __init bond_init(struct net_device *dev) ...@@ -3594,8 +3590,8 @@ static int __init bond_init(struct net_device *dev)
bond->bond_proc_dir->owner = THIS_MODULE; bond->bond_proc_dir->owner = THIS_MODULE;
bond->bond_proc_info_file = bond->bond_proc_info_file =
create_proc_info_entry("info", 0, bond->bond_proc_dir, create_proc_read_entry("info", 0, bond->bond_proc_dir,
bond_get_info); bond_read_proc, bond);
if (bond->bond_proc_info_file == NULL) { if (bond->bond_proc_info_file == NULL) {
printk(KERN_ERR "%s: Cannot init /proc/net/%s/info\n", printk(KERN_ERR "%s: Cannot init /proc/net/%s/info\n",
dev->name, dev->name); dev->name, dev->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment