~pr0gg3d/ubuntu/oneiric/util-linux/bug-805886

« back to all changes in this revision

Viewing changes to libs/blkid/src/probers/cramfs.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2009-07-16 15:48:23 UTC
  • mfrom: (1.3.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090716154823-i26fshvs4v8h90qh
Tags: 2.16-1ubuntu1
* Merge from Debian, remaining changes:
  - Since udev is required in Ubuntu, the hwclock.sh init script is
    not called on startup and the hwclockfirst.sh init script is
    removed.
  - Remove /etc/adjtime on upgrade if it was not used.
  - Install custom blkid.conf to use /dev/.blkid.tab since we don't
    expect device names to survive a reboot
  - No lsb_release call in mount.preinst since we'd need Pre-Depends
    (LP: #383697).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
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 "blkidP.h"
19
 
 
20
 
struct 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
 
        } info;
34
 
        uint8_t         name[16];
35
 
};
36
 
 
37
 
static 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
 
 
49
 
const 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