summaryrefslogtreecommitdiffstats
path: root/sbin/newfs/newfs.c
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>1996-12-01 11:25:38 +0000
committersos <sos@FreeBSD.org>1996-12-01 11:25:38 +0000
commit304d831859d554948e48205432147cf4e04acca8 (patch)
tree3caeb1000fbf433bbefbf62abe3def80c205c219 /sbin/newfs/newfs.c
parent33c2e639e1d61f008dac52121511b79f1fb488e6 (diff)
downloadFreeBSD-src-304d831859d554948e48205432147cf4e04acca8.zip
FreeBSD-src-304d831859d554948e48205432147cf4e04acca8.tar.gz
This update adds the support for != 512 byte sector SCSI devices to
the sd & od drivers. There is also slight changes to fdisk & newfs in order to comply with different sectorsizes. Currently sectors of size 512, 1024 & 2048 are supported, the only restriction beeing in fdisk, which hunts for the sectorsize of the device. This is based on patches to od.c and the other system files by John Gumb & Barry Scott, minor changes and the sd.c patches by me. There also exist some patches for the msdos filesys code, but I havn't been able to test those (yet). John Gumb (john@talisker.demon.co.uk) Barry Scott (barry@scottb.demon.co.uk)
Diffstat (limited to 'sbin/newfs/newfs.c')
-rw-r--r--sbin/newfs/newfs.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index c9f2504..44058b1 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -167,9 +167,7 @@ int secpercyl; /* sectors per cylinder */
int trackspares = -1; /* spare sectors per track */
int cylspares = -1; /* spare sectors per cylinder */
int sectorsize; /* bytes/sector */
-#ifdef tahoe
int realsectorsize; /* bytes/sector in hardware */
-#endif
int rpm; /* revolutions/minute of drive */
int interleave; /* hardware sector interleave */
int trackskew = -1; /* sector 0 skew, per track */
@@ -530,11 +528,26 @@ main(argc, argv)
fssize /= secperblk;
pp->p_size /= secperblk;
}
+#else
+ realsectorsize = sectorsize;
+ if (sectorsize != DEV_BSIZE) { /* XXX */
+ int secperblk = sectorsize / DEV_BSIZE;
+
+ sectorsize = DEV_BSIZE;
+ nsectors *= secperblk;
+ nphyssectors *= secperblk;
+ secpercyl *= secperblk;
+ fssize *= secperblk;
+ pp->p_size *= secperblk;
+ }
#endif
mkfs(pp, special, fsi, fso);
#ifdef tahoe
if (realsectorsize != DEV_BSIZE)
pp->p_size *= DEV_BSIZE / realsectorsize;
+#else
+ if (realsectorsize != DEV_BSIZE)
+ pp->p_size /= realsectorsize /DEV_BSIZE;
#endif
if (!Nflag)
close(fso);
OpenPOWER on IntegriCloud