|
|
5f5089 |
From e8c8b5f97c864f0fd65378ccde0c45526e6916c9 Mon Sep 17 00:00:00 2001
|
|
|
5f5089 |
From: Sweet Tea Dorminy <sweettea@mit.edu>
|
|
|
5f5089 |
Date: Wed, 6 Dec 2017 18:26:59 -0500
|
|
|
5f5089 |
Subject: [PATCH 146/146] libblkid: Add VDO superblock information into blkid
|
|
|
5f5089 |
|
|
|
5f5089 |
[kzak@redhat.com: - add tests/expected/blkid/low-probe-vdo
|
|
|
5f5089 |
- enlarge the image (must be > 1024)]
|
|
|
5f5089 |
|
|
|
5f5089 |
[RHEL7: exclude vdo regression test doe to binary stuff in the patch]
|
|
|
5f5089 |
|
|
|
5f5089 |
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1521163
|
|
|
5f5089 |
Upstream: http://github.com/karelzak/util-linux/commit/6418cba457a701d44294d934c2bc4b766bbcfa2b
|
|
|
5f5089 |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
5f5089 |
---
|
|
|
5f5089 |
libblkid/src/Makemodule.am | 1 +
|
|
|
5f5089 |
libblkid/src/superblocks/superblocks.c | 1 +
|
|
|
5f5089 |
libblkid/src/superblocks/superblocks.h | 1 +
|
|
|
5f5089 |
libblkid/src/superblocks/vdo.c | 48 +++++++++++++++++++++++++++++++++
|
|
|
5f5089 |
4 files changed, 55 insertions(+)
|
|
|
5f5089 |
create mode 100644 libblkid/src/superblocks/vdo.c
|
|
|
5f5089 |
|
|
|
5f5089 |
diff --git a/libblkid/src/Makemodule.am b/libblkid/src/Makemodule.am
|
|
|
5f5089 |
index 15639768a..791d7cbe8 100644
|
|
|
5f5089 |
--- a/libblkid/src/Makemodule.am
|
|
|
5f5089 |
+++ b/libblkid/src/Makemodule.am
|
|
|
5f5089 |
@@ -88,6 +88,7 @@ libblkid_la_SOURCES = \
|
|
|
5f5089 |
libblkid/src/superblocks/ubifs.c \
|
|
|
5f5089 |
libblkid/src/superblocks/udf.c \
|
|
|
5f5089 |
libblkid/src/superblocks/ufs.c \
|
|
|
5f5089 |
+ libblkid/src/superblocks/vdo.c \
|
|
|
5f5089 |
libblkid/src/superblocks/vfat.c \
|
|
|
5f5089 |
libblkid/src/superblocks/via_raid.c \
|
|
|
5f5089 |
libblkid/src/superblocks/vmfs.c \
|
|
|
5f5089 |
diff --git a/libblkid/src/superblocks/superblocks.c b/libblkid/src/superblocks/superblocks.c
|
|
|
5f5089 |
index 3721544ff..8210fc17b 100644
|
|
|
5f5089 |
--- a/libblkid/src/superblocks/superblocks.c
|
|
|
5f5089 |
+++ b/libblkid/src/superblocks/superblocks.c
|
|
|
5f5089 |
@@ -109,6 +109,7 @@ static const struct blkid_idinfo *idinfos[] =
|
|
|
5f5089 |
&verity_hash_idinfo,
|
|
|
5f5089 |
&luks_idinfo,
|
|
|
5f5089 |
&vmfs_volume_idinfo,
|
|
|
5f5089 |
+ &vdo_idinfo,
|
|
|
5f5089 |
|
|
|
5f5089 |
/* Filesystems */
|
|
|
5f5089 |
&vfat_idinfo,
|
|
|
5f5089 |
diff --git a/libblkid/src/superblocks/superblocks.h b/libblkid/src/superblocks/superblocks.h
|
|
|
5f5089 |
index 90847151b..487fe38c2 100644
|
|
|
5f5089 |
--- a/libblkid/src/superblocks/superblocks.h
|
|
|
5f5089 |
+++ b/libblkid/src/superblocks/superblocks.h
|
|
|
5f5089 |
@@ -72,6 +72,7 @@ extern const struct blkid_idinfo befs_idinfo;
|
|
|
5f5089 |
extern const struct blkid_idinfo nilfs2_idinfo;
|
|
|
5f5089 |
extern const struct blkid_idinfo exfat_idinfo;
|
|
|
5f5089 |
extern const struct blkid_idinfo f2fs_idinfo;
|
|
|
5f5089 |
+extern const struct blkid_idinfo vdo_idinfo;
|
|
|
5f5089 |
|
|
|
5f5089 |
/*
|
|
|
5f5089 |
* superblock functions
|
|
|
5f5089 |
diff --git a/libblkid/src/superblocks/vdo.c b/libblkid/src/superblocks/vdo.c
|
|
|
5f5089 |
new file mode 100644
|
|
|
5f5089 |
index 000000000..bec686f4f
|
|
|
5f5089 |
--- /dev/null
|
|
|
5f5089 |
+++ b/libblkid/src/superblocks/vdo.c
|
|
|
5f5089 |
@@ -0,0 +1,48 @@
|
|
|
5f5089 |
+/*
|
|
|
5f5089 |
+ * Copyright (C) 2017 Red Hat, Inc.
|
|
|
5f5089 |
+ *
|
|
|
5f5089 |
+ * This file may be redistributed under the terms of the
|
|
|
5f5089 |
+ * GNU Lesser General Public License.
|
|
|
5f5089 |
+ */
|
|
|
5f5089 |
+
|
|
|
5f5089 |
+#include <stdio.h>
|
|
|
5f5089 |
+#include <stdlib.h>
|
|
|
5f5089 |
+#include <unistd.h>
|
|
|
5f5089 |
+#include <string.h>
|
|
|
5f5089 |
+#include <errno.h>
|
|
|
5f5089 |
+#include <ctype.h>
|
|
|
5f5089 |
+#include <stdint.h>
|
|
|
5f5089 |
+
|
|
|
5f5089 |
+#include "superblocks.h"
|
|
|
5f5089 |
+
|
|
|
5f5089 |
+struct vdo_super_block {
|
|
|
5f5089 |
+ char magic[8]; /* magic number 'dmvdo001'*/
|
|
|
5f5089 |
+ char unused[32]; /* 32 bytes of unimportant space */
|
|
|
5f5089 |
+ unsigned char sb_uuid[16]; /* vdo unique id */
|
|
|
5f5089 |
+
|
|
|
5f5089 |
+ /* this is not all... but enough for libblkid */
|
|
|
5f5089 |
+} __attribute__((packed));
|
|
|
5f5089 |
+
|
|
|
5f5089 |
+static int probe_vdo(blkid_probe pr, const struct blkid_idmag *mag)
|
|
|
5f5089 |
+{
|
|
|
5f5089 |
+ struct vdo_super_block *vsb;
|
|
|
5f5089 |
+
|
|
|
5f5089 |
+ vsb = blkid_probe_get_sb(pr, mag, struct vdo_super_block);
|
|
|
5f5089 |
+ if (!vsb)
|
|
|
5f5089 |
+ return errno ? -errno : 1;
|
|
|
5f5089 |
+
|
|
|
5f5089 |
+ blkid_probe_set_uuid(pr, vsb->sb_uuid);
|
|
|
5f5089 |
+ return 0;
|
|
|
5f5089 |
+}
|
|
|
5f5089 |
+
|
|
|
5f5089 |
+const struct blkid_idinfo vdo_idinfo =
|
|
|
5f5089 |
+{
|
|
|
5f5089 |
+ .name = "vdo",
|
|
|
5f5089 |
+ .usage = BLKID_USAGE_OTHER,
|
|
|
5f5089 |
+ .probefunc = probe_vdo,
|
|
|
5f5089 |
+ .magics =
|
|
|
5f5089 |
+ {
|
|
|
5f5089 |
+ { .magic = "dmvdo001", .len = 8 },
|
|
|
5f5089 |
+ { NULL }
|
|
|
5f5089 |
+ }
|
|
|
5f5089 |
+};
|
|
|
5f5089 |
--
|
|
|
5f5089 |
2.13.6
|
|
|
5f5089 |
|