summaryrefslogtreecommitdiffstats
path: root/sys/sys/gpt.h
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2002-05-31 01:07:13 +0000
committermarcel <marcel@FreeBSD.org>2002-05-31 01:07:13 +0000
commit8d5d2e362e96119a0faffb6eec2dd041e7cc4609 (patch)
tree91e3e16ada3b35d13ddc7d48fbe26b5d706984de /sys/sys/gpt.h
parent2040c65febf86fee6bb39ab232d0255e46c8dfe2 (diff)
downloadFreeBSD-src-8d5d2e362e96119a0faffb6eec2dd041e7cc4609.zip
FreeBSD-src-8d5d2e362e96119a0faffb6eec2dd041e7cc4609.tar.gz
Don't use an incomplete array type to mark the start of the padding
because the padding should be inserted before the array and not after it, as is done by GCC 3.1. Instead use an explicit uint32_t field to get what was intended and on top of that make the size of the padding explicit. This also doesn't depend on a C99 feature. While here, expand the comment. Just to make a point. Pointed out by: fanf
Diffstat (limited to 'sys/sys/gpt.h')
-rw-r--r--sys/sys/gpt.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/sys/gpt.h b/sys/sys/gpt.h
index 95a6cda..e952534 100644
--- a/sys/sys/gpt.h
+++ b/sys/sys/gpt.h
@@ -46,7 +46,14 @@ struct gpt_hdr {
uint32_t hdr_entries;
uint32_t hdr_entsz;
uint32_t hdr_crc_table;
- char padding[]; /* XXX: struct not a multiple of 8. */
+ /*
+ * The header as defined in the EFI spec is not a multiple of 8 bytes
+ * and given that the alignment requirement is on an 8 byte boundary,
+ * padding will happen. We make the padding explicit so that we can
+ * correct the value returned by sizeof() when we put the size of the
+ * header in field hdr_size, or otherwise use offsetof().
+ */
+ uint32_t padding;
};
struct gpt_ent {
OpenPOWER on IntegriCloud