summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2008-07-06 15:03:37 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2008-07-06 15:03:37 +0000
commitbd84a5e923da7622e5a883bf52779ecddc0f199c (patch)
treeddeec9d7663b991bac79dc47709098e7274c25f9
parenta475330ca952a0a8f308d67200fe5ac992f80cd3 (diff)
Don't change the size of the partition being newfs'd when sectorsize,
either from the disklabel or via -S, is not 512 bytes. Disklabel partition sizes are sectors and not 512 byte blocks. One less 'block is 512 bytes' assumption. 2^32 or so to go. ok otto@ millert@
-rw-r--r--sbin/newfs/newfs.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index c14ff657262..911b8f1c257 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newfs.c,v 1.78 2008/06/27 18:50:43 sobrado Exp $ */
+/* $OpenBSD: newfs.c,v 1.79 2008/07/06 15:03:36 krw Exp $ */
/* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */
/*
@@ -113,7 +113,6 @@ int Nflag; /* run without writing file system */
int Oflag = 1; /* 0 = 4.3BSD ffs, 1 = 4.4BSD ffs, 2 = ffs2 */
daddr64_t fssize; /* file system size */
int sectorsize; /* bytes/sector */
-int realsectorsize; /* bytes/sector in hardware */
int fsize = 0; /* fragment size */
int bsize = 0; /* block size */
int maxfrgspercg = INT_MAX; /* maximum fragments per cylinder group */
@@ -454,20 +453,6 @@ havelabel:
maxbpg = MAXBLKPG_FFS2(bsize);
}
oldpartition = *pp;
- realsectorsize = sectorsize;
- if (sectorsize < DEV_BSIZE) {
- int secperblk = DEV_BSIZE / sectorsize;
-
- sectorsize = DEV_BSIZE;
- fssize /= secperblk;
- DL_SETPSIZE(pp, DL_GETPSIZE(pp) / secperblk);
- } else if (sectorsize > DEV_BSIZE) {
- int blkpersec = sectorsize / DEV_BSIZE;
-
- sectorsize = DEV_BSIZE;
- fssize *= blkpersec;
- DL_SETPSIZE(pp, DL_GETPSIZE(pp) * blkpersec);
- }
#ifdef MFS
if (mfs) {
if (realpath(argv[1], node) == NULL)
@@ -481,10 +466,6 @@ havelabel:
#endif
mkfs(pp, special, fsi, fso, mfsmode, mfsuid, mfsgid);
- if (realsectorsize < DEV_BSIZE)
- DL_SETPSIZE(pp, DL_GETPSIZE(pp) * DEV_BSIZE / realsectorsize);
- else if (realsectorsize > DEV_BSIZE)
- DL_SETPSIZE(pp, DL_GETPSIZE(pp) / realsectorsize / DEV_BSIZE);
if (!Nflag && memcmp(pp, &oldpartition, sizeof(oldpartition)))
rewritelabel(special, fso, lp);
if (!Nflag)