summaryrefslogtreecommitdiffstats
path: root/usr.bin/mkimg/gpt.c
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2014-09-23 16:05:23 +0000
committermarcel <marcel@FreeBSD.org>2014-09-23 16:05:23 +0000
commit0eb256ebfd6ec7a8d152bc026d9c3c9b4ba98a8e (patch)
treef0239b9f2c740e07f234bd5513b12512b8429249 /usr.bin/mkimg/gpt.c
parent26cc830ced9db561629daa6804f53a0cc6548c0d (diff)
downloadFreeBSD-src-0eb256ebfd6ec7a8d152bc026d9c3c9b4ba98a8e.zip
FreeBSD-src-0eb256ebfd6ec7a8d152bc026d9c3c9b4ba98a8e.tar.gz
MFC 271881: Fix partition alignment and image rounding when any of
-P (block size), -T (track size) or -H (number of heads) is given. Approved by: re@ (gjb)
Diffstat (limited to 'usr.bin/mkimg/gpt.c')
-rw-r--r--usr.bin/mkimg/gpt.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/usr.bin/mkimg/gpt.c b/usr.bin/mkimg/gpt.c
index 959deb3..5773a6a 100644
--- a/usr.bin/mkimg/gpt.c
+++ b/usr.bin/mkimg/gpt.c
@@ -153,17 +153,15 @@ gpt_tblsz(void)
return ((nparts + ents - 1) / ents);
}
-static u_int
-gpt_metadata(u_int where)
+static lba_t
+gpt_metadata(u_int where, lba_t blk)
{
- u_int secs;
-
- if (where != SCHEME_META_IMG_START && where != SCHEME_META_IMG_END)
- return (0);
- secs = gpt_tblsz();
- secs += (where == SCHEME_META_IMG_START) ? 2 : 1;
- return (secs);
+ if (where == SCHEME_META_IMG_START || where == SCHEME_META_IMG_END) {
+ blk += gpt_tblsz();
+ blk += (where == SCHEME_META_IMG_START) ? 2 : 1;
+ }
+ return (round_block(blk));
}
static int
OpenPOWER on IntegriCloud