bigbiff bigbiff | e60683a | 2013-02-22 20:55:50 -0500 | [diff] [blame] | 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 | |