syslinux-3.08-2 sources from FC4
[bootcd.git] / syslinux / ext2_fs.inc
1 ; $Id: ext2_fs.inc,v 1.3 2005/01/06 22:34:06 hpa Exp $
2 ; -----------------------------------------------------------------------
3 ;   
4 ;   Copyright 1998-1999 H. Peter Anvin - All Rights Reserved
5 ;
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.
11 ;
12 ; -----------------------------------------------------------------------
13
14 ;
15 ; ext2_fs.inc
16 ;
17 ; NASM include file for ext2fs data structures
18 ;
19
20 %define EXT2_SUPER_MAGIC        0xEF53
21
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
25
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
33
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
41
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)
47
48 ;
49 ; Structure definition for the ext2 superblock
50 ;
51                         struc ext2_super_block
52 s_inodes_count          resd 1                  ; Inodes count 
53 s_blocks_count          resd 1                  ; Blocks count 
54 s_r_blocks_count        resd 1                  ; Reserved blocks count 
55 s_free_blocks_count     resd 1                  ; Free blocks count 
56 s_free_inodes_count     resd 1                  ; Free inodes count 
57 s_first_data_block      resd 1                  ; First Data Block 
58 s_log_block_size        resd 1                  ; Block size 
59 s_log_frag_size         resd 1                  ; Fragment size 
60 s_blocks_per_group      resd 1                  ; # Blocks per group 
61 s_frags_per_group       resd 1                  ; # Fragments per group 
62 s_inodes_per_group      resd 1                  ; # Inodes per group 
63 s_mtime                 resd 1                  ; Mount time 
64 s_wtime                 resd 1                  ; Write time 
65 s_mnt_count             resw 1                  ; Mount count 
66 s_max_mnt_count         resw 1                  ; Maximal mount count 
67 s_magic                 resw 1                  ; Magic signature 
68 s_state                 resw 1                  ; File system state 
69 s_errors                resw 1                  ; Behaviour when detecting errors 
70 s_minor_rev_level       resw 1                  ; minor revision level 
71 s_lastcheck             resd 1                  ; time of last check 
72 s_checkinterval         resd 1                  ; max. time between checks 
73 s_creator_os            resd 1                  ; OS 
74 s_rev_level             resd 1                  ; Revision level 
75 s_def_resuid            resw 1                  ; Default uid for reserved blocks 
76 s_def_resgid            resw 1                  ; Default gid for reserved blocks 
77 s_first_ino             resd 1                  ; First non-reserved inode 
78 s_inode_size            resw 1                  ; size of inode structure 
79 s_block_group_nr        resw 1                  ; block group # of this superblock 
80 s_feature_compat        resd 1                  ; compatible feature set 
81 s_feature_incompat      resd 1                  ; incompatible feature set 
82 s_feature_ro_compat     resd 1                  ; readonly-compatible feature set 
83 s_uuid                  resb 16                 ; 128-bit uuid for volume 
84 s_volume_name           resb 16                 ; volume name 
85 s_last_mounted          resb 64                 ; directory where last mounted 
86 s_algorithm_usage_bitmap resd 1                 ; For compression 
87 s_prealloc_blocks       resb 1                  ; Nr of blocks to try to preallocate
88 s_prealloc_dir_blocks   resb 1                  ; Nr to preallocate for dirs 
89 s_padding1              resw 1
90 s_reserved              resd 204                ; Padding to the end of the block 
91                         endstruc
92
93 %ifndef DEPEND
94 %if ext2_super_block_size != 1024
95 %error "ext2_super_block definition bogus"
96 %endif
97 %endif
98
99 ;
100 ; Structure definition for the ext2 inode
101 ;
102                         struc ext2_inode
103 i_mode                  resw 1                  ; File mode 
104 i_uid                   resw 1                  ; Owner Uid 
105 i_size                  resd 1                  ; Size in bytes 
106 i_atime                 resd 1                  ; Access time 
107 i_ctime                 resd 1                  ; Creation time 
108 i_mtime                 resd 1                  ; Modification time 
109 i_dtime                 resd 1                  ; Deletion Time 
110 i_gid                   resw 1                  ; Group Id 
111 i_links_count           resw 1                  ; Links count 
112 i_blocks                resd 1                  ; Blocks count 
113 i_flags                 resd 1                  ; File flags 
114 l_i_reserved1           resd 1
115 i_block                 resd EXT2_N_BLOCKS      ; Pointer to blocks
116 i_version               resd 1                  ; File version (for NFS) 
117 i_file_acl              resd 1                  ; File ACL 
118 i_dir_acl               resd 1                  ; Directory ACL 
119 i_faddr                 resd 1                  ; Fragment address 
120 l_i_frag                resb 1                  ; Fragment number 
121 l_i_fsize               resb 1                  ; Fragment size 
122 i_pad1                  resw 1
123 l_i_reserved2           resd 2
124                         endstruc
125
126 %ifndef DEPEND
127 %if ext2_inode_size != 128
128 %error "ext2_inode definition bogus"
129 %endif
130 %endif
131
132 ;
133 ; Structure definition for ext2 block group descriptor
134 ;
135                         struc ext2_group_desc
136 bg_block_bitmap         resd 1                  ; Block bitmap block
137 bg_inode_bitmap         resd 1                  ; Inode bitmap block
138 bg_inode_table          resd 1                  ; Inode table block
139 bg_free_blocks_count    resw 1                  ; Free blocks count
140 bg_free_inodes_count    resw 1                  ; Free inodes count
141 bg_used_dirs_count      resw 1                  ; Used inodes count
142 bg_pad                  resw 1
143 bg_reserved             resd 3
144                         endstruc
145
146 %ifndef DEPEND
147 %if ext2_group_desc_size != 32
148 %error "ext2_group_desc definition bogus"
149 %endif
150 %endif
151
152 %define ext2_group_desc_lg2size 5
153
154 ;
155 ; Structure definition for ext2 directory entry
156 ;
157                         struc ext2_dir_entry
158 d_inode                 resd 1                  ; Inode number
159 d_rec_len               resw 1                  ; Directory entry length
160 d_name_len              resb 1                  ; Name length
161 d_file_type             resb 1                  ; File type
162 d_name                  equ $
163                         endstruc