blob: 57be23921cbbf6ea3ac011f9d2e9381d53761a9c [file] [log] [blame]
bigbiff bigbiffe60683a2013-02-22 20:55:50 -05001#ifndef UTIL_LINUX_MINIX_H
2#define UTIL_LINUX_MINIX_H
3
4#include <stdint.h>
5
6struct minix_inode {
7 uint16_t i_mode;
8 uint16_t i_uid;
9 uint32_t i_size;
10 uint32_t i_time;
11 uint8_t i_gid;
12 uint8_t i_nlinks;
13 uint16_t i_zone[9];
14};
15
16struct minix2_inode {
17 uint16_t i_mode;
18 uint16_t i_nlinks;
19 uint16_t i_uid;
20 uint16_t i_gid;
21 uint32_t i_size;
22 uint32_t i_atime;
23 uint32_t i_mtime;
24 uint32_t i_ctime;
25 uint32_t i_zone[10];
26};
27
28struct minix_super_block {
29 uint16_t s_ninodes;
30 uint16_t s_nzones;
31 uint16_t s_imap_blocks;
32 uint16_t s_zmap_blocks;
33 uint16_t s_firstdatazone;
34 uint16_t s_log_zone_size;
35 uint32_t s_max_size;
36 uint16_t s_magic;
37 uint16_t s_state;
38 uint32_t s_zones;
39};
40
41/* V3 minix super-block data on disk */
42struct minix3_super_block {
43 uint32_t s_ninodes;
44 uint16_t s_pad0;
45 uint16_t s_imap_blocks;
46 uint16_t s_zmap_blocks;
47 uint16_t s_firstdatazone;
48 uint16_t s_log_zone_size;
49 uint16_t s_pad1;
50 uint32_t s_max_size;
51 uint32_t s_zones;
52 uint16_t s_magic;
53 uint16_t s_pad2;
54 uint16_t s_blocksize;
55 uint8_t s_disk_version;
56};
57
58/*
59 * Minix subpartitions are always within primary dos partition.
60 */
61#define MINIX_MAXPARTITIONS 4
62
63#define MINIX_BLOCK_SIZE_BITS 10
64#define MINIX_BLOCK_SIZE (1 << MINIX_BLOCK_SIZE_BITS)
65
66#define MINIX_NAME_MAX 255 /* # chars in a file name */
67#define MINIX_MAX_INODES 65535
68
69#define MINIX_INODES_PER_BLOCK ((MINIX_BLOCK_SIZE)/(sizeof (struct minix_inode)))
70#define MINIX2_INODES_PER_BLOCK ((MINIX_BLOCK_SIZE)/(sizeof (struct minix2_inode)))
71
72/* minix_super_block.s_state */
73#define MINIX_VALID_FS 0x0001 /* Clean fs. */
74#define MINIX_ERROR_FS 0x0002 /* fs has errors. */
75
76#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
77#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
78#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */
79#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */
80#define MINIX3_SUPER_MAGIC 0x4d5a /* minix V3 fs (60 char names) */
81
82#endif /* UTIL_LINUX_MINIX_H */