blob: af597224f60b8e9352d8bf6ae9f84254e28e9517 [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)
bigbiff7b4c7a62015-01-01 19:44:14 -050036 return errno ? -errno : 1;
bigbiff bigbiffe60683a2013-02-22 20:55:50 -050037
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};