diff options
author | 2007-05-29 06:28:14 +0000 | |
---|---|---|
committer | 2007-05-29 06:28:14 +0000 | |
commit | ddfcbf38c8ab6225a6b172d829aa957007d2587f (patch) | |
tree | c5f4d21233850402b96caaad6159a790e2ebac70 /lib/libc | |
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 'lib/libc')
-rw-r--r-- | lib/libc/gen/disklabel.c | 12 |
1 files changed, 7 insertions, 5 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) |