cmd: Add fsinfo command
Add the fsinfo command to display filesystem statistics including block size, total blocks, used blocks, and free blocks. Both raw byte counts and human-readable sizes are shown. Example output: => fsinfo mmc 0:1 Block size: 4096 bytes Total blocks: 16384 (67108864 bytes, 64 MiB) Used blocks: 2065 (8458240 bytes, 8.1 MiB) Free blocks: 14319 (58650624 bytes, 55.9 MiB) Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
10
cmd/Kconfig
10
cmd/Kconfig
@@ -2839,6 +2839,16 @@ config CMD_FS_UUID
|
||||
help
|
||||
Enables fsuuid command for filesystem UUID.
|
||||
|
||||
config CMD_FSINFO
|
||||
bool "fsinfo command"
|
||||
depends on !CMD_JFFS2
|
||||
default y if SANDBOX
|
||||
help
|
||||
Enables the fsinfo command which prints filesystem statistics
|
||||
such as block size, total blocks, used blocks and free blocks.
|
||||
This command conflicts with the JFFS2 fsinfo command, so it
|
||||
cannot be enabled when JFFS2 support is enabled.
|
||||
|
||||
config CMD_LUKS
|
||||
bool "luks command"
|
||||
depends on BLK_LUKS
|
||||
|
||||
14
cmd/fs.c
14
cmd/fs.c
@@ -152,3 +152,17 @@ U_BOOT_CMD(
|
||||
" - renames/moves a file/directory in 'dev' on 'interface' from\n"
|
||||
" 'old_path' to 'new_path'"
|
||||
);
|
||||
|
||||
#ifdef CONFIG_CMD_FSINFO
|
||||
static int do_fsinfo_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
return do_fs_statfs(cmdtp, flag, argc, argv);
|
||||
}
|
||||
|
||||
U_BOOT_CMD(fsinfo, 3, 1, do_fsinfo_wrapper,
|
||||
"Print filesystem information",
|
||||
"<interface> <dev[:part]>\n"
|
||||
" - Print filesystem statistics (block size, total/used/free blocks)"
|
||||
);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user