diff mbox

Btrfs-progs: in btrfs-debug-tree, print -1 in key for (u64)-1

Message ID 1366709101-17887-2-git-send-email-sbehrens@giantdisaster.de (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Stefan Behrens April 23, 2013, 9:25 a.m. UTC
For the objectid and offset field of a key, print -1 instead of the
decimal representation of 0xffffffffffffffff. At least for me it is
more readable like this.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
---
 print-tree.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/print-tree.c b/print-tree.c
index 49c8384..aae47a9 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -585,6 +585,9 @@  static void print_objectid(u64 objectid, u8 type)
 	case BTRFS_MULTIPLE_OBJECTIDS:
 		printf("MULTIPLE");
 		break;
+	case (u64)-1:
+		printf("-1");
+		break;
 	case BTRFS_FIRST_CHUNK_TREE_OBJECTID:
 		if (type == BTRFS_CHUNK_ITEM_KEY) {
 			printf("FIRST_CHUNK_TREE");
@@ -614,7 +617,10 @@  void btrfs_print_key(struct btrfs_disk_key *disk_key)
 			(unsigned long long)(offset & ((1ll << 48) - 1)));
 		break;
 	default:
-		printf(" %llu)", (unsigned long long)offset);
+		if (offset == (u64)-1)
+			printf(" -1)");
+		else
+			printf(" %llu)", (unsigned long long)offset);
 		break;
 	}
 }