U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm@redhat.com>
To: u-boot@lists.denx.de
Cc: eballetb@redhat.com, alexl@redhat.com,
	Javier Martinez Canillas <javierm@redhat.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Tom Rini <trini@konsulko.com>
Subject: [PATCH 3/5] disk: part_efi: Remove redundant struct partition definition
Date: Tue, 20 Jan 2026 14:36:12 +0100	[thread overview]
Message-ID: <20260120133630.1695055-4-javierm@redhat.com> (raw)
In-Reply-To: <20260120133630.1695055-1-javierm@redhat.com>

Now that dos_partition_t and struct partition are identical the duplicated
data structure definition in the part_efi.h header can just be removed.

This results in a single, shared definition for MBR partition table
entries, instead of having the same definition in two different places.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---

 disk/part_efi.c    |  4 ++--
 include/part_efi.h | 19 +++----------------
 2 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index fb1ed534f861..d8b17ec2e91a 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -51,7 +51,7 @@ static inline u32 efi_crc32(const void *buf, u32 len)
  * Private function prototypes
  */
 
-static int pmbr_part_valid(struct partition *part);
+static int pmbr_part_valid(dos_partition_t *part);
 static int is_pmbr_valid(legacy_mbr * mbr);
 static int is_gpt_valid(struct blk_desc *desc, u64 lba, gpt_header *pgpt_head,
 			gpt_entry **pgpt_pte);
@@ -990,7 +990,7 @@ int write_mbr_and_gpt_partitions(struct blk_desc *desc, void *buf)
  *
  * Returns: 1 if EFI GPT partition type is found.
  */
-static int pmbr_part_valid(struct partition *part)
+static int pmbr_part_valid(dos_partition_t *part)
 {
 	if (part->sys_ind == EFI_PMBR_OSTYPE_EFI_GPT &&
 		get_unaligned_le32(&part->start_sect) == 1UL) {
diff --git a/include/part_efi.h b/include/part_efi.h
index fb402df6f13e..2cea50880465 100644
--- a/include/part_efi.h
+++ b/include/part_efi.h
@@ -18,6 +18,7 @@
 #define _DISK_PART_EFI_H
 
 #include <efi.h>
+#include <part_dos.h>
 
 #define MSDOS_MBR_SIGNATURE 0xAA55
 #define MSDOS_MBR_BOOT_CODE_SIZE 440
@@ -77,20 +78,6 @@
 /* linux/include/efi.h */
 typedef u16 efi_char16_t;
 
-/* based on linux/include/genhd.h */
-struct partition {
-	u8 boot_ind;		/* 0x80 - active */
-	u8 head;		/* starting head */
-	u8 sector;		/* starting sector */
-	u8 cyl;			/* starting cylinder */
-	u8 sys_ind;		/* What partition type */
-	u8 end_head;		/* end head */
-	u8 end_sector;		/* end sector */
-	u8 end_cyl;		/* end cylinder */
-	__le32 start_sect;	/* starting sector counting from 0 */
-	__le32 nr_sects;	/* nr of sectors in partition */
-} __packed;
-
 /* based on linux/fs/partitions/efi.h */
 typedef struct _gpt_header {
 	__le64 signature;
@@ -134,7 +121,7 @@ typedef struct _legacy_mbr {
 	u8 boot_code[MSDOS_MBR_BOOT_CODE_SIZE];
 	__le32 unique_mbr_signature;
 	__le16 unknown;
-	struct partition partition_record[4];
+	dos_partition_t partition_record[4];
 	__le16 signature;
 } __packed legacy_mbr;
 
@@ -153,7 +140,7 @@ struct efi_partition_info {
 	u8 system;
 	u8 reserved[7];
 	union {
-		struct partition mbr;
+		dos_partition_t mbr;
 		gpt_entry gpt;
 	} info;
 } __packed;
-- 
2.52.0


  parent reply	other threads:[~2026-01-20 13:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 13:36 [PATCH 0/5] efi_loader: disk: Add EFI_PARTITION_INFO_PROTOCOL support for MBR Javier Martinez Canillas
2026-01-20 13:36 ` [PATCH 1/5] disk: part_dos: Move header to the main include directory Javier Martinez Canillas
2026-01-20 14:34   ` Tom Rini
2026-01-20 13:36 ` [PATCH 2/5] disk: part_dos: Align dos_partition_t with struct partition Javier Martinez Canillas
2026-01-20 14:35   ` Tom Rini
2026-01-20 13:36 ` Javier Martinez Canillas [this message]
2026-01-20 14:37   ` [PATCH 3/5] disk: part_efi: Remove redundant struct partition definition Tom Rini
2026-01-20 13:36 ` [PATCH 4/5] efi_loader: disk: Extend EFI_PARTITION_INFO_PROTOCOL to support MBR Javier Martinez Canillas
2026-01-20 14:53   ` Heinrich Schuchardt
2026-01-21  9:25     ` Javier Martinez Canillas
2026-01-20 17:39   ` Jan Kiszka
2026-01-21  9:28     ` Javier Martinez Canillas
2026-01-22  8:54       ` Jan Kiszka
2026-01-20 13:36 ` [PATCH 5/5] efi_selftest: Enhance MBR test for PARTITION_INFO_PROTOCOL Javier Martinez Canillas
2026-01-20 14:56   ` Heinrich Schuchardt
2026-01-21  9:28     ` Javier Martinez Canillas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260120133630.1695055-4-javierm@redhat.com \
    --to=javierm@redhat.com \
    --cc=alexl@redhat.com \
    --cc=eballetb@redhat.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox