mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-20 11:55:03 +00:00
cmd: host: Print out the block size of the host device
It's useful if we can print out the block size of the host device in the "host info" command. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
e261fbf347
commit
256f6da8cf
2 changed files with 14 additions and 13 deletions
|
@ -160,8 +160,8 @@ static void show_host_dev(struct udevice *dev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
desc = dev_get_uclass_plat(blk);
|
desc = dev_get_uclass_plat(blk);
|
||||||
printf("%12lu %-15s %s\n", (unsigned long)desc->lba, plat->label,
|
printf("%12lu %6lu %-15s %s\n", (unsigned long)desc->lba, desc->blksz,
|
||||||
plat->filename);
|
plat->label, plat->filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_host_info(struct cmd_tbl *cmdtp, int flag, int argc,
|
static int do_host_info(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||||
|
@ -179,7 +179,8 @@ static int do_host_info(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%3s %12s %-15s %s\n", "dev", "blocks", "label", "path");
|
printf("%3s %12s %6s %-15s %s\n",
|
||||||
|
"dev", "blocks", "blksz", "label", "path");
|
||||||
if (dev) {
|
if (dev) {
|
||||||
show_host_dev(dev);
|
show_host_dev(dev);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -120,7 +120,7 @@ static int dm_test_cmd_host(struct unit_test_state *uts)
|
||||||
|
|
||||||
/* first check 'host info' with binding */
|
/* first check 'host info' with binding */
|
||||||
ut_assertok(run_command("host info", 0));
|
ut_assertok(run_command("host info", 0));
|
||||||
ut_assert_nextline("dev blocks label path");
|
ut_assert_nextline("dev blocks blksz label path");
|
||||||
ut_assert_console_end();
|
ut_assert_console_end();
|
||||||
|
|
||||||
ut_assertok(os_persistent_file(fname, sizeof(fname), "2MB.ext2.img"));
|
ut_assertok(os_persistent_file(fname, sizeof(fname), "2MB.ext2.img"));
|
||||||
|
@ -133,8 +133,8 @@ static int dm_test_cmd_host(struct unit_test_state *uts)
|
||||||
ut_asserteq(true, desc->removable);
|
ut_asserteq(true, desc->removable);
|
||||||
|
|
||||||
ut_assertok(run_command("host info", 0));
|
ut_assertok(run_command("host info", 0));
|
||||||
ut_assert_nextline("dev blocks label path");
|
ut_assert_nextline("dev blocks blksz label path");
|
||||||
ut_assert_nextlinen(" 0 4096 test2");
|
ut_assert_nextlinen(" 0 4096 512 test2");
|
||||||
ut_assert_console_end();
|
ut_assert_console_end();
|
||||||
|
|
||||||
ut_assertok(os_persistent_file(fname, sizeof(fname), "1MB.fat32.img"));
|
ut_assertok(os_persistent_file(fname, sizeof(fname), "1MB.fat32.img"));
|
||||||
|
@ -147,9 +147,9 @@ static int dm_test_cmd_host(struct unit_test_state *uts)
|
||||||
ut_asserteq(false, desc->removable);
|
ut_asserteq(false, desc->removable);
|
||||||
|
|
||||||
ut_assertok(run_command("host info", 0));
|
ut_assertok(run_command("host info", 0));
|
||||||
ut_assert_nextline("dev blocks label path");
|
ut_assert_nextline("dev blocks blksz label path");
|
||||||
ut_assert_nextlinen(" 0 4096 test2");
|
ut_assert_nextlinen(" 0 4096 512 test2");
|
||||||
ut_assert_nextlinen(" 1 2048 fat");
|
ut_assert_nextlinen(" 1 2048 512 fat");
|
||||||
ut_assert_console_end();
|
ut_assert_console_end();
|
||||||
|
|
||||||
ut_asserteq(1, run_command("host info test", 0));
|
ut_asserteq(1, run_command("host info test", 0));
|
||||||
|
@ -157,8 +157,8 @@ static int dm_test_cmd_host(struct unit_test_state *uts)
|
||||||
ut_assert_console_end();
|
ut_assert_console_end();
|
||||||
|
|
||||||
ut_assertok(run_command("host info fat", 0));
|
ut_assertok(run_command("host info fat", 0));
|
||||||
ut_assert_nextline("dev blocks label path");
|
ut_assert_nextline("dev blocks blksz label path");
|
||||||
ut_assert_nextlinen(" 1 2048 fat");
|
ut_assert_nextlinen(" 1 2048 512 fat");
|
||||||
ut_assert_console_end();
|
ut_assert_console_end();
|
||||||
|
|
||||||
/* check 'host dev' */
|
/* check 'host dev' */
|
||||||
|
@ -194,8 +194,8 @@ static int dm_test_cmd_host(struct unit_test_state *uts)
|
||||||
ut_assert_console_end();
|
ut_assert_console_end();
|
||||||
|
|
||||||
ut_assertok(run_command("host info", 0));
|
ut_assertok(run_command("host info", 0));
|
||||||
ut_assert_nextline("dev blocks label path");
|
ut_assert_nextline("dev blocks blksz label path");
|
||||||
ut_assert_nextlinen(" 1 2048 fat");
|
ut_assert_nextlinen(" 1 2048 512 fat");
|
||||||
ut_assert_console_end();
|
ut_assert_console_end();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue