Date: Fri, 21 Mar 2014 04:14:26 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r263462 - user/marcel/mkimg Message-ID: <201403210414.s2L4EQQF098731@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403210414.s2L4EQQF098731>