+++ /dev/null
-/**\r
- * Acess2\r
- * \file ext2fs.h\r
- * \brief EXT2 Filesystem Driver\r
- */\r
-#ifndef _EXT2FS_H_\r
-#define _EXT2FS_H_\r
-\r
-/**\r
- \name Inode Flag Values\r
- \{\r
-*/\r
-#define EXT2_S_IFMT 0xF000 //!< Format Mask\r
-#define EXT2_S_IFSOCK 0xC000 //!< Socket\r
-#define EXT2_S_IFLNK 0xA000 //!< Symbolic Link\r
-#define EXT2_S_IFREG 0x8000 //!< Regular File\r
-#define EXT2_S_IFBLK 0x6000 //!< Block Device\r
-#define EXT2_S_IFDIR 0x4000 //!< Directory\r
-#define EXT2_S_IFCHR 0x2000 //!< Character Device\r
-#define EXT2_S_IFIFO 0x1000 //!< FIFO\r
-#define EXT2_S_ISUID 0x0800 //!< SUID\r
-#define EXT2_S_ISGID 0x0400 //!< SGID\r
-#define EXT2_S_ISVTX 0x0200 //!< sticky bit\r
-#define EXT2_S_IRWXU 0700 //!< user access rights mask\r
-#define EXT2_S_IRUSR 0400 //!< Owner Read\r
-#define EXT2_S_IWUSR 0200 //!< Owner Write\r
-#define EXT2_S_IXUSR 0100 //!< Owner Execute\r
-#define EXT2_S_IRWXG 0070 //!< Group Access rights mask\r
-#define EXT2_S_IRGRP 0040 //!< Group Read\r
-#define EXT2_S_IWGRP 0020 //!< Group Write\r
-#define EXT2_S_IXGRP 0010 //!< Group Execute\r
-#define EXT2_S_IRWXO 0007 //!< Global Access rights mask\r
-#define EXT2_S_IROTH 0004 //!< Global Read\r
-#define EXT2_S_IWOTH 0002 //!< Global Write\r
-#define EXT2_S_IXOTH 0001 //!< Global Execute\r
-//! \}\r
-\r
-#define EXT2_NAME_LEN 255 //!< Maximum Name Length\r
-\r
-// === TYPEDEFS ===\r
-typedef struct ext2_inode_s tExt2_Inode; //!< Inode Type\r
-typedef struct ext2_super_block_s tExt2_SuperBlock; //!< Superblock Type\r
-typedef struct ext2_group_desc_s tExt2_Group; //!< Group Descriptor Type\r
-typedef struct ext2_dir_entry_s tExt2_DirEnt; //!< Directory Entry Type\r
-\r
-// === STRUCTURES ===\r
-/**\r
- * \brief EXT2 Superblock Structure\r
- */\r
-struct ext2_super_block_s {\r
- Uint32 s_inodes_count; //!< Inodes count\r
- Uint32 s_blocks_count; //!< Blocks count\r
- Uint32 s_r_blocks_count; //!< Reserved blocks count\r
- Uint32 s_free_blocks_count; //!< Free blocks count\r
- \r
- Uint32 s_free_inodes_count; //!< Free inodes count\r
- Uint32 s_first_data_block; //!< First Data Block\r
- Uint32 s_log_block_size; //!< Block size\r
- Sint32 s_log_frag_size; //!< Fragment size\r
- \r
- Uint32 s_blocks_per_group; //!< Number Blocks per group\r
- Uint32 s_frags_per_group; //!< Number Fragments per group\r
- Uint32 s_inodes_per_group; //!< Number Inodes per group\r
- Uint32 s_mtime; //!< Mount time\r
- \r
- Uint32 s_wtime; //!< Write time\r
- Uint16 s_mnt_count; //!< Mount count\r
- Sint16 s_max_mnt_count; //!< Maximal mount count\r
- Uint16 s_magic; //!< Magic signature\r
- Uint16 s_state; //!< File system state\r
- Uint16 s_errors; //!< Behaviour when detecting errors\r
- Uint16 s_pad; //!< Padding\r
- \r
- Uint32 s_lastcheck; //!< time of last check\r
- Uint32 s_checkinterval; //!< max. time between checks\r
- Uint32 s_creator_os; //!< Formatting OS\r
- Uint32 s_rev_level; //!< Revision level\r
- \r
- Uint16 s_def_resuid; //!< Default uid for reserved blocks\r
- Uint16 s_def_resgid; //!< Default gid for reserved blocks\r
- Uint32 s_reserved[235]; //!< Padding to the end of the block\r
-};\r
-\r
-/**\r
- * \struct ext2_inode_s\r
- * \brief EXT2 Inode Definition\r
- */\r
-struct ext2_inode_s {\r
- Uint16 i_mode; //!< File mode\r
- Uint16 i_uid; //!< Owner Uid\r
- Uint32 i_size; //!< Size in bytes\r
- Uint32 i_atime; //!< Access time\r
- Uint32 i_ctime; //!< Creation time\r
- Uint32 i_mtime; //!< Modification time\r
- Uint32 i_dtime; //!< Deletion Time\r
- Uint16 i_gid; //!< Group Id\r
- Uint16 i_links_count; //!< Links count\r
- Uint32 i_blocks; //!< Number of blocks allocated for the file\r
- Uint32 i_flags; //!< File flags\r
- union {\r
- Uint32 linux_reserved1; //!< Linux: Reserved\r
- Uint32 hurd_translator; //!< HURD: Translator\r
- Uint32 masix_reserved1; //!< Masix: Reserved\r
- } osd1; //!< OS dependent 1\r
- Uint32 i_block[15]; //!< Pointers to blocks\r
- Uint32 i_version; //!< File version (for NFS)\r
- Uint32 i_file_acl; //!< File ACL\r
- Uint32 i_dir_acl; //!< Directory ACL / Extended File Size\r
- Uint32 i_faddr; //!< Fragment address\r
- union {\r
- struct {\r
- Uint8 l_i_frag; //!< Fragment number\r
- Uint8 l_i_fsize; //!< Fragment size\r
- Uint16 i_pad1; //!< Padding\r
- Uint32 l_i_reserved2[2]; //!< Reserved\r
- } linux2;\r
- struct {\r
- Uint8 h_i_frag; //!< Fragment number\r
- Uint8 h_i_fsize; //!< Fragment size\r
- Uint16 h_i_mode_high; //!< Mode High Bits\r
- Uint16 h_i_uid_high; //!< UID High Bits\r
- Uint16 h_i_gid_high; //!< GID High Bits\r
- Uint32 h_i_author; //!< Creator ID\r
- } hurd2;\r
- struct {\r
- Uint8 m_i_frag; //!< Fragment number\r
- Uint8 m_i_fsize; //!< Fragment size\r
- Uint16 m_pad1; //!< Padding\r
- Uint32 m_i_reserved2[2]; //!< reserved\r
- } masix2;\r
- } osd2; //!< OS dependent 2\r
-};\r
-\r
-/**\r
- * \struct ext2_group_desc_s\r
- * \brief EXT2 Group Descriptor\r
- */\r
-struct ext2_group_desc_s {\r
- Uint32 bg_block_bitmap; //!< Blocks bitmap block\r
- Uint32 bg_inode_bitmap; //!< Inodes bitmap block\r
- Uint32 bg_inode_table; //!< Inodes table block\r
- Uint16 bg_free_blocks_count; //!< Free blocks count\r
- Uint16 bg_free_inodes_count; //!< Free inodes count\r
- Uint16 bg_used_dirs_count; //!< Directories count\r
- Uint16 bg_pad; //!< Padding\r
- Uint32 bg_reserved[3]; //!< Reserved\r
-};\r
-\r
-/**\r
- * \brief EXT2 Directory Entry\r
- * \note The name may take up less than 255 characters\r
- */\r
-struct ext2_dir_entry_s {\r
- Uint32 inode; //!< Inode number\r
- Uint16 rec_len; //!< Directory entry length\r
- Uint8 name_len; //!< Short Name Length\r
- Uint8 type; //!< File Type (Duplicate of ext2_inode_s.i_mode)\r
- char name[EXT2_NAME_LEN+1]; //!< File name\r
-};\r
-#define EXT2_DIRENT_SIZE (sizeof(struct ext2_dir_entry_s)-EXT2_NAME_LEN+1)\r
-\r
-#endif\r