summaryrefslogtreecommitdiffstats
path: root/libblkid/src/superblocks/vdo.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/vdo.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/vdo.c')
-rw-r--r--libblkid/src/superblocks/vdo.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/libblkid/src/superblocks/vdo.c b/libblkid/src/superblocks/vdo.c
new file mode 100644
index 0000000..bec686f
--- /dev/null
+++ b/libblkid/src/superblocks/vdo.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * This file may be redistributed under the terms of the
+ * GNU Lesser General Public License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+#include <stdint.h>
+
+#include "superblocks.h"
+
+struct vdo_super_block {
+ char magic[8]; /* magic number 'dmvdo001'*/
+ char unused[32]; /* 32 bytes of unimportant space */
+ unsigned char sb_uuid[16]; /* vdo unique id */
+
+ /* this is not all... but enough for libblkid */
+} __attribute__((packed));
+
+static int probe_vdo(blkid_probe pr, const struct blkid_idmag *mag)
+{
+ struct vdo_super_block *vsb;
+
+ vsb = blkid_probe_get_sb(pr, mag, struct vdo_super_block);
+ if (!vsb)
+ return errno ? -errno : 1;
+
+ blkid_probe_set_uuid(pr, vsb->sb_uuid);
+ return 0;
+}
+
+const struct blkid_idinfo vdo_idinfo =
+{
+ .name = "vdo",
+ .usage = BLKID_USAGE_OTHER,
+ .probefunc = probe_vdo,
+ .magics =
+ {
+ { .magic = "dmvdo001", .len = 8 },
+ { NULL }
+ }
+};