[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 5/6] netfront: remove /proc interface



# HG changeset patch
# User shemminger@xxxxxxxxxxxxxxxxxxxxx
# Node ID 5663fb293dd7810e7d707a5e467a9d0de9a6d230
# Parent  06cea5a9cbae9af028300e470849bc034beaff75
Give netfront a procectomy. The existing /proc interface for
tuning in buggy (network device names can change), and would
not be accepted in mainline.

Signed-off-by: Stephen Hemminger <shemminger@xxxxxxxx>

diff -r 06cea5a9cbae -r 5663fb293dd7 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Wed May 17 
20:48:41 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Wed May 17 
20:50:07 2006
@@ -187,16 +187,6 @@
 
 static irqreturn_t netif_int(int irq, void *dev_id, struct pt_regs *ptregs);
 
-#ifdef CONFIG_PROC_FS
-static int xennet_proc_init(void);
-static int xennet_proc_addif(struct net_device *dev);
-static void xennet_proc_delif(struct net_device *dev);
-#else
-#define xennet_proc_init()   (0)
-#define xennet_proc_addif(d) (0)
-#define xennet_proc_delif(d) ((void)0)
-#endif
-
 
 /**
  * Entry point to this code when a new device is created.  Allocate the basic
@@ -1192,11 +1182,6 @@
                goto exit_free_grefs;
        }
 
-       if ((err = xennet_proc_addif(netdev)) != 0) {
-               unregister_netdev(netdev);
-               goto exit_free_grefs;
-       }
-
        np->netdev = netdev;
        if (val)
                *val = netdev;
@@ -1270,10 +1255,6 @@
        spin_lock_irq(&info->netdev->xmit_lock);
        netif_stop_queue(info->netdev);
        spin_unlock_irq(&info->netdev->xmit_lock);
-
-#ifdef CONFIG_PROC_FS
-       xennet_proc_delif(info->netdev);
-#endif
 
        del_timer_sync(&info->rx_refill_timer);
 
@@ -1351,9 +1332,6 @@
        if (xen_start_info->flags & SIF_INITDOMAIN)
                return 0;
 
-       if ((err = xennet_proc_init()) != 0)
-               return err;
-
        IPRINTK("Initialising virtual ethernet driver.\n");
 
        (void)register_inetaddr_notifier(&notifier_inetdev);
@@ -1372,156 +1350,3 @@
 module_exit(netif_exit);
 
 MODULE_LICENSE("Dual BSD/GPL");
-
-
-/* ** /proc **/
-
-
-#ifdef CONFIG_PROC_FS
-
-#define TARGET_MIN 0UL
-#define TARGET_MAX 1UL
-#define TARGET_CUR 2UL
-
-static int xennet_proc_read(
-       char *page, char **start, off_t off, int count, int *eof, void *data)
-{
-       struct net_device *dev =
-               (struct net_device *)((unsigned long)data & ~3UL);
-       struct netfront_info *np = netdev_priv(dev);
-       int len = 0, which_target = (long)data & 3;
-
-       switch (which_target) {
-       case TARGET_MIN:
-               len = sprintf(page, "%d\n", np->rx_min_target);
-               break;
-       case TARGET_MAX:
-               len = sprintf(page, "%d\n", np->rx_max_target);
-               break;
-       case TARGET_CUR:
-               len = sprintf(page, "%d\n", np->rx_target);
-               break;
-       }
-
-       *eof = 1;
-       return len;
-}
-
-static int xennet_proc_write(
-       struct file *file, const char __user *buffer,
-       unsigned long count, void *data)
-{
-       struct net_device *dev =
-               (struct net_device *)((unsigned long)data & ~3UL);
-       struct netfront_info *np = netdev_priv(dev);
-       int which_target = (long)data & 3;
-       char string[64];
-       long target;
-
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
-
-       if (count <= 1)
-               return -EBADMSG; /* runt */
-       if (count > sizeof(string))
-               return -EFBIG;   /* too long */
-
-       if (copy_from_user(string, buffer, count))
-               return -EFAULT;
-       string[sizeof(string)-1] = '\0';
-
-       target = simple_strtol(string, NULL, 10);
-       if (target < RX_MIN_TARGET)
-               target = RX_MIN_TARGET;
-       if (target > RX_MAX_TARGET)
-               target = RX_MAX_TARGET;
-
-       spin_lock(&np->rx_lock);
-
-       switch (which_target) {
-       case TARGET_MIN:
-               if (target > np->rx_max_target)
-                       np->rx_max_target = target;
-               np->rx_min_target = target;
-               if (target > np->rx_target)
-                       np->rx_target = target;
-               break;
-       case TARGET_MAX:
-               if (target < np->rx_min_target)
-                       np->rx_min_target = target;
-               np->rx_max_target = target;
-               if (target < np->rx_target)
-                       np->rx_target = target;
-               break;
-       case TARGET_CUR:
-               break;
-       }
-
-       network_alloc_rx_buffers(dev);
-
-       spin_unlock(&np->rx_lock);
-
-       return count;
-}
-
-static int xennet_proc_init(void)
-{
-       if (proc_mkdir("xen/net", NULL) == NULL)
-               return -ENOMEM;
-       return 0;
-}
-
-static int xennet_proc_addif(struct net_device *dev)
-{
-       struct proc_dir_entry *dir, *min, *max, *cur;
-       char name[30];
-
-       sprintf(name, "xen/net/%s", dev->name);
-
-       dir = proc_mkdir(name, NULL);
-       if (!dir)
-               goto nomem;
-
-       min = create_proc_entry("rxbuf_min", 0644, dir);
-       max = create_proc_entry("rxbuf_max", 0644, dir);
-       cur = create_proc_entry("rxbuf_cur", 0444, dir);
-       if (!min || !max || !cur)
-               goto nomem;
-
-       min->read_proc  = xennet_proc_read;
-       min->write_proc = xennet_proc_write;
-       min->data       = (void *)((unsigned long)dev | TARGET_MIN);
-
-       max->read_proc  = xennet_proc_read;
-       max->write_proc = xennet_proc_write;
-       max->data       = (void *)((unsigned long)dev | TARGET_MAX);
-
-       cur->read_proc  = xennet_proc_read;
-       cur->write_proc = xennet_proc_write;
-       cur->data       = (void *)((unsigned long)dev | TARGET_CUR);
-
-       return 0;
-
- nomem:
-       xennet_proc_delif(dev);
-       return -ENOMEM;
-}
-
-static void xennet_proc_delif(struct net_device *dev)
-{
-       char name[30];
-
-       sprintf(name, "xen/net/%s/rxbuf_min", dev->name);
-       remove_proc_entry(name, NULL);
-
-       sprintf(name, "xen/net/%s/rxbuf_max", dev->name);
-       remove_proc_entry(name, NULL);
-
-       sprintf(name, "xen/net/%s/rxbuf_cur", dev->name);
-       remove_proc_entry(name, NULL);
-
-       sprintf(name, "xen/net/%s", dev->name);
-       remove_proc_entry(name, NULL);
-}
-
-#endif

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.