More fixes to the extlinux installer; change back to writable types
[profile/ivi/syslinux.git] / ext2_fs.inc
1 ; $Id$
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 %if ext2_super_block_size != 1024
94 %error "ext2_super_block definition bogus"
95 %endif
96
97 ;
98 ; Structure definition for the ext2 inode
99 ;
100                         struc ext2_inode
101 i_mode                  resw 1                  ; File mode 
102 i_uid                   resw 1                  ; Owner Uid 
103 i_size                  resd 1                  ; Size in bytes 
104 i_atime                 resd 1                  ; Access time 
105 i_ctime                 resd 1                  ; Creation time 
106 i_mtime                 resd 1                  ; Modification time 
107 i_dtime                 resd 1                  ; Deletion Time 
108 i_gid                   resw 1                  ; Group Id 
109 i_links_count           resw 1                  ; Links count 
110 i_blocks                resd 1                  ; Blocks count 
111 i_flags                 resd 1                  ; File flags 
112 l_i_reserved1           resd 1
113 i_block                 resd EXT2_N_BLOCKS      ; Pointer to blocks
114 i_version               resd 1                  ; File version (for NFS) 
115 i_file_acl              resd 1                  ; File ACL 
116 i_dir_acl               resd 1                  ; Directory ACL 
117 i_faddr                 resd 1                  ; Fragment address 
118 l_i_frag                resb 1                  ; Fragment number 
119 l_i_fsize               resb 1                  ; Fragment size 
120 i_pad1                  resw 1
121 l_i_reserved2           resd 2
122                         endstruc
123
124 %if ext2_inode_size != 128
125 %error "ext2_inode definition bogus"
126 %endif
127
128 ;
129 ; Structure definition for ext2 block group descriptor
130 ;
131                         struc ext2_group_desc
132 bg_block_bitmap         resd 1                  ; Block bitmap block
133 bg_inode_bitmap         resd 1                  ; Inode bitmap block
134 bg_inode_table          resd 1                  ; Inode table block
135 bg_free_blocks_count    resw 1                  ; Free blocks count
136 bg_free_inodes_count    resw 1                  ; Free inodes count
137 bg_used_dirs_count      resw 1                  ; Used inodes count
138 bg_pad                  resw 1
139 bg_reserved             resd 3
140                         endstruc
141
142 %if ext2_group_desc_size != 32
143 %error "ext2_group_desc definition bogus"
144 %endif
145
146 %define ext2_group_desc_lg2size 5
147
148 ;
149 ; Structure definition for ext2 directory entry
150 ;
151                         struc ext2_dir_entry
152 d_inode                 resd 1                  ; Inode number
153 d_rec_len               resw 1                  ; Directory entry length
154 d_name_len              resb 1                  ; Name length
155 d_file_type             resb 1                  ; File type
156 d_name                  equ $
157                         endstruc