sweettea / rpms / btrfs-progs

Forked from rpms/btrfs-progs 8 months ago
Clone

Blame Btrfs-progs-make-btrfs-filesystem-show-uuid-actually.patch

Josef Bacik 758d90
From 33cbabf480ea811ddaef1b5f97603f4c7df7b240 Mon Sep 17 00:00:00 2001
Josef Bacik 758d90
From: Josef Bacik <josef@redhat.com>
Josef Bacik 758d90
Date: Wed, 25 Apr 2012 14:25:24 -0400
Josef Bacik 758d90
Subject: [PATCH] Btrfs-progs: make btrfs filesystem show <uuid> actually work
Josef Bacik 758d90
Josef Bacik 758d90
The btrfs filesystem show command is only actually searching for labels,
Josef Bacik 758d90
it's not searching for UUID's at all.  This patch fixes that problem.
Josef Bacik 758d90
Thanks,
Josef Bacik 758d90
Josef Bacik 758d90
Signed-off-by: Josef Bacik <josef@redhat.com>
Josef Bacik 758d90
---
Josef Bacik 758d90
 cmds-filesystem.c |    7 +++++++
Josef Bacik 758d90
 1 files changed, 7 insertions(+), 0 deletions(-)
Josef Bacik 758d90
Josef Bacik 758d90
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
Josef Bacik 758d90
index 1f53d1c..ff98a77 100644
Josef Bacik 758d90
--- a/cmds-filesystem.c
Josef Bacik 758d90
+++ b/cmds-filesystem.c
Josef Bacik 758d90
@@ -155,8 +155,15 @@ static int cmd_df(int argc, char **argv)
Josef Bacik 758d90
 
Josef Bacik 758d90
 static int uuid_search(struct btrfs_fs_devices *fs_devices, char *search)
Josef Bacik 758d90
 {
Josef Bacik 758d90
+	char uuidbuf[37];
Josef Bacik 758d90
 	struct list_head *cur;
Josef Bacik 758d90
 	struct btrfs_device *device;
Josef Bacik 758d90
+	int search_len = strlen(search);
Josef Bacik 758d90
+
Josef Bacik 758d90
+	search_len = min(search_len, 37);
Josef Bacik 758d90
+	uuid_unparse(fs_devices->fsid, uuidbuf);
Josef Bacik 758d90
+	if (!strncmp(uuidbuf, search, search_len))
Josef Bacik 758d90
+		return 1;
Josef Bacik 758d90
 
Josef Bacik 758d90
 	list_for_each(cur, &fs_devices->devices) {
Josef Bacik 758d90
 		device = list_entry(cur, struct btrfs_device, dev_list);
Josef Bacik 758d90
-- 
Josef Bacik 758d90
1.7.7.6
Josef Bacik 758d90