blob: 8e63c100d0d70763577925631d876520fcb2a63c [file] [log] [blame]
bigbiff bigbiffe60683a2013-02-22 20:55:50 -05001/*
2 * Copyright (C) 1999, 2001 by Andries Brouwer
3 * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o
4 * Copyright (C) 2008 Karel Zak <kzak@redhat.com>
5 *
6 * This file may be redistributed under the terms of the
7 * GNU Lesser General Public License.
8 */
9
10#include <stdio.h>
11#include <stdlib.h>
12#include <unistd.h>
13#include <string.h>
14#include <errno.h>
15#include <ctype.h>
16#include <stdint.h>
17
18#include "superblocks.h"
19
20struct romfs_super_block {
21 unsigned char ros_magic[8];
22 uint32_t ros_dummy1[2];
23 unsigned char ros_volume[16];
24} __attribute__((packed));
25
26static int probe_romfs(blkid_probe pr, const struct blkid_idmag *mag)
27{
28 struct romfs_super_block *ros;
29
30 ros = blkid_probe_get_sb(pr, mag, struct romfs_super_block);
31 if (!ros)
bigbiff7b4c7a62015-01-01 19:44:14 -050032 return errno ? -errno : 1;
bigbiff bigbiffe60683a2013-02-22 20:55:50 -050033
34 if (strlen((char *) ros->ros_volume))
35 blkid_probe_set_label(pr, ros->ros_volume,
36 sizeof(ros->ros_volume));
37 return 0;
38}
39
40const struct blkid_idinfo romfs_idinfo =
41{
42 .name = "romfs",
43 .usage = BLKID_USAGE_FILESYSTEM,
44 .probefunc = probe_romfs,
45 .magics =
46 {
47 { .magic = "-rom1fs-", .len = 8 },
48 { NULL }
49 }
50};
51