blob: afe4725a06724ff0092c20eaceefe801aa0d1531 [file] [log] [blame]
bigbiff bigbiffe60683a2013-02-22 20:55:50 -05001/*
2 * Copyright (C) 2011 by Philipp Marek <philipp.marek@linbit.com>
3 *
4 * This file may be redistributed under the terms of the
5 * GNU Lesser General Public License.
6 */
7#include <stdio.h>
8#include <stdlib.h>
9#include <unistd.h>
10#include <string.h>
11#include <errno.h>
12#include <ctype.h>
13#include <inttypes.h>
14#include <stddef.h>
15
16#include "superblocks.h"
17
18
19struct log_header_t {
20 uint64_t magic;
21 uint64_t version;
22
23 unsigned char uuid[16];
24
25 uint64_t flags;
26} __attribute__((packed));
27
28
29static int probe_drbdproxy_datalog(blkid_probe pr,
30 const struct blkid_idmag *mag __attribute__((__unused__)))
31{
32 struct log_header_t *lh;
33
34 lh = (struct log_header_t *) blkid_probe_get_buffer(pr, 0, sizeof(*lh));
35 if (!lh)
36 return -1;
37
38 blkid_probe_set_uuid(pr, lh->uuid);
39 blkid_probe_sprintf_version(pr, "v%jd", le64_to_cpu(lh->version));
40
41 return 0;
42}
43
44const struct blkid_idinfo drbdproxy_datalog_idinfo =
45{
46 .name = "drbdproxy_datalog",
47 .usage = BLKID_USAGE_FILESYSTEM,
48 .probefunc = probe_drbdproxy_datalog,
49 .minsz = 16*1024,
50 .magics =
51 {
52 { .magic = "DRBDdlh*", .len = 8, .sboff = 0, .kboff = 0 },
53 { NULL }
54 }
55};