A bit of premptive GEOM POLA magic: If we don't get a virgin disklabel
from /dev/food0, then try from /dev/f00d0c, in strange cases this work.
This commit is contained in:
parent
72b0228f10
commit
7b0ce36f94
@ -1613,13 +1613,23 @@ getvirginlabel(void)
|
|||||||
* Try to use the new get-virgin-label ioctl. If it fails,
|
* Try to use the new get-virgin-label ioctl. If it fails,
|
||||||
* fallback to the old get-disdk-info ioctl.
|
* fallback to the old get-disdk-info ioctl.
|
||||||
*/
|
*/
|
||||||
if (ioctl(f, DIOCGDVIRGIN, &lab) < 0) {
|
if (ioctl(f, DIOCGDVIRGIN, &lab) == 0)
|
||||||
if (ioctl(f, DIOCGDINFO, &lab) < 0) {
|
goto out;
|
||||||
warn("ioctl DIOCGDINFO");
|
if (ioctl(f, DIOCGDINFO, &lab) == 0)
|
||||||
close(f);
|
goto out;
|
||||||
return (NULL);
|
close(f);
|
||||||
}
|
(void)snprintf(namebuf, BBSIZE, "%s%s%c", _PATH_DEV, dkname,
|
||||||
|
'a' + RAW_PART);
|
||||||
|
if ((f = open(namebuf, O_RDONLY)) == -1) {
|
||||||
|
warn("cannot open %s", namebuf);
|
||||||
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
if (ioctl(f, DIOCGDINFO, &lab) == 0)
|
||||||
|
goto out;
|
||||||
|
close(f);
|
||||||
|
warn("No virgin disklabel found %s", namebuf);
|
||||||
|
return (NULL);
|
||||||
|
out:
|
||||||
close(f);
|
close(f);
|
||||||
lab.d_boot0 = NULL;
|
lab.d_boot0 = NULL;
|
||||||
lab.d_boot1 = NULL;
|
lab.d_boot1 = NULL;
|
||||||
|
@ -1613,13 +1613,23 @@ getvirginlabel(void)
|
|||||||
* Try to use the new get-virgin-label ioctl. If it fails,
|
* Try to use the new get-virgin-label ioctl. If it fails,
|
||||||
* fallback to the old get-disdk-info ioctl.
|
* fallback to the old get-disdk-info ioctl.
|
||||||
*/
|
*/
|
||||||
if (ioctl(f, DIOCGDVIRGIN, &lab) < 0) {
|
if (ioctl(f, DIOCGDVIRGIN, &lab) == 0)
|
||||||
if (ioctl(f, DIOCGDINFO, &lab) < 0) {
|
goto out;
|
||||||
warn("ioctl DIOCGDINFO");
|
if (ioctl(f, DIOCGDINFO, &lab) == 0)
|
||||||
close(f);
|
goto out;
|
||||||
return (NULL);
|
close(f);
|
||||||
}
|
(void)snprintf(namebuf, BBSIZE, "%s%s%c", _PATH_DEV, dkname,
|
||||||
|
'a' + RAW_PART);
|
||||||
|
if ((f = open(namebuf, O_RDONLY)) == -1) {
|
||||||
|
warn("cannot open %s", namebuf);
|
||||||
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
if (ioctl(f, DIOCGDINFO, &lab) == 0)
|
||||||
|
goto out;
|
||||||
|
close(f);
|
||||||
|
warn("No virgin disklabel found %s", namebuf);
|
||||||
|
return (NULL);
|
||||||
|
out:
|
||||||
close(f);
|
close(f);
|
||||||
lab.d_boot0 = NULL;
|
lab.d_boot0 = NULL;
|
||||||
lab.d_boot1 = NULL;
|
lab.d_boot1 = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user