namelen, namebuf);
}
-static int count_bytes(void *buf, int len, char b)
+static int empty_uuid(const u8 *uuid)
{
- int cnt = 0;
int i;
- for (i = 0; i < len; i++) {
- if (((char*)buf)[i] == b)
- cnt++;
- }
- return cnt;
+
+ for (i = 0; i < BTRFS_UUID_SIZE; i++)
+ if (uuid[i])
+ return 0;
+ return 1;
}
/*
if (root_item.generation == root_item.generation_v2) {
uuid_unparse(root_item.uuid, uuid_str);
printf("\t\tuuid %s\n", uuid_str);
- if (count_bytes(root_item.parent_uuid, BTRFS_UUID_SIZE, 0) != BTRFS_UUID_SIZE) {
+ if (!empty_uuid(root_item.parent_uuid)) {
uuid_unparse(root_item.parent_uuid, uuid_str);
printf("\t\tparent_uuid %s\n", uuid_str);
}
- if (count_bytes(root_item.received_uuid, BTRFS_UUID_SIZE, 0) != BTRFS_UUID_SIZE) {
+ if (!empty_uuid(root_item.received_uuid)) {
uuid_unparse(root_item.received_uuid, uuid_str);
printf("\t\treceived_uuid %s\n", uuid_str);
}