Skip to contentSkip to conversation

Btrfs-progs: make btrfs filesystem show <uuid> actually work

PATCH New Josef Bacik 1 participant 1 message Apr 25, 2012 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs-progs: make btrfs filesystem show <uuid> actually work

The btrfs filesystem show command is only actually searching for labels, it's not searching for UUID's at all. This patch fixes that problem. Thanks,

---
 cmds-filesystem.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
cmds-filesystem.c +7 -0
index 1f53d1c..ff98a77 100644
@@ -155,8 +155,15 @@ static int cmd_df(int argc, char **argv)
 
 static int uuid_search(struct btrfs_fs_devices *fs_devices, char *search)
 {
+	char uuidbuf[37];
 	struct list_head *cur;
 	struct btrfs_device *device;
+	int search_len = strlen(search);
+
+	search_len = min(search_len, 37);
+	uuid_unparse(fs_devices->fsid, uuidbuf);
+	if (!strncmp(uuidbuf, search, search_len))
+		return 1;
 
 	list_for_each(cur, &fs_devices->devices) {
 		device = list_entry(cur, struct btrfs_device, dev_list);
Signature · 1 line
1.7.7.6