Module Name:    src
Committed By:   jym
Date:           Sat Jan  8 05:23:20 UTC 2011

Modified Files:
        src/sys/arch/xen/xen: xennetback_xenbus.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/xen/xen/xennetback_xenbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.34 src/sys/arch/xen/xen/xennetback_xenbus.c:1.35
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.34	Mon Apr  5 07:19:32 2010
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Sat Jan  8 05:23:19 2011
@@ -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 =

Reply via email to