diff mbox series

[v3,2/6] disk: dos: add some defines for the hardcoded numbers

Message ID 20201223125515.28865-3-m.szyprowski@samsung.com
State Accepted
Commit 80bd05f27fb4e26e765cfb5bde43166a48c218e1
Headers show
Series Add MBR partition table creation and verify command | expand

Commit Message

Marek Szyprowski Dec. 23, 2020, 12:55 p.m. UTC
Add some handy defines for some hardcoded magic numbers related to
extended partition handling.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

---
 disk/part_dos.c | 6 +++---
 disk/part_dos.h | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

-- 
2.17.1

Comments

Tom Rini Jan. 16, 2021, 4:25 p.m. UTC | #1
On Wed, Dec 23, 2020 at 01:55:11PM +0100, Marek Szyprowski wrote:

> Add some handy defines for some hardcoded magic numbers related to

> extended partition handling.

> 

> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>


Applied to u-boot/master, thanks!

-- 
Tom
diff mbox series

Patch

diff --git a/disk/part_dos.c b/disk/part_dos.c
index ef706fb59c..20d35dc9cd 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -42,9 +42,9 @@  static inline unsigned int le32_to_int(unsigned char *le32)
 
 static inline int is_extended(int part_type)
 {
-    return (part_type == 0x5 ||
-	    part_type == 0xf ||
-	    part_type == 0x85);
+    return (part_type == DOS_PART_TYPE_EXTENDED ||
+	    part_type == DOS_PART_TYPE_EXTENDED_LBA ||
+	    part_type == DOS_PART_TYPE_EXTENDED_LINUX);
 }
 
 static int get_bootable(dos_partition_t *p)
diff --git a/disk/part_dos.h b/disk/part_dos.h
index 434b021ae8..dd909a9317 100644
--- a/disk/part_dos.h
+++ b/disk/part_dos.h
@@ -15,6 +15,9 @@ 
 #define DOS_PBR_MEDIA_TYPE_OFFSET	0x15
 #define DOS_MBR	0
 #define DOS_PBR	1
+#define DOS_PART_TYPE_EXTENDED		0x05
+#define DOS_PART_TYPE_EXTENDED_LBA	0x0F
+#define DOS_PART_TYPE_EXTENDED_LINUX	0x85
 
 typedef struct dos_partition {
 	unsigned char boot_ind;		/* 0x80 - active			*/