aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/newfs_msdos
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2015-01-06 05:28:37 +0000
committerWarner Losh <imp@FreeBSD.org>2015-01-06 05:28:37 +0000
commita91275f72fda164c3d0efdb1190d334b5b447f22 (patch)
tree7642f45fc42d6192ce6b58f0f4c3c598067a0410 /sbin/newfs_msdos
parenta3f9f9a5a860e62873a5a9689fc7f0b703b117c0 (diff)
downloadsrc-a91275f72fda164c3d0efdb1190d334b5b447f22.tar.gz
src-a91275f72fda164c3d0efdb1190d334b5b447f22.zip
Remove old ioctl use and support, once and for all.
Notes
Notes: svn path=/head/; revision=276737
Diffstat (limited to 'sbin/newfs_msdos')
-rw-r--r--sbin/newfs_msdos/newfs_msdos.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c
index f315d9810fba..468578287671 100644
--- a/sbin/newfs_msdos/newfs_msdos.c
+++ b/sbin/newfs_msdos/newfs_msdos.c
@@ -829,28 +829,26 @@ getdiskinfo(int fd, const char *fname, const char *dtype, __unused int oflag,
if (lp == NULL) {
if (bpb->bpbBytesPerSec)
dlp.d_secsize = bpb->bpbBytesPerSec;
- if (ioctl(fd, DIOCGDINFO, &dlp) == -1) {
- if (bpb->bpbBytesPerSec == 0 && ioctl(fd, DIOCGSECTORSIZE,
- &dlp.d_secsize) == -1)
- err(1, "cannot get sector size");
+ if (bpb->bpbBytesPerSec == 0 && ioctl(fd, DIOCGSECTORSIZE,
+ &dlp.d_secsize) == -1)
+ err(1, "cannot get sector size");
- dlp.d_secperunit = ms / dlp.d_secsize;
+ dlp.d_secperunit = ms / dlp.d_secsize;
- if (bpb->bpbSecPerTrack == 0 && ioctl(fd, DIOCGFWSECTORS,
- &dlp.d_nsectors) == -1) {
- warn("cannot get number of sectors per track");
- dlp.d_nsectors = 63;
- }
- if (bpb->bpbHeads == 0 &&
- ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) {
- warn("cannot get number of heads");
- if (dlp.d_secperunit <= 63*1*1024)
- dlp.d_ntracks = 1;
- else if (dlp.d_secperunit <= 63*16*1024)
- dlp.d_ntracks = 16;
- else
- dlp.d_ntracks = 255;
- }
+ if (bpb->bpbSecPerTrack == 0 && ioctl(fd, DIOCGFWSECTORS,
+ &dlp.d_nsectors) == -1) {
+ warn("cannot get number of sectors per track");
+ dlp.d_nsectors = 63;
+ }
+ if (bpb->bpbHeads == 0 &&
+ ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) {
+ warn("cannot get number of heads");
+ if (dlp.d_secperunit <= 63*1*1024)
+ dlp.d_ntracks = 1;
+ else if (dlp.d_secperunit <= 63*16*1024)
+ dlp.d_ntracks = 16;
+ else
+ dlp.d_ntracks = 255;
}
hs = (ms / dlp.d_secsize) - dlp.d_secperunit;