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 218273 2011-02-04 14:20:27Z 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 u_int32_t e2fs_icount; /* Inode count */
69 u_int32_t e2fs_bcount; /* blocks count */
70 u_int32_t e2fs_rbcount; /* reserved blocks count */
71 u_int32_t e2fs_fbcount; /* free blocks count */
72 u_int32_t e2fs_ficount; /* free inodes count */
73 u_int32_t e2fs_first_dblock; /* first data block */
74 u_int32_t e2fs_log_bsize; /* block size = 1024*(2^e2fs_log_bsize) */
75 u_int32_t e2fs_log_fsize; /* fragment size */
76 u_int32_t e2fs_bpg; /* blocks per group */
77 u_int32_t e2fs_fpg; /* frags per group */
78 u_int32_t e2fs_ipg; /* inodes per group */
79 u_int32_t e2fs_mtime; /* mount time */
80 u_int32_t e2fs_wtime; /* write time */
81 u_int16_t e2fs_mnt_count; /* mount count */
82 u_int16_t e2fs_max_mnt_count; /* max mount count */
83 u_int16_t e2fs_magic; /* magic number */
84 u_int16_t e2fs_state; /* file system state */
85 u_int16_t e2fs_beh; /* behavior on errors */
86 u_int16_t e2fs_minrev; /* minor revision level */
87 u_int32_t e2fs_lastfsck; /* time of last fsck */
88 u_int32_t e2fs_fsckintv; /* max time between fscks */
89 u_int32_t e2fs_creator; /* creator OS */
90 u_int32_t e2fs_rev; /* revision level */
91 u_int16_t e2fs_ruid; /* default uid for reserved blocks */
92 u_int16_t e2fs_rgid; /* default gid for reserved blocks */
93 /* EXT2_DYNAMIC_REV superblocks */
94 u_int32_t e2fs_first_ino; /* first non-reserved inode */
95 u_int16_t e2fs_inode_size; /* size of inode structure */
96 u_int16_t e2fs_block_group_nr; /* block grp number of this sblk*/
97 u_int32_t e2fs_features_compat; /* compatible feature set */
98 u_int32_t e2fs_features_incompat; /* incompatible feature set */
99 u_int32_t e2fs_features_rocompat; /* RO-compatible feature set */
100 u_int8_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 u_int32_t e2fs_algo; /* For comcate for dir */
104 u_int16_t e2fs_reserved_ngdb; /* # of reserved gd blocks for resize */
105 u_int32_t reserved2[204];
106};
107
108
109/*
110 * In-Memory Superblock
111 */
112
113struct m_ext2fs {
114 struct ext2fs * e2fs;
115 char e2fs_fsmnt[MAXMNTLEN];/* name mounted on */
116 char e2fs_ronly; /* mounted read-only flag */
117 char e2fs_fmod; /* super block modified flag */
118 uint32_t e2fs_bsize; /* Block size */
119 uint32_t e2fs_bshift; /* calc of logical block no */
120 int32_t e2fs_bmask; /* calc of block offset */
121 int32_t e2fs_bpg; /* Number of blocks per group */
122 int64_t e2fs_qbmask; /* = s_blocksize -1 */
123 uint32_t e2fs_fsbtodb; /* Shift to get disk block */
124 uint32_t e2fs_ipg; /* Number of inodes per group */
125 uint32_t e2fs_ipb; /* Number of inodes per block */
126 uint32_t e2fs_itpg; /* Number of inode table per group */
127 uint32_t e2fs_fsize; /* Size of fragments per block */
128 uint32_t e2fs_fpb; /* Number of fragments per block */
129 uint32_t e2fs_fpg; /* Number of fragments per group */
130 uint32_t e2fs_dbpg; /* Number of descriptor blocks per group */
131 uint32_t e2fs_descpb; /* Number of group descriptors per block */
132 uint32_t e2fs_gdbcount; /* Number of group descriptors */
133 uint32_t e2fs_gcount; /* Number of groups */
134 uint32_t e2fs_first_inode;/* First inode on fs */
135 int32_t e2fs_isize; /* Size of inode */
136 uint32_t e2fs_mount_opt;
137 uint32_t e2fs_blocksize_bits;
138 uint32_t e2fs_total_dir; /* Total number of directories */
139 uint8_t *e2fs_contigdirs; /* (u) # of contig. allocated dirs */
140 char e2fs_wasvalid; /* valid at mount time */
141 off_t e2fs_maxfilesize;
142 struct ext2_gd *e2fs_gd; /* Group Descriptors */
143};
144
145/*
146 * The second extended file system version
147 */
148#define E2FS_DATE "95/08/09"
149#define E2FS_VERSION "0.5b"
150
--- 76 unchanged lines hidden (view full) ---
227 * File clean flags
228 */
229#define E2FS_ISCLEAN 0x0001 /* Unmounted cleanly */
230#define E2FS_ERRORS 0x0002 /* Errors detected */
231
232/* ext2 file system block group descriptor */
233
234struct ext2_gd {
235 u_int32_t ext2bgd_b_bitmap; /* blocks bitmap block */
236 u_int32_t ext2bgd_i_bitmap; /* inodes bitmap block */
237 u_int32_t ext2bgd_i_tables; /* inodes table block */
238 u_int16_t ext2bgd_nbfree; /* number of free blocks */
239 u_int16_t ext2bgd_nifree; /* number of free inodes */
240 u_int16_t ext2bgd_ndirs; /* number of directories */
241 u_int16_t reserved;
242 u_int32_t reserved2[3];
243};
244
245/* EXT2FS metadatas are stored in little-endian byte order. These macros
246 * helps reading these metadatas
247 */
248
249#define e2fs_cgload(old, new, size) memcpy((new), (old), (size));
250#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 218273 2011-02-04 14:20:27Z 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 u_int32_t e2fs_icount; /* Inode count */
69 u_int32_t e2fs_bcount; /* blocks count */
70 u_int32_t e2fs_rbcount; /* reserved blocks count */
71 u_int32_t e2fs_fbcount; /* free blocks count */
72 u_int32_t e2fs_ficount; /* free inodes count */
73 u_int32_t e2fs_first_dblock; /* first data block */
74 u_int32_t e2fs_log_bsize; /* block size = 1024*(2^e2fs_log_bsize) */
75 u_int32_t e2fs_log_fsize; /* fragment size */
76 u_int32_t e2fs_bpg; /* blocks per group */
77 u_int32_t e2fs_fpg; /* frags per group */
78 u_int32_t e2fs_ipg; /* inodes per group */
79 u_int32_t e2fs_mtime; /* mount time */
80 u_int32_t e2fs_wtime; /* write time */
81 u_int16_t e2fs_mnt_count; /* mount count */
82 u_int16_t e2fs_max_mnt_count; /* max mount count */
83 u_int16_t e2fs_magic; /* magic number */
84 u_int16_t e2fs_state; /* file system state */
85 u_int16_t e2fs_beh; /* behavior on errors */
86 u_int16_t e2fs_minrev; /* minor revision level */
87 u_int32_t e2fs_lastfsck; /* time of last fsck */
88 u_int32_t e2fs_fsckintv; /* max time between fscks */
89 u_int32_t e2fs_creator; /* creator OS */
90 u_int32_t e2fs_rev; /* revision level */
91 u_int16_t e2fs_ruid; /* default uid for reserved blocks */
92 u_int16_t e2fs_rgid; /* default gid for reserved blocks */
93 /* EXT2_DYNAMIC_REV superblocks */
94 u_int32_t e2fs_first_ino; /* first non-reserved inode */
95 u_int16_t e2fs_inode_size; /* size of inode structure */
96 u_int16_t e2fs_block_group_nr; /* block grp number of this sblk*/
97 u_int32_t e2fs_features_compat; /* compatible feature set */
98 u_int32_t e2fs_features_incompat; /* incompatible feature set */
99 u_int32_t e2fs_features_rocompat; /* RO-compatible feature set */
100 u_int8_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 u_int32_t e2fs_algo; /* For comcate for dir */
104 u_int16_t e2fs_reserved_ngdb; /* # of reserved gd blocks for resize */
105 u_int32_t reserved2[204];
106};
107
108
109/*
110 * In-Memory Superblock
111 */
112
113struct m_ext2fs {
114 struct ext2fs * e2fs;
115 char e2fs_fsmnt[MAXMNTLEN];/* name mounted on */
116 char e2fs_ronly; /* mounted read-only flag */
117 char e2fs_fmod; /* super block modified flag */
118 uint32_t e2fs_bsize; /* Block size */
119 uint32_t e2fs_bshift; /* calc of logical block no */
120 int32_t e2fs_bmask; /* calc of block offset */
121 int32_t e2fs_bpg; /* Number of blocks per group */
122 int64_t e2fs_qbmask; /* = s_blocksize -1 */
123 uint32_t e2fs_fsbtodb; /* Shift to get disk block */
124 uint32_t e2fs_ipg; /* Number of inodes per group */
125 uint32_t e2fs_ipb; /* Number of inodes per block */
126 uint32_t e2fs_itpg; /* Number of inode table per group */
127 uint32_t e2fs_fsize; /* Size of fragments per block */
128 uint32_t e2fs_fpb; /* Number of fragments per block */
129 uint32_t e2fs_fpg; /* Number of fragments per group */
130 uint32_t e2fs_dbpg; /* Number of descriptor blocks per group */
131 uint32_t e2fs_descpb; /* Number of group descriptors per block */
132 uint32_t e2fs_gdbcount; /* Number of group descriptors */
133 uint32_t e2fs_gcount; /* Number of groups */
134 uint32_t e2fs_first_inode;/* First inode on fs */
135 int32_t e2fs_isize; /* Size of inode */
136 uint32_t e2fs_mount_opt;
137 uint32_t e2fs_blocksize_bits;
138 uint32_t e2fs_total_dir; /* Total number of directories */
139 uint8_t *e2fs_contigdirs; /* (u) # of contig. allocated dirs */
140 char e2fs_wasvalid; /* valid at mount time */
141 off_t e2fs_maxfilesize;
142 struct ext2_gd *e2fs_gd; /* Group Descriptors */
143};
144
145/*
146 * The second extended file system version
147 */
148#define E2FS_DATE "95/08/09"
149#define E2FS_VERSION "0.5b"
150
--- 76 unchanged lines hidden (view full) ---
227 * File clean flags
228 */
229#define E2FS_ISCLEAN 0x0001 /* Unmounted cleanly */
230#define E2FS_ERRORS 0x0002 /* Errors detected */
231
232/* ext2 file system block group descriptor */
233
234struct ext2_gd {
235 u_int32_t ext2bgd_b_bitmap; /* blocks bitmap block */
236 u_int32_t ext2bgd_i_bitmap; /* inodes bitmap block */
237 u_int32_t ext2bgd_i_tables; /* inodes table block */
238 u_int16_t ext2bgd_nbfree; /* number of free blocks */
239 u_int16_t ext2bgd_nifree; /* number of free inodes */
240 u_int16_t ext2bgd_ndirs; /* number of directories */
241 u_int16_t reserved;
242 u_int32_t reserved2[3];
243};
244
245/* EXT2FS metadatas are stored in little-endian byte order. These macros
246 * helps reading these metadatas
247 */
248
249#define e2fs_cgload(old, new, size) memcpy((new), (old), (size));
250#define e2fs_cgsave(old, new, size) memcpy((new), (old), (size));
--- 57 unchanged lines hidden ---