summaryrefslogtreecommitdiffstats
path: root/sbin/bsdlabel/bsdlabel.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>2000-10-31 07:07:39 +0000
committerjkh <jkh@FreeBSD.org>2000-10-31 07:07:39 +0000
commitc99208647479c0b824d2424b1192f105dabace2b (patch)
tree8fec587868519dff571a9bc9340e8aa4a963d37f /sbin/bsdlabel/bsdlabel.c
parent7f3f30a6781f4feda57bd393fff125a6f56d2880 (diff)
downloadFreeBSD-src-c99208647479c0b824d2424b1192f105dabace2b.zip
FreeBSD-src-c99208647479c0b824d2424b1192f105dabace2b.tar.gz
Add support for virgin disklabels
Submitted by: dillon
Diffstat (limited to 'sbin/bsdlabel/bsdlabel.c')
-rw-r--r--sbin/bsdlabel/bsdlabel.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c
index a3fc788..484f073 100644
--- a/sbin/bsdlabel/bsdlabel.c
+++ b/sbin/bsdlabel/bsdlabel.c
@@ -1346,10 +1346,17 @@ getvirginlabel(void)
warn("cannot open %s", namebuf);
return (NULL);
}
- if (ioctl(f, DIOCGDINFO, &lab) < 0) {
- warn("ioctl DIOCGDINFO");
- close(f);
- return (NULL);
+
+ /*
+ * Try to use the new get-virgin-label ioctl. If it fails,
+ * fallback to the old get-disdk-info ioctl.
+ */
+ if (ioctl(f, DIOCGDVIRGIN, &lab) < 0) {
+ if (ioctl(f, DIOCGDINFO, &lab) < 0) {
+ warn("ioctl DIOCGDINFO");
+ close(f);
+ return (NULL);
+ }
}
close(f);
lab.d_boot0 = NULL;
OpenPOWER on IntegriCloud