1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

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
This commit is contained in:
Andriy Gapon 2012-10-06 19:42:50 +00:00
parent edfd4fce8f
commit d39075208e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=241292

View File

@ -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);
}