diff options
author | Dees Troy <dees_troy@teamw.in> | 2013-02-27 19:39:14 +0100 |
---|---|---|
committer | Gerrit Code Review <gerrit@5.9.244.119> | 2013-02-27 19:39:14 +0100 |
commit | 2cf31af56114cf997b10218db7c35ee047f5d400 (patch) | |
tree | 85f3b51e45ff8233922f2c0c151299868ca89371 /libblkid/cramfs.c | |
parent | libtar - Fix extraction of hardlinks to use the prefix (diff) | |
parent | use libblkid to get filesystem type (diff) | |
download | android_bootable_recovery-2cf31af56114cf997b10218db7c35ee047f5d400.tar android_bootable_recovery-2cf31af56114cf997b10218db7c35ee047f5d400.tar.gz android_bootable_recovery-2cf31af56114cf997b10218db7c35ee047f5d400.tar.bz2 android_bootable_recovery-2cf31af56114cf997b10218db7c35ee047f5d400.tar.lz android_bootable_recovery-2cf31af56114cf997b10218db7c35ee047f5d400.tar.xz android_bootable_recovery-2cf31af56114cf997b10218db7c35ee047f5d400.tar.zst android_bootable_recovery-2cf31af56114cf997b10218db7c35ee047f5d400.zip |
Diffstat (limited to 'libblkid/cramfs.c')
-rw-r--r-- | libblkid/cramfs.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/libblkid/cramfs.c b/libblkid/cramfs.c new file mode 100644 index 000000000..b58ed08cb --- /dev/null +++ b/libblkid/cramfs.c @@ -0,0 +1,62 @@ +/* + * Copyright (C) 1999 by Andries Brouwer + * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o + * Copyright (C) 2001 by Andreas Dilger + * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org> + * Copyright (C) 2008 Karel Zak <kzak@redhat.com> + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <stdint.h> + +#include "superblocks.h" + +struct cramfs_super +{ + uint8_t magic[4]; + uint32_t size; + uint32_t flags; + uint32_t future; + uint8_t signature[16]; + struct cramfs_info + { + uint32_t crc; + uint32_t edition; + uint32_t blocks; + uint32_t files; + } __attribute__((packed)) info; + uint8_t name[16]; +} __attribute__((packed)); + +static int probe_cramfs(blkid_probe pr, const struct blkid_idmag *mag) +{ + struct cramfs_super *cs; + + cs = blkid_probe_get_sb(pr, mag, struct cramfs_super); + if (!cs) + return -1; + + blkid_probe_set_label(pr, cs->name, sizeof(cs->name)); + return 0; +} + +const struct blkid_idinfo cramfs_idinfo = +{ + .name = "cramfs", + .usage = BLKID_USAGE_FILESYSTEM, + .probefunc = probe_cramfs, + .magics = + { + { "\x45\x3d\xcd\x28", 4, 0, 0 }, + { "\x28\xcd\x3d\x45", 4, 0, 0 }, + { NULL } + } +}; + + |