130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#ifndef _LINUX_MINIX_FS_H
230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define _LINUX_MINIX_FS_H
330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#include <linux/types.h>
530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#include <linux/magic.h>
630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * The minix filesystem constants/structures
930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
1030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
1130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
1230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Thanks to Kees J Bot for sending me the definitions of the new
1330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * minix filesystem (aka V2) with bigger inodes and 32-bit block
1430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * pointers.
1530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
1630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
1730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define MINIX_ROOT_INO 1
1830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
1930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* Not the same as the bogus LINK_MAX in <linux/limits.h>. Oh well. */
2030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define MINIX_LINK_MAX	250
2130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define MINIX2_LINK_MAX	65530
2230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
2330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define MINIX_I_MAP_SLOTS	8
2430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define MINIX_Z_MAP_SLOTS	64
2530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define MINIX_VALID_FS		0x0001		/* Clean fs. */
2630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define MINIX_ERROR_FS		0x0002		/* fs has errors. */
2730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
2830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
2930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
3030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
3130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * This is the original minix inode layout on disk.
3230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Note the 8-bit gid and atime and ctime.
3330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
3430692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct minix_inode {
3530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 i_mode;
3630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 i_uid;
3730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 i_size;
3830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 i_time;
3930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8  i_gid;
4030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8  i_nlinks;
4130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 i_zone[9];
4230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
4330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
4430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
4530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * The new minix inode has all the time entries, as well as
4630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * long block numbers and a third indirect block (7+1+1+1
4730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * instead of 7+1+1). Also, some previously 8-bit values are
4830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * now 16-bit. The inode is now 64 bytes instead of 32.
4930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
5030692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct minix2_inode {
5130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 i_mode;
5230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 i_nlinks;
5330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 i_uid;
5430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 i_gid;
5530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 i_size;
5630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 i_atime;
5730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 i_mtime;
5830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 i_ctime;
5930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 i_zone[10];
6030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
6130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
6230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
6330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * minix super-block data on disk
6430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
6530692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct minix_super_block {
6630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_ninodes;
6730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_nzones;
6830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_imap_blocks;
6930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_zmap_blocks;
7030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_firstdatazone;
7130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_log_zone_size;
7230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 s_max_size;
7330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_magic;
7430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_state;
7530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 s_zones;
7630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
7730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
7830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
7930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * V3 minix super-block data on disk
8030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
8130692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct minix3_super_block {
8230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 s_ninodes;
8330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_pad0;
8430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_imap_blocks;
8530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_zmap_blocks;
8630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_firstdatazone;
8730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_log_zone_size;
8830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_pad1;
8930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 s_max_size;
9030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 s_zones;
9130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_magic;
9230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_pad2;
9330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 s_blocksize;
9430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8  s_disk_version;
9530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
9630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
9730692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct minix_dir_entry {
9830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 inode;
9930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	char name[0];
10030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
10130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
10230692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct minix3_dir_entry {
10330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 inode;
10430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	char name[0];
10530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
10630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#endif
107