diff mbox series

btrfs-progs: dump-tree: allow using '-' for tree ids

Message ID a59a24349345a83c7594ea0340278061ce35a912.1696398970.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: dump-tree: allow using '-' for tree ids | expand

Commit Message

Qu Wenruo Oct. 4, 2023, 5:56 a.m. UTC
Currently for multi-word tree names, we only allow '_' to connect the
two words, like "block_group".

Meanwhile for mkfs features, we go '-' to connect two words, like
"block-group-tree".
This makes users to use different separators for different commands.

This patch would allow using both '-' and '_' for tree ids.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 cmds/inspect-dump-tree.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Johannes Thumshirn Oct. 4, 2023, 6:10 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
David Sterba Oct. 6, 2023, 3:33 p.m. UTC | #2
On Wed, Oct 04, 2023 at 04:26:14PM +1030, Qu Wenruo wrote:
> Currently for multi-word tree names, we only allow '_' to connect the
> two words, like "block_group".
> 
> Meanwhile for mkfs features, we go '-' to connect two words, like
> "block-group-tree".
> This makes users to use different separators for different commands.
> 
> This patch would allow using both '-' and '_' for tree ids.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Added to devel, thanks.
diff mbox series

Patch

diff --git a/cmds/inspect-dump-tree.c b/cmds/inspect-dump-tree.c
index 2bfeb25b5482..de271fa6438c 100644
--- a/cmds/inspect-dump-tree.c
+++ b/cmds/inspect-dump-tree.c
@@ -169,12 +169,19 @@  static u64 treeid_from_string(const char *str, const char **end)
 		{ "QUOTA", BTRFS_QUOTA_TREE_OBJECTID },
 		{ "UUID", BTRFS_UUID_TREE_OBJECTID },
 		{ "FREE_SPACE", BTRFS_FREE_SPACE_TREE_OBJECTID },
+		{ "FREE-SPACE", BTRFS_FREE_SPACE_TREE_OBJECTID },
 		{ "TREE_LOG_FIXUP", BTRFS_TREE_LOG_FIXUP_OBJECTID },
+		{ "TREE-LOG-FIXUP", BTRFS_TREE_LOG_FIXUP_OBJECTID },
 		{ "TREE_LOG", BTRFS_TREE_LOG_OBJECTID },
+		{ "TREE-LOG", BTRFS_TREE_LOG_OBJECTID },
 		{ "TREE_RELOC", BTRFS_TREE_RELOC_OBJECTID },
+		{ "TREE-RELOC", BTRFS_TREE_RELOC_OBJECTID },
 		{ "DATA_RELOC", BTRFS_DATA_RELOC_TREE_OBJECTID },
+		{ "DATA-RELOC", BTRFS_DATA_RELOC_TREE_OBJECTID },
 		{ "BLOCK_GROUP", BTRFS_BLOCK_GROUP_TREE_OBJECTID },
+		{ "BLOCK-GROUP", BTRFS_BLOCK_GROUP_TREE_OBJECTID },
 		{ "RAID_STRIPE", BTRFS_RAID_STRIPE_TREE_OBJECTID },
+		{ "RAID-STRIPE", BTRFS_RAID_STRIPE_TREE_OBJECTID },
 	};
 
 	if (strncasecmp("BTRFS_", str, strlen("BTRFS_")) == 0)