summaryrefslogtreecommitdiffstats
path: root/libblkid/src/superblocks/bluestore.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
commit378c18e5f024ac5a8aef4cb40d7c9aa9633d144c (patch)
tree44dfb6ca500d32cabd450649b322a42e70a30683 /libblkid/src/superblocks/bluestore.c
parentInitial commit. (diff)
downloadutil-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.tar.xz
util-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.zip
Adding upstream version 2.38.1.upstream/2.38.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libblkid/src/superblocks/bluestore.c')
-rw-r--r--libblkid/src/superblocks/bluestore.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/libblkid/src/superblocks/bluestore.c b/libblkid/src/superblocks/bluestore.c
new file mode 100644
index 0000000..2ff1f35
--- /dev/null
+++ b/libblkid/src/superblocks/bluestore.c
@@ -0,0 +1,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)
+{
+ 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 }
+ }
+};