xref: /linux/include/uapi/linux/minix_fs.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2607ca46eSDavid Howells #ifndef _LINUX_MINIX_FS_H
3607ca46eSDavid Howells #define _LINUX_MINIX_FS_H
4607ca46eSDavid Howells 
5607ca46eSDavid Howells #include <linux/types.h>
6607ca46eSDavid Howells #include <linux/magic.h>
7607ca46eSDavid Howells 
8607ca46eSDavid Howells /*
9607ca46eSDavid Howells  * The minix filesystem constants/structures
10607ca46eSDavid Howells  */
11607ca46eSDavid Howells 
12607ca46eSDavid Howells /*
13607ca46eSDavid Howells  * Thanks to Kees J Bot for sending me the definitions of the new
14607ca46eSDavid Howells  * minix filesystem (aka V2) with bigger inodes and 32-bit block
15607ca46eSDavid Howells  * pointers.
16607ca46eSDavid Howells  */
17607ca46eSDavid Howells 
18607ca46eSDavid Howells #define MINIX_ROOT_INO 1
19607ca46eSDavid Howells 
20607ca46eSDavid Howells /* Not the same as the bogus LINK_MAX in <linux/limits.h>. Oh well. */
21607ca46eSDavid Howells #define MINIX_LINK_MAX	250
22607ca46eSDavid Howells #define MINIX2_LINK_MAX	65530
23607ca46eSDavid Howells 
24607ca46eSDavid Howells #define MINIX_I_MAP_SLOTS	8
25607ca46eSDavid Howells #define MINIX_Z_MAP_SLOTS	64
26607ca46eSDavid Howells #define MINIX_VALID_FS		0x0001		/* Clean fs. */
27607ca46eSDavid Howells #define MINIX_ERROR_FS		0x0002		/* fs has errors. */
28607ca46eSDavid Howells 
29607ca46eSDavid Howells #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
30607ca46eSDavid Howells 
31607ca46eSDavid Howells /*
32607ca46eSDavid Howells  * This is the original minix inode layout on disk.
33607ca46eSDavid Howells  * Note the 8-bit gid and atime and ctime.
34607ca46eSDavid Howells  */
35607ca46eSDavid Howells struct minix_inode {
36607ca46eSDavid Howells 	__u16 i_mode;
37607ca46eSDavid Howells 	__u16 i_uid;
38607ca46eSDavid Howells 	__u32 i_size;
39607ca46eSDavid Howells 	__u32 i_time;
40607ca46eSDavid Howells 	__u8  i_gid;
41607ca46eSDavid Howells 	__u8  i_nlinks;
42607ca46eSDavid Howells 	__u16 i_zone[9];
43607ca46eSDavid Howells };
44607ca46eSDavid Howells 
45607ca46eSDavid Howells /*
46607ca46eSDavid Howells  * The new minix inode has all the time entries, as well as
47607ca46eSDavid Howells  * long block numbers and a third indirect block (7+1+1+1
48607ca46eSDavid Howells  * instead of 7+1+1). Also, some previously 8-bit values are
49607ca46eSDavid Howells  * now 16-bit. The inode is now 64 bytes instead of 32.
50607ca46eSDavid Howells  */
51607ca46eSDavid Howells struct minix2_inode {
52607ca46eSDavid Howells 	__u16 i_mode;
53607ca46eSDavid Howells 	__u16 i_nlinks;
54607ca46eSDavid Howells 	__u16 i_uid;
55607ca46eSDavid Howells 	__u16 i_gid;
56607ca46eSDavid Howells 	__u32 i_size;
57607ca46eSDavid Howells 	__u32 i_atime;
58607ca46eSDavid Howells 	__u32 i_mtime;
59607ca46eSDavid Howells 	__u32 i_ctime;
60607ca46eSDavid Howells 	__u32 i_zone[10];
61607ca46eSDavid Howells };
62607ca46eSDavid Howells 
63607ca46eSDavid Howells /*
64607ca46eSDavid Howells  * minix super-block data on disk
65607ca46eSDavid Howells  */
66607ca46eSDavid Howells struct minix_super_block {
67607ca46eSDavid Howells 	__u16 s_ninodes;
68607ca46eSDavid Howells 	__u16 s_nzones;
69607ca46eSDavid Howells 	__u16 s_imap_blocks;
70607ca46eSDavid Howells 	__u16 s_zmap_blocks;
71607ca46eSDavid Howells 	__u16 s_firstdatazone;
72607ca46eSDavid Howells 	__u16 s_log_zone_size;
73607ca46eSDavid Howells 	__u32 s_max_size;
74607ca46eSDavid Howells 	__u16 s_magic;
75607ca46eSDavid Howells 	__u16 s_state;
76607ca46eSDavid Howells 	__u32 s_zones;
77607ca46eSDavid Howells };
78607ca46eSDavid Howells 
79607ca46eSDavid Howells /*
80607ca46eSDavid Howells  * V3 minix super-block data on disk
81607ca46eSDavid Howells  */
82607ca46eSDavid Howells struct minix3_super_block {
83607ca46eSDavid Howells 	__u32 s_ninodes;
84607ca46eSDavid Howells 	__u16 s_pad0;
85607ca46eSDavid Howells 	__u16 s_imap_blocks;
86607ca46eSDavid Howells 	__u16 s_zmap_blocks;
87607ca46eSDavid Howells 	__u16 s_firstdatazone;
88607ca46eSDavid Howells 	__u16 s_log_zone_size;
89607ca46eSDavid Howells 	__u16 s_pad1;
90607ca46eSDavid Howells 	__u32 s_max_size;
91607ca46eSDavid Howells 	__u32 s_zones;
92607ca46eSDavid Howells 	__u16 s_magic;
93607ca46eSDavid Howells 	__u16 s_pad2;
94607ca46eSDavid Howells 	__u16 s_blocksize;
95607ca46eSDavid Howells 	__u8  s_disk_version;
96607ca46eSDavid Howells };
97607ca46eSDavid Howells 
98607ca46eSDavid Howells struct minix_dir_entry {
99607ca46eSDavid Howells 	__u16 inode;
100*94dfc73eSGustavo A. R. Silva 	char name[];
101607ca46eSDavid Howells };
102607ca46eSDavid Howells 
103607ca46eSDavid Howells struct minix3_dir_entry {
104607ca46eSDavid Howells 	__u32 inode;
105*94dfc73eSGustavo A. R. Silva 	char name[];
106607ca46eSDavid Howells };
107607ca46eSDavid Howells #endif
108