1/*-
2 * modified for EXT2FS support in Lites 1.1
3 *
4 * Aug 1995, Godmar Back (gback@cs.utah.edu)
5 * University of Utah, Department of Computer Science
6 *
7 * $FreeBSD: head/sys/fs/ext2fs/ext2fs.h 221126 2011-04-27 18:15:34Z jhb $
8 */
9/*-
10 * Copyright (c) 2009 Aditya Sarawgi
11 * All rights reserved.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
--- 44 unchanged lines hidden (view full) ---
60 * the super block for this name.
61 */
62#define MAXMNTLEN 512
63
64/*
65 * Super block for an ext2fs file system.
66 */
67struct ext2fs {
68 uint32_t e2fs_icount; /* Inode count */
69 uint32_t e2fs_bcount; /* blocks count */
70 uint32_t e2fs_rbcount; /* reserved blocks count */
71 uint32_t e2fs_fbcount; /* free blocks count */
72 uint32_t e2fs_ficount; /* free inodes count */
73 uint32_t e2fs_first_dblock; /* first data block */
74 uint32_t e2fs_log_bsize; /* block size = 1024*(2^e2fs_log_bsize) */
75 uint32_t e2fs_log_fsize; /* fragment size */
76 uint32_t e2fs_bpg; /* blocks per group */
77 uint32_t e2fs_fpg; /* frags per group */
78 uint32_t e2fs_ipg; /* inodes per group */
79 uint32_t e2fs_mtime; /* mount time */
80 uint32_t e2fs_wtime; /* write time */
81 uint16_t e2fs_mnt_count; /* mount count */
82 uint16_t e2fs_max_mnt_count; /* max mount count */
83 uint16_t e2fs_magic; /* magic number */
84 uint16_t e2fs_state; /* file system state */
85 uint16_t e2fs_beh; /* behavior on errors */
86 uint16_t e2fs_minrev; /* minor revision level */
87 uint32_t e2fs_lastfsck; /* time of last fsck */
88 uint32_t e2fs_fsckintv; /* max time between fscks */
89 uint32_t e2fs_creator; /* creator OS */
90 uint32_t e2fs_rev; /* revision level */
91 uint16_t e2fs_ruid; /* default uid for reserved blocks */
92 uint16_t e2fs_rgid; /* default gid for reserved blocks */
93 /* EXT2_DYNAMIC_REV superblocks */
94 uint32_t e2fs_first_ino; /* first non-reserved inode */
95 uint16_t e2fs_inode_size; /* size of inode structure */
96 uint16_t e2fs_block_group_nr; /* block grp number of this sblk*/
97 uint32_t e2fs_features_compat; /* compatible feature set */
98 uint32_t e2fs_features_incompat; /* incompatible feature set */
99 uint32_t e2fs_features_rocompat; /* RO-compatible feature set */
100 uint8_t e2fs_uuid[16]; /* 128-bit uuid for volume */
101 char e2fs_vname[16]; /* volume name */
102 char e2fs_fsmnt[64]; /* name mounted on */
103 uint32_t e2fs_algo; /* For compression */
104 uint8_t e2fs_prealloc; /* # of blocks for old prealloc */
105 uint8_t e2fs_dir_prealloc; /* # of blocks for old prealloc dirs */
106 uint16_t e2fs_reserved_ngdb; /* # of reserved gd blocks for resize */
107 char e3fs_journal_uuid[16]; /* uuid of journal superblock */
108 uint32_t e3fs_journal_inum; /* inode number of journal file */
109 uint32_t e3fs_journal_dev; /* device number of journal file */
110 uint32_t e3fs_last_orphan; /* start of list of inodes to delete */
111 uint32_t e3fs_hash_seed[4]; /* HTREE hash seed */
112 char e3fs_def_hash_version; /* Default hash version to use */
113 char e3fs_reserved_char_pad;
114 uint32_t e3fs_default_mount_opts;
115 uint32_t e3fs_first_meta_bg; /* First metablock block group */
116 uint32_t reserved2[190]; /* Padding to the end of the block */
117};
118
119
120/*
121 * In-Memory Superblock
122 */
123
124struct m_ext2fs {
125 struct ext2fs * e2fs;
126 char e2fs_fsmnt[MAXMNTLEN];/* name mounted on */
127 char e2fs_ronly; /* mounted read-only flag */
128 char e2fs_fmod; /* super block modified flag */
129 uint32_t e2fs_bsize; /* Block size */
130 uint32_t e2fs_bshift; /* calc of logical block no */
131 int32_t e2fs_bmask; /* calc of block offset */
132 int32_t e2fs_bpg; /* Number of blocks per group */
133 int64_t e2fs_qbmask; /* = s_blocksize -1 */
134 uint32_t e2fs_fsbtodb; /* Shift to get disk block */
135 uint32_t e2fs_ipg; /* Number of inodes per group */
136 uint32_t e2fs_ipb; /* Number of inodes per block */
137 uint32_t e2fs_itpg; /* Number of inode table per group */
138 uint32_t e2fs_fsize; /* Size of fragments per block */
139 uint32_t e2fs_fpb; /* Number of fragments per block */
140 uint32_t e2fs_fpg; /* Number of fragments per group */
141 uint32_t e2fs_dbpg; /* Number of descriptor blocks per group */
142 uint32_t e2fs_descpb; /* Number of group descriptors per block */
143 uint32_t e2fs_gdbcount; /* Number of group descriptors */
144 uint32_t e2fs_gcount; /* Number of groups */
145 uint32_t e2fs_first_inode;/* First inode on fs */
146 int32_t e2fs_isize; /* Size of inode */
147 uint32_t e2fs_mount_opt;
148 uint32_t e2fs_blocksize_bits;
149 uint32_t e2fs_total_dir; /* Total number of directories */
150 uint8_t *e2fs_contigdirs; /* (u) # of contig. allocated dirs */
151 char e2fs_wasvalid; /* valid at mount time */
152 off_t e2fs_maxfilesize;
153 struct ext2_gd *e2fs_gd; /* Group Descriptors */
154};
155
156/*
157 * The second extended file system version
158 */
159#define E2FS_DATE "95/08/09"
160#define E2FS_VERSION "0.5b"
161
--- 76 unchanged lines hidden (view full) ---
238 * File clean flags
239 */
240#define E2FS_ISCLEAN 0x0001 /* Unmounted cleanly */
241#define E2FS_ERRORS 0x0002 /* Errors detected */
242
243/* ext2 file system block group descriptor */
244
245struct ext2_gd {
246 uint32_t ext2bgd_b_bitmap; /* blocks bitmap block */
247 uint32_t ext2bgd_i_bitmap; /* inodes bitmap block */
248 uint32_t ext2bgd_i_tables; /* inodes table block */
249 uint16_t ext2bgd_nbfree; /* number of free blocks */
250 uint16_t ext2bgd_nifree; /* number of free inodes */
251 uint16_t ext2bgd_ndirs; /* number of directories */
252 uint16_t reserved;
253 uint32_t reserved2[3];
254};
255
256/* EXT2FS metadatas are stored in little-endian byte order. These macros
257 * helps reading these metadatas
258 */
259
260#define e2fs_cgload(old, new, size) memcpy((new), (old), (size));
261#define e2fs_cgsave(old, new, size) memcpy((new), (old), (size));
--- 57 unchanged lines hidden ---
2 * modified for EXT2FS support in Lites 1.1
3 *
4 * Aug 1995, Godmar Back (gback@cs.utah.edu)
5 * University of Utah, Department of Computer Science
6 *
7 * $FreeBSD: head/sys/fs/ext2fs/ext2fs.h 221126 2011-04-27 18:15:34Z jhb $
8 */
9/*-
10 * Copyright (c) 2009 Aditya Sarawgi
11 * All rights reserved.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
--- 44 unchanged lines hidden (view full) ---
60 * the super block for this name.
61 */
62#define MAXMNTLEN 512
63
64/*
65 * Super block for an ext2fs file system.
66 */
67struct ext2fs {
68 uint32_t e2fs_icount; /* Inode count */
69 uint32_t e2fs_bcount; /* blocks count */
70 uint32_t e2fs_rbcount; /* reserved blocks count */
71 uint32_t e2fs_fbcount; /* free blocks count */
72 uint32_t e2fs_ficount; /* free inodes count */
73 uint32_t e2fs_first_dblock; /* first data block */
74 uint32_t e2fs_log_bsize; /* block size = 1024*(2^e2fs_log_bsize) */
75 uint32_t e2fs_log_fsize; /* fragment size */
76 uint32_t e2fs_bpg; /* blocks per group */
77 uint32_t e2fs_fpg; /* frags per group */
78 uint32_t e2fs_ipg; /* inodes per group */
79 uint32_t e2fs_mtime; /* mount time */
80 uint32_t e2fs_wtime; /* write time */
81 uint16_t e2fs_mnt_count; /* mount count */
82 uint16_t e2fs_max_mnt_count; /* max mount count */
83 uint16_t e2fs_magic; /* magic number */
84 uint16_t e2fs_state; /* file system state */
85 uint16_t e2fs_beh; /* behavior on errors */
86 uint16_t e2fs_minrev; /* minor revision level */
87 uint32_t e2fs_lastfsck; /* time of last fsck */
88 uint32_t e2fs_fsckintv; /* max time between fscks */
89 uint32_t e2fs_creator; /* creator OS */
90 uint32_t e2fs_rev; /* revision level */
91 uint16_t e2fs_ruid; /* default uid for reserved blocks */
92 uint16_t e2fs_rgid; /* default gid for reserved blocks */
93 /* EXT2_DYNAMIC_REV superblocks */
94 uint32_t e2fs_first_ino; /* first non-reserved inode */
95 uint16_t e2fs_inode_size; /* size of inode structure */
96 uint16_t e2fs_block_group_nr; /* block grp number of this sblk*/
97 uint32_t e2fs_features_compat; /* compatible feature set */
98 uint32_t e2fs_features_incompat; /* incompatible feature set */
99 uint32_t e2fs_features_rocompat; /* RO-compatible feature set */
100 uint8_t e2fs_uuid[16]; /* 128-bit uuid for volume */
101 char e2fs_vname[16]; /* volume name */
102 char e2fs_fsmnt[64]; /* name mounted on */
103 uint32_t e2fs_algo; /* For compression */
104 uint8_t e2fs_prealloc; /* # of blocks for old prealloc */
105 uint8_t e2fs_dir_prealloc; /* # of blocks for old prealloc dirs */
106 uint16_t e2fs_reserved_ngdb; /* # of reserved gd blocks for resize */
107 char e3fs_journal_uuid[16]; /* uuid of journal superblock */
108 uint32_t e3fs_journal_inum; /* inode number of journal file */
109 uint32_t e3fs_journal_dev; /* device number of journal file */
110 uint32_t e3fs_last_orphan; /* start of list of inodes to delete */
111 uint32_t e3fs_hash_seed[4]; /* HTREE hash seed */
112 char e3fs_def_hash_version; /* Default hash version to use */
113 char e3fs_reserved_char_pad;
114 uint32_t e3fs_default_mount_opts;
115 uint32_t e3fs_first_meta_bg; /* First metablock block group */
116 uint32_t reserved2[190]; /* Padding to the end of the block */
117};
118
119
120/*
121 * In-Memory Superblock
122 */
123
124struct m_ext2fs {
125 struct ext2fs * e2fs;
126 char e2fs_fsmnt[MAXMNTLEN];/* name mounted on */
127 char e2fs_ronly; /* mounted read-only flag */
128 char e2fs_fmod; /* super block modified flag */
129 uint32_t e2fs_bsize; /* Block size */
130 uint32_t e2fs_bshift; /* calc of logical block no */
131 int32_t e2fs_bmask; /* calc of block offset */
132 int32_t e2fs_bpg; /* Number of blocks per group */
133 int64_t e2fs_qbmask; /* = s_blocksize -1 */
134 uint32_t e2fs_fsbtodb; /* Shift to get disk block */
135 uint32_t e2fs_ipg; /* Number of inodes per group */
136 uint32_t e2fs_ipb; /* Number of inodes per block */
137 uint32_t e2fs_itpg; /* Number of inode table per group */
138 uint32_t e2fs_fsize; /* Size of fragments per block */
139 uint32_t e2fs_fpb; /* Number of fragments per block */
140 uint32_t e2fs_fpg; /* Number of fragments per group */
141 uint32_t e2fs_dbpg; /* Number of descriptor blocks per group */
142 uint32_t e2fs_descpb; /* Number of group descriptors per block */
143 uint32_t e2fs_gdbcount; /* Number of group descriptors */
144 uint32_t e2fs_gcount; /* Number of groups */
145 uint32_t e2fs_first_inode;/* First inode on fs */
146 int32_t e2fs_isize; /* Size of inode */
147 uint32_t e2fs_mount_opt;
148 uint32_t e2fs_blocksize_bits;
149 uint32_t e2fs_total_dir; /* Total number of directories */
150 uint8_t *e2fs_contigdirs; /* (u) # of contig. allocated dirs */
151 char e2fs_wasvalid; /* valid at mount time */
152 off_t e2fs_maxfilesize;
153 struct ext2_gd *e2fs_gd; /* Group Descriptors */
154};
155
156/*
157 * The second extended file system version
158 */
159#define E2FS_DATE "95/08/09"
160#define E2FS_VERSION "0.5b"
161
--- 76 unchanged lines hidden (view full) ---
238 * File clean flags
239 */
240#define E2FS_ISCLEAN 0x0001 /* Unmounted cleanly */
241#define E2FS_ERRORS 0x0002 /* Errors detected */
242
243/* ext2 file system block group descriptor */
244
245struct ext2_gd {
246 uint32_t ext2bgd_b_bitmap; /* blocks bitmap block */
247 uint32_t ext2bgd_i_bitmap; /* inodes bitmap block */
248 uint32_t ext2bgd_i_tables; /* inodes table block */
249 uint16_t ext2bgd_nbfree; /* number of free blocks */
250 uint16_t ext2bgd_nifree; /* number of free inodes */
251 uint16_t ext2bgd_ndirs; /* number of directories */
252 uint16_t reserved;
253 uint32_t reserved2[3];
254};
255
256/* EXT2FS metadatas are stored in little-endian byte order. These macros
257 * helps reading these metadatas
258 */
259
260#define e2fs_cgload(old, new, size) memcpy((new), (old), (size));
261#define e2fs_cgsave(old, new, size) memcpy((new), (old), (size));
--- 57 unchanged lines hidden ---