Commit 9d845509553e3c07414259ea97e4f59a3fe65904
Committed by
Tom Rini
1 parent
0c936ee319
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
cmd: Add the 'btrsubvol' command to list BTRFS subvolumes
Signed-off-by: Marek Behun <marek.behun@nic.cz> create mode 100644 cmd/btrfs.c
Showing 3 changed files with 39 additions and 0 deletions Side-by-side Diff
cmd/Kconfig
... | ... | @@ -1313,6 +1313,16 @@ |
1313 | 1313 | endmenu |
1314 | 1314 | |
1315 | 1315 | menu "Filesystem commands" |
1316 | +config CMD_BTRFS | |
1317 | + bool "Enable the 'btrsubvol' command" | |
1318 | + select FS_BTRFS | |
1319 | + help | |
1320 | + This enables the 'btrsubvol' command to list subvolumes | |
1321 | + of a BTRFS filesystem. There are no special commands for | |
1322 | + listing BTRFS directories or loading BTRFS files - this | |
1323 | + can be done by the generic 'fs' commands (see CMD_FS_GENERIC) | |
1324 | + when BTRFS is enabled (see FS_BTRFS). | |
1325 | + | |
1316 | 1326 | config CMD_CBFS |
1317 | 1327 | bool "Enable the 'cbfs' command" |
1318 | 1328 | depends on FS_CBFS |
cmd/Makefile
... | ... | @@ -27,6 +27,7 @@ |
27 | 27 | obj-$(CONFIG_CMD_BOOTSTAGE) += bootstage.o |
28 | 28 | obj-$(CONFIG_CMD_BOOTZ) += bootz.o |
29 | 29 | obj-$(CONFIG_CMD_BOOTI) += booti.o |
30 | +obj-$(CONFIG_CMD_BTRFS) += btrfs.o | |
30 | 31 | obj-$(CONFIG_CMD_CACHE) += cache.o |
31 | 32 | obj-$(CONFIG_CMD_CBFS) += cbfs.o |
32 | 33 | obj-$(CONFIG_CMD_CLK) += clk.o |
cmd/btrfs.c
1 | +/* | |
2 | + * 2017 by Marek Behun <marek.behun@nic.cz> | |
3 | + * | |
4 | + * SPDX-License-Identifier: GPL-2.0+ | |
5 | + */ | |
6 | + | |
7 | +#include <common.h> | |
8 | +#include <command.h> | |
9 | +#include <btrfs.h> | |
10 | +#include <fs.h> | |
11 | + | |
12 | +int do_btrsubvol(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) | |
13 | +{ | |
14 | + if (argc != 3) | |
15 | + return CMD_RET_USAGE; | |
16 | + | |
17 | + if (fs_set_blk_dev(argv[1], argv[2], FS_TYPE_BTRFS)) | |
18 | + return 1; | |
19 | + | |
20 | + btrfs_list_subvols(); | |
21 | + return 0; | |
22 | +} | |
23 | + | |
24 | +U_BOOT_CMD(btrsubvol, 3, 1, do_btrsubvol, | |
25 | + "list subvolumes of a BTRFS filesystem", | |
26 | + "<interface> <dev[:part]>\n" | |
27 | + " - List subvolumes of a BTRFS filesystem." | |
28 | +) |