diff options
author | jkh <jkh@FreeBSD.org> | 2000-10-31 07:07:39 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 2000-10-31 07:07:39 +0000 |
commit | c99208647479c0b824d2424b1192f105dabace2b (patch) | |
tree | 8fec587868519dff571a9bc9340e8aa4a963d37f /sbin/bsdlabel/bsdlabel.c | |
parent | 7f3f30a6781f4feda57bd393fff125a6f56d2880 (diff) | |
download | FreeBSD-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.c | 15 |
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; |