[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Remove net_driver_util module. Inline the one mac-parsing function
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID ac4a961f7e646683c089389b1d473d6c2ec401c5 # Parent 93db1b536f383ee93359080097b0870ea3add01a Remove net_driver_util module. Inline the one mac-parsing function into the netfront and netback drivers. Take the opportunity to fix the mac-parsing logic. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- linux-2.6-xen-sparse/drivers/xen/net_driver_util.c | 58 ------------------- linux-2.6-xen-sparse/include/xen/net_driver_util.h | 48 --------------- linux-2.6-xen-sparse/arch/ia64/xen/drivers/Makefile | 1 linux-2.6-xen-sparse/drivers/xen/Makefile | 1 linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c | 27 ++++++-- linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c | 22 ++++++- 6 files changed, 42 insertions(+), 115 deletions(-) diff -r 93db1b536f38 -r ac4a961f7e64 linux-2.6-xen-sparse/arch/ia64/xen/drivers/Makefile --- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/Makefile Thu May 25 21:41:04 2006 +0100 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/Makefile Thu May 25 22:57:44 2006 +0100 @@ -2,7 +2,6 @@ ifneq ($(CONFIG_XEN_IA64_DOM0_VP),y) ifneq ($(CONFIG_XEN_IA64_DOM0_VP),y) obj-y += util.o endif -obj-$(CONFIG_XEN_IA64_DOM0_VP) += net_driver_util.o obj-y += core/ #obj-y += char/ diff -r 93db1b536f38 -r ac4a961f7e64 linux-2.6-xen-sparse/drivers/xen/Makefile --- a/linux-2.6-xen-sparse/drivers/xen/Makefile Thu May 25 21:41:04 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/Makefile Thu May 25 22:57:44 2006 +0100 @@ -1,5 +1,4 @@ -obj-y += net_driver_util.o obj-y += util.o obj-y += core/ diff -r 93db1b536f38 -r ac4a961f7e64 linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Thu May 25 21:41:04 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Thu May 25 22:57:44 2006 +0100 @@ -17,13 +17,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include <stdarg.h> #include <linux/module.h> #include <xen/xenbus.h> -#include <xen/net_driver_util.h> #include "common.h" - #if 0 #undef DPRINTK @@ -31,7 +28,6 @@ printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args) #endif - struct backend_info { struct xenbus_device *dev; @@ -40,13 +36,11 @@ struct backend_info enum xenbus_state frontend_state; }; - static int connect_rings(struct backend_info *); static void connect(struct backend_info *); static void maybe_connect(struct backend_info *); static void backend_changed(struct xenbus_watch *, const char **, unsigned int); - static int netback_remove(struct xenbus_device *dev) { @@ -273,6 +267,27 @@ static void xen_net_read_rate(struct xen kfree(ratestr); } +static int xen_net_read_mac(struct xenbus_device *dev, u8 mac[]) +{ + char *s, *e, *macstr; + int i; + + macstr = s = xenbus_read(XBT_NULL, dev->nodename, "mac", NULL); + if (IS_ERR(macstr)) + return PTR_ERR(macstr); + + for (i = 0; i < ETH_ALEN; i++) { + mac[i] = simple_strtoul(s, &e, 16); + if ((s == e) || (*e != ((i == ETH_ALEN-1) ? '\0' : ':'))) { + kfree(macstr); + return -ENOENT; + } + s = e+1; + } + + kfree(macstr); + return 0; +} static void connect(struct backend_info *be) { diff -r 93db1b536f38 -r ac4a961f7e64 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Thu May 25 21:41:04 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Thu May 25 22:57:44 2006 +0100 @@ -60,7 +60,6 @@ #include <asm/uaccess.h> #include <xen/interface/grant_table.h> #include <xen/gnttab.h> -#include <xen/net_driver_util.h> #define GRANT_INVALID_REF 0 @@ -233,6 +232,27 @@ static int netfront_resume(struct xenbus return talk_to_backend(dev, info); } +static int xen_net_read_mac(struct xenbus_device *dev, u8 mac[]) +{ + char *s, *e, *macstr; + int i; + + macstr = s = xenbus_read(XBT_NULL, dev->nodename, "mac", NULL); + if (IS_ERR(macstr)) + return PTR_ERR(macstr); + + for (i = 0; i < ETH_ALEN; i++) { + mac[i] = simple_strtoul(s, &e, 16); + if ((s == e) || (*e != ((i == ETH_ALEN-1) ? '\0' : ':'))) { + kfree(macstr); + return -ENOENT; + } + s = e+1; + } + + kfree(macstr); + return 0; +} /* Common code used when first setting up, and when resuming. */ static int talk_to_backend(struct xenbus_device *dev, diff -r 93db1b536f38 -r ac4a961f7e64 linux-2.6-xen-sparse/drivers/xen/net_driver_util.c --- a/linux-2.6-xen-sparse/drivers/xen/net_driver_util.c Thu May 25 21:41:04 2006 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/***************************************************************************** - * - * Utility functions for Xen network devices. - * - * Copyright (c) 2005 XenSource Ltd. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation; or, when distributed - * separately from the Linux kernel or incorporated into other - * software packages, subject to the following license: - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this source file (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, modify, - * merge, publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject - * to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include <linux/if_ether.h> -#include <linux/err.h> -#include <linux/module.h> -#include <xen/net_driver_util.h> - - -int xen_net_read_mac(struct xenbus_device *dev, u8 mac[]) -{ - char *s; - int i; - char *e; - char *macstr = xenbus_read(XBT_NULL, dev->nodename, "mac", NULL); - if (IS_ERR(macstr)) - return PTR_ERR(macstr); - s = macstr; - for (i = 0; i < ETH_ALEN; i++) { - mac[i] = simple_strtoul(s, &e, 16); - if (s == e || (e[0] != ':' && e[0] != 0)) { - kfree(macstr); - return -ENOENT; - } - s = &e[1]; - } - kfree(macstr); - return 0; -} -EXPORT_SYMBOL_GPL(xen_net_read_mac); diff -r 93db1b536f38 -r ac4a961f7e64 linux-2.6-xen-sparse/include/xen/net_driver_util.h --- a/linux-2.6-xen-sparse/include/xen/net_driver_util.h Thu May 25 21:41:04 2006 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/***************************************************************************** - * - * Utility functions for Xen network devices. - * - * Copyright (c) 2005 XenSource Ltd. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation; or, when distributed - * separately from the Linux kernel or incorporated into other - * software packages, subject to the following license: - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this source file (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, modify, - * merge, publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject - * to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef _ASM_XEN_NET_DRIVER_UTIL_H -#define _ASM_XEN_NET_DRIVER_UTIL_H - - -#include <xen/xenbus.h> - - -/** - * Read the 'mac' node at the given device's node in the store, and parse that - * as colon-separated octets, placing result the given mac array. mac must be - * a preallocated array of length ETH_ALEN (as declared in linux/if_ether.h). - * Return 0 on success, or -errno on error. - */ -int xen_net_read_mac(struct xenbus_device *dev, u8 mac[]); - - -#endif /* _ASM_XEN_NET_DRIVER_UTIL_H */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |