blkid: recognize btrfs
PATCH 1/1 blkid: recognize btrfs
Add btrfs detection to libblkid, now that the disk format should be recognizable in the future.
# misc/blkid /tmp/fsfile /tmp/fsfile: LABEL="mylabel" UUID="102b07f0-0e79-4b42-8a4e-1dde418bbe6d" TYPE="btrfs"
Signed-off-by Eric Sandeen <[email protected]>
---
lib/blkid/probe.c +17 -0
@@ -1293,6 +1293,22 @@ static int probe_lvm2(struct blkid_probereturn 0 ; } + +static int probe_btrfs (struct blkid_probe *probe, +struct blkid_magic *id, +unsigned char *buf) +{ +struct btrfs_super_block *bs; +const char *label =0 ; + + bs = (struct btrfs_super_block *)buf; + +if (strlen (bs->label)) + label = bs->label; +blkid_set_tag (probe->dev,"LABEL" , label,sizeof (bs->label)); +set_uuid (probe->dev, bs->fsid,0 ); +return 0 ; +}/* * Various filesystem magics that we can check for. Note that kboff and * sboff are in kilobytes and bytes respectively. All magics are in
@@ -1386,6 +1402,7 @@ static struct blkid_magic type_array[] = { "lvm2pv", 0, 0x018, 8, "LVM2 001", probe_lvm2 }, { "lvm2pv", 1, 0x018, 8, "LVM2 001", probe_lvm2 }, { "lvm2pv", 1, 0x218, 8, "LVM2 001", probe_lvm2 }, + { "btrfs", 64, 0x40, 8, "_BHRfS_M", probe_btrfs }, { NULL, 0, 0, 0, NULL, NULL } };
lib/blkid/probe.h +104 -0
110 lines not on this page · raw message
Theodore Tso
AppliedQuoted 2 lines · Eric Sandeen
Add btrfs detection to libblkid, now that the disk format should be recognizable in the future.
Thanks, applied.
- Ted