linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] block: store GPT attributes as a raw value
@ 2026-09-08 18:58 Vincent Mailhol
  2026-09-10  7:16 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vincent Mailhol @ 2026-09-08 18:58 UTC (permalink / raw)
  To: Davidlohr Bueso, Jens Axboe
  Cc: linux-efi, linux-block, linux-kernel, Vincent Mailhol

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.

Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
 block/partitions/efi.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/block/partitions/efi.h b/block/partitions/efi.h
index 84b9f36b9e47..1f56f93b2804 100644
--- a/block/partitions/efi.h
+++ b/block/partitions/efi.h
@@ -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,
-- 
Vincent Mailhol <mailhol@kernel.org>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND] block: store GPT attributes as a raw value
  2026-09-08 18:58 [PATCH RESEND] block: store GPT attributes as a raw value Vincent Mailhol
@ 2026-09-10  7:16 ` Christoph Hellwig
  2026-09-10 17:30 ` Davidlohr Bueso
  2026-09-10 20:55 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2026-09-10  7:16 UTC (permalink / raw)
  To: Vincent Mailhol
  Cc: Davidlohr Bueso, Jens Axboe, linux-efi, linux-block, linux-kernel

On Tue, Sep 08, 2026 at 08:58:26PM +0200, Vincent Mailhol wrote:
> 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.

This is much better.  If we ever need to interpret it swe should use
le64_to_cpu and masking/shifting anyway.

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND] block: store GPT attributes as a raw value
  2026-09-08 18:58 [PATCH RESEND] block: store GPT attributes as a raw value Vincent Mailhol
  2026-09-10  7:16 ` Christoph Hellwig
@ 2026-09-10 17:30 ` Davidlohr Bueso
  2026-09-10 20:55 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Davidlohr Bueso @ 2026-09-10 17:30 UTC (permalink / raw)
  To: Vincent Mailhol; +Cc: Jens Axboe, linux-efi, linux-block, linux-kernel

On 2026-09-08 11:58, Vincent Mailhol wrote:
> 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.
> 
> Signed-off-by: Vincent Mailhol <mailhol@kernel.org>

Acked-by: Davidlohr Bueso <dave@stgolabs.net>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND] block: store GPT attributes as a raw value
  2026-09-08 18:58 [PATCH RESEND] block: store GPT attributes as a raw value Vincent Mailhol
  2026-09-10  7:16 ` Christoph Hellwig
  2026-09-10 17:30 ` Davidlohr Bueso
@ 2026-09-10 20:55 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2026-09-10 20:55 UTC (permalink / raw)
  To: Davidlohr Bueso, Vincent Mailhol; +Cc: linux-efi, linux-block, linux-kernel


On Tue, 08 Sep 2026 20:58:26 +0200, Vincent Mailhol wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] block: store GPT attributes as a raw value
      commit: 74ea55a6ecb3fd69b47b2b8a6f6979a6c79c7ce7

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-10 20:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08 18:58 [PATCH RESEND] block: store GPT attributes as a raw value Vincent Mailhol
2026-09-10  7:16 ` Christoph Hellwig
2026-09-10 17:30 ` Davidlohr Bueso
2026-09-10 20:55 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).