~ubuntu-branches/ubuntu/trusty/util-linux/trusty-proposed

« back to all changes in this revision

Viewing changes to libblkid/src/superblocks/romfs.c

  • Committer: Package Import Robot
  • Author(s): LaMont Jones
  • Date: 2011-11-03 15:38:23 UTC
  • mto: (4.5.5 sid) (1.6.4)
  • mto: This revision was merged to the branch mainline in revision 85.
  • Revision ID: package-import@ubuntu.com-20111103153823-10sx16jprzxlhkqf
ImportĀ upstreamĀ versionĀ 2.20.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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
 
 
20
struct 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
 
 
26
static 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)
 
32
                return -1;
 
33
 
 
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
 
 
40
const 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