diff options
author | avg <avg@FreeBSD.org> | 2012-10-06 19:42:50 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2012-10-06 19:42:50 +0000 |
commit | 9e17baa574362b48400e993efd857fa97880b96a (patch) | |
tree | 3d9debcfac80720a350693b608249505d1dc43f3 /sys/boot/zfs | |
parent | 081a118a0fa818ecd0a085d6bc47d5b3526190e0 (diff) | |
download | FreeBSD-src-9e17baa574362b48400e993efd857fa97880b96a.zip FreeBSD-src-9e17baa574362b48400e993efd857fa97880b96a.tar.gz |
zfs loader: treat plain pool name as a name of its root dataset
... as opposed to the previous behavior of treating it as boot
dataset (specified by bootfs or default)
MFC after: 19 days
Diffstat (limited to 'sys/boot/zfs')
-rw-r--r-- | sys/boot/zfs/zfs.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/sys/boot/zfs/zfs.c b/sys/boot/zfs/zfs.c index a92da26..64c738d 100644 --- a/sys/boot/zfs/zfs.c +++ b/sys/boot/zfs/zfs.c @@ -617,12 +617,9 @@ zfs_parsedev(struct zfs_devdesc *dev, const char *devspec, const char **path) 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; @@ -642,9 +639,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"); @@ -682,19 +680,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); } |