

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---

 lxc-dave/net/core/dev.c |  142 ++++++++++++++++++++++++------------------------
 1 files changed, 71 insertions(+), 71 deletions(-)

diff -puN net/core/dev.c~C0-netns-cleanups-2 net/core/dev.c
--- lxc/net/core/dev.c~C0-netns-cleanups-2	2006-05-31 12:48:44.000000000 -0700
+++ lxc-dave/net/core/dev.c	2006-05-31 12:48:44.000000000 -0700
@@ -1,5 +1,5 @@
 /*
- * 	NET3	Protocol independent device support routines.
+ *	NET3	Protocol independent device support routines.
  *
  *		This program is free software; you can redistribute it and/or
  *		modify it under the terms of the GNU General Public License
@@ -7,7 +7,7 @@
  *		2 of the License, or (at your option) any later version.
  *
  *	Derived from the non IP parts of dev.c 1.0.19
- * 		Authors:	Ross Biro
+ *		Authors:	Ross Biro
  *				Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  *				Mark Evans, <evansmp@uhura.aston.ac.uk>
  *
@@ -17,13 +17,13 @@
  *		David Hinds <dahinds@users.sourceforge.net>
  *		Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
  *		Adam Sulmicki <adam@cfar.umd.edu>
- *              Pekka Riikonen <priikone@poesidon.pspt.fi>
+ *		Pekka Riikonen <priikone@poesidon.pspt.fi>
  *
  *	Changes:
- *              D.J. Barrow     :       Fixed bug where dev->refcnt gets set
- *              			to 2 if register_netdev gets called
- *              			before net_dev_init & also removed a
- *              			few lines of code in the process.
+ *		D.J. Barrow     :       Fixed bug where dev->refcnt gets set
+ *					to 2 if register_netdev gets called
+ *					before net_dev_init & also removed a
+ *					few lines of code in the process.
  *		Alan Cox	:	device private ioctl copies fields back.
  *		Alan Cox	:	Transmit queue code does relevant
  *					stunts to keep the queue safe.
@@ -36,7 +36,7 @@
  *		Alan Cox	:	100 backlog just doesn't cut it when
  *					you start doing multicast video 8)
  *		Alan Cox	:	Rewrote net_bh and list manager.
- *		Alan Cox	: 	Fix ETH_P_ALL echoback lengths.
+ *		Alan Cox	:	Fix ETH_P_ALL echoback lengths.
  *		Alan Cox	:	Took out transmit every packet pass
  *					Saved a few bytes in the ioctl handler
  *		Alan Cox	:	Network driver sets packet type before
@@ -46,7 +46,7 @@
  *		Richard Kooijman:	Timestamp fixes.
  *		Alan Cox	:	Wrong field in SIOCGIFDSTADDR
  *		Alan Cox	:	Device lock protection.
- *		Alan Cox	: 	Fixed nasty side effect of device close
+ *		Alan Cox	:	Fixed nasty side effect of device close
  *					changes.
  *		Rudi Cilibrasi	:	Pass the right thing to
  *					set_mac_address()
@@ -65,11 +65,11 @@
  *					A network device unload needs to purge
  *					the backlog queue.
  *	Paul Rusty Russell	:	SIOCSIFNAME
- *              Pekka Riikonen  :	Netdev boot-time settings code
- *              Andrew Morton   :       Make unregister_netdevice wait
- *              			indefinitely on dev->refcnt
- * 		J Hadi Salim	:	- Backlog queue sampling
- *				        - netif_rx() feedback
+ *		Pekka Riikonen  :	Netdev boot-time settings code
+ *		Andrew Morton   :       Make unregister_netdevice wait
+ *					indefinitely on dev->refcnt
+ *		J Hadi Salim	:	- Backlog queue sampling
+ *					- netif_rx() feedback
  */
 
 #include <asm/uaccess.h>
@@ -125,11 +125,11 @@
  *	low nibble of the protocol value is RARP/SNAP/X.25.
  *
  *      NOTE:  That is no longer true with the addition of VLAN tags.  Not
- *             sure which should go first, but I bet it won't make much
- *             difference if we are running VLANs.  The good news is that
- *             this protocol won't be in the list unless compiled in, so
- *             the average user (w/out VLANs) will not be adversly affected.
- *             --BLG
+ *	       sure which should go first, but I bet it won't make much
+ *	       difference if we are running VLANs.  The good news is that
+ *	       this protocol won't be in the list unless compiled in, so
+ *	       the average user (w/out VLANs) will not be adversly affected.
+ *	       --BLG
  *
  *		0800	IP
  *		8100    802.1Q VLAN
@@ -207,7 +207,7 @@ extern int netdev_sysfs_init(void);
 extern int netdev_register_sysfs(struct net_device *);
 extern void netdev_unregister_sysfs(struct net_device *);
 #else
-#define netdev_sysfs_init()	 	(0)
+#define netdev_sysfs_init()		(0)
 #define netdev_register_sysfs(dev)	(0)
 #define	netdev_unregister_sysfs(dev)	do { } while(0)
 #endif
@@ -249,7 +249,7 @@ int netdev_nit;
  *	is linked into kernel lists and may not be freed until it has been
  *	removed from the kernel lists.
  *
- *	This call does not sleep therefore it can not 
+ *	This call does not sleep therefore it can not
  *	guarantee all CPU's that are in middle of receiving packets
  *	will see the new packet type (until the next received packet).
  */
@@ -276,7 +276,7 @@ void dev_add_pack(struct packet_type *pt
  *	Remove a protocol handler that was previously added to the kernel
  *	protocol handlers by dev_add_pack(). The passed &packet_type is removed
  *	from the kernel lists and can be freed or reused once this function
- *	returns. 
+ *	returns.
  *
  *      The packet type might still be in use by receivers
  *	and must not be freed until after all the CPU's have gone
@@ -365,7 +365,7 @@ static int netdev_boot_setup_add(char *n
  *	netdev_boot_setup_check	- check boot time settings
  *	@dev: the netdevice
  *
- * 	Check boot time settings for the device.
+ *	Check boot time settings for the device.
  *	The found settings are set for the device to be used
  *	later in the device probing.
  *	Returns 0 if no settings found, 1 if they are.
@@ -378,10 +378,10 @@ int netdev_boot_setup_check(struct net_d
 	for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) {
 		if (s[i].name[0] != '\0' && s[i].name[0] != ' ' &&
 		    !strncmp(dev->name, s[i].name, strlen(s[i].name))) {
-			dev->irq 	= s[i].map.irq;
-			dev->base_addr 	= s[i].map.base_addr;
-			dev->mem_start 	= s[i].map.mem_start;
-			dev->mem_end 	= s[i].map.mem_end;
+			dev->irq	= s[i].map.irq;
+			dev->base_addr	= s[i].map.base_addr;
+			dev->mem_start	= s[i].map.mem_start;
+			dev->mem_end	= s[i].map.mem_end;
 			return 1;
 		}
 	}
@@ -394,7 +394,7 @@ int netdev_boot_setup_check(struct net_d
  *	@prefix: prefix for network device
  *	@unit: id for network device
  *
- * 	Check boot time settings for the base address of device.
+ *	Check boot time settings for the base address of device.
  *	The found settings are set for the device to be used
  *	later in the device probing.
  *	Returns 0 if no settings found.
@@ -622,7 +622,7 @@ EXPORT_SYMBOL(dev_getfirstbyhwtype);
  *	@mask: bitmask of bits in if_flags to check
  *
  *	Search for any interface with the given flags. Returns NULL if a device
- *	is not found or a pointer to the device. The device returned has 
+ *	is not found or a pointer to the device. The device returned has
  *	had a reference added and the pointer is safe until the user calls
  *	dev_put to indicate they have finished with it.
  */
@@ -658,7 +658,7 @@ out:
  */
 int dev_valid_name(const char *name)
 {
-	return !(*name == '\0' 
+	return !(*name == '\0'
 		 || !strcmp(name, ".")
 		 || !strcmp(name, "..")
 		 || strchr(name, '/'));
@@ -802,7 +802,7 @@ void netdev_state_change(struct net_devi
 }
 
 /**
- *	dev_load 	- load a network module
+ *	dev_load	- load a network module
  *	@name: name of interface
  *
  *	If a network interface is not present and the process has suitable
@@ -812,7 +812,7 @@ void netdev_state_change(struct net_devi
 
 void dev_load(const char *name)
 {
-	struct net_device *dev;  
+	struct net_device *dev;
 
 	read_lock(&dev_base_lock);
 	dev = __dev_get_by_name(name);
@@ -870,7 +870,7 @@ int dev_open(struct net_device *dev)
 			clear_bit(__LINK_STATE_START, &dev->state);
 	}
 
- 	/*
+	/*
 	 *	If it went open OK then:
 	 */
 
@@ -973,8 +973,8 @@ int dev_close(struct net_device *dev)
  *	not be reused until it has been unregistered. A negative errno code
  *	is returned on a failure.
  *
- * 	When registered all registration and up events are replayed
- *	to the new notifier to allow device to have a race free 
+ *	When registered all registration and up events are replayed
+ *	to the new notifier to allow device to have a race free
  *	view of the network device list.
  */
 
@@ -989,7 +989,7 @@ int register_netdevice_notifier(struct n
 		for (dev = dev_base; dev; dev = dev->next) {
 			nb->notifier_call(nb, NETDEV_REGISTER, dev);
 
-			if (dev->flags & IFF_UP) 
+			if (dev->flags & IFF_UP)
 				nb->notifier_call(nb, NETDEV_UP, dev);
 		}
 	}
@@ -1167,7 +1167,7 @@ void netif_device_attach(struct net_devi
 	if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) &&
 	    netif_running(dev)) {
 		netif_wake_queue(dev);
- 		__netdev_watchdog_up(dev);
+		__netdev_watchdog_up(dev);
 	}
 }
 EXPORT_SYMBOL(netif_device_attach);
@@ -1211,7 +1211,7 @@ out:	
 void netdev_rx_csum_fault(struct net_device *dev)
 {
 	if (net_ratelimit()) {
-		printk(KERN_ERR "%s: hw csum failure.\n", 
+		printk(KERN_ERR "%s: hw csum failure.\n",
 			dev ? dev->name : "<unknown>");
 		dump_stack();
 	}
@@ -1337,7 +1337,7 @@ int __skb_linearize(struct sk_buff *skb,
  *
  *      When calling this method, interrupts MUST be enabled.  This is because
  *      the BH enable code must have IRQs enabled so that it will not deadlock.
- *          --BLG
+ *	    --BLG
  */
 
 int dev_queue_xmit(struct sk_buff *skb)
@@ -1367,24 +1367,24 @@ int dev_queue_xmit(struct sk_buff *skb)
 	    (!(dev->features & (NETIF_F_HW_CSUM | NETIF_F_NO_CSUM)) &&
 	     (!(dev->features & NETIF_F_IP_CSUM) ||
 	      skb->protocol != htons(ETH_P_IP))))
-	      	if (skb_checksum_help(skb, 0))
-	      		goto out_kfree_skb;
+		if (skb_checksum_help(skb, 0))
+			goto out_kfree_skb;
 
 	spin_lock_prefetch(&dev->queue_lock);
 
-	/* Disable soft irqs for various locks below. Also 
-	 * stops preemption for RCU. 
+	/* Disable soft irqs for various locks below. Also
+	 * stops preemption for RCU.
 	 */
-	local_bh_disable(); 
+	local_bh_disable();
 
-	/* Updates of qdisc are serialized by queue_lock. 
-	 * The struct Qdisc which is pointed to by qdisc is now a 
-	 * rcu structure - it may be accessed without acquiring 
+	/* Updates of qdisc are serialized by queue_lock.
+	 * The struct Qdisc which is pointed to by qdisc is now a
+	 * rcu structure - it may be accessed without acquiring
 	 * a lock (but the structure may be stale.) The freeing of the
-	 * qdisc will be deferred until it's known that there are no 
+	 * qdisc will be deferred until it's known that there are no
 	 * more references to it.
-	 * 
-	 * If the qdisc has an enqueue function, we still need to 
+	 *
+	 * If the qdisc has an enqueue function, we still need to
 	 * hold the queue_lock before calling it, since queue_lock
 	 * also serializes access to the device queue.
 	 */
@@ -1466,7 +1466,7 @@ out:
 
 int netdev_max_backlog = 1000;
 int netdev_budget = 300;
-int weight_p = 64;            /* old backlog weight */
+int weight_p = 64;	/* old backlog weight */
 
 DEFINE_PER_CPU(struct netif_rx_stats, netdev_rx_stat) = { 0, };
 
@@ -1649,7 +1649,7 @@ static __inline__ int handle_bridge(stru
 	if (*pt_prev) {
 		*ret = deliver_skb(*pskb, *pt_prev, orig_dev);
 		*pt_prev = NULL;
-	} 
+	}
 	
 	return br_handle_frame_hook(port, pskb);
 }
@@ -1662,11 +1662,11 @@ static __inline__ int handle_bridge(stru
  * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions
  * a compare and 2 stores extra right now if we dont have it on
  * but have CONFIG_NET_CLS_ACT
- * NOTE: This doesnt stop any functionality; if you dont have 
+ * NOTE: This doesnt stop any functionality; if you dont have
  * the ingress scheduler, you just cant add policies on ingress.
  *
  */
-static int ing_filter(struct sk_buff *skb) 
+static int ing_filter(struct sk_buff *skb)
 {
 	struct Qdisc *q;
 	struct net_device *dev = skb->dev;
@@ -1735,7 +1735,7 @@ int netif_receive_skb(struct sk_buff *sk
 
 	list_for_each_entry_rcu(ptype, &ptype_all, list) {
 		if (!ptype->dev || ptype->dev == skb->dev) {
-			if (pt_prev) 
+			if (pt_prev)
 				ret = deliver_skb(skb, pt_prev, orig_dev);
 			pt_prev = ptype;
 		}
@@ -1769,7 +1769,7 @@ ncls:
 	list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) {
 		if (ptype->type == type &&
 		    (!ptype->dev || ptype->dev == skb->dev)) {
-			if (pt_prev) 
+			if (pt_prev)
 				ret = deliver_skb(skb, pt_prev, orig_dev);
 			pt_prev = ptype;
 		}
@@ -1993,7 +1993,7 @@ static int dev_ifconf(char __user *arg)
 				total += done;
 			}
 		}
-  	}
+	}
 
 	/*
 	 *	All done.  Write the updated control block back to the caller.
@@ -2001,7 +2001,7 @@ static int dev_ifconf(char __user *arg)
 	ifc.ifc_len = total;
 
 	/*
-	 * 	Both BSD and Solaris return 0 here, so we do too.
+	 *	Both BSD and Solaris return 0 here, so we do too.
 	 */
 	return copy_to_user(arg, &ifc, sizeof(struct ifconf)) ? -EFAULT : 0;
 }
@@ -2109,7 +2109,7 @@ static struct netif_rx_stats *softnet_ge
 	struct netif_rx_stats *rc = NULL;
 
 	while (*pos < NR_CPUS)
-	       	if (cpu_online(*pos)) {
+		if (cpu_online(*pos)) {
 			rc = &per_cpu(netdev_rx_stat, *pos);
 			break;
 		} else
@@ -2274,13 +2274,13 @@ void dev_set_promiscuity(struct net_devi
 		dev_mc_upload(dev);
 		printk(KERN_INFO "device %s %s promiscuous mode\n",
 		       dev->name, (dev->flags & IFF_PROMISC) ? "entered" :
-		       					       "left");
+							       "left");
 		audit_log(current->audit_context, GFP_ATOMIC,
 			AUDIT_ANOM_PROMISCUOUS,
 			"dev=%s prom=%d old_prom=%d auid=%u",
 			dev->name, (dev->flags & IFF_PROMISC),
 			(old_flags & IFF_PROMISC),
-			audit_get_loginuid(current->audit_context)); 
+			audit_get_loginuid(current->audit_context));
 	}
 }
 
@@ -2771,7 +2771,7 @@ int dev_ioctl(unsigned int cmd, void __u
 				rtnl_unlock();
 				if (IW_IS_GET(cmd) &&
 				    copy_to_user(arg, &ifr,
-					    	 sizeof(struct ifreq)))
+						 sizeof(struct ifreq)))
 					ret = -EFAULT;
 				return ret;
 			}
@@ -2865,7 +2865,7 @@ int register_netdevice(struct net_device
 			goto out_err;
 		}
 	}
- 
+
 	if (!dev_valid_name(dev->name)) {
 		ret = -EINVAL;
 		goto out_err;
@@ -2882,9 +2882,9 @@ int register_netdevice(struct net_device
 			= hlist_entry(p, struct net_device, name_hlist);
 		if (!strncmp(d->name, dev->name, IFNAMSIZ)) {
 			ret = -EEXIST;
- 			goto out_err;
+			goto out_err;
 		}
- 	}
+	}
 
 	ret = net_ns_register_dev(dev, &(net_ns()->dev_list));
 	if (ret)
@@ -3018,7 +3018,7 @@ EXPORT_SYMBOL(register_netdev);
  * for netdevice notification, and cleanup and put back the
  * reference if they receive an UNREGISTER event.
  * We can get stuck here if buggy protocols don't correctly
- * call dev_put. 
+ * call dev_put.
  */
 static void netdev_wait_allrefs(struct net_device *dev)
 {
@@ -3180,8 +3180,8 @@ EXPORT_SYMBOL(alloc_netdev);
  *	free_netdev - free network device
  *	@dev: device
  *
- *	This function does the last stage of destroying an allocated device 
- * 	interface. The reference to the device object is released.  
+ *	This function does the last stage of destroying an allocated device
+ *	interface. The reference to the device object is released.
  *	If this is the last reference then it will be freed.
  */
 void free_netdev(struct net_device *dev)
@@ -3202,9 +3202,9 @@ void free_netdev(struct net_device *dev)
 	kfree((char *)dev - dev->padded);
 #endif
 }
- 
+
 /* Synchronize with packet receive processing. */
-void synchronize_net(void) 
+void synchronize_net(void)
 {
 	might_sleep();
 	synchronize_rcu();
@@ -3392,7 +3392,7 @@ static int __init net_dev_init(void)
 		goto out;
 
 	INIT_LIST_HEAD(&ptype_all);
-	for (i = 0; i < 16; i++) 
+	for (i = 0; i < 16; i++)
 		INIT_LIST_HEAD(&ptype_base[i]);
 
 	for (i = 0; i < ARRAY_SIZE(dev_name_head); i++)
_
