Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/xen Move if_xname setting earlier for xvif crea...



details:   https://anonhg.NetBSD.org/src/rev/e88f7c962742
branches:  trunk
changeset: 760577:e88f7c962742
user:      jym <jym%NetBSD.org@localhost>
date:      Sat Jan 08 05:23:19 2011 +0000

description:
Move if_xname setting earlier for xvif creation, so we can grab domid
and handle values sooner for error cases.

diffstat:

 sys/arch/xen/xen/xennetback_xenbus.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r f38079cee4cb -r e88f7c962742 sys/arch/xen/xen/xennetback_xenbus.c
--- a/sys/arch/xen/xen/xennetback_xenbus.c      Sat Jan 08 02:36:52 2011 +0000
+++ b/sys/arch/xen/xen/xennetback_xenbus.c      Sat Jan 08 05:23:19 2011 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xennetback_xenbus.c,v 1.34 2010/04/05 07:19:32 joerg Exp $      */
+/*      $NetBSD: xennetback_xenbus.c,v 1.35 2011/01/08 05:23:19 jym Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -271,18 +271,20 @@
 
        ifp = &xneti->xni_if;
        ifp->if_softc = xneti;
+       snprintf(ifp->if_xname, IFNAMSIZ, "xvif%d.%d",
+           (int)domid, (int)handle);
 
        /* read mac address */
        if ((err = xenbus_read(NULL, xbusd->xbusd_path, "mac", NULL, &val))) {
-               aprint_error("xvif: can' read %s/mac: %d\n",
+               aprint_error_ifnet(ifp, "can't read %s/mac: %d\n",
                    xbusd->xbusd_path, err);
                goto fail;
        }
        for (i = 0, p = val; i < 6; i++) {
                xneti->xni_enaddr[i] = strtoul(p, &e, 16);
                if ((e[0] == '\0' && i != 5) && e[0] != ':') {
-                       aprint_error("xvif: %s is not a valid mac address\n",
-                           val);
+                       aprint_error_ifnet(ifp,
+                           "%s is not a valid mac address\n", val);
                        err = EINVAL;
                        goto fail;
                }
@@ -293,8 +295,6 @@
        /* we can't use the same MAC addr as our guest */
        xneti->xni_enaddr[3]++;
        /* create pseudo-interface */
-       snprintf(xneti->xni_if.if_xname, IFNAMSIZ, "xvif%d.%d",
-           (int)domid, (int)handle);
        aprint_verbose_ifnet(ifp, "Ethernet address %s\n",
            ether_sprintf(xneti->xni_enaddr));
        ifp->if_flags =



Home | Main Index | Thread Index | Old Index