Adding upstream version 3.35.
[syslinux-debian/hramrach.git] / ext2_fs.inc
blobe79b8d72a4f8a70b28674d20149eec6a9d835c07
1 ; -----------------------------------------------------------------------
3 ;   Copyright 1998-2005 H. Peter Anvin - All Rights Reserved
5 ;   This program is free software; you can redistribute it and/or modify
6 ;   it under the terms of the GNU General Public License as published by
7 ;   the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
8 ;   USA; either version 2 of the License, or (at your option) any later
9 ;   version; incorporated herein by reference.
11 ; -----------------------------------------------------------------------
14 ; ext2_fs.inc
16 ; NASM include file for ext2fs data structures
19 %define EXT2_SUPER_MAGIC        0xEF53
21 %define EXT2_GOOD_OLD_REV       0       ; The good old (original) format
22 %define EXT2_DYNAMIC_REV        1       ; V2 format w/ dynamic inode sizes
23 %define EXT2_GOOD_OLD_INODE_SIZE 128
25 ; Special inode numbers
26 %define EXT2_BAD_INO             1      ; Bad blocks inode
27 %define EXT2_ROOT_INO            2      ; Root inode
28 %define EXT2_BOOT_LOADER_INO     5      ; Boot loader inode
29 %define EXT2_UNDEL_DIR_INO       6      ; Undelete directory inode
30 %define EXT3_RESIZE_INO          7      ; Reserved group descriptors inode
31 %define EXT3_JOURNAL_INO         8      ; Journal inode
33 ; We're readonly, so we only care about incompat features.
34 %define EXT2_FEATURE_INCOMPAT_COMPRESSION       0x0001
35 %define EXT2_FEATURE_INCOMPAT_FILETYPE          0x0002
36 %define EXT3_FEATURE_INCOMPAT_RECOVER           0x0004
37 %define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV       0x0008
38 %define EXT2_FEATURE_INCOMPAT_META_BG           0x0010
39 %define EXT2_FEATURE_INCOMPAT_ANY               0xffffffff
41 %define EXT2_NDIR_BLOCKS        12
42 %define EXT2_IND_BLOCK          EXT2_NDIR_BLOCKS
43 %define EXT2_DIND_BLOCK         (EXT2_IND_BLOCK+1)
44 %define EXT2_TIND_BLOCK         (EXT2_DIND_BLOCK+1)
45 %define EXT2_N_BLOCKS           (EXT2_TIND_BLOCK+1)
48 ; File types and file modes
50 %define S_IFDIR         0040000o        ; Directory
51 %define S_IFCHR         0020000o        ; Character device
52 %define S_IFBLK         0060000o        ; Block device
53 %define S_IFREG         0100000o        ; Regular file
54 %define S_IFIFO         0010000o        ; FIFO
55 %define S_IFLNK         0120000o        ; Symbolic link
56 %define S_IFSOCK        0140000o        ; Socket
58 %define S_IFSHIFT       12
60 %define T_IFDIR         (S_IFDIR >> S_IFSHIFT)
61 %define T_IFCHR         (S_IFCHR >> S_IFSHIFT)
62 %define T_IFBLK         (S_IFBLK >> S_IFSHIFT)
63 %define T_IFREG         (S_IFREG >> S_IFSHIFT)
64 %define T_IFIFO         (S_IFIFO >> S_IFSHIFT)
65 %define T_IFLNK         (S_IFLNK >> S_IFSHIFT)
66 %define T_IFSOCK        (S_IFSOCK >> S_IFSHIFT)
69 ; Structure definition for the ext2 superblock
71                         struc ext2_super_block
72 s_inodes_count          resd 1                  ; Inodes count
73 s_blocks_count          resd 1                  ; Blocks count
74 s_r_blocks_count        resd 1                  ; Reserved blocks count
75 s_free_blocks_count     resd 1                  ; Free blocks count
76 s_free_inodes_count     resd 1                  ; Free inodes count
77 s_first_data_block      resd 1                  ; First Data Block
78 s_log_block_size        resd 1                  ; Block size
79 s_log_frag_size         resd 1                  ; Fragment size
80 s_blocks_per_group      resd 1                  ; # Blocks per group
81 s_frags_per_group       resd 1                  ; # Fragments per group
82 s_inodes_per_group      resd 1                  ; # Inodes per group
83 s_mtime                 resd 1                  ; Mount time
84 s_wtime                 resd 1                  ; Write time
85 s_mnt_count             resw 1                  ; Mount count
86 s_max_mnt_count         resw 1                  ; Maximal mount count
87 s_magic                 resw 1                  ; Magic signature
88 s_state                 resw 1                  ; File system state
89 s_errors                resw 1                  ; Behaviour when detecting errors
90 s_minor_rev_level       resw 1                  ; minor revision level
91 s_lastcheck             resd 1                  ; time of last check
92 s_checkinterval         resd 1                  ; max. time between checks
93 s_creator_os            resd 1                  ; OS
94 s_rev_level             resd 1                  ; Revision level
95 s_def_resuid            resw 1                  ; Default uid for reserved blocks
96 s_def_resgid            resw 1                  ; Default gid for reserved blocks
97 s_first_ino             resd 1                  ; First non-reserved inode
98 s_inode_size            resw 1                  ; size of inode structure
99 s_block_group_nr        resw 1                  ; block group # of this superblock
100 s_feature_compat        resd 1                  ; compatible feature set
101 s_feature_incompat      resd 1                  ; incompatible feature set
102 s_feature_ro_compat     resd 1                  ; readonly-compatible feature set
103 s_uuid                  resb 16                 ; 128-bit uuid for volume
104 s_volume_name           resb 16                 ; volume name
105 s_last_mounted          resb 64                 ; directory where last mounted
106 s_algorithm_usage_bitmap resd 1                 ; For compression
107 s_prealloc_blocks       resb 1                  ; Nr of blocks to try to preallocate
108 s_prealloc_dir_blocks   resb 1                  ; Nr to preallocate for dirs
109 s_padding1              resw 1
110 s_reserved              resd 204                ; Padding to the end of the block
111                         endstruc
113 %ifndef DEPEND
114 %if ext2_super_block_size != 1024
115 %error "ext2_super_block definition bogus"
116 %endif
117 %endif
120 ; Structure definition for the ext2 inode
122                         struc ext2_inode
123 i_mode                  resw 1                  ; File mode
124 i_uid                   resw 1                  ; Owner Uid
125 i_size                  resd 1                  ; Size in bytes
126 i_atime                 resd 1                  ; Access time
127 i_ctime                 resd 1                  ; Creation time
128 i_mtime                 resd 1                  ; Modification time
129 i_dtime                 resd 1                  ; Deletion Time
130 i_gid                   resw 1                  ; Group Id
131 i_links_count           resw 1                  ; Links count
132 i_blocks                resd 1                  ; Blocks count
133 i_flags                 resd 1                  ; File flags
134 l_i_reserved1           resd 1
135 i_block                 resd EXT2_N_BLOCKS      ; Pointer to blocks
136 i_version               resd 1                  ; File version (for NFS)
137 i_file_acl              resd 1                  ; File ACL
138 i_dir_acl               resd 1                  ; Directory ACL
139 i_faddr                 resd 1                  ; Fragment address
140 l_i_frag                resb 1                  ; Fragment number
141 l_i_fsize               resb 1                  ; Fragment size
142 i_pad1                  resw 1
143 l_i_reserved2           resd 2
144                         endstruc
146 %ifndef DEPEND
147 %if ext2_inode_size != 128
148 %error "ext2_inode definition bogus"
149 %endif
150 %endif
153 ; Structure definition for ext2 block group descriptor
155                         struc ext2_group_desc
156 bg_block_bitmap         resd 1                  ; Block bitmap block
157 bg_inode_bitmap         resd 1                  ; Inode bitmap block
158 bg_inode_table          resd 1                  ; Inode table block
159 bg_free_blocks_count    resw 1                  ; Free blocks count
160 bg_free_inodes_count    resw 1                  ; Free inodes count
161 bg_used_dirs_count      resw 1                  ; Used inodes count
162 bg_pad                  resw 1
163 bg_reserved             resd 3
164                         endstruc
166 %ifndef DEPEND
167 %if ext2_group_desc_size != 32
168 %error "ext2_group_desc definition bogus"
169 %endif
170 %endif
172 %define ext2_group_desc_lg2size 5
175 ; Structure definition for ext2 directory entry
177                         struc ext2_dir_entry
178 d_inode                 resd 1                  ; Inode number
179 d_rec_len               resw 1                  ; Directory entry length
180 d_name_len              resb 1                  ; Name length
181 d_file_type             resb 1                  ; File type
182 d_name                  equ $
183                         endstruc