ext2_fs.h revision 7e7bd3dccbfe8f79e25e5c1554b5bc3a9aaca321
/*
*
* Copyright (C) 1992, 1993, 1994, 1995
* Remy Card (card@masi.ibp.fr)
* Laboratoire MASI - Institut Blaise Pascal
* Universite Pierre et Marie Curie (Paris VI)
*
* from
*
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
/*
* EXT2_*_*() convienience macros added by Andrew Clausen <clausen@gnu.org>
* Copyright (C) 2000 Free Software Foundation, Inc.
*/
#ifndef _EXT2_FS_H
#define _EXT2_FS_H
#include <stdint.h>
/*
* The second extended file system constants/structures
*/
#define EXT2_SUPER_MAGIC_CONST 0xEF53
#define EXT2_MIN_BLOCK_SIZE 1024
#define EXT2_NDIR_BLOCKS 12
#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
#define EXT2_VALID_FS 0x0001
#define EXT2_ERROR_FS 0x0002
#define EXT2_RESERVED_INODE_COUNT 11
/*
* Codes for operating systems
*/
#define EXT2_OS_LINUX 0
#define EXT2_OS_HURD 1
#define EXT2_OS_MASIX 2
#define EXT2_OS_FREEBSD 3
#define EXT2_OS_LITES 4
/*
* Feature set definitions
*/
#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
#define EXT2_FEATURE_COMPAT_HAS_DIR_INDEX 0x0020
#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004
/*
* Special inodes numbers
*/
/*
* Ext2 directory file types. Only the low 3 bits are used. The
* other bits are reserved for now.
*/
#define EXT2_FT_UNKNOWN 0
#define EXT2_FT_REG_FILE 1
#define EXT2_FT_DIR 2
#define EXT2_FT_CHRDEV 3
#define EXT2_FT_BLKDEV 4
#define EXT2_FT_FIFO 5
#define EXT2_FT_SOCK 6
#define EXT2_FT_SYMLINK 7
/*
* Behaviour when detecting errors
*/
struct ext2_dir_entry_2
{
char name[255];
};
struct ext2_group_desc
{
};
struct ext2_inode
{
union {
struct {
} linux1;
struct {
} hurd1;
struct {
} masix1;
} osd1; /* OS dependent 1 */
union {
struct {
} linux2;
struct {
} hurd2;
struct {
} masix2;
} osd2; /* OS dependent 2 */
};
#define i_size_high i_dir_acl
struct ext2_super_block
{
/*
* These fields are for EXT2_DYNAMIC_REV superblocks only.
*
* Note: the difference between the compatible feature set and
* the incompatible feature set is that if there is a bit set
* in the incompatible feature set that the kernel doesn't
* know about, it should refuse to mount the file system.
*
* e2fsck's requirements are more strict; if it doesn't know
* about a feature in either the compatible or incompatible
* feature set, it must abort and not try to meddle with
* things it doesn't understand...
*/
/*
* Performance hints. Directory preallocation should only
* happen if the EXT2_COMPAT_PREALLOC flag is on.
*/
/*
* Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
*/
};
#define EXT2_GROUP_FREE_BLOCKS_COUNT(gd) \
#define EXT2_GROUP_FREE_INODES_COUNT(gd) \
#define EXT2_GROUP_USED_DIRS_COUNT(gd) \
#define EXT2_INODE_SIZE(inode) \
#define EXT2_SUPER_FREE_BLOCKS_COUNT(sb) \
#define EXT2_SUPER_FREE_INODES_COUNT(sb) \
#define EXT2_SUPER_FIRST_DATA_BLOCK(sb) \
#define EXT2_SUPER_LOG_FRAG_SIZE(sb) \
#define EXT2_SUPER_BLOCKS_PER_GROUP(sb) \
#define EXT2_SUPER_FRAGS_PER_GROUP(sb) \
#define EXT2_SUPER_INODES_PER_GROUP(sb) \
#define EXT2_SUPER_MAX_MNT_COUNT(sb) \
#define EXT2_SUPER_MINOR_REV_LEVEL(sb) \
#define EXT2_SUPER_FEATURE_INCOMPAT(sb) \
#define EXT2_SUPER_FEATURE_RO_COMPAT(sb) \
#define EXT2_SUPER_ALGORITHM_USAGE_BITMAP(sb) \
#endif