summaryrefslogtreecommitdiffstats
path: root/shlibs/blkid/src/superblocks/drbd.c
diff options
context:
space:
mode:
authorKarel Zak2010-04-21 14:24:52 +0200
committerKarel Zak2010-04-21 15:49:59 +0200
commitabc67e06783aa1326b99f9ddee820cc495466e6c (patch)
tree58af5b38f418912cced901d99eae937c184404f8 /shlibs/blkid/src/superblocks/drbd.c
parentlibblkid: add partial support for superblock binary API (diff)
downloadkernel-qcow2-util-linux-abc67e06783aa1326b99f9ddee820cc495466e6c.tar.gz
kernel-qcow2-util-linux-abc67e06783aa1326b99f9ddee820cc495466e6c.tar.xz
kernel-qcow2-util-linux-abc67e06783aa1326b99f9ddee820cc495466e6c.zip
liblkid: export magic strings from raids
The library provides detected magic strings by SBMAGIC= and offsets of the magic strings by SBMAGIC_OFFSET= variables. This patch allows to support this feature for RAIDs and filesystems where the magic string is not on fixed position. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid/src/superblocks/drbd.c')
-rw-r--r--shlibs/blkid/src/superblocks/drbd.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/shlibs/blkid/src/superblocks/drbd.c b/shlibs/blkid/src/superblocks/drbd.c
index 5adcac7b9..3490948de 100644
--- a/shlibs/blkid/src/superblocks/drbd.c
+++ b/shlibs/blkid/src/superblocks/drbd.c
@@ -14,6 +14,7 @@
#include <errno.h>
#include <ctype.h>
#include <inttypes.h>
+#include <stddef.h>
#include "superblocks.h"
@@ -75,9 +76,9 @@ static int probe_drbd(blkid_probe pr, const struct blkid_idmag *mag)
return -1;
md = (struct md_on_disk_08 *)
- blkid_probe_get_buffer(pr,
- off,
- sizeof(struct md_on_disk_08));
+ blkid_probe_get_buffer(pr,
+ off,
+ sizeof(struct md_on_disk_08));
if (!md)
return -1;
@@ -94,6 +95,12 @@ static int probe_drbd(blkid_probe pr, const struct blkid_idmag *mag)
blkid_probe_set_version(pr, "v08");
+ if (blkid_probe_set_magic(pr,
+ off + offsetof(struct md_on_disk_08, magic),
+ sizeof(md->magic),
+ (unsigned char *) &md->magic))
+ return -1;
+
return 0;
}