Fix 'mbr' command with hybrid MBR/GPT
PATCH 2/2 cmd: mbr: Force DOS driver to be used for verify
In reply to Joshua WattForces the DOS partition type driver to be used when verifying the MBR. This is particularly useful when using a hybrid MBR & GPT layout as otherwise MBR verification would mostly likely fail since the GPT partitions will be returned, even if the MBR is actually valid.
--- cmd/mbr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/mbr.c +1 -1
@@ -244,7 +244,7 @@ static int do_verify_mbr(struct blk_desc *dev, const char *str)for (i =0 ; i < count; i++) {struct disk_partition p; -if (part_get_info (dev, i +1 , &p)) +if (part_get_info_by_type (dev, i +1 ,PART_TYPE_DOS , &p)) goto fail; if ((partitions[i].size && p.size != partitions[i].size) ||
Signature · 1 line
2.33.0
PATCH 1/2 disk: part: Add API to get partitions with specific driver
In reply to Joshua WattAdds part_driver_get_type() API which can be used to force a specific driver to be used when getting partition information instead of relying on auto detection.
--- disk/part.c | 38 +++++++++++++++++++++++++++++++------- include/part.h | 2 ++ 2 files changed, 33 insertions(+), 7 deletions(-)
disk/part.c +31 -7
@@ -26,6 +26,22 @@/* Check all partition types */ #define PART_TYPE_ALL -1 +static struct part_driver *part_driver_get_type (int part_type) +{ +struct part_driver *drv = + ll_entry_start(struct part_driver, part_driver); + const int n_ents = ll_entry_count(struct part_driver, part_driver); +struct part_driver *entry; + +for (entry = drv; entry != drv + n_ents; entry++) { +if (part_type == entry->part_type) +return entry; + } + +/* Not found */ +return NULL ; +} +static struct part_driver *part_driver_lookup_type (struct blk_desc *dev_desc) { struct part_driver *drv =
@@ -44,10 +60,7 @@ static struct part_driver *part_driver_lookup_type(struct blk_desc *dev_desc) } } }else { -for (entry = drv; entry != drv + n_ents; entry++) { -if (dev_desc->part_type == entry->part_type) -return entry; - } +return part_driver_get_type (dev_desc->part_type); }/* Not found */
@@ -306,8 +319,8 @@ void part_print(struct blk_desc *dev_desc) drv->int part_get_info (struct blk_desc *dev_desc,int part, -struct disk_partition *info) +int part_get_info_by_type (struct blk_desc *dev_desc,int part,int part_type, +struct disk_partition *info) {struct part_driver *drv;
@@ -320,7 +333,12 @@ int part_get_info(struct blk_desc *dev_desc, int part, info->type_guid[0 ] =0 ;#endif - drv =part_driver_lookup_type (dev_desc); +if (part_type ==PART_TYPE_UNKNOWN ) { + drv =part_driver_lookup_type (dev_desc); + }else { + drv =part_driver_get_type (part_type); + } +if (!drv) {debug ("## Unknown partition table type %x\n" , dev_desc->part_type);
@@ -340,6 +358,12 @@ int part_get_info(struct blk_desc *dev_desc, int part,return -ENOENT ; } +int part_get_info (struct blk_desc *dev_desc,int part, +struct disk_partition *info) +{ +return part_get_info_by_type (dev_desc, part,PART_TYPE_UNKNOWN , info); +} +int part_get_info_whole_disk (struct blk_desc *dev_desc,struct disk_partition *info) {
include/part.h +2 -0
@@ -106,6 +106,8 @@ struct blk_desc *blk_get_dev(const char *ifname, int dev);struct blk_desc *mg_disk_get_dev (int dev);/* disk/part.c */ +int part_get_info_by_type (struct blk_desc *dev_desc,int part,int part_type, +struct disk_partition *info);int part_get_info (struct blk_desc *dev_desc,int part,struct disk_partition *info);/**
Signature · 1 line
2.33.0
cover Fix 'mbr' command with hybrid MBR/GPT
When dealing with a hybrid MBR/GPT partition table, the 'mbr' command would misbehave because it was reading the GPT partitions instead of reading from the MBR when verifying. Fix this by forcing 'mbr verify' to read MBR partitions.
Joshua Watt (2):
disk: part: Add API to get partitions with specific driver
cmd: mbr: Force DOS driver to be used for verify
cmd/mbr.c | 2 +- disk/part.c | 38 +++++++++++++++++++++++++++++++------- include/part.h | 2 ++ 3 files changed, 34 insertions(+), 8 deletions(-)
Signature · 1 line
2.33.0
Re: [PATCH 1/2] disk: part: Add API to get partitions with specific driver
In reply to Joshua WattHi Joshua,
Quoted 93 lines · Joshua Watt
Adds
part_driver_get_type()API which can be used to force a specific driver to be used when getting partition information instead of relying on auto detection.Signed-off-by Joshua Watt <[email protected]>--- disk/part.c | 38 +++++++++++++++++++++++++++++++------- include/part.h | 2 ++ 2 files changed, 33 insertions(+), 7 deletions(-)disk/part.c +31
-7@@ -26,6 +26,22 @@/* Check all partition types */ #define PART_TYPE_ALL -1 +static struct part_driver *part_driver_get_type (int part_type) +{ +struct part_driver *drv = + ll_entry_start(struct part_driver, part_driver); + const int n_ents = ll_entry_count(struct part_driver, part_driver); +struct part_driver *entry; + +for (entry = drv; entry != drv + n_ents; entry++) { +if (part_type == entry->part_type) +return entry; + } + +/* Not found */ +return NULL ; +} +static struct part_driver *part_driver_lookup_type (struct blk_desc *dev_desc) { struct part_driver *drv =@@ -44,10 +60,7 @@ static struct part_driver *part_driver_lookup_type(struct blk_desc *dev_desc) } } }else { -for (entry = drv; entry != drv + n_ents; entry++) { -if (dev_desc->part_type == entry->part_type) -return entry; - } +return part_driver_get_type (dev_desc->part_type); }/* Not found */ @@ -306,8 +319,8 @@ void part_print(struct blk_desc *dev_desc) drv->int part_get_info (struct blk_desc *dev_desc,int part, -struct disk_partition *info) +int part_get_info_by_type (struct blk_desc *dev_desc,int part,int part_type, +struct disk_partition *info) {struct part_driver *drv;@@ -320,7 +333,12 @@ int part_get_info(struct blk_desc *dev_desc, int part, info->type_guid[0 ] =0 ;#endif - drv =part_driver_lookup_type (dev_desc); +if (part_type ==PART_TYPE_UNKNOWN ) { + drv =part_driver_lookup_type (dev_desc); + }else { + drv =part_driver_get_type (part_type); + } +if (!drv) {debug ("## Unknown partition table type %x\n" , dev_desc->part_type);@@ -340,6 +358,12 @@ int part_get_info(struct blk_desc *dev_desc, int part,return -ENOENT ; } +int part_get_info (struct blk_desc *dev_desc,int part, +struct disk_partition *info) +{ +return part_get_info_by_type (dev_desc, part,PART_TYPE_UNKNOWN , info); +} +int part_get_info_whole_disk (struct blk_desc *dev_desc,struct disk_partition *info) {include/part.h +0
-0
include/part.h struct blk_desc *blk_get_dev(const char *ifname, int dev); · line 110
Quoted 5 lines
include/part.h +2
-0@@ -106,6 +106,8 @@ struct blk_desc *blk_get_dev(const char *ifname, int dev);struct blk_desc *mg_disk_get_dev (int dev);/* disk/part.c */ +int part_get_info_by_type (struct blk_desc *dev_desc,int part,int part_type, +struct disk_partition *info);
Please can you add a full comment?
Also please add a test to test/dm/part.c for your new function[1]
Quoted 6 lines
include/part.h +0
-1int part_get_info (struct blk_desc *dev_desc,int part,struct disk_partition *info);/** -- 2.33.0
Regards,
Simon
Re: [PATCH 1/2] disk: part: Add API to get partitions with specific driver
Quoted 99 lines · Simon Glass
Hi Joshua,
Quoted 95 lines · Joshua Watt
Adds
part_driver_get_type()API which can be used to force a specific driver to be used when getting partition information instead of relying on auto detection.Signed-off-by Joshua Watt <[email protected]>--- disk/part.c | 38 +++++++++++++++++++++++++++++++------- include/part.h | 2 ++ 2 files changed, 33 insertions(+), 7 deletions(-)disk/part.c +31
-7@@ -26,6 +26,22 @@/* Check all partition types */ #define PART_TYPE_ALL -1 +static struct part_driver *part_driver_get_type (int part_type) +{ +struct part_driver *drv = + ll_entry_start(struct part_driver, part_driver); + const int n_ents = ll_entry_count(struct part_driver, part_driver); +struct part_driver *entry; + +for (entry = drv; entry != drv + n_ents; entry++) { +if (part_type == entry->part_type) +return entry; + } + +/* Not found */ +return NULL ; +} +static struct part_driver *part_driver_lookup_type (struct blk_desc *dev_desc) { struct part_driver *drv =@@ -44,10 +60,7 @@ static struct part_driver *part_driver_lookup_type(struct blk_desc *dev_desc) } } }else { -for (entry = drv; entry != drv + n_ents; entry++) { -if (dev_desc->part_type == entry->part_type) -return entry; - } +return part_driver_get_type (dev_desc->part_type); }/* Not found */ @@ -306,8 +319,8 @@ void part_print(struct blk_desc *dev_desc) drv->int part_get_info (struct blk_desc *dev_desc,int part, -struct disk_partition *info) +int part_get_info_by_type (struct blk_desc *dev_desc,int part,int part_type, +struct disk_partition *info) {struct part_driver *drv;@@ -320,7 +333,12 @@ int part_get_info(struct blk_desc *dev_desc, int part, info->type_guid[0 ] =0 ;#endif - drv =part_driver_lookup_type (dev_desc); +if (part_type ==PART_TYPE_UNKNOWN ) { + drv =part_driver_lookup_type (dev_desc); + }else { + drv =part_driver_get_type (part_type); + } +if (!drv) {debug ("## Unknown partition table type %x\n" , dev_desc->part_type);@@ -340,6 +358,12 @@ int part_get_info(struct blk_desc *dev_desc, int part,return -ENOENT ; } +int part_get_info (struct blk_desc *dev_desc,int part, +struct disk_partition *info) +{ +return part_get_info_by_type (dev_desc, part,PART_TYPE_UNKNOWN , info); +} +int part_get_info_whole_disk (struct blk_desc *dev_desc,struct disk_partition *info) {include/part.h +0
-0@@ -106,6 +106,8 @@ struct blk_desc *blk_get_dev(const char *ifname, int dev);struct blk_desc *mg_disk_get_dev (int dev);
Quoted 7 lines
include/part.h struct blk_desc *blk_get_dev(const char *ifname, int dev); · line 110
Quoted 3 lines
include/part.h +2
-0/* disk/part.c */ +int part_get_info_by_type (struct blk_desc *dev_desc,int part,int part_type, +struct disk_partition *info);Please can you add a full comment?
Also please add a test to
test/dm/part.cfor your new function[1]
Any trick to getting the current test/dm/part.c tests to pass? When I run them they fail with ** No device specified ** errors, which doesn't give me hope that I can write tests that I could actually run locally.
Quoted 10 lines
Quoted 7 lines
include/part.h +0
-1int part_get_info (struct blk_desc *dev_desc,int part,struct disk_partition *info);/** -- 2.33.0
Regards,
Simon
Re: [PATCH 1/2] disk: part: Add API to get partitions with specific driver
Hi Joshua,
Quoted 107 lines · Joshua Watt
Quoted 105 lines · Simon Glass
Hi Joshua,
Quoted 93 lines · Joshua Watt
Adds
part_driver_get_type()API which can be used to force a specific driver to be used when getting partition information instead of relying on auto detection.Signed-off-by Joshua Watt <[email protected]>--- disk/part.c | 38 +++++++++++++++++++++++++++++++------- include/part.h | 2 ++ 2 files changed, 33 insertions(+), 7 deletions(-)disk/part.c +31
-7@@ -26,6 +26,22 @@/* Check all partition types */ #define PART_TYPE_ALL -1 +static struct part_driver *part_driver_get_type (int part_type) +{ +struct part_driver *drv = + ll_entry_start(struct part_driver, part_driver); + const int n_ents = ll_entry_count(struct part_driver, part_driver); +struct part_driver *entry; + +for (entry = drv; entry != drv + n_ents; entry++) { +if (part_type == entry->part_type) +return entry; + } + +/* Not found */ +return NULL ; +} +static struct part_driver *part_driver_lookup_type (struct blk_desc *dev_desc) { struct part_driver *drv =@@ -44,10 +60,7 @@ static struct part_driver *part_driver_lookup_type(struct blk_desc *dev_desc) } } }else { -for (entry = drv; entry != drv + n_ents; entry++) { -if (dev_desc->part_type == entry->part_type) -return entry; - } +return part_driver_get_type (dev_desc->part_type); }/* Not found */ @@ -306,8 +319,8 @@ void part_print(struct blk_desc *dev_desc) drv->int part_get_info (struct blk_desc *dev_desc,int part, -struct disk_partition *info) +int part_get_info_by_type (struct blk_desc *dev_desc,int part,int part_type, +struct disk_partition *info) {struct part_driver *drv;@@ -320,7 +333,12 @@ int part_get_info(struct blk_desc *dev_desc, int part, info->type_guid[0 ] =0 ;#endif - drv =part_driver_lookup_type (dev_desc); +if (part_type ==PART_TYPE_UNKNOWN ) { + drv =part_driver_lookup_type (dev_desc); + }else { + drv =part_driver_get_type (part_type); + } +if (!drv) {debug ("## Unknown partition table type %x\n" , dev_desc->part_type);@@ -340,6 +358,12 @@ int part_get_info(struct blk_desc *dev_desc, int part,return -ENOENT ; } +int part_get_info (struct blk_desc *dev_desc,int part, +struct disk_partition *info) +{ +return part_get_info_by_type (dev_desc, part,PART_TYPE_UNKNOWN , info); +} +int part_get_info_whole_disk (struct blk_desc *dev_desc,struct disk_partition *info) {include/part.h +0
-0include/part.h struct blk_desc *blk_get_dev(const char *ifname, int dev); · line 110
Quoted 5 lines
include/part.h +2
-0@@ -106,6 +106,8 @@ struct blk_desc *blk_get_dev(const char *ifname, int dev);struct blk_desc *mg_disk_get_dev (int dev);/* disk/part.c */ +int part_get_info_by_type (struct blk_desc *dev_desc,int part,int part_type, +struct disk_partition *info);Please can you add a full comment?
Quoted 6 lines
Quoted 1 line
Also please add a test to
test/dm/part.cfor your new function[1]Any trick to getting the current
test/dm/part.ctests to pass? When I run them they fail with** No device specified **errors, which doesn't give me hope that I can write tests that I could actually run locally.
Yes you probably need to run the ''test_ut_dm_init_bootstd' test first. This pytest is run automatically if you run everything, but otherwise is not. It sets up the mmc1.img file.
Regards,
Simon
v2 cover Fix 'mbr' command with hybrid MBR/GPT
In reply to Joshua WattWhen dealing with a hybrid MBR/GPT partition table, the 'mbr' command would misbehave because it was reading the GPT partitions instead of reading from the MBR when verifying. Fix this by forcing 'mbr verify' to read MBR partitions.
V2: Fixed up dm_test_part tests and added tests for new API
Joshua Watt (5):
dm: test: Fix partition test to use mmc2
dm: test: Improve partition test error output
disk: part: Add API to get partitions with specific driver
dm: test: Add test for part_get_info_by_type
cmd: mbr: Force DOS driver to be used for verify
cmd/mbr.c | 2 +- configs/sandbox_defconfig | 2 + disk/part.c | 38 ++++++++++--- include/part.h | 19 ++++++- test/dm/part.c | 115 +++++++++++++++++++++++++++++++++----- 5 files changed, 154 insertions(+), 22 deletions(-)
Signature · 1 line
2.33.0
PATCH v2 1/5 dm: test: Fix partition test to use mmc2
d94d9844bc ("dm: part: Update test to use mmc2") attempted to make the test use mmc2, but the change was incomplete in that it didn't also change the strings that reference a specific partition. Fix these so that the test passes again
--- test/dm/part.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
test/dm/part.c +9 -9
@@ -76,15 +76,15 @@ static int dm_test_part(struct unit_test_state *uts)test (-EINVAL ,"#test1" , true);test (1 ,"2" , false);test (1 ,"2" , true); -test (-ENOENT ,"1:0" , false); -test (0 ,"1:0" , true); -test (1 ,"1:1" , false); -test (2 ,"1:2" , false); -test (1 ,"1.0" , false); -test (0 ,"1.0:0" , true); -test (1 ,"1.0:1" , false); -test (2 ,"1.0:2" , false); -test (-EINVAL ,"1#bogus" , false); +test (-ENOENT ,"2:0" , false); +test (0 ,"2:0" , true); +test (1 ,"2:1" , false); +test (2 ,"2:2" , false); +test (1 ,"2.0" , false); +test (0 ,"2.0:0" , true); +test (1 ,"2.0:1" , false); +test (2 ,"2.0:2" , false); +test (-EINVAL ,"2#bogus" , false);test (1 ,"2#test1" , false);test (2 ,"2#test2" , false); ret =0 ;
Signature · 1 line
2.33.0
PATCH v2 2/5 dm: test: Improve partition test error output
In reply to Joshua WattImprove the logging when the partition test fails so that it is clear what went wrong, shown with actual values.
--- test/dm/part.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
test/dm/part.c +6 -4
@@ -17,10 +17,12 @@ static int do_test(struct unit_test_state *uts, int expected,struct blk_desc *mmc_dev_desc;struct disk_partition part_info; -ut_asserteq (expected, -part_get_info_by_dev_and_name_or_num ("mmc" , part_str, - &mmc_dev_desc, - &part_info, whole)); +int ret =part_get_info_by_dev_and_name_or_num ("mmc" , part_str, + &mmc_dev_desc, + &part_info, whole); + +ut_assertf (expected == ret,"test(%d, \"%s\", %d) == %d" , expected, + part_str, whole, ret);return 0 ; }
Signature · 1 line
2.33.0
PATCH v2 3/5 disk: part: Add API to get partitions with specific driver
In reply to Joshua WattAdds part_driver_get_type() API which can be used to force a specific driver to be used when getting partition information instead of relying on auto detection.
--- disk/part.c | 38 +++++++++++++++++++++++++++++++------- include/part.h | 19 ++++++++++++++++++- 2 files changed, 49 insertions(+), 8 deletions(-)
disk/part.c +31 -7
@@ -26,6 +26,22 @@/* Check all partition types */ #define PART_TYPE_ALL -1 +static struct part_driver *part_driver_get_type (int part_type) +{ +struct part_driver *drv = + ll_entry_start(struct part_driver, part_driver); + const int n_ents = ll_entry_count(struct part_driver, part_driver); +struct part_driver *entry; + +for (entry = drv; entry != drv + n_ents; entry++) { +if (part_type == entry->part_type) +return entry; + } + +/* Not found */ +return NULL ; +} +static struct part_driver *part_driver_lookup_type (struct blk_desc *dev_desc) { struct part_driver *drv =
@@ -44,10 +60,7 @@ static struct part_driver *part_driver_lookup_type(struct blk_desc *dev_desc) } } }else { -for (entry = drv; entry != drv + n_ents; entry++) { -if (dev_desc->part_type == entry->part_type) -return entry; - } +return part_driver_get_type (dev_desc->part_type); }/* Not found */
@@ -306,8 +319,8 @@ void part_print(struct blk_desc *dev_desc) drv->int part_get_info (struct blk_desc *dev_desc,int part, -struct disk_partition *info) +int part_get_info_by_type (struct blk_desc *dev_desc,int part,int part_type, +struct disk_partition *info) {struct part_driver *drv;
@@ -320,7 +333,12 @@ int part_get_info(struct blk_desc *dev_desc, int part, info->type_guid[0 ] =0 ;#endif - drv =part_driver_lookup_type (dev_desc); +if (part_type ==PART_TYPE_UNKNOWN ) { + drv =part_driver_lookup_type (dev_desc); + }else { + drv =part_driver_get_type (part_type); + } +if (!drv) {debug ("## Unknown partition table type %x\n" , dev_desc->part_type);
@@ -340,6 +358,12 @@ int part_get_info(struct blk_desc *dev_desc, int part,return -ENOENT ; } +int part_get_info (struct blk_desc *dev_desc,int part, +struct disk_partition *info) +{ +return part_get_info_by_type (dev_desc, part,PART_TYPE_UNKNOWN , info); +} +int part_get_info_whole_disk (struct blk_desc *dev_desc,struct disk_partition *info) {
include/part.h +18 -1
@@ -105,7 +105,24 @@ struct blk_desc *blk_get_dev(const char *ifname, int dev);struct blk_desc *mg_disk_get_dev (int dev); -/* disk/part.c */ +/** +* part_get_info_by_type() - Get partitions from a block device using a specific +* partition driver +* +* Each interface allocates its own devices and typically struct blk_desc is +* contained with the interface's data structure. There is no global +* numbering for block devices, so the interface name must be provided. +* +* @dev_desc: Block device descriptor +* @part: Partition number to read +* @part_type: Partition driver to use, or PART_TYPE_UNKNOWN to automatically +* choose a driver +* @info: Returned partition information +* +* Return: 0 on success, negative errno on failure +*/ +int part_get_info_by_type (struct blk_desc *dev_desc,int part,int part_type, +struct disk_partition *info);int part_get_info (struct blk_desc *dev_desc,int part,struct disk_partition *info);/**
Signature · 1 line
2.33.0
PATCH v2 4/5 dm: test: Add test for part_get_info_by_type
In reply to Joshua WattAdds a test suite to ensure that part_get_info_by_type works correctly by creating a hybrid GPT/MBR partition table and reading both.
--- configs/sandbox_defconfig | 2 + test/dm/part.c | 87 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+)
configs/sandbox_defconfig +2 -0
@@ -71,6 +71,7 @@ CONFIG_CMD_GPIO_READ=y CONFIG_CMD_PWM=y CONFIG_CMD_GPT=y CONFIG_CMD_GPT_RENAME=y +CONFIG_CMD_MBR=y CONFIG_CMD_IDE=y CONFIG_CMD_I2C=y CONFIG_CMD_LOADM=y
@@ -131,6 +132,7 @@ CONFIG_CMD_MTDPARTS=y CONFIG_CMD_STACKPROTECTOR_TEST=y CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y +CONFIG_DOS_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_OF_LIVE=y CONFIG_ENV_IS_NOWHERE=y
test/dm/part.c +87 -0
90 lines not on this page · raw message
Signature · 1 line
2.33.0
PATCH v2 5/5 cmd: mbr: Force DOS driver to be used for verify
In reply to Joshua WattForces the DOS partition type driver to be used when verifying the MBR. This is particularly useful when using a hybrid MBR & GPT layout as otherwise MBR verification would mostly likely fail since the GPT partitions will be returned, even if the MBR is actually valid.
--- cmd/mbr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/mbr.c +1 -1
@@ -244,7 +244,7 @@ static int do_verify_mbr(struct blk_desc *dev, const char *str)for (i =0 ; i < count; i++) {struct disk_partition p; -if (part_get_info (dev, i +1 , &p)) +if (part_get_info_by_type (dev, i +1 ,PART_TYPE_DOS , &p)) goto fail; if ((partitions[i].size && p.size != partitions[i].size) ||
Signature · 1 line
2.33.0
Re: [PATCH v2 1/5] dm: test: Fix partition test to use mmc2
In reply to Joshua WattQuoted 11 lines · Joshua Watt
d94d9844bc("dm: part: Update test to use mmc2") attempted to make the test use mmc2, but the change was incomplete in that it didn't also change the strings that reference a specific partition. Fix these so that the test passes againSigned-off-by Joshua Watt <[email protected]>--- test/dm/part.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
Thanks.
Re: [PATCH v2 2/5] dm: test: Improve partition test error output
In reply to Joshua WattQuoted 8 lines · Joshua Watt
Improve the logging when the partition test fails so that it is clear what went wrong, shown with actual values.
Signed-off-by Joshua Watt <[email protected]>--- test/dm/part.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Re: [PATCH v2 3/5] disk: part: Add API to get partitions with specific driver
In reply to Joshua WattQuoted 2 lines · Joshua Watt
Adds
part_driver_get_type()API which can be used to force a specific
Nit: Add
Quoted 8 lines
driver to be used when getting partition information instead of relying on auto detection.
Signed-off-by Joshua Watt <[email protected]>--- disk/part.c | 38 +++++++++++++++++++++++++++++++------- include/part.h | 19 ++++++++++++++++++- 2 files changed, 49 insertions(+), 8 deletions(-)
Re: [PATCH v2 5/5] cmd: mbr: Force DOS driver to be used for verify
In reply to Joshua WattQuoted 10 lines · Joshua Watt
Forces the DOS partition type driver to be used when verifying the MBR. This is particularly useful when using a hybrid MBR & GPT layout as otherwise MBR verification would mostly likely fail since the GPT partitions will be returned, even if the MBR is actually valid.
Signed-off-by Joshua Watt <[email protected]>--- cmd/mbr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH v2 4/5] dm: test: Add test for part_get_info_by_type
In reply to Joshua WattQuoted 10 lines · Joshua Watt
Adds a test suite to ensure that
part_get_info_by_typeworks correctly by creating a hybrid GPT/MBR partition table and reading both.Signed-off-by Joshua Watt <[email protected]>--- configs/sandbox_defconfig | 2 + test/dm/part.c | 87 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+)
RE: [PATCH v2 1/5] dm: test: Fix partition test to use mmc2
In reply to Joshua WattQuoted 9 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Joshua Watt
Sent: Monday, July 3, 2023 10:40 PM
To: [email protected]
Cc: Joshua Watt <[email protected]>; Simon Glass <[email protected]>
Subject: [PATCH v2 1/5] dm: test: Fix partition test to use mmc2
Quoted 6 lines
d94d9844bc("dm: part: Update test to use mmc2") attempted to make the test use mmc2, but the change was incomplete in that it didn't also change the strings that reference a specific partition. Fix these so that the test passes againSigned-off-by Joshua Watt <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 35 lines
--- test/dm/part.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)test/dm/part.c +9
-10@@ -76,15 +76,15 @@ static int dm_test_part(struct unit_test_state *uts)test (-EINVAL ,"#test1" , true);test (1 ,"2" , false);test (1 ,"2" , true); -test (-ENOENT ,"1:0" , false); -test (0 ,"1:0" , true); -test (1 ,"1:1" , false); -test (2 ,"1:2" , false); -test (1 ,"1.0" , false); -test (0 ,"1.0:0" , true); -test (1 ,"1.0:1" , false); -test (2 ,"1.0:2" , false); -test (-EINVAL ,"1#bogus" , false); +test (-ENOENT ,"2:0" , false); +test (0 ,"2:0" , true); +test (1 ,"2:1" , false); +test (2 ,"2:2" , false); +test (1 ,"2.0" , false); +test (0 ,"2.0:0" , true); +test (1 ,"2.0:1" , false); +test (2 ,"2.0:2" , false); +test (-EINVAL ,"2#bogus" , false);test (1 ,"2#test1" , false);test (2 ,"2#test2" , false); ret =0 ; --2.33.0
Re: [PATCH v2 1/5] dm: test: Fix partition test to use mmc2
In reply to Joshua WattQuoted 8 lines · Joshua Watt
d94d9844bc("dm: part: Update test to use mmc2") attempted to make the test use mmc2, but the change was incomplete in that it didn't also change the strings that reference a specific partition. Fix these so that the test passes againSigned-off-by Joshua Watt <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Jaehoon Chung <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
Re: [PATCH v2 2/5] dm: test: Improve partition test error output
In reply to Joshua WattQuoted 5 lines · Joshua Watt
Improve the logging when the partition test fails so that it is clear what went wrong, shown with actual values.
Signed-off-by Joshua Watt <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
Re: [PATCH v2 3/5] disk: part: Add API to get partitions with specific driver
In reply to Joshua WattQuoted 6 lines · Joshua Watt
Adds
part_driver_get_type()API which can be used to force a specific driver to be used when getting partition information instead of relying on auto detection.Signed-off-by Joshua Watt <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
Re: [PATCH v2 4/5] dm: test: Add test for part_get_info_by_type
In reply to Joshua WattQuoted 5 lines · Joshua Watt
Adds a test suite to ensure that
part_get_info_by_typeworks correctly by creating a hybrid GPT/MBR partition table and reading both.Signed-off-by Joshua Watt <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
Re: [PATCH v2 5/5] cmd: mbr: Force DOS driver to be used for verify
In reply to Joshua WattQuoted 7 lines · Joshua Watt
Forces the DOS partition type driver to be used when verifying the MBR. This is particularly useful when using a hybrid MBR & GPT layout as otherwise MBR verification would mostly likely fail since the GPT partitions will be returned, even if the MBR is actually valid.
Signed-off-by Joshua Watt <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom