PERFORCE change 167897 for review
Aditya Sarawgi
truncs at FreeBSD.org
Thu Aug 27 17:35:38 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=167897
Change 167897 by truncs at aditya on 2009/08/27 17:35:17
Resort ext2_fs.h to make it more consistent with NetBSD's
sources.
Affected files ...
.. //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_fs.h#2 edit
Differences ...
==== //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_fs.h#2 (text+ko) ====
@@ -38,34 +38,13 @@
#define _LINUX_EXT2_FS_H
#include <sys/types.h>
-#define cpu_to_le32(x) htole32(x)
-#define MAXMNTLEN 512
-#define EXT2_MAX_GROUP_LOADED 8
-#define e2fs_cgload(old, new, size) memcpy((new), (old), (size));
-#define e2fs_cgsave(old, new, size) memcpy((new), (old), (size));
/*
- * The second extended filesystem constants/structures
- */
-
-/*
* Define EXT2FS_DEBUG to produce debug messages
*/
#undef EXT2FS_DEBUG
/*
- * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
- */
-#define EXT2_PREALLOCATE
-#define EXT2_DEFAULT_PREALLOC_BLOCKS 8
-
-/*
- * The second extended file system version
- */
-#define E2FS_DATE "95/08/09"
-#define E2FS_VERSION "0.5b"
-
-/*
* Debug code
*/
#ifdef EXT2FS_DEBUG
@@ -113,75 +92,6 @@
#define EXT2_LINK_MAX 32000
/*
- * Macro-instructions used to manage several block sizes
- */
-#define EXT2_MIN_BLOCK_SIZE 1024
-#define EXT2_MAX_BLOCK_SIZE 4096
-#define EXT2_MIN_BLOCK_LOG_SIZE 10
-#if defined(_KERNEL)
-# define EXT2_BLOCK_SIZE(s) ((s)->e2fs_bsize)
-#else
-# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->e2fs_log_bsize)
-#endif
-#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (uint32_t))
-#if defined(_KERNEL)
-# define EXT2_BLOCK_SIZE_BITS(s) ((s)->e2fs_blocksize_bits)
-#else
-# define EXT2_BLOCK_SIZE_BITS(s) ((s)->e2fs_log_bsize + 10)
-#endif
-#if defined(_KERNEL)
-#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_addr_per_block_bits)
-#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->e2fs_isize)
-#define EXT2_FIRST_INO(s) (EXT2_SB(s)->e2fs_first_inode)
-#else
-#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == E2FS_REV0) ? \
- E2FS_REV0 : (s)->s_inode_size)
-#define EXT2_FIRST_INO(s) (((s)->s_rev_level == E2FS_REV0) ? \
- E2FS_REV0 : (s)->e2fs_first_ino)
-#endif
-
-/*
- * Macro-instructions used to manage fragments
- */
-#define EXT2_MIN_FRAG_SIZE 1024
-#define EXT2_MAX_FRAG_SIZE 4096
-#define EXT2_MIN_FRAG_LOG_SIZE 10
-#if defined(_KERNEL)
-# define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->e2fs_fsize)
-# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->e2fs_fpb)
-#else
-# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->e2fs_log_fsize)
-# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
-#endif
-
-
-/* ext2 file system block group descriptor */
-
-struct ext2_gd {
- u_int32_t ext2bgd_b_bitmap; /* blocks bitmap block */
- u_int32_t ext2bgd_i_bitmap; /* inodes bitmap block */
- u_int32_t ext2bgd_i_tables; /* inodes table block */
- u_int16_t ext2bgd_nbfree; /* number of free blocks */
- u_int16_t ext2bgd_nifree; /* number of free inodes */
- u_int16_t ext2bgd_ndirs; /* number of directories */
- u_int16_t reserved;
- u_int32_t reserved2[3];
-};
-
-/*
- * Macro-instructions used to manage group descriptors
- */
-#if defined(_KERNEL)
-# define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->e2fs_bpg)
-# define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->e2fs_descpb)
-# define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits)
-#else
-# define EXT2_BLOCKS_PER_GROUP(s) ((s)->e2fs_bpg)
-# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_gd))
-
-#endif
-
-/*
* Constants relative to the data blocks
*/
#define EXT2_NDIR_BLOCKS 12
@@ -192,6 +102,13 @@
#define EXT2_MAXSYMLINKLEN (EXT2_N_BLOCKS * sizeof (uint32_t))
/*
+ * The path name on which the file system is mounted is maintained
+ * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
+ * the super block for this name.
+ */
+#define MAXMNTLEN 512
+
+/*
* Super block for an ext2fs file system.
*/
struct ext2fs {
@@ -236,14 +153,11 @@
};
-
/* Assume that user mode programs are passing in an ext2fs superblock, not
* a kernel struct super_block. This will allow us to call the feature-test
* macros from user land. */
#define EXT2_SB(sb) (sb)
-
-
/*
* In-Memory Superblock
*/
@@ -270,6 +184,8 @@
uint32_t e2fs_gdbcount; /* Number of group descriptors */
uint32_t e2fs_gcount; /* Number of groups */
uint32_t e2fs_first_inode;/* First inode on fs */
+ uint32_t e2fs_dircount; /* Directory count for Orlov Allocator*/
+ uint8_t *e2fs_debts; /* Debts for Orlov Allocator*/
int32_t e2fs_isize; /* Size of inode */
uint32_t e2fs_mount_opt;
uint32_t e2fs_blocksize_bits;
@@ -279,6 +195,12 @@
};
/*
+ * The second extended file system version
+ */
+#define E2FS_DATE "95/08/09"
+#define E2FS_VERSION "0.5b"
+
+/*
* Revision levels
*/
#define E2FS_REV0 0 /* The good old (original) format */
@@ -290,18 +212,6 @@
#define E2FS_REV0_INODE_SIZE 128
/*
- * Feature set definitions
- */
-
-#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
- ( EXT2_SB(sb)->e2fs->e2fs_features_compat & cpu_to_le32(mask) )
-#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
- ( EXT2_SB(sb)->e2fs->e2fs_features_rocompat & cpu_to_le32(mask) )
-#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
- ( EXT2_SB(sb)->e2fs->e2fs_features_incompat & cpu_to_le32(mask) )
-
-
-/*
* compatible/incompatible features
*/
#define EXT2F_COMPAT_PREALLOC 0x0001
@@ -328,6 +238,16 @@
#define EXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE
/*
+ * Feature set definitions
+ */
+#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
+ ( EXT2_SB(sb)->e2fs->e2fs_features_compat & htole32(mask) )
+#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
+ ( EXT2_SB(sb)->e2fs->e2fs_features_rocompat & htole32(mask) )
+#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
+ ( EXT2_SB(sb)->e2fs->e2fs_features_incompat & htole32(mask) )
+
+/*
* Definitions of behavior on errors
*/
#define E2FS_BEH_CONTINUE 1 /* continue operation */
@@ -350,4 +270,78 @@
#define E2FS_ISCLEAN 0x0001 /* Unmounted cleanly */
#define E2FS_ERRORS 0x0002 /* Errors detected */
+/* ext2 file system block group descriptor */
+
+struct ext2_gd {
+ u_int32_t ext2bgd_b_bitmap; /* blocks bitmap block */
+ u_int32_t ext2bgd_i_bitmap; /* inodes bitmap block */
+ u_int32_t ext2bgd_i_tables; /* inodes table block */
+ u_int16_t ext2bgd_nbfree; /* number of free blocks */
+ u_int16_t ext2bgd_nifree; /* number of free inodes */
+ u_int16_t ext2bgd_ndirs; /* number of directories */
+ u_int16_t reserved;
+ u_int32_t reserved2[3];
+};
+
+/* EXT2FS metadatas are stored in little-endian byte order. These macros
+ * helps reading these metadatas
+ */
+
+#define e2fs_cgload(old, new, size) memcpy((new), (old), (size));
+#define e2fs_cgsave(old, new, size) memcpy((new), (old), (size));
+/*
+ * Macro-instructions used to manage several block sizes
+ */
+#define EXT2_MIN_BLOCK_SIZE 1024
+#define EXT2_MAX_BLOCK_SIZE 4096
+#define EXT2_MIN_BLOCK_LOG_SIZE 10
+#if defined(_KERNEL)
+# define EXT2_BLOCK_SIZE(s) ((s)->e2fs_bsize)
+#else
+# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->e2fs_log_bsize)
+#endif
+#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (uint32_t))
+#if defined(_KERNEL)
+# define EXT2_BLOCK_SIZE_BITS(s) ((s)->e2fs_blocksize_bits)
+#else
+# define EXT2_BLOCK_SIZE_BITS(s) ((s)->e2fs_log_bsize + 10)
+#endif
+#if defined(_KERNEL)
+#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_addr_per_block_bits)
+#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->e2fs_isize)
+#define EXT2_FIRST_INO(s) (EXT2_SB(s)->e2fs_first_inode)
+#else
+#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == E2FS_REV0) ? \
+ E2FS_REV0 : (s)->s_inode_size)
+#define EXT2_FIRST_INO(s) (((s)->s_rev_level == E2FS_REV0) ? \
+ E2FS_REV0 : (s)->e2fs_first_ino)
+#endif
+
+/*
+ * Macro-instructions used to manage fragments
+ */
+#define EXT2_MIN_FRAG_SIZE 1024
+#define EXT2_MAX_FRAG_SIZE 4096
+#define EXT2_MIN_FRAG_LOG_SIZE 10
+#if defined(_KERNEL)
+# define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->e2fs_fsize)
+# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->e2fs_fpb)
+#else
+# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->e2fs_log_fsize)
+# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
+#endif
+
+/*
+ * Macro-instructions used to manage group descriptors
+ */
+#if defined(_KERNEL)
+# define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->e2fs_bpg)
+# define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->e2fs_descpb)
+# define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits)
+#else
+# define EXT2_BLOCKS_PER_GROUP(s) ((s)->e2fs_bpg)
+# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_gd))
+
+#endif
+
#endif /* _LINUX_EXT2_FS_H */
More information about the p4-projects
mailing list