mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-19 03:15:00 +00:00
disk: simplify print_part_header()
Using uclass_get_name() reduces the code size. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
9b6d415eea
commit
51b2f4f085
2 changed files with 4 additions and 45 deletions
47
disk/part.c
47
disk/part.c
|
@ -14,6 +14,7 @@
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <part.h>
|
#include <part.h>
|
||||||
#include <ubifs_uboot.h>
|
#include <ubifs_uboot.h>
|
||||||
|
#include <dm/uclass.h>
|
||||||
|
|
||||||
#undef PART_DEBUG
|
#undef PART_DEBUG
|
||||||
|
|
||||||
|
@ -305,50 +306,8 @@ static void print_part_header(const char *type, struct blk_desc *desc)
|
||||||
CONFIG_IS_ENABLED(ISO_PARTITION) || \
|
CONFIG_IS_ENABLED(ISO_PARTITION) || \
|
||||||
CONFIG_IS_ENABLED(AMIGA_PARTITION) || \
|
CONFIG_IS_ENABLED(AMIGA_PARTITION) || \
|
||||||
CONFIG_IS_ENABLED(EFI_PARTITION)
|
CONFIG_IS_ENABLED(EFI_PARTITION)
|
||||||
puts ("\nPartition Map for ");
|
printf("\nPartition Map for %s device %d -- Partition Type: %s\n\n",
|
||||||
switch (desc->uclass_id) {
|
uclass_get_name(desc->uclass_id), desc->devnum, type);
|
||||||
case UCLASS_IDE:
|
|
||||||
puts ("IDE");
|
|
||||||
break;
|
|
||||||
case UCLASS_AHCI:
|
|
||||||
puts ("SATA");
|
|
||||||
break;
|
|
||||||
case UCLASS_SCSI:
|
|
||||||
puts ("SCSI");
|
|
||||||
break;
|
|
||||||
case UCLASS_USB:
|
|
||||||
puts ("USB");
|
|
||||||
break;
|
|
||||||
case UCLASS_MMC:
|
|
||||||
puts ("MMC");
|
|
||||||
break;
|
|
||||||
case UCLASS_HOST:
|
|
||||||
puts ("HOST");
|
|
||||||
break;
|
|
||||||
case UCLASS_NVME:
|
|
||||||
puts ("NVMe");
|
|
||||||
break;
|
|
||||||
case UCLASS_PVBLOCK:
|
|
||||||
puts("PV BLOCK");
|
|
||||||
break;
|
|
||||||
case UCLASS_RKMTD:
|
|
||||||
puts("RKMTD");
|
|
||||||
break;
|
|
||||||
case UCLASS_VIRTIO:
|
|
||||||
puts("VirtIO");
|
|
||||||
break;
|
|
||||||
case UCLASS_EFI_MEDIA:
|
|
||||||
puts("EFI");
|
|
||||||
break;
|
|
||||||
case UCLASS_BLKMAP:
|
|
||||||
puts("BLKMAP");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("UNKNOWN(%d)", desc->uclass_id);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
printf (" device %d -- Partition Type: %s\n\n",
|
|
||||||
desc->devnum, type);
|
|
||||||
#endif /* any CONFIG_..._PARTITION */
|
#endif /* any CONFIG_..._PARTITION */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,6 @@ def test_scsi_dev(u_boot_console):
|
||||||
def test_scsi_part(u_boot_console):
|
def test_scsi_part(u_boot_console):
|
||||||
test_scsi_dev(u_boot_console)
|
test_scsi_dev(u_boot_console)
|
||||||
output = u_boot_console.run_command('scsi part')
|
output = u_boot_console.run_command('scsi part')
|
||||||
assert 'Partition Map for SCSI device' in output
|
assert 'Partition Map for scsi device' in output
|
||||||
output = u_boot_console.run_command('echo $?')
|
output = u_boot_console.run_command('echo $?')
|
||||||
assert output.endswith('0')
|
assert output.endswith('0')
|
||||||
|
|
Loading…
Add table
Reference in a new issue