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 251562 2013-06-09 01:38:51Z pfg $
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:
--- 24 unchanged lines hidden (view full) ---
40#include <sys/types.h>
41
42/*
43 * Maximal count of links to a file
44 */
45#define EXT2_LINK_MAX 32000
46
47/*
48 * A summary of contiguous blocks of various sizes is maintained
49 * in each cylinder group. Normally this is set by the initial
50 * value of fs_maxcontig.
51 *
52 * XXX:FS_MAXCONTIG is set to 16 to conserve space. Here we set
53 * EXT2_MAXCONTIG to 32 for better performance.
54 */
55#define EXT2_MAXCONTIG 32
56
57/*
58 * Constants relative to the data blocks
59 */
60#define EXT2_NDIR_BLOCKS 12
61#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
62#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
63#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
64#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
65#define EXT2_MAXSYMLINKLEN (EXT2_N_BLOCKS * sizeof(uint32_t))
66
67/*
68 * The path name on which the file system is mounted is maintained
69 * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
70 * the super block for this name.
71 */
72#define MAXMNTLEN 512
73
74/*
75 * Super block for an ext2fs file system.
--- 94 unchanged lines hidden (view full) ---
170 char e2fs_wasvalid; /* valid at mount time */
171 off_t e2fs_maxfilesize;
172 struct ext2_gd *e2fs_gd; /* Group Descriptors */
173 int32_t e2fs_contigsumsize; /* size of cluster summary array */
174 int32_t *e2fs_maxcluster; /* max cluster in each cyl group */
175 struct csum *e2fs_clustersum; /* cluster summary in each cyl group */
176};
177
178/*
179 * The second extended file system version
180 */
181#define E2FS_DATE "95/08/09"
182#define E2FS_VERSION "0.5b"
183
184/*
185 * The second extended file system magic number
186 */
187#define E2FS_MAGIC 0xEF53
188
189/*
190 * Revision levels
191 */
192#define E2FS_REV0 0 /* The good old (original) format */
193#define E2FS_REV1 1 /* V2 format w/ dynamic inode sizes */
194
195#define E2FS_CURRENT_REV E2FS_REV0
196#define E2FS_MAX_SUPP_REV E2FS_REV1
197
198#define E2FS_REV0_INODE_SIZE 128
199
200/*
201 * compatible/incompatible features
202 */
203#define EXT2F_COMPAT_PREALLOC 0x0001
204#define EXT2F_COMPAT_HASJOURNAL 0x0004
205#define EXT2F_COMPAT_RESIZE 0x0010
--- 40 unchanged lines hidden (view full) ---
246#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
247 ( EXT2_SB(sb)->e2fs->e2fs_features_compat & htole32(mask) )
248#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
249 ( EXT2_SB(sb)->e2fs->e2fs_features_rocompat & htole32(mask) )
250#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
251 ( EXT2_SB(sb)->e2fs->e2fs_features_incompat & htole32(mask) )
252
253/*
254 * Definitions of behavior on errors
255 */
256#define E2FS_BEH_CONTINUE 1 /* continue operation */
257#define E2FS_BEH_READONLY 2 /* remount fs read only */
258#define E2FS_BEH_PANIC 3 /* cause panic */
259#define E2FS_BEH_DEFAULT E2FS_BEH_CONTINUE
260
261/*
262 * OS identification
263 */
264#define E2FS_OS_LINUX 0
265#define E2FS_OS_HURD 1
266#define E2FS_OS_MASIX 2
267#define E2FS_OS_FREEBSD 3
268#define E2FS_OS_LITES 4
269
270/*
271 * File clean flags
272 */
273#define E2FS_ISCLEAN 0x0001 /* Unmounted cleanly */
274#define E2FS_ERRORS 0x0002 /* Errors detected */
275
276/* ext2 file system block group descriptor */
277
278struct ext2_gd {
--- 6 unchanged lines hidden (view full) ---
285 uint16_t ext2bgd_flags; /* block group flags */
286 uint32_t ext2bgd_x_bitmap; /* snapshot exclusion bitmap loc. */
287 uint16_t ext2bgd_b_bmap_csum; /* block bitmap checksum */
288 uint16_t ext2bgd_i_bmap_csum; /* inode bitmap checksum */
289 uint16_t ext2bgd_i_unused; /* unused inode count */
290 uint16_t ext2bgd_csum; /* group descriptor checksum */
291};
292
293/* cluster summary information */
294
295struct csum {
296 int8_t cs_init; /* cluster summary has been initialized */
297 int32_t *cs_sum; /* cluster summary array */
298};
299
300/* EXT2FS metadatas are stored in little-endian byte order. These macros
301 * helps reading these metadatas
302 */
303
304#define e2fs_cgload(old, new, size) memcpy((new), (old), (size));
305#define e2fs_cgsave(old, new, size) memcpy((new), (old), (size));
306
307/*
--- 23 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 251562 2013-06-09 01:38:51Z pfg $
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:
--- 24 unchanged lines hidden (view full) ---
40#include <sys/types.h>
41
42/*
43 * Maximal count of links to a file
44 */
45#define EXT2_LINK_MAX 32000
46
47/*
48 * A summary of contiguous blocks of various sizes is maintained
49 * in each cylinder group. Normally this is set by the initial
50 * value of fs_maxcontig.
51 *
52 * XXX:FS_MAXCONTIG is set to 16 to conserve space. Here we set
53 * EXT2_MAXCONTIG to 32 for better performance.
54 */
55#define EXT2_MAXCONTIG 32
56
57/*
58 * Constants relative to the data blocks
59 */
60#define EXT2_NDIR_BLOCKS 12
61#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
62#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
63#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
64#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
65#define EXT2_MAXSYMLINKLEN (EXT2_N_BLOCKS * sizeof(uint32_t))
66
67/*
68 * The path name on which the file system is mounted is maintained
69 * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
70 * the super block for this name.
71 */
72#define MAXMNTLEN 512
73
74/*
75 * Super block for an ext2fs file system.
--- 94 unchanged lines hidden (view full) ---
170 char e2fs_wasvalid; /* valid at mount time */
171 off_t e2fs_maxfilesize;
172 struct ext2_gd *e2fs_gd; /* Group Descriptors */
173 int32_t e2fs_contigsumsize; /* size of cluster summary array */
174 int32_t *e2fs_maxcluster; /* max cluster in each cyl group */
175 struct csum *e2fs_clustersum; /* cluster summary in each cyl group */
176};
177
178/*
179 * The second extended file system version
180 */
181#define E2FS_DATE "95/08/09"
182#define E2FS_VERSION "0.5b"
183
184/*
185 * The second extended file system magic number
186 */
187#define E2FS_MAGIC 0xEF53
188
189/*
190 * Revision levels
191 */
192#define E2FS_REV0 0 /* The good old (original) format */
193#define E2FS_REV1 1 /* V2 format w/ dynamic inode sizes */
194
195#define E2FS_CURRENT_REV E2FS_REV0
196#define E2FS_MAX_SUPP_REV E2FS_REV1
197
198#define E2FS_REV0_INODE_SIZE 128
199
200/*
201 * compatible/incompatible features
202 */
203#define EXT2F_COMPAT_PREALLOC 0x0001
204#define EXT2F_COMPAT_HASJOURNAL 0x0004
205#define EXT2F_COMPAT_RESIZE 0x0010
--- 40 unchanged lines hidden (view full) ---
246#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
247 ( EXT2_SB(sb)->e2fs->e2fs_features_compat & htole32(mask) )
248#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
249 ( EXT2_SB(sb)->e2fs->e2fs_features_rocompat & htole32(mask) )
250#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
251 ( EXT2_SB(sb)->e2fs->e2fs_features_incompat & htole32(mask) )
252
253/*
254 * Definitions of behavior on errors
255 */
256#define E2FS_BEH_CONTINUE 1 /* continue operation */
257#define E2FS_BEH_READONLY 2 /* remount fs read only */
258#define E2FS_BEH_PANIC 3 /* cause panic */
259#define E2FS_BEH_DEFAULT E2FS_BEH_CONTINUE
260
261/*
262 * OS identification
263 */
264#define E2FS_OS_LINUX 0
265#define E2FS_OS_HURD 1
266#define E2FS_OS_MASIX 2
267#define E2FS_OS_FREEBSD 3
268#define E2FS_OS_LITES 4
269
270/*
271 * File clean flags
272 */
273#define E2FS_ISCLEAN 0x0001 /* Unmounted cleanly */
274#define E2FS_ERRORS 0x0002 /* Errors detected */
275
276/* ext2 file system block group descriptor */
277
278struct ext2_gd {
--- 6 unchanged lines hidden (view full) ---
285 uint16_t ext2bgd_flags; /* block group flags */
286 uint32_t ext2bgd_x_bitmap; /* snapshot exclusion bitmap loc. */
287 uint16_t ext2bgd_b_bmap_csum; /* block bitmap checksum */
288 uint16_t ext2bgd_i_bmap_csum; /* inode bitmap checksum */
289 uint16_t ext2bgd_i_unused; /* unused inode count */
290 uint16_t ext2bgd_csum; /* group descriptor checksum */
291};
292
293/* cluster summary information */
294
295struct csum {
296 int8_t cs_init; /* cluster summary has been initialized */
297 int32_t *cs_sum; /* cluster summary array */
298};
299
300/* EXT2FS metadatas are stored in little-endian byte order. These macros
301 * helps reading these metadatas
302 */
303
304#define e2fs_cgload(old, new, size) memcpy((new), (old), (size));
305#define e2fs_cgsave(old, new, size) memcpy((new), (old), (size));
306
307/*
--- 23 unchanged lines hidden ---