summaryrefslogtreecommitdiffstats
path: root/libblkid/src/superblocks/bluestore.c
blob: f9178d9605f978a0c0013ff941c98d4f1e70f045 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Copyright (C) 2018 by Kenneth Van Alstyne <kvanals@kvanals.org>
 *
 * This file may be redistributed under the terms of the
 * GNU Lesser General Public License.
 *
 *
 * Ceph BlueStore is one of the supported storage
 * methods for Object Storage Devices (OSDs).
 * This is used to detect the backing block devices
 * used for these types of OSDs in a Ceph Cluster.
 *
 */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <inttypes.h>
#include <stddef.h>

#include "bitops.h"
#include "superblocks.h"

#define BLUESTORE_MAGIC_L		22

struct bluestore_phdr {
	uint8_t		magic[BLUESTORE_MAGIC_L];
} __attribute__((packed));

static int probe_bluestore(blkid_probe pr, const struct blkid_idmag *mag)
{
	const struct bluestore_phdr *header;

	header = blkid_probe_get_sb(pr, mag, struct bluestore_phdr);
	if (header == NULL)
		return errno ? -errno : 1;

	return 0;
}

const struct blkid_idinfo bluestore_idinfo =
{
	.name		= "ceph_bluestore",
	.usage		= BLKID_USAGE_OTHER,
	.probefunc	= probe_bluestore,
	.magics		=
	{
		{ .magic = "bluestore block device", .len = 22 },
		{ NULL }
	}
};