block: store GPT attributes as a raw value
Subsystems (3)
PATCH RESEND 1/1 block: store GPT attributes as a raw value
struct _gpt_entry_attributes currently models the GPT partition entry attributes field with bitfields. This is broken on machines using the __BIG_ENDIAN_BITFIELD ABI because GPT always stores the attributes on disk as a 64-bit little-endian.
No current code consumes individual fields from that structure. So just remove struct _gpt_entry_attributes entirely and replace it by an __le64 value in struct _gpt_entry instead. This lets users apply endian-aware masks explicitly when inspecting attribute bits.
--- block/partitions/efi.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
block/partitions/efi.h +1 -7
@@ -75,18 +75,12 @@ typedef struct _gpt_header {*/ }__packed gpt_header; -typedef struct _gpt_entry_attributes { -u64 required_to_function:1 ; -u64 reserved:47 ; -u64 type_guid_specific:16 ; -} __packed gpt_entry_attributes; -typedef struct _gpt_entry {efi_guid_t partition_type_guid;efi_guid_t unique_partition_guid;__le64 starting_lba;__le64 ending_lba; -gpt_entry_attributes attributes; +__le64 attributes;__le16 partition_name[72 /sizeof (__le16)]; } __packed gpt_entry;
---
base-commit: 1590cf0329716306e948a8fc29f1d3ee87d3989f
change-id: 20260724-fix_gpt_entry_attributes-e5af9e080ce1
Best regards,
Signature · 1 line
Vincent Mailhol <[email protected]>
Quoted 9 lines · Vincent Mailhol
struct
_gpt_entry_attributescurrently models the GPT partition entry attributes field with bitfields. This is broken on machines using the__BIG_ENDIAN_BITFIELDABI because GPT always stores the attributes on disk as a 64-bit little-endian.No current code consumes individual fields from that structure. So just remove struct
_gpt_entry_attributesentirely and replace it by an__le64value in struct_gpt_entryinstead. This lets users apply endian-aware masks explicitly when inspecting attribute bits.
This is much better. If we ever need to interpret it swe should use le64_to_cpu and masking/shifting anyway.
Quoted 11 lines · Vincent Mailhol
struct
_gpt_entry_attributescurrently models the GPT partition entry attributes field with bitfields. This is broken on machines using the__BIG_ENDIAN_BITFIELDABI because GPT always stores the attributes on disk as a 64-bit little-endian.No current code consumes individual fields from that structure. So just remove struct
_gpt_entry_attributesentirely and replace it by an__le64value in struct_gpt_entryinstead. This lets users apply endian-aware masks explicitly when inspecting attribute bits.Signed-off-by Vincent Mailhol <[email protected]>
Quoted 11 lines · Vincent Mailhol
struct
_gpt_entry_attributescurrently models the GPT partition entry attributes field with bitfields. This is broken on machines using the__BIG_ENDIAN_BITFIELDABI because GPT always stores the attributes on disk as a 64-bit little-endian.No current code consumes individual fields from that structure. So just remove struct
_gpt_entry_attributesentirely and replace it by an__le64value in struct_gpt_entryinstead. This lets users apply endian-aware masks explicitly when inspecting attribute bits.[...]
Applied, thanks!
[1/1] block: store GPT attributes as a raw value
commit: 74ea55a6ecb3fd69b47b2b8a6f6979a6c79c7ce7
Best regards,
Signature · 1 line
Jens Axboe