/src/util-linux/libblkid/src/superblocks/bluestore.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (C) 2018 by Kenneth Van Alstyne <kvanals@kvanals.org> |
3 | | * |
4 | | * This file may be redistributed under the terms of the |
5 | | * GNU Lesser General Public License. |
6 | | * |
7 | | * |
8 | | * Ceph BlueStore is one of the supported storage |
9 | | * methods for Object Storage Devices (OSDs). |
10 | | * This is used to detect the backing block devices |
11 | | * used for these types of OSDs in a Ceph Cluster. |
12 | | * |
13 | | */ |
14 | | #include <stdio.h> |
15 | | #include <stdlib.h> |
16 | | #include <unistd.h> |
17 | | #include <string.h> |
18 | | #include <errno.h> |
19 | | #include <ctype.h> |
20 | | #include <inttypes.h> |
21 | | #include <stddef.h> |
22 | | |
23 | | #include "bitops.h" |
24 | | #include "superblocks.h" |
25 | | |
26 | | #define BLUESTORE_MAGIC_L 22 |
27 | | |
28 | | struct bluestore_phdr { |
29 | | uint8_t magic[BLUESTORE_MAGIC_L]; |
30 | | } __attribute__((packed)); |
31 | | |
32 | | static int probe_bluestore(blkid_probe pr, const struct blkid_idmag *mag) |
33 | 18 | { |
34 | 18 | const struct bluestore_phdr *header; |
35 | | |
36 | 18 | header = blkid_probe_get_sb(pr, mag, struct bluestore_phdr); |
37 | 18 | if (header == NULL) |
38 | 0 | return errno ? -errno : 1; |
39 | | |
40 | 18 | return 0; |
41 | 18 | } |
42 | | |
43 | | const struct blkid_idinfo bluestore_idinfo = |
44 | | { |
45 | | .name = "ceph_bluestore", |
46 | | .usage = BLKID_USAGE_OTHER, |
47 | | .probefunc = probe_bluestore, |
48 | | .magics = |
49 | | { |
50 | | { .magic = "bluestore block device", .len = 22 }, |
51 | | { NULL } |
52 | | } |
53 | | }; |