stand/zfs: Add a third argument to zfs_probe_dev: part_too
Pass in 'true' if you'd like to search this device's partitions or 'false' if you should just search the device. EFI and (in the future) kboot have discrete partitions that aren't accessed via the full disk device. Weird things happen if you try to search in these cases. Sponsored by: Netflix
This commit is contained in:
parent
c1871a3372
commit
71bbe6fb70
@ -115,7 +115,7 @@ efi_zfs_probe(void)
|
|||||||
snprintf(devname, sizeof(devname), "%s%dp%d:",
|
snprintf(devname, sizeof(devname), "%s%dp%d:",
|
||||||
efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit);
|
efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit);
|
||||||
guid = 0;
|
guid = 0;
|
||||||
if (zfs_probe_dev(devname, &guid) == 0) {
|
if (zfs_probe_dev(devname, &guid, false) == 0) {
|
||||||
insert_zfs(pd->pd_handle, guid);
|
insert_zfs(pd->pd_handle, guid);
|
||||||
if (pd->pd_handle == boot_img->DeviceHandle)
|
if (pd->pd_handle == boot_img->DeviceHandle)
|
||||||
pool_guid = guid;
|
pool_guid = guid;
|
||||||
|
@ -453,7 +453,7 @@ i386_zfs_probe(void)
|
|||||||
for (dev.dd.d_unit = 0; bd_unit2bios(&dev) >= 0; dev.dd.d_unit++) {
|
for (dev.dd.d_unit = 0; bd_unit2bios(&dev) >= 0; dev.dd.d_unit++) {
|
||||||
snprintf(devname, sizeof(devname), "%s%d:", bioshd.dv_name,
|
snprintf(devname, sizeof(devname), "%s%d:", bioshd.dv_name,
|
||||||
dev.dd.d_unit);
|
dev.dd.d_unit);
|
||||||
zfs_probe_dev(devname, NULL);
|
zfs_probe_dev(devname, NULL, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -706,9 +706,9 @@ i386_zfs_probe(void)
|
|||||||
dev.dd.d_unit);
|
dev.dd.d_unit);
|
||||||
/* If this is not boot disk, use generic probe. */
|
/* If this is not boot disk, use generic probe. */
|
||||||
if (dev.dd.d_unit != boot_unit)
|
if (dev.dd.d_unit != boot_unit)
|
||||||
zfs_probe_dev(devname, NULL);
|
zfs_probe_dev(devname, NULL, true);
|
||||||
else
|
else
|
||||||
zfs_probe_dev(devname, &pool_guid);
|
zfs_probe_dev(devname, &pool_guid, true);
|
||||||
|
|
||||||
if (pool_guid != 0 && bdev == NULL) {
|
if (pool_guid != 0 && bdev == NULL) {
|
||||||
bdev = malloc(sizeof (struct i386_devdesc));
|
bdev = malloc(sizeof (struct i386_devdesc));
|
||||||
|
@ -49,7 +49,7 @@ struct zfs_devdesc {
|
|||||||
};
|
};
|
||||||
|
|
||||||
char *zfs_fmtdev(struct devdesc *);
|
char *zfs_fmtdev(struct devdesc *);
|
||||||
int zfs_probe_dev(const char *devname, uint64_t *pool_guid);
|
int zfs_probe_dev(const char *devname, uint64_t *pool_guid, bool part_too);
|
||||||
int zfs_list(const char *name);
|
int zfs_list(const char *name);
|
||||||
int zfs_get_bootonce(void *, const char *, char *, size_t);
|
int zfs_get_bootonce(void *, const char *, char *, size_t);
|
||||||
int zfs_get_bootenv(void *, nvlist_t **);
|
int zfs_get_bootenv(void *, nvlist_t **);
|
||||||
|
@ -1492,7 +1492,7 @@ zfs_attach_nvstore(void *vdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
zfs_probe_dev(const char *devname, uint64_t *pool_guid)
|
zfs_probe_dev(const char *devname, uint64_t *pool_guid, bool parts_too)
|
||||||
{
|
{
|
||||||
struct ptable *table;
|
struct ptable *table;
|
||||||
struct zfs_probe_args pa;
|
struct zfs_probe_args pa;
|
||||||
@ -1508,6 +1508,8 @@ zfs_probe_dev(const char *devname, uint64_t *pool_guid)
|
|||||||
ret = zfs_probe(pa.fd, pool_guid);
|
ret = zfs_probe(pa.fd, pool_guid);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
if (!parts_too)
|
||||||
|
return (ENXIO);
|
||||||
|
|
||||||
/* Probe each partition */
|
/* Probe each partition */
|
||||||
ret = ioctl(pa.fd, DIOCGMEDIASIZE, &mediasz);
|
ret = ioctl(pa.fd, DIOCGMEDIASIZE, &mediasz);
|
||||||
|
@ -313,7 +313,7 @@ userboot_zfs_probe(void)
|
|||||||
for (unit = 0; unit < userboot_disk_maxunit; unit++) {
|
for (unit = 0; unit < userboot_disk_maxunit; unit++) {
|
||||||
sprintf(devname, "disk%d:", unit);
|
sprintf(devname, "disk%d:", unit);
|
||||||
pool_guid = 0;
|
pool_guid = 0;
|
||||||
zfs_probe_dev(devname, &pool_guid);
|
zfs_probe_dev(devname, &pool_guid, true);
|
||||||
if (pool_guid != 0)
|
if (pool_guid != 0)
|
||||||
userboot_zfs_found = 1;
|
userboot_zfs_found = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user