Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _LINUX_MINIX_FS_H
0003 #define _LINUX_MINIX_FS_H
0004 
0005 #include <linux/types.h>
0006 #include <linux/magic.h>
0007 
0008 /*
0009  * The minix filesystem constants/structures
0010  */
0011 
0012 /*
0013  * Thanks to Kees J Bot for sending me the definitions of the new
0014  * minix filesystem (aka V2) with bigger inodes and 32-bit block
0015  * pointers.
0016  */
0017 
0018 #define MINIX_ROOT_INO 1
0019 
0020 /* Not the same as the bogus LINK_MAX in <linux/limits.h>. Oh well. */
0021 #define MINIX_LINK_MAX  250
0022 #define MINIX2_LINK_MAX 65530
0023 
0024 #define MINIX_I_MAP_SLOTS   8
0025 #define MINIX_Z_MAP_SLOTS   64
0026 #define MINIX_VALID_FS      0x0001      /* Clean fs. */
0027 #define MINIX_ERROR_FS      0x0002      /* fs has errors. */
0028 
0029 #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
0030 
0031 /*
0032  * This is the original minix inode layout on disk.
0033  * Note the 8-bit gid and atime and ctime.
0034  */
0035 struct minix_inode {
0036     __u16 i_mode;
0037     __u16 i_uid;
0038     __u32 i_size;
0039     __u32 i_time;
0040     __u8  i_gid;
0041     __u8  i_nlinks;
0042     __u16 i_zone[9];
0043 };
0044 
0045 /*
0046  * The new minix inode has all the time entries, as well as
0047  * long block numbers and a third indirect block (7+1+1+1
0048  * instead of 7+1+1). Also, some previously 8-bit values are
0049  * now 16-bit. The inode is now 64 bytes instead of 32.
0050  */
0051 struct minix2_inode {
0052     __u16 i_mode;
0053     __u16 i_nlinks;
0054     __u16 i_uid;
0055     __u16 i_gid;
0056     __u32 i_size;
0057     __u32 i_atime;
0058     __u32 i_mtime;
0059     __u32 i_ctime;
0060     __u32 i_zone[10];
0061 };
0062 
0063 /*
0064  * minix super-block data on disk
0065  */
0066 struct minix_super_block {
0067     __u16 s_ninodes;
0068     __u16 s_nzones;
0069     __u16 s_imap_blocks;
0070     __u16 s_zmap_blocks;
0071     __u16 s_firstdatazone;
0072     __u16 s_log_zone_size;
0073     __u32 s_max_size;
0074     __u16 s_magic;
0075     __u16 s_state;
0076     __u32 s_zones;
0077 };
0078 
0079 /*
0080  * V3 minix super-block data on disk
0081  */
0082 struct minix3_super_block {
0083     __u32 s_ninodes;
0084     __u16 s_pad0;
0085     __u16 s_imap_blocks;
0086     __u16 s_zmap_blocks;
0087     __u16 s_firstdatazone;
0088     __u16 s_log_zone_size;
0089     __u16 s_pad1;
0090     __u32 s_max_size;
0091     __u32 s_zones;
0092     __u16 s_magic;
0093     __u16 s_pad2;
0094     __u16 s_blocksize;
0095     __u8  s_disk_version;
0096 };
0097 
0098 struct minix_dir_entry {
0099     __u16 inode;
0100     char name[];
0101 };
0102 
0103 struct minix3_dir_entry {
0104     __u32 inode;
0105     char name[];
0106 };
0107 #endif