blob: b58ed08cb1052a392641ec7ca8ef55143c8b89c2 [file] [log] [blame]
bigbiff bigbiffe60683a2013-02-22 20:55:50 -05001/*
2 * Copyright (C) 1999 by Andries Brouwer
3 * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o
4 * Copyright (C) 2001 by Andreas Dilger
5 * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
6 * Copyright (C) 2008 Karel Zak <kzak@redhat.com>
7 *
8 * This file may be redistributed under the terms of the
9 * GNU Lesser General Public License.
10 */
11
12#include <stdio.h>
13#include <stdlib.h>
14#include <unistd.h>
15#include <string.h>
16#include <stdint.h>
17
18#include "superblocks.h"
19
20struct cramfs_super
21{
22 uint8_t magic[4];
23 uint32_t size;
24 uint32_t flags;
25 uint32_t future;
26 uint8_t signature[16];
27 struct cramfs_info
28 {
29 uint32_t crc;
30 uint32_t edition;
31 uint32_t blocks;
32 uint32_t files;
33 } __attribute__((packed)) info;
34 uint8_t name[16];
35} __attribute__((packed));
36
37static int probe_cramfs(blkid_probe pr, const struct blkid_idmag *mag)
38{
39 struct cramfs_super *cs;
40
41 cs = blkid_probe_get_sb(pr, mag, struct cramfs_super);
42 if (!cs)
43 return -1;
44
45 blkid_probe_set_label(pr, cs->name, sizeof(cs->name));
46 return 0;
47}
48
49const struct blkid_idinfo cramfs_idinfo =
50{
51 .name = "cramfs",
52 .usage = BLKID_USAGE_FILESYSTEM,
53 .probefunc = probe_cramfs,
54 .magics =
55 {
56 { "\x45\x3d\xcd\x28", 4, 0, 0 },
57 { "\x28\xcd\x3d\x45", 4, 0, 0 },
58 { NULL }
59 }
60};
61
62