Author: avg
Date: Sat Jan 26 09:55:51 2013
New Revision: 245943
URL: http://svnweb.freebsd.org/changeset/base/245943

Log:
  MFC r245697: zfs/sparc64 boot: fix booting after r242230

Modified:
  stable/9/sys/boot/sparc64/loader/main.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/boot/   (props changed)

Modified: stable/9/sys/boot/sparc64/loader/main.c
==============================================================================
--- stable/9/sys/boot/sparc64/loader/main.c     Sat Jan 26 08:55:04 2013        
(r245942)
+++ stable/9/sys/boot/sparc64/loader/main.c     Sat Jan 26 09:55:51 2013        
(r245943)
@@ -142,6 +142,10 @@ static vm_offset_t heapva;
 static char bootpath[64];
 static phandle_t root;
 
+#ifdef LOADER_ZFS_SUPPORT
+static struct zfs_devdesc zfs_currdev;
+#endif
+
 /*
  * Machine dependent structures that the machine independent
  * loader part uses.
@@ -732,7 +736,6 @@ static void
 sparc64_zfs_probe(void)
 {
        struct vtoc8 vtoc;
-       struct zfs_devdesc zfs_currdev;
        char alias[64], devname[sizeof(alias) + sizeof(":x") - 1];
        char type[sizeof("device_type")];
        char *bdev, *dev, *odev;
@@ -805,9 +808,6 @@ sparc64_zfs_probe(void)
                zfs_currdev.root_guid = 0;
                zfs_currdev.d_dev = &zfs_dev;
                zfs_currdev.d_type = zfs_currdev.d_dev->dv_type;
-               (void)strncpy(bootpath, zfs_fmtdev(&zfs_currdev),
-                   sizeof(bootpath) - 1);
-               bootpath[sizeof(bootpath) - 1] = '\0';
        }
 }
 #endif /* LOADER_ZFS_SUPPORT */
@@ -878,10 +878,14 @@ main(int (*openfirm)(void *))
                if ((*dp)->dv_init != 0)
                        (*dp)->dv_init();
 
-       /*
-        * Now that sparc64_zfs_probe() might have altered bootpath,
-        * export it.
-        */
+#ifdef LOADER_ZFS_SUPPORT
+       if (zfs_currdev.pool_guid != 0) {
+               (void)strncpy(bootpath, zfs_fmtdev(&zfs_currdev),
+                   sizeof(bootpath) - 1);
+               bootpath[sizeof(bootpath) - 1] = '\0';
+       }
+#endif
+
        env_setenv("currdev", EV_VOLATILE, bootpath,
            ofw_setcurrdev, env_nounset);
        env_setenv("loaddev", EV_VOLATILE, bootpath,
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to