summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/gen/disklabel.c12
-rw-r--r--sbin/disklabel/disklabel.c59
-rw-r--r--sbin/disklabel/editor.c41
-rw-r--r--sbin/fsck_ext2fs/setup.c6
-rw-r--r--sbin/fsck_ffs/setup.c8
-rw-r--r--sbin/growfs/growfs.c8
-rw-r--r--sbin/newfs/mkfs.c6
-rw-r--r--sbin/newfs/newfs.c18
-rw-r--r--sys/adosfs/advfsops.c6
-rw-r--r--sys/arch/alpha/alpha/disksubr.c6
-rw-r--r--sys/arch/amd64/amd64/disksubr.c6
-rw-r--r--sys/arch/arm/arm/disksubr.c6
-rw-r--r--sys/arch/aviion/aviion/disksubr.c6
-rw-r--r--sys/arch/hp300/hp300/disksubr.c6
-rw-r--r--sys/arch/hppa/hppa/disksubr.c6
-rw-r--r--sys/arch/hppa64/hppa64/disksubr.c6
-rw-r--r--sys/arch/i386/i386/disksubr.c6
-rw-r--r--sys/arch/landisk/landisk/disksubr.c6
-rw-r--r--sys/arch/luna88k/luna88k/disksubr.c7
-rw-r--r--sys/arch/mac68k/mac68k/disksubr.c6
-rw-r--r--sys/arch/macppc/macppc/disksubr.c6
-rw-r--r--sys/arch/mips64/mips64/disksubr.c10
-rw-r--r--sys/arch/mvme68k/mvme68k/disksubr.c6
-rw-r--r--sys/arch/mvme88k/mvme88k/disksubr.c6
-rw-r--r--sys/arch/mvmeppc/mvmeppc/disksubr.c6
-rw-r--r--sys/arch/sparc/sparc/disksubr.c11
-rw-r--r--sys/arch/sparc64/sparc64/disksubr.c11
-rw-r--r--sys/arch/sparc64/stand/ofwboot/ofdev.c6
-rw-r--r--sys/arch/vax/vax/disksubr.c6
-rw-r--r--sys/kern/spec_vnops.c24
-rw-r--r--sys/kern/subr_disk.c27
-rw-r--r--sys/miscfs/specfs/spec_vnops.c24
-rw-r--r--sys/sys/disklabel.h37
33 files changed, 261 insertions, 150 deletions
diff --git a/lib/libc/gen/disklabel.c b/lib/libc/gen/disklabel.c
index ad5148e0cde..a921b8e0bf0 100644
--- a/lib/libc/gen/disklabel.c
+++ b/lib/libc/gen/disklabel.c
@@ -116,16 +116,18 @@ getdiskbyname(const char *name)
if (cgetnum(buf, psize, &f) == -1)
pp->p_size = 0;
else {
+ u_int32_t fsize, frag = 8;
+
pp->p_size = f;
getnum(pp->p_offset, poffset);
- getnumdflt(pp->p_fsize, pfsize, 0);
- if (pp->p_fsize) {
+ getnumdflt(fsize, pfsize, 0);
+ if (fsize) {
long bsize;
if (cgetnum(buf, pbsize, &bsize) == 0)
- pp->p_frag = bsize / pp->p_fsize;
- else
- pp->p_frag = 8;
+ frag = bsize / fsize;
+ pp->p_fragblock =
+ DISKLABELV1_FFS_FRAGBLOCK(fsize, frag);
}
getnumdflt(pp->p_fstype, ptype, 0);
if (pp->p_fstype == 0 && cgetstr(buf, ptype, &cq) > 0)
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index 3a93a1abeef..837e9c9ae2b 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.c,v 1.109 2007/05/24 13:01:23 krw Exp $ */
+/* $OpenBSD: disklabel.c,v 1.110 2007/05/29 06:28:15 otto Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -39,7 +39,7 @@ static const char copyright[] =
#endif /* not lint */
#ifndef lint
-static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.109 2007/05/24 13:01:23 krw Exp $";
+static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.110 2007/05/29 06:28:15 otto Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -388,6 +388,31 @@ makelabel(char *type, char *name, struct disklabel *lp)
(void)strncpy(lp->d_packname, name, sizeof(lp->d_packname));
}
+/*
+ * Convert an old disklabel to a v1 disklabel
+ */
+void
+cvtdisklabelv1(struct disklabel *lp)
+{
+ int i;
+
+ if (lp->d_version == 1)
+ return;
+
+ lp->d_version = 1;
+ lp->d_secperunith = 0;
+ for (i = 0; i < MAXPARTITIONS; i++) {
+ struct partition *pp = &lp->d_partitions[i];
+ struct __partitionv0 *v0pp = (struct __partitionv0 *)
+ &lp->d_partitions[i];
+
+ pp->p_fragblock = DISKLABELV1_FFS_FRAGBLOCK(v0pp->p_fsize,
+ v0pp->p_frag);
+ pp->p_offseth = 0;
+ pp->p_sizeh = 0;
+ }
+}
+
int
writelabel(int f, char *boot, struct disklabel *lp)
{
@@ -409,6 +434,7 @@ writelabel(int f, char *boot, struct disklabel *lp)
lp->d_magic = DISKMAGIC;
lp->d_magic2 = DISKMAGIC;
lp->d_checksum = 0;
+ cvtdisklabelv1(lp);
lp->d_checksum = dkcksum(lp);
if (rflag) {
#ifdef DOSLABEL
@@ -930,8 +956,9 @@ makedisktab(FILE *f, struct disklabel *lp)
case FS_BSDFFS:
(void)fprintf(f, "b%c#%u:", c,
- pp->p_fsize * pp->p_frag);
- (void)fprintf(f, "f%c#%u:", c, pp->p_fsize);
+ DISKLABELV1_FFS_BSIZE(pp->p_fragblock));
+ (void)fprintf(f, "f%c#%u:", c,
+ DISKLABELV1_FFS_FSIZE(pp->p_fragblock));
break;
default:
@@ -979,6 +1006,8 @@ display_partition(FILE *f, struct disklabel *lp, char **mp, int i,
p_size = scale(pp->p_size, unit, lp);
p_offset = scale(pp->p_offset, unit, lp);
if (pp->p_size) {
+ u_int32_t frag = DISKLABELV1_FFS_FRAG(pp->p_fragblock);
+ u_int32_t fsize = DISKLABELV1_FFS_FSIZE(pp->p_fragblock);
if (p_size < 0)
fprintf(f, " %c: %13u %13u ", 'a' + i,
pp->p_size, pp->p_offset);
@@ -994,12 +1023,12 @@ display_partition(FILE *f, struct disklabel *lp, char **mp, int i,
case FS_UNUSED: /* XXX */
fprintf(f, " %5u %5u %4.4s ",
- pp->p_fsize, pp->p_fsize * pp->p_frag, "");
+ fsize, fsize * frag, "");
break;
case FS_BSDFFS:
fprintf(f, " %5u %5u %4hu ",
- pp->p_fsize, pp->p_fsize * pp->p_frag,
+ fsize, fsize * frag,
pp->p_cpg);
break;
@@ -1274,7 +1303,7 @@ getasciilabel(FILE *f, struct disklabel *lp)
struct partition *pp;
char *tp, *s, line[BUFSIZ];
int lineno = 0, errors = 0;
- u_int32_t v;
+ u_int32_t v, fsize;
lp->d_bbsize = BBSIZE; /* XXX */
lp->d_sbsize = SBSIZE; /* XXX */
@@ -1527,19 +1556,21 @@ getasciilabel(FILE *f, struct disklabel *lp)
case FS_UNUSED: /* XXX */
if (tp == NULL) /* ok to skip fsize/bsize */
break;
- NXTNUM(pp->p_fsize, pp->p_fsize, &errstr);
- if (pp->p_fsize == 0)
+ NXTNUM(fsize, fsize, &errstr);
+ if (fsize == 0)
break;
NXTNUM(v, v, &errstr);
- pp->p_frag = v / pp->p_fsize;
+ pp->p_fragblock =
+ DISKLABELV1_FFS_FRAGBLOCK(fsize, v / fsize);
break;
case FS_BSDFFS:
- NXTNUM(pp->p_fsize, pp->p_fsize, &errstr);
- if (pp->p_fsize == 0)
+ NXTNUM(fsize, fsize, &errstr);
+ if (fsize == 0)
break;
NXTNUM(v, v, &errstr);
- pp->p_frag = v / pp->p_fsize;
+ pp->p_fragblock =
+ DISKLABELV1_FFS_FRAGBLOCK(fsize, v / fsize);
NXTNUM(pp->p_cpg, pp->p_cpg, &errstr);
break;
@@ -1642,10 +1673,12 @@ checklabel(struct disklabel *lp)
part);
errors++;
}
+#if 0
if (pp->p_frag == 0 && pp->p_fsize != 0) {
warnx("partition %c: block size < fragment size", part);
errors++;
}
+#endif
}
for (; i < MAXPARTITIONS; i++) {
part = 'a' + i;
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index 2366dbf29d3..d7e54e2f867 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.112 2007/04/29 18:31:35 otto Exp $ */
+/* $OpenBSD: editor.c,v 1.113 2007/05/29 06:28:15 otto Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -17,7 +17,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: editor.c,v 1.112 2007/04/29 18:31:35 otto Exp $";
+static char rcsid[] = "$OpenBSD: editor.c,v 1.113 2007/05/29 06:28:15 otto Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -147,7 +147,7 @@ editor(struct disklabel *lp, int f, char *dev, char *fstabfile)
pp->p_offset = 0;
pp->p_size = label.d_secperunit;
pp->p_fstype = FS_UNUSED;
- pp->p_fsize = pp->p_frag = pp->p_cpg = 0;
+ pp->p_fragblock = pp->p_cpg = 0;
}
#ifdef CYLCHECK
@@ -503,11 +503,11 @@ editor_add(struct disklabel *lp, char **mp, u_int32_t *freep, char *p)
pp->p_fstype = partno == 1 ? FS_SWAP : FS_BSDFFS;
#if defined (__sparc__) && !defined(__sparc64__)
/* can't boot from > 8k boot blocks */
- pp->p_fsize = partno == 0 ? 1024 : 2048;
+ pp->p_fragblock =
+ DISKLABELV1_FFS_FRAGBLOCK(partno == 0 ? 1024 : 2048, 8);
#else
- pp->p_fsize = 2048;
+ pp->p_fragblock = DISKLABELV1_FFS_FRAGBLOCK(2048, 8);
#endif
- pp->p_frag = 8;
pp->p_cpg = 16;
old_offset = pp->p_offset;
old_size = pp->p_size;
@@ -2054,13 +2054,18 @@ get_size(struct disklabel *lp, int partno, u_int32_t *freep, int new)
int
get_fsize(struct disklabel *lp, int partno)
{
- u_int32_t ui;
+ u_int32_t ui, fsize, frag;
struct partition *pp = &lp->d_partitions[partno];
+
+ fsize = DISKLABELV1_FFS_FSIZE(pp->p_fragblock);
+ frag = DISKLABELV1_FFS_FRAG(pp->p_fragblock);
+ if (fsize == 0)
+ frag = 8;
for (;;) {
ui = getuint(lp, partno, "fragment size",
"Size of fs block fragments. Usually 2048 or 512.",
- pp->p_fsize, pp->p_fsize, 0, 0);
+ fsize, fsize, 0, 0);
if (ui == UINT_MAX - 1) {
fputs("Command aborted\n", stderr);
return(1);
@@ -2071,26 +2076,28 @@ get_fsize(struct disklabel *lp, int partno)
}
if (ui == 0)
puts("Zero fragment size implies zero block size");
- pp->p_fsize = ui;
+ pp->p_fragblock = DISKLABELV1_FFS_FRAGBLOCK(ui, frag);
return(0);
}
int
get_bsize(struct disklabel *lp, int partno)
{
- u_int32_t ui;
+ u_int32_t ui, bsize, frag, fsize;
struct partition *pp = &lp->d_partitions[partno];
/* Avoid dividing by zero... */
- if (pp->p_fsize == 0) {
- pp->p_frag = 0;
+ if (pp->p_fragblock == 0)
return(1);
- }
+
+ bsize = DISKLABELV1_FFS_BSIZE(pp->p_fragblock);
+ fsize = DISKLABELV1_FFS_FSIZE(pp->p_fragblock);
+ frag = DISKLABELV1_FFS_FRAG(pp->p_fragblock);
for (;;) {
ui = getuint(lp, partno, "block size",
"Size of filesystem blocks. Usually 16384 or 4096.",
- pp->p_fsize * pp->p_frag, pp->p_fsize * pp->p_frag,
+ fsize * frag, fsize * frag,
0, 0);
/* sanity checks */
@@ -2103,16 +2110,16 @@ get_bsize(struct disklabel *lp, int partno)
fprintf(stderr,
"Error: block size must be at least as big "
"as page size (%d).\n", getpagesize());
- else if (ui % pp->p_fsize != 0)
+ else if (ui % fsize != 0)
fputs("Error: block size must be a multiple of the "
"fragment size.\n", stderr);
- else if (ui / pp->p_fsize < 1)
+ else if (ui / fsize < 1)
fputs("Error: block size must be at least as big as "
"fragment size.\n", stderr);
else
break;
}
- pp->p_frag = ui / pp->p_fsize;
+ pp->p_fragblock = DISKLABELV1_FFS_FRAGBLOCK(ui / frag, frag);
return(0);
}
diff --git a/sbin/fsck_ext2fs/setup.c b/sbin/fsck_ext2fs/setup.c
index 7a3767982bf..e4c1637be70 100644
--- a/sbin/fsck_ext2fs/setup.c
+++ b/sbin/fsck_ext2fs/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.13 2005/04/30 13:56:16 niallo Exp $ */
+/* $OpenBSD: setup.c,v 1.14 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: setup.c,v 1.1 1997/06/11 11:22:01 bouyer Exp $ */
/*
@@ -441,8 +441,8 @@ calcsb(char *dev, int devfd, struct m_ext2fs *fs)
return (0);
}
memset(fs, 0, sizeof(struct m_ext2fs));
- fs->e2fs_bsize = pp->p_fsize;
- fs->e2fs.e2fs_log_bsize = pp->p_fsize / 1024;
+ fs->e2fs_bsize = DISKLABELV1_FFS_FSIZE(pp->p_fragblock); /* XXX */
+ fs->e2fs.e2fs_log_bsize = fs->e2fs_bsize / 1024;
fs->e2fs.e2fs_bcount = (pp->p_size * DEV_BSIZE) / fs->e2fs_bsize;
fs->e2fs.e2fs_first_dblock = (fs->e2fs.e2fs_log_bsize == 0) ? 1 : 0;
fs->e2fs.e2fs_bpg = fs->e2fs_bsize * NBBY;
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index ada879b2f3b..3c007e05a5a 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.34 2007/04/18 20:49:46 otto Exp $ */
+/* $OpenBSD: setup.c,v 1.35 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94";
#else
-static const char rcsid[] = "$OpenBSD: setup.c,v 1.34 2007/04/18 20:49:46 otto Exp $";
+static const char rcsid[] = "$OpenBSD: setup.c,v 1.35 2007/05/29 06:28:15 otto Exp $";
#endif
#endif /* not lint */
@@ -638,8 +638,8 @@ calcsb(char *dev, int devfd, struct fs *fs)
return (0);
}
memset(fs, 0, sizeof(struct fs));
- fs->fs_fsize = pp->p_fsize;
- fs->fs_frag = pp->p_frag;
+ fs->fs_fsize = DISKLABELV1_FFS_FSIZE(pp->p_fragblock);
+ fs->fs_frag = DISKLABELV1_FFS_FRAG(pp->p_fragblock);
fs->fs_bsize = fs->fs_fsize * fs->fs_frag;
fs->fs_cpg = pp->p_cpg;
fs->fs_nspf = fs->fs_fsize / lp->d_secsize;
diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index 1d7ec8b243a..83b6668edc9 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: growfs.c,v 1.18 2007/04/23 10:18:30 pedro Exp $ */
+/* $OpenBSD: growfs.c,v 1.19 2007/05/29 06:28:16 otto Exp $ */
/*
* Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
* Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
@@ -46,7 +46,7 @@ static const char copyright[] =
Copyright (c) 1980, 1989, 1993 The Regents of the University of California.\n\
All rights reserved.\n";
-static const char rcsid[] = "$OpenBSD: growfs.c,v 1.18 2007/04/23 10:18:30 pedro Exp $";
+static const char rcsid[] = "$OpenBSD: growfs.c,v 1.19 2007/05/29 06:28:16 otto Exp $";
#endif /* not lint */
/* ********************************************************** INCLUDES ***** */
@@ -2093,8 +2093,8 @@ main(int argc, char **argv)
/*
* Update the disk label.
*/
- 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;
return_disklabel(fso, lp, Nflag);
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);
}
diff --git a/sys/adosfs/advfsops.c b/sys/adosfs/advfsops.c
index f26aadfbaf9..3653ccafc8d 100644
--- a/sys/adosfs/advfsops.c
+++ b/sys/adosfs/advfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: advfsops.c,v 1.25 2003/08/14 07:46:39 mickey Exp $ */
+/* $OpenBSD: advfsops.c,v 1.26 2007/05/29 06:28:16 otto Exp $ */
/* $NetBSD: advfsops.c,v 1.24 1996/12/22 10:10:12 cgd Exp $ */
/*
@@ -200,8 +200,8 @@ adosfs_mountfs(devvp, mp, p)
amp->secsperblk = 1;
}
else {
- amp->bsize = parp->p_fsize * parp->p_frag;
- amp->secsperblk = parp->p_frag;
+ amp->bsize = DISKLABELV1_FFS_BSIZE(parp->fragblock);
+ amp->secsperblk = DISKLABELV1_FFS_FRAG(parp->p_fragblock);
}
amp->rootb = (parp->p_size / amp->secsperblk - 1 + parp->p_cpg) >> 1;
amp->numblks = parp->p_size / amp->secsperblk - parp->p_cpg;
diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c
index 141dd05afea..8fe69125170 100644
--- a/sys/arch/alpha/alpha/disksubr.c
+++ b/sys/arch/alpha/alpha/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.68 2007/05/29 05:08:19 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.69 2007/05/29 06:28:14 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -194,6 +194,7 @@ done:
bp->b_flags |= B_INVAL;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -450,8 +451,7 @@ setdisklabel(olp, nlp, openmask, osdep)
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c
index d0395f77af6..a084c728ef7 100644
--- a/sys/arch/amd64/amd64/disksubr.c
+++ b/sys/arch/amd64/amd64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.32 2007/05/29 05:08:19 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.33 2007/05/29 06:28:14 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -316,6 +316,7 @@ done:
bp->b_flags |= B_INVAL;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -362,8 +363,7 @@ setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask,
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/arm/arm/disksubr.c b/sys/arch/arm/arm/disksubr.c
index 818d8e695c5..bf75cf30c28 100644
--- a/sys/arch/arm/arm/disksubr.c
+++ b/sys/arch/arm/arm/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.27 2007/05/29 05:08:19 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.28 2007/05/29 06:28:14 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -292,6 +292,7 @@ done:
bp->b_flags |= B_INVAL;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -340,8 +341,7 @@ setdisklabel(olp, nlp, openmask, osdep)
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/aviion/aviion/disksubr.c b/sys/arch/aviion/aviion/disksubr.c
index 000ff6aa2c1..13cd52806e0 100644
--- a/sys/arch/aviion/aviion/disksubr.c
+++ b/sys/arch/aviion/aviion/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.18 2007/05/29 05:08:19 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.19 2007/05/29 06:28:14 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -292,6 +292,7 @@ done:
bp->b_flags |= B_INVAL;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -340,8 +341,7 @@ setdisklabel(olp, nlp, openmask, osdep)
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c
index 025a2e5b57e..84e8442e8eb 100644
--- a/sys/arch/hp300/hp300/disksubr.c
+++ b/sys/arch/hp300/hp300/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.24 2007/05/29 05:08:19 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.25 2007/05/29 06:28:14 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */
/*
@@ -125,6 +125,7 @@ done:
bp->b_flags = B_INVAL | B_AGE;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -158,8 +159,7 @@ setdisklabel(olp, nlp, openmask, osdep)
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/hppa/hppa/disksubr.c b/sys/arch/hppa/hppa/disksubr.c
index 313649991d2..7b7991dbe33 100644
--- a/sys/arch/hppa/hppa/disksubr.c
+++ b/sys/arch/hppa/hppa/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.48 2007/05/29 05:08:19 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.49 2007/05/29 06:28:15 otto Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -197,6 +197,7 @@ done:
bp->b_flags |= B_INVAL;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -615,8 +616,7 @@ setdisklabel(olp, nlp, openmask, osdep)
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/hppa64/hppa64/disksubr.c b/sys/arch/hppa64/hppa64/disksubr.c
index 60bba818722..678dfee3469 100644
--- a/sys/arch/hppa64/hppa64/disksubr.c
+++ b/sys/arch/hppa64/hppa64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.31 2007/05/29 05:08:19 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.32 2007/05/29 06:28:15 otto Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -193,6 +193,7 @@ done:
bp->b_flags |= B_INVAL;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -611,8 +612,7 @@ setdisklabel(olp, nlp, openmask, osdep)
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c
index ec7e97d05a7..7cb6237ba9a 100644
--- a/sys/arch/i386/i386/disksubr.c
+++ b/sys/arch/i386/i386/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.72 2007/05/29 05:08:20 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.73 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -316,6 +316,7 @@ done:
bp->b_flags |= B_INVAL;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -362,8 +363,7 @@ setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask,
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/landisk/landisk/disksubr.c b/sys/arch/landisk/landisk/disksubr.c
index c176cae4e4a..2ccb0a91e9d 100644
--- a/sys/arch/landisk/landisk/disksubr.c
+++ b/sys/arch/landisk/landisk/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.15 2007/05/29 05:08:20 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.16 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -292,6 +292,7 @@ done:
bp->b_flags |= B_INVAL;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -340,8 +341,7 @@ setdisklabel(olp, nlp, openmask, osdep)
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/luna88k/luna88k/disksubr.c b/sys/arch/luna88k/luna88k/disksubr.c
index 9168329f120..1112ef4a592 100644
--- a/sys/arch/luna88k/luna88k/disksubr.c
+++ b/sys/arch/luna88k/luna88k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.11 2007/05/29 05:08:20 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.12 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.12 2002/02/19 17:09:44 wiz Exp $ */
/*
@@ -208,6 +208,7 @@ done:
bp->b_flags = B_INVAL | B_AGE | B_READ;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -453,8 +454,8 @@ disklabel_om_to_bsd(cp, lp)
* XXX: (Should remove that code from newfs...)
*/
if (npp->p_fstype == FS_BSDFFS) {
- npp->p_fsize = 1024;
- npp->p_frag = 8;
+ npp->p_fragblock =
+ DISKLABELV1_FFS_FRAGBLOCK(1024, 8);
npp->p_cpg = 16;
}
}
diff --git a/sys/arch/mac68k/mac68k/disksubr.c b/sys/arch/mac68k/mac68k/disksubr.c
index 84ec4f989c3..ad775c8b45c 100644
--- a/sys/arch/mac68k/mac68k/disksubr.c
+++ b/sys/arch/mac68k/mac68k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.32 2007/05/29 05:08:20 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.33 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.22 1997/11/26 04:18:20 briggs Exp $ */
/*
@@ -436,6 +436,7 @@ done:
bp->b_flags |= B_INVAL;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -481,8 +482,7 @@ setdisklabel(olp, nlp, openmask, osdep)
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c
index 8b274d31fe2..34ee90539af 100644
--- a/sys/arch/macppc/macppc/disksubr.c
+++ b/sys/arch/macppc/macppc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.37 2007/05/29 05:08:20 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.38 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -381,6 +381,7 @@ done:
bp->b_flags |= B_INVAL;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -427,8 +428,7 @@ setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask,
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/mips64/mips64/disksubr.c b/sys/arch/mips64/mips64/disksubr.c
index f48e84212a2..f191f688e19 100644
--- a/sys/arch/mips64/mips64/disksubr.c
+++ b/sys/arch/mips64/mips64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.37 2007/05/29 05:08:20 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.38 2007/05/29 06:28:15 otto Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -201,6 +201,7 @@ done:
bp->b_flags |= B_INVAL;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -501,8 +502,8 @@ static struct {int m; int b;} maptab[] = {
lp->d_partitions[bsd].p_size = dlp->partitions[i].blocks;
lp->d_partitions[bsd].p_fstype = maptab[i].b;
if (lp->d_partitions[bsd].p_fstype == FS_BSDFFS) {
- lp->d_partitions[bsd].p_fsize = 1024;
- lp->d_partitions[bsd].p_frag = 8;
+ lp->d_partitions[bsd].p_fragblock =
+ DISKLABELV1_FFS_FRAGBLOCK(1024, 8);
lp->d_partitions[bsd].p_cpg = 16;
}
}
@@ -561,8 +562,7 @@ setdisklabel(olp, nlp, openmask, osdep)
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c
index 1dd4d51b7b2..13ceb97c242 100644
--- a/sys/arch/mvme68k/mvme68k/disksubr.c
+++ b/sys/arch/mvme68k/mvme68k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.38 2007/05/29 05:08:20 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.39 2007/05/29 06:28:15 otto Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Dale Rahn.
@@ -147,6 +147,7 @@ done:
bp->b_flags = B_INVAL | B_AGE | B_READ;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -202,8 +203,7 @@ setdisklabel(olp, nlp, openmask, clp)
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c
index 04dbd071675..bd9535d72d7 100644
--- a/sys/arch/mvme88k/mvme88k/disksubr.c
+++ b/sys/arch/mvme88k/mvme88k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.34 2007/05/29 05:08:20 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.35 2007/05/29 06:28:15 otto Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Dale Rahn.
@@ -144,6 +144,7 @@ done:
bp->b_flags = B_INVAL | B_AGE | B_READ;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -199,8 +200,7 @@ setdisklabel(olp, nlp, openmask, clp)
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/mvmeppc/mvmeppc/disksubr.c b/sys/arch/mvmeppc/mvmeppc/disksubr.c
index 0b538400c3a..00d369c3c77 100644
--- a/sys/arch/mvmeppc/mvmeppc/disksubr.c
+++ b/sys/arch/mvmeppc/mvmeppc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.33 2007/05/29 05:08:20 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.34 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -295,6 +295,7 @@ done:
bp->b_flags |= B_INVAL;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -343,8 +344,7 @@ setdisklabel(olp, nlp, openmask, osdep)
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c
index 8d9ceeaf2ac..c8394812869 100644
--- a/sys/arch/sparc/sparc/disksubr.c
+++ b/sys/arch/sparc/sparc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.43 2007/05/29 05:08:20 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.44 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */
/*
@@ -186,6 +186,7 @@ done:
bp->b_flags = B_INVAL | B_AGE | B_READ;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -448,8 +449,8 @@ disklabel_sun_to_bsd(cp, lp)
* The sun label does not store the FFS fields,
* so just set them with default values here.
*/
- npp->p_fsize = 2048;
- npp->p_frag = 8;
+ npp->p_fragblock =
+ DISKLABELV1_FFS_FRAGBLOCK(2048, 8);
npp->p_cpg = 16;
}
}
@@ -481,8 +482,8 @@ disklabel_sun_to_bsd(cp, lp)
}
npp->p_fstype = sun_fstypes[i+8];
if (npp->p_fstype == FS_BSDFFS) {
- npp->p_fsize = 2048;
- npp->p_frag = 8;
+ npp->p_fragblock =
+ DISKLABELV1_FFS_FRAGBLOCK(2048, 8);
npp->p_cpg = 16;
}
}
diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c
index b0b4987106b..162bcb88134 100644
--- a/sys/arch/sparc64/sparc64/disksubr.c
+++ b/sys/arch/sparc64/sparc64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.21 2007/05/29 05:08:20 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.22 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */
/*
@@ -185,6 +185,7 @@ done:
bp->b_flags = B_INVAL | B_AGE | B_READ;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -445,8 +446,8 @@ disklabel_sun_to_bsd(cp, lp)
* The sun label does not store the FFS fields,
* so just set them with default values here.
*/
- npp->p_fsize = 2048;
- npp->p_frag = 8;
+ npp->p_fragblock =
+ DISKLABELV1_FFS_FRAGBLOCK(2048, 8);
npp->p_cpg = 16;
}
}
@@ -478,8 +479,8 @@ disklabel_sun_to_bsd(cp, lp)
}
npp->p_fstype = sun_fstypes[i+8];
if (npp->p_fstype == FS_BSDFFS) {
- npp->p_fsize = 2048;
- npp->p_frag = 8;
+ npp->p_fragblock =
+ DISKLABELV1_FFS_FRAGBLOCK(2048, 8)
npp->p_cpg = 16;
}
}
diff --git a/sys/arch/sparc64/stand/ofwboot/ofdev.c b/sys/arch/sparc64/stand/ofwboot/ofdev.c
index 870e7c347b4..e03f7d7bebc 100644
--- a/sys/arch/sparc64/stand/ofwboot/ofdev.c
+++ b/sys/arch/sparc64/stand/ofwboot/ofdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofdev.c,v 1.8 2006/07/27 20:41:29 deraadt Exp $ */
+/* $OpenBSD: ofdev.c,v 1.9 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: ofdev.c,v 1.1 2000/08/20 14:58:41 mrg Exp $ */
/*
@@ -307,8 +307,8 @@ disklabel_sun_to_bsd(cp, lp)
* The sun label does not store the FFS fields,
* so just set them with default values here.
*/
- npp->p_fsize = 1024;
- npp->p_frag = 8;
+ npp->p_fragblock =
+ DISKLABELV1_FFS_FRAGBLOCK(1024, 8);
npp->p_cpg = 16;
}
}
diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c
index 59aa57f35af..c94fd2c0ff2 100644
--- a/sys/arch/vax/vax/disksubr.c
+++ b/sys/arch/vax/vax/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.34 2007/05/29 05:08:20 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.35 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1999/06/30 18:48:06 ragge Exp $ */
/*
@@ -185,6 +185,7 @@ done:
bp->b_flags = B_INVAL | B_AGE | B_READ;
brelse(bp);
}
+ cvtdisklabelv1(lp);
return (msg);
}
@@ -231,8 +232,7 @@ setdisklabel(olp, nlp, openmask, osdep)
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
+ npp->p_fragblock = opp->p_fragblock;
npp->p_cpg = opp->p_cpg;
}
}
diff --git a/sys/kern/spec_vnops.c b/sys/kern/spec_vnops.c
index 183b66b7fde..f06ee19defe 100644
--- a/sys/kern/spec_vnops.c
+++ b/sys/kern/spec_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spec_vnops.c,v 1.39 2007/04/10 19:02:26 thib Exp $ */
+/* $OpenBSD: spec_vnops.c,v 1.40 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */
/*
@@ -267,10 +267,13 @@ spec_read(v)
if ((majordev = major(vp->v_rdev)) < nblkdev &&
(ioctl = bdevsw[majordev].d_ioctl) != NULL &&
(*ioctl)(vp->v_rdev, DIOCGPART, (caddr_t)&dpart, FREAD, p) == 0) {
- if (dpart.part->p_fstype == FS_BSDFFS &&
- dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
- bsize = dpart.part->p_frag *
- dpart.part->p_fsize;
+ u_int32_t frag =
+ DISKLABELV1_FFS_FRAG(dpart.part->p_fragblock);
+ u_int32_t fsize =
+ DISKLABELV1_FFS_FSIZE(dpart.part->p_fragblock);
+ if (dpart.part->p_fstype == FS_BSDFFS && frag != 0 &&
+ fsize != 0)
+ bsize = frag * fsize;
}
bscale = btodb(bsize);
do {
@@ -363,10 +366,13 @@ spec_write(v)
if ((majordev = major(vp->v_rdev)) < nblkdev &&
(ioctl = bdevsw[majordev].d_ioctl) != NULL &&
(*ioctl)(vp->v_rdev, DIOCGPART, (caddr_t)&dpart, FREAD, p) == 0) {
- if (dpart.part->p_fstype == FS_BSDFFS &&
- dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
- bsize = dpart.part->p_frag *
- dpart.part->p_fsize;
+ u_int32_t frag =
+ DISKLABELV1_FFS_FRAG(dpart.part->p_fragblock);
+ u_int32_t fsize =
+ DISKLABELV1_FFS_FSIZE(dpart.part->p_fragblock);
+ if (dpart.part->p_fstype == FS_BSDFFS && frag != 0 &&
+ fsize != 0)
+ bsize = frag * fsize;
}
bscale = btodb(bsize);
do {
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index b085a719e56..90ca865c6f8 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_disk.c,v 1.42 2007/05/18 16:26:38 drahn Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.43 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
@@ -182,6 +182,31 @@ dkcksum(struct disklabel *lp)
}
/*
+ * Convert an old disklabel to a v1 disklabel
+ */
+void
+cvtdisklabelv1(struct disklabel *lp)
+{
+ int i;
+
+ if (lp->d_version == 1)
+ return;
+
+ lp->d_version = 1;
+ lp->d_secperunith = 0;
+ for (i = 0; i < MAXPARTITIONS; i++) {
+ struct partition *pp = &lp->d_partitions[i];
+ struct __partitionv0 *v0pp = (struct __partitionv0 *)
+ &lp->d_partitions[i];
+
+ pp->p_fragblock = DISKLABELV1_FFS_FRAGBLOCK(v0pp->p_fsize,
+ v0pp->p_frag);
+ pp->p_offseth = 0;
+ pp->p_sizeh = 0;
+ }
+}
+
+/*
* Disk error is the preface to plaintive error messages
* about failing disk transfers. It prints messages of the form
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index 183b66b7fde..f06ee19defe 100644
--- a/sys/miscfs/specfs/spec_vnops.c
+++ b/sys/miscfs/specfs/spec_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spec_vnops.c,v 1.39 2007/04/10 19:02:26 thib Exp $ */
+/* $OpenBSD: spec_vnops.c,v 1.40 2007/05/29 06:28:15 otto Exp $ */
/* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */
/*
@@ -267,10 +267,13 @@ spec_read(v)
if ((majordev = major(vp->v_rdev)) < nblkdev &&
(ioctl = bdevsw[majordev].d_ioctl) != NULL &&
(*ioctl)(vp->v_rdev, DIOCGPART, (caddr_t)&dpart, FREAD, p) == 0) {
- if (dpart.part->p_fstype == FS_BSDFFS &&
- dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
- bsize = dpart.part->p_frag *
- dpart.part->p_fsize;
+ u_int32_t frag =
+ DISKLABELV1_FFS_FRAG(dpart.part->p_fragblock);
+ u_int32_t fsize =
+ DISKLABELV1_FFS_FSIZE(dpart.part->p_fragblock);
+ if (dpart.part->p_fstype == FS_BSDFFS && frag != 0 &&
+ fsize != 0)
+ bsize = frag * fsize;
}
bscale = btodb(bsize);
do {
@@ -363,10 +366,13 @@ spec_write(v)
if ((majordev = major(vp->v_rdev)) < nblkdev &&
(ioctl = bdevsw[majordev].d_ioctl) != NULL &&
(*ioctl)(vp->v_rdev, DIOCGPART, (caddr_t)&dpart, FREAD, p) == 0) {
- if (dpart.part->p_fstype == FS_BSDFFS &&
- dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
- bsize = dpart.part->p_frag *
- dpart.part->p_fsize;
+ u_int32_t frag =
+ DISKLABELV1_FFS_FRAG(dpart.part->p_fragblock);
+ u_int32_t fsize =
+ DISKLABELV1_FFS_FSIZE(dpart.part->p_fragblock);
+ if (dpart.part->p_fstype == FS_BSDFFS && frag != 0 &&
+ fsize != 0)
+ bsize = frag * fsize;
}
bscale = btodb(bsize);
do {
diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h
index a80c265aa10..f7a3e7fbf83 100644
--- a/sys/sys/disklabel.h
+++ b/sys/sys/disklabel.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.h,v 1.28 2006/09/26 23:33:04 krw Exp $ */
+/* $OpenBSD: disklabel.h,v 1.29 2007/05/29 06:28:14 otto Exp $ */
/* $NetBSD: disklabel.h,v 1.41 1996/05/10 23:07:37 mark Exp $ */
/*
@@ -145,7 +145,9 @@ struct disklabel {
u_int32_t d_flags; /* generic flags */
#define NDDATA 5
u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */
-#define NSPARE 5
+ u_int16_t d_secperunith; /* # of data sectors (high part) */
+ u_int16_t d_version; /* version # (1=48 bit addressing) */
+#define NSPARE 4
u_int32_t d_spare[NSPARE]; /* reserved for future use */
u_int32_t d_magic2; /* the magic number (again) */
u_int16_t d_checksum; /* xor of data incl. partitions */
@@ -157,9 +159,10 @@ struct disklabel {
struct partition { /* the partition table */
u_int32_t p_size; /* number of sectors in partition */
u_int32_t p_offset; /* starting sector */
- u_int32_t p_fsize; /* filesystem basic fragment size */
+ u_int16_t p_offseth; /* starting sector (high part) */
+ u_int16_t p_sizeh; /* number of sectors (high part) */
u_int8_t p_fstype; /* filesystem type, see below */
- u_int8_t p_frag; /* filesystem fragments per block */
+ u_int8_t p_fragblock; /* encoded filesystem frag/block */
union {
u_int16_t cpg; /* UFS: FS cylinders per group */
u_int16_t sgs; /* LFS: FS segment shift */
@@ -168,6 +171,20 @@ struct disklabel {
#define p_sgs __partition_u1.sgs
} d_partitions[MAXPARTITIONS]; /* actually may be more */
};
+
+
+struct __partitionv0 { /* the partition table */
+ u_int32_t p_size; /* number of sectors in partition */
+ u_int32_t p_offset; /* starting sector */
+ u_int32_t p_fsize; /* filesystem basic fragment size */
+ u_int8_t p_fstype; /* filesystem type, see below */
+ u_int8_t p_frag; /* filesystem fragments per block */
+ union {
+ u_int16_t cpg; /* UFS: FS cylinders per group */
+ u_int16_t sgs; /* LFS: FS segment shift */
+ } __partitionv0_u1;
+};
+
#else /* _LOCORE */
/*
* offsets for asm boot files.
@@ -181,6 +198,17 @@ struct disklabel {
.set d_end_,404 /* size of disk label */
#endif /* _LOCORE */
+
+#define DISKLABELV1_FFS_FRAGBLOCK(fsize, frag) \
+ ((fsize) * (frag) == 0 ? 0 : \
+ (((ffs((fsize) * (frag)) - 13) << 3) | (ffs(frag))))
+
+#define DISKLABELV1_FFS_BSIZE(i) ((i) == 0 ? 0 : (1 << (((i) >> 3) + 12)))
+#define DISKLABELV1_FFS_FRAG(i) ((i) == 0 ? 0 : (1 << (((i) & 0x07) - 1)))
+#define DISKLABELV1_FFS_FSIZE(i) ((i) == 0 ? 0 : \
+ (DISKLABELV1_FFS_BSIZE(i) / DISKLABELV1_FFS_FRAG(i)))
+
+
/* d_type values: */
#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */
#define DTYPE_MSCP 2 /* MSCP */
@@ -354,6 +382,7 @@ struct partinfo {
void diskerr(struct buf *, char *, char *, int, int, struct disklabel *);
void disksort(struct buf *, struct buf *);
u_int dkcksum(struct disklabel *);
+void cvtdisklabelv1(struct disklabel *);
int setdisklabel(struct disklabel *, struct disklabel *, u_long,
struct cpu_disklabel *);
char *readdisklabel(dev_t, void (*)(struct buf *), struct disklabel *,