From 1450a4555d0533a0ca16df5bc6aa16f8162f91e1 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 12 Feb 2026 21:44:56 +0100 Subject: disk: part_dos: Align dos_partition_t with struct partition The dos_partition_t struct defined in part_dos.h is nearly identical to the struct partition defined in part_efi.h. They differ primarily in how define their starting sector and number of sectors fields. The former uses unsigned char arrays while the latter uses __le32 types. Using __le32 is preferable, as it removes the ambiguity and potential misuse of a raw byte array. This also aligns the structure with how the Linux kernel defines it nowadays, which is the original source of it. To prepare for future consolidation where one of the data structures can be removed, this change aligns both definitions and updates all accessors for dos_partition_t. Signed-off-by: Javier Martinez Canillas Reviewed-by: Tom Rini Reviewed-by: Ilias Apalodimas --- include/part_dos.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/part_dos.h b/include/part_dos.h index 50558224228..92956d53063 100644 --- a/include/part_dos.h +++ b/include/part_dos.h @@ -30,8 +30,8 @@ typedef struct dos_partition { unsigned char end_head; /* end head */ unsigned char end_sector; /* end sector */ unsigned char end_cyl; /* end cylinder */ - unsigned char start4[4]; /* starting sector counting from 0 */ - unsigned char size4[4]; /* nr of sectors in partition */ -} dos_partition_t; + __le32 start_sect; /* starting sector counting from 0 */ + __le32 nr_sects; /* nr of sectors in partition */ +} __packed dos_partition_t; #endif /* _DISK_PART_DOS_H */ -- cgit v1.2.3