diff options
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 |