path: root/sys/sys/gpt.h
diff options
authorMarcel Moolenaar <marcel@FreeBSD.org>2002-05-31 01:07:13 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2002-05-31 01:07:13 +0000
commit78dff92b6b014e78b6bed92f32007e3437f1dc6d (patch)
tree91e3e16ada3b35d13ddc7d48fbe26b5d706984de /sys/sys/gpt.h
parent806968d6a721cc982fb07ccc861e8a54c01a21db (diff)
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
Notes: svn path=/head/; revision=97644
Diffstat (limited to 'sys/sys/gpt.h')
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/sys/gpt.h b/sys/sys/gpt.h
index 95a6cda8c011..e95253421126 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 {