diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 02:42:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 02:42:50 +0000 |
commit | 8cb83eee5a58b1fad74c34094ce3afb9e430b5a4 (patch) | |
tree | a9b2e7baeca1be40eb734371e3c8b11b02294497 /libblkid/src/superblocks/vdo.c | |
parent | Initial commit. (diff) | |
download | util-linux-8cb83eee5a58b1fad74c34094ce3afb9e430b5a4.tar.xz util-linux-8cb83eee5a58b1fad74c34094ce3afb9e430b5a4.zip |
Adding upstream version 2.33.1.upstream/2.33.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.c | 48 |
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 } + } +}; |