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