svn commit: r263462 - user/marcel/mkimg
Marcel Moolenaar
marcel at FreeBSD.org
Fri Mar 21 04:14:26 UTC 2014
Author: marcel
Date: Fri Mar 21 04:14:26 2014
New Revision: 263462
URL: http://svnweb.freebsd.org/changeset/base/263462
Log:
Fix writing GPT:
1. Fix copy-paste bug that resulted in not sizing the image correctly
for the secondary header and table.
2. The hdr_lba_end field in the header is the LBA of the last usable
sector, not the one after it.
While here, fix a white-space nit.
Modified:
user/marcel/mkimg/gpt.c
Modified: user/marcel/mkimg/gpt.c
==============================================================================
--- user/marcel/mkimg/gpt.c Fri Mar 21 03:27:42 2014 (r263461)
+++ user/marcel/mkimg/gpt.c Fri Mar 21 04:14:26 2014 (r263462)
@@ -121,7 +121,7 @@ gpt_metadata(u_int where, u_int parts, u
{
u_int secs;
- if (where != SCHEME_META_IMG_START && where != SCHEME_META_IMG_START)
+ if (where != SCHEME_META_IMG_START && where != SCHEME_META_IMG_END)
return (0);
secs = gpt_tblsz(parts, secsz);
@@ -243,7 +243,7 @@ gpt_write(int fd, off_t imgsz, u_int par
hdr->hdr_revision = GPT_HDR_REVISION;
hdr->hdr_size = offsetof(struct gpt_hdr, padding);
hdr->hdr_lba_start = 2 + tblsz;
- hdr->hdr_lba_end = nblocks - tblsz - 1;
+ hdr->hdr_lba_end = nblocks - tblsz - 2;
uuidgen(&hdr->hdr_uuid, 1);
hdr->hdr_entries = parts;
hdr->hdr_entsz = sizeof(struct gpt_ent);
@@ -251,7 +251,7 @@ gpt_write(int fd, off_t imgsz, u_int par
error = gpt_write_hdr(fd, hdr, 1, nblocks - 1, 2, secsz);
if (!error)
error = gpt_write_hdr(fd, hdr, nblocks - 1, 1,
- nblocks - tblsz -1, secsz);
+ nblocks - tblsz - 1, secsz);
free(hdr);
out:
More information about the svn-src-user
mailing list