diff options
author | 2007-05-29 06:28:14 +0000 | |
---|---|---|
committer | 2007-05-29 06:28:14 +0000 | |
commit | ddfcbf38c8ab6225a6b172d829aa957007d2587f (patch) | |
tree | c5f4d21233850402b96caaad6159a790e2ebac70 /sys/kern/subr_disk.c | |
parent | tweaks; help/ok cnst (diff) | |
download | wireguard-openbsd-ddfcbf38c8ab6225a6b172d829aa957007d2587f.tar.xz wireguard-openbsd-ddfcbf38c8ab6225a6b172d829aa957007d2587f.zip |
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 'sys/kern/subr_disk.c')
-rw-r--r-- | sys/kern/subr_disk.c | 27 |
1 files changed, 26 insertions, 1 deletions
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 |