summaryrefslogtreecommitdiff
path: root/sbin/newfs
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-05-29 06:28:17 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-05-29 06:28:17 +0000
commit444b0299644e2e692c1f8d00d8b1caa0acea33a3 (patch)
tree1b53b5865bcc8b3675238c2ebdd9daf6797ccd39 /sbin/newfs
parent3f6176ec485942a0e5cfcc7e61ca01950df6452c (diff)
Updated disklabel format to support larger disks and partitions. We
free room in struct partition by packing fragment size and fragments/block more tighlty and use the resulting space to make offset and size 48 bits. For the disk part we use spare fields in struct disklabel. Kernel converts in-mem copy of the on-disk label if needed, disklabel(8) writes new version. We are careful to only change fields not used by bootloaders. Conception of basic scheme by deraadt. ok deraadt@ krw@
Diffstat (limited to 'sbin/newfs')
-rw-r--r--sbin/newfs/mkfs.c6
-rw-r--r--sbin/newfs/newfs.c18
2 files changed, 12 insertions, 12 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index 317260128a0..3b2cc58df5f 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkfs.c,v 1.63 2007/05/19 20:12:50 otto Exp $ */
+/* $OpenBSD: mkfs.c,v 1.64 2007/05/29 06:28:16 otto Exp $ */
/* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */
/*
@@ -593,8 +593,8 @@ mkfs(struct partition *pp, char *fsys, int fi, int fo, mode_t mfsmode,
* be updated on disk.
*/
pp->p_fstype = FS_BSDFFS;
- pp->p_fsize = sblock.fs_fsize;
- pp->p_frag = sblock.fs_frag;
+ pp->p_fragblock =
+ DISKLABELV1_FFS_FRAGBLOCK(sblock.fs_fsize, sblock.fs_frag);
pp->p_cpg = sblock.fs_cpg;
}
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index c307fb47377..98541cf8957 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newfs.c,v 1.64 2007/05/20 11:28:06 millert Exp $ */
+/* $OpenBSD: newfs.c,v 1.65 2007/05/29 06:28:16 otto Exp $ */
/* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */
/*
@@ -168,7 +168,7 @@ main(int argc, char *argv[])
mode_t mfsmode = 0;
char *fstype = NULL;
char **saveargv = argv;
- int ffs = 1;
+ int ffsflag = 1;
const char *errstr;
if (strstr(__progname, "mfs"))
@@ -272,7 +272,7 @@ main(int argc, char *argv[])
case 't':
fstype = optarg;
if (strcmp(fstype, "ffs"))
- ffs = 0;
+ ffsflag = 0;
break;
#ifdef MFS
case 'P':
@@ -283,13 +283,13 @@ main(int argc, char *argv[])
default:
usage();
}
- if (!ffs)
+ if (!ffsflag)
break;
}
argc -= optind;
argv += optind;
- if (ffs && argc - mfs != 1)
+ if (ffsflag && argc - mfs != 1)
usage();
/* Increase our data size to the max */
@@ -335,8 +335,8 @@ main(int argc, char *argv[])
mfsfakelabel.d_interleave = 1;
mfsfakelabel.d_npartitions = 1;
mfsfakelabel.d_partitions[0].p_size = 16384;
- mfsfakelabel.d_partitions[0].p_fsize = 1024;
- mfsfakelabel.d_partitions[0].p_frag = 8;
+ mfsfakelabel.d_partitions[0].p_fragblock =
+ DISKLABELV1_FFS_FRAGBLOCK(1024, 8);
mfsfakelabel.d_partitions[0].p_cpg = 16;
lp = &mfsfakelabel;
@@ -428,12 +428,12 @@ havelabel:
fatal("%s: no default sector size", argv[0]);
}
if (fsize == 0) {
- fsize = pp->p_fsize;
+ fsize = DISKLABELV1_FFS_FSIZE(pp->p_fragblock);
if (fsize <= 0)
fsize = MAX(DFL_FRAGSIZE, lp->d_secsize);
}
if (bsize == 0) {
- bsize = pp->p_frag * pp->p_fsize;
+ bsize = DISKLABELV1_FFS_BSIZE(pp->p_fragblock);
if (bsize <= 0)
bsize = MIN(DFL_BLKSIZE, 8 * fsize);
}