svn commit: r242234 - stable/9/sys/boot/zfs
Andriy Gapon
avg at FreeBSD.org
Sun Oct 28 15:54:02 UTC 2012
Author: avg
Date: Sun Oct 28 15:54:01 2012
New Revision: 242234
URL: http://svn.freebsd.org/changeset/base/242234
Log:
MFC r241292: zfs loader: treat plain pool name as a name of its root
dataset
Modified:
stable/9/sys/boot/zfs/zfs.c
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/boot/ (props changed)
Modified: stable/9/sys/boot/zfs/zfs.c
==============================================================================
--- stable/9/sys/boot/zfs/zfs.c Sun Oct 28 15:51:15 2012 (r242233)
+++ stable/9/sys/boot/zfs/zfs.c Sun Oct 28 15:54:01 2012 (r242234)
@@ -533,12 +533,9 @@ zfs_parsedev(struct zfs_devdesc *dev, co
if (!spa)
return (ENXIO);
dev->pool_guid = spa->spa_guid;
- if (rootname[0] != '\0') {
- rv = zfs_lookup_dataset(spa, rootname, &dev->root_guid);
- if (rv != 0)
- return (rv);
- } else
- dev->root_guid = 0;
+ rv = zfs_lookup_dataset(spa, rootname, &dev->root_guid);
+ if (rv != 0)
+ return (rv);
if (path != NULL)
*path = (*end == '\0') ? end : end + 1;
dev->d_dev = &zfs_dev;
@@ -558,9 +555,10 @@ zfs_fmtdev(void *vdev)
if (dev->d_type != DEVT_ZFS)
return (buf);
- if (dev->pool_guid == 0)
+ if (dev->pool_guid == 0) {
spa = STAILQ_FIRST(&zfs_pools);
- else
+ dev->pool_guid = spa->spa_guid;
+ } else
spa = spa_find_by_guid(dev->pool_guid);
if (spa == NULL) {
printf("ZFS: can't find pool by guid\n");
@@ -598,19 +596,17 @@ zfs_list(const char *name)
if (dsname != NULL) {
len = dsname - name;
dsname++;
- }
+ } else
+ dsname = "";
memcpy(poolname, name, len);
poolname[len] = '\0';
spa = spa_find_by_name(poolname);
if (!spa)
return (ENXIO);
- if (dsname != NULL)
- rv = zfs_lookup_dataset(spa, dsname, &objid);
- else
- rv = zfs_get_root(spa, &objid);
+ rv = zfs_lookup_dataset(spa, dsname, &objid);
if (rv != 0)
return (rv);
rv = zfs_list_dataset(spa, objid);
- return (0);
+ return (rv);
}
More information about the svn-src-stable-9
mailing list