2 * Copyright (C) 2009 Karel Zak <kzak@redhat.com>
4 * This file may be redistributed under the terms of the
5 * GNU Lesser General Public License.
13 #include "superblocks.h"
15 struct btrfs_super_block
{
25 uint64_t log_root_transid
;
28 uint64_t root_dir_objectid
;
34 uint32_t sys_chunk_array_size
;
35 uint64_t chunk_root_generation
;
36 uint64_t compat_flags
;
37 uint64_t compat_ro_flags
;
38 uint64_t incompat_flags
;
41 uint8_t chunk_root_level
;
42 uint8_t log_root_level
;
43 struct btrfs_dev_item
{
52 uint64_t start_offset
;
58 } __attribute__ ((__packed__
)) dev_item
;
60 } __attribute__ ((__packed__
));
62 static int probe_btrfs(blkid_probe pr
, const struct blkid_idmag
*mag
)
64 struct btrfs_super_block
*bfs
;
66 bfs
= blkid_probe_get_sb(pr
, mag
, struct btrfs_super_block
);
68 return errno
? -errno
: 1;
71 blkid_probe_set_label(pr
,
72 (unsigned char *) bfs
->label
,
75 blkid_probe_set_uuid(pr
, bfs
->fsid
);
76 blkid_probe_set_uuid_as(pr
, bfs
->dev_item
.uuid
, "UUID_SUB");
81 const struct blkid_idinfo btrfs_idinfo
=
84 .usage
= BLKID_USAGE_FILESYSTEM
,
85 .probefunc
= probe_btrfs
,
89 { .magic
= "_BHRfS_M", .len
= 8, .sboff
= 0x40, .kboff
= 64 },