From cd2895aab0b00a8493c0da56562c8cf4bac13e78 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 21 Jan 2011 22:00:40 +0000 Subject: [PATCH] - Move special inode constants to ext2_dinode.h and rename them to match NetBSD. - Add a constant for the HASJOURNAL compat flag. PR: kern/153584 Submitted by: Pedro F. Giffuni giffunip at yahoo --- sys/fs/ext2fs/ext2_dinode.h | 17 +++++++++++++++++ sys/fs/ext2fs/ext2fs.h | 27 ++++++++++----------------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/sys/fs/ext2fs/ext2_dinode.h b/sys/fs/ext2fs/ext2_dinode.h index 405c930801b..ba19d5b57b1 100755 --- a/sys/fs/ext2fs/ext2_dinode.h +++ b/sys/fs/ext2fs/ext2_dinode.h @@ -31,6 +31,23 @@ #define e2di_size_high e2di_dacl +/* + * Special inode numbers + * The root inode is the root of the file system. Inode 0 can't be used for + * normal purposes and bad blocks are normally linked to inode 1, thus + * the root inode is 2. + * Inode 3 to 10 are reserved in ext2fs. + */ +#define EXT2_BADBLKINO ((ino_t)1) +#define EXT2_ROOTINO ((ino_t)2) +#define EXT2_ACLIDXINO ((ino_t)3) +#define EXT2_ACLDATAINO ((ino_t)4) +#define EXT2_BOOTLOADERINO ((ino_t)5) +#define EXT2_UNDELDIRINO ((ino_t)6) +#define EXT2_RESIZEINO ((ino_t)7) +#define EXT2_JOURNALINO ((ino_t)8) +#define EXT2_FIRSTINO ((ino_t)11) + /* * Inode flags * The current implementation uses only EXT2_IMMUTABLE and EXT2_APPEND flags diff --git a/sys/fs/ext2fs/ext2fs.h b/sys/fs/ext2fs/ext2fs.h index 8bfd29e4e06..9e69f1d8724 100755 --- a/sys/fs/ext2fs/ext2fs.h +++ b/sys/fs/ext2fs/ext2fs.h @@ -39,22 +39,6 @@ #include -/* - * Special inode numbers - */ -#define EXT2_BAD_INO 1 /* Bad blocks inode */ -#define EXT2_ROOT_INO 2 /* Root inode */ -#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */ -#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */ - -/* First non-reserved inode for old ext2 filesystems */ -#define E2FS_REV0_FIRST_INO 11 - -/* - * The second extended file system magic number - */ -#define E2FS_MAGIC 0xEF53 - #if defined(_KERNEL) /* * FreeBSD passes the pointer to the in-core struct with relevant @@ -170,7 +154,7 @@ struct m_ext2fs { uint32_t e2fs_mount_opt; uint32_t e2fs_blocksize_bits; uint32_t e2fs_total_dir; /* Total number of directories */ - uint8_t *e2fs_contigdirs; + uint8_t *e2fs_contigdirs; /* (u) # of contig. allocated dirs */ char e2fs_wasvalid; /* valid at mount time */ off_t e2fs_maxfilesize; struct ext2_gd *e2fs_gd; /* Group Descriptors */ @@ -182,6 +166,14 @@ struct m_ext2fs { #define E2FS_DATE "95/08/09" #define E2FS_VERSION "0.5b" +/* First non-reserved inode for old ext2 filesystems */ +#define E2FS_REV0_FIRST_INO 11 + +/* + * The second extended file system magic number + */ +#define E2FS_MAGIC 0xEF53 + /* * Revision levels */ @@ -197,6 +189,7 @@ struct m_ext2fs { * compatible/incompatible features */ #define EXT2F_COMPAT_PREALLOC 0x0001 +#define EXT2F_COMPAT_HASJOURNAL 0x0004 #define EXT2F_COMPAT_RESIZE 0x0010 #define EXT2F_ROCOMPAT_SPARSESUPER 0x0001 -- 2.45.2