ReactOS 0.4.16-dev-289-g096a551
ext2.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ext2_sblock
 
struct  ext2_block_group
 
struct  ext2_inode
 
struct  ext2_dirent
 
struct  EXT2_FILE_INFO
 

Macros

#define EXT2_MAGIC   0xEF53
 
#define INDIRECT_BLOCKS   12
 
#define EXT2_PATH_MAX   4096
 
#define EXT2_MAX_SYMLINKCNT   8
 
#define EXT2_GOOD_OLD_REVISION   0
 
#define EXT2_DYNAMIC_REVISION   1
 
#define EXT2_GOOD_OLD_INODE_SIZE   128
 
#define FILETYPE_UNKNOWN   0
 
#define FILETYPE_REG   1
 
#define FILETYPE_DIRECTORY   2
 
#define FILETYPE_SYMLINK   7
 
#define FILETYPE_INO_MASK   0170000
 
#define FILETYPE_INO_REG   0100000
 
#define FILETYPE_INO_DIRECTORY   0040000
 
#define FILETYPE_INO_SYMLINK   0120000
 
#define EXT2_NAME_LEN   255
 
#define EXT2_ROOT_INO   2
 
#define EXT3_FEATURE_INCOMPAT_SUPP   0x0002
 
#define LOG2_BLOCK_SIZE(sb)   (sb->log2_block_size + 10)
 
#define EXT2_BLOCK_SIZE(sb)   (((SIZE_T)1) << LOG2_BLOCK_SIZE(sb))
 
#define EXT2_REVISION(sb)   (sb->revision_level)
 
#define EXT2_INODE_SIZE(sb)
 
#define EXT2_DESC_PER_BLOCK(s)   (EXT2_BLOCK_SIZE(s) / sizeof(struct ext2_block_group))
 
#define EXT2_S_IRWXO   0x0007
 
#define EXT2_S_IXOTH   0x0001
 
#define EXT2_S_IWOTH   0x0002
 
#define EXT2_S_IROTH   0x0004
 
#define EXT2_S_IRWXG   0x0038
 
#define EXT2_S_IXGRP   0x0008
 
#define EXT2_S_IWGRP   0x0010
 
#define EXT2_S_IRGRP   0x0020
 
#define EXT2_S_IRWXU   0x01C0
 
#define EXT2_S_IXUSR   0x0040
 
#define EXT2_S_IWUSR   0x0080
 
#define EXT2_S_IRUSR   0x0100
 
#define EXT2_S_ISVTX   0x0200
 
#define EXT2_S_ISGID   0x0400
 
#define EXT2_S_ISUID   0x0800
 
#define EXT2_S_IFMT   0xF000
 
#define EXT2_S_IFIFO   0x1000
 
#define EXT2_S_IFCHR   0x2000
 
#define EXT2_S_IFDIR   0x4000
 
#define EXT2_S_IFBLK   0x6000
 
#define EXT2_S_IFREG   0x8000
 
#define EXT2_S_IFLNK   0xA000
 
#define EXT2_S_IFSOCK   0xC000
 
#define FAST_SYMLINK_MAX_NAME_SIZE   60
 

Typedefs

typedef struct ext2_sblock EXT2_SUPER_BLOCK
 
typedef struct ext2_sblockPEXT2_SUPER_BLOCK
 
typedef struct ext2_inode EXT2_INODE
 
typedef struct ext2_inodePEXT2_INODE
 
typedef struct ext2_block_group EXT2_GROUP_DESC
 
typedef struct ext2_block_groupPEXT2_GROUP_DESC
 
typedef struct ext2_dirent EXT2_DIR_ENTRY
 
typedef struct ext2_direntPEXT2_DIR_ENTRY
 
typedef struct _EXT2_VOLUME_INFOPEXT2_VOLUME_INFO
 
typedef struct EXT2_FILE_INFOPEXT2_FILE_INFO
 

Functions

const DEVVTBLExt2Mount (ULONG DeviceId)
 

Macro Definition Documentation

◆ EXT2_BLOCK_SIZE

#define EXT2_BLOCK_SIZE (   sb)    (((SIZE_T)1) << LOG2_BLOCK_SIZE(sb))

Definition at line 186 of file ext2.h.

◆ EXT2_DESC_PER_BLOCK

#define EXT2_DESC_PER_BLOCK (   s)    (EXT2_BLOCK_SIZE(s) / sizeof(struct ext2_block_group))

Definition at line 196 of file ext2.h.

◆ EXT2_DYNAMIC_REVISION

#define EXT2_DYNAMIC_REVISION   1

Definition at line 53 of file ext2.h.

◆ EXT2_GOOD_OLD_INODE_SIZE

#define EXT2_GOOD_OLD_INODE_SIZE   128

Definition at line 54 of file ext2.h.

◆ EXT2_GOOD_OLD_REVISION

#define EXT2_GOOD_OLD_REVISION   0

Definition at line 52 of file ext2.h.

◆ EXT2_INODE_SIZE

#define EXT2_INODE_SIZE (   sb)
Value:
: sb->inode_size)
superblock * sb
Definition: btrfs.c:4261
#define EXT2_GOOD_OLD_REVISION
Definition: ext2.h:52
#define EXT2_GOOD_OLD_INODE_SIZE
Definition: ext2.h:54
#define EXT2_REVISION(sb)
Definition: ext2.h:189

Definition at line 192 of file ext2.h.

◆ EXT2_MAGIC

#define EXT2_MAGIC   0xEF53

Definition at line 43 of file ext2.h.

◆ EXT2_MAX_SYMLINKCNT

#define EXT2_MAX_SYMLINKCNT   8

Definition at line 49 of file ext2.h.

◆ EXT2_NAME_LEN

#define EXT2_NAME_LEN   255

Definition at line 156 of file ext2.h.

◆ EXT2_PATH_MAX

#define EXT2_PATH_MAX   4096

Definition at line 47 of file ext2.h.

◆ EXT2_REVISION

#define EXT2_REVISION (   sb)    (sb->revision_level)

Definition at line 189 of file ext2.h.

◆ EXT2_ROOT_INO

#define EXT2_ROOT_INO   2

Definition at line 177 of file ext2.h.

◆ EXT2_S_IFBLK

#define EXT2_S_IFBLK   0x6000

Definition at line 222 of file ext2.h.

◆ EXT2_S_IFCHR

#define EXT2_S_IFCHR   0x2000

Definition at line 220 of file ext2.h.

◆ EXT2_S_IFDIR

#define EXT2_S_IFDIR   0x4000

Definition at line 221 of file ext2.h.

◆ EXT2_S_IFIFO

#define EXT2_S_IFIFO   0x1000

Definition at line 219 of file ext2.h.

◆ EXT2_S_IFLNK

#define EXT2_S_IFLNK   0xA000

Definition at line 224 of file ext2.h.

◆ EXT2_S_IFMT

#define EXT2_S_IFMT   0xF000

Definition at line 218 of file ext2.h.

◆ EXT2_S_IFREG

#define EXT2_S_IFREG   0x8000

Definition at line 223 of file ext2.h.

◆ EXT2_S_IFSOCK

#define EXT2_S_IFSOCK   0xC000

Definition at line 225 of file ext2.h.

◆ EXT2_S_IRGRP

#define EXT2_S_IRGRP   0x0020

Definition at line 207 of file ext2.h.

◆ EXT2_S_IROTH

#define EXT2_S_IROTH   0x0004

Definition at line 202 of file ext2.h.

◆ EXT2_S_IRUSR

#define EXT2_S_IRUSR   0x0100

Definition at line 212 of file ext2.h.

◆ EXT2_S_IRWXG

#define EXT2_S_IRWXG   0x0038

Definition at line 204 of file ext2.h.

◆ EXT2_S_IRWXO

#define EXT2_S_IRWXO   0x0007

Definition at line 199 of file ext2.h.

◆ EXT2_S_IRWXU

#define EXT2_S_IRWXU   0x01C0

Definition at line 209 of file ext2.h.

◆ EXT2_S_ISGID

#define EXT2_S_ISGID   0x0400

Definition at line 215 of file ext2.h.

◆ EXT2_S_ISUID

#define EXT2_S_ISUID   0x0800

Definition at line 216 of file ext2.h.

◆ EXT2_S_ISVTX

#define EXT2_S_ISVTX   0x0200

Definition at line 214 of file ext2.h.

◆ EXT2_S_IWGRP

#define EXT2_S_IWGRP   0x0010

Definition at line 206 of file ext2.h.

◆ EXT2_S_IWOTH

#define EXT2_S_IWOTH   0x0002

Definition at line 201 of file ext2.h.

◆ EXT2_S_IWUSR

#define EXT2_S_IWUSR   0x0080

Definition at line 211 of file ext2.h.

◆ EXT2_S_IXGRP

#define EXT2_S_IXGRP   0x0008

Definition at line 205 of file ext2.h.

◆ EXT2_S_IXOTH

#define EXT2_S_IXOTH   0x0001

Definition at line 200 of file ext2.h.

◆ EXT2_S_IXUSR

#define EXT2_S_IXUSR   0x0040

Definition at line 210 of file ext2.h.

◆ EXT3_FEATURE_INCOMPAT_SUPP

#define EXT3_FEATURE_INCOMPAT_SUPP   0x0002

Definition at line 180 of file ext2.h.

◆ FAST_SYMLINK_MAX_NAME_SIZE

#define FAST_SYMLINK_MAX_NAME_SIZE   60

Definition at line 227 of file ext2.h.

◆ FILETYPE_DIRECTORY

#define FILETYPE_DIRECTORY   2

Definition at line 59 of file ext2.h.

◆ FILETYPE_INO_DIRECTORY

#define FILETYPE_INO_DIRECTORY   0040000

Definition at line 65 of file ext2.h.

◆ FILETYPE_INO_MASK

#define FILETYPE_INO_MASK   0170000

Definition at line 63 of file ext2.h.

◆ FILETYPE_INO_REG

#define FILETYPE_INO_REG   0100000

Definition at line 64 of file ext2.h.

◆ FILETYPE_INO_SYMLINK

#define FILETYPE_INO_SYMLINK   0120000

Definition at line 66 of file ext2.h.

◆ FILETYPE_REG

#define FILETYPE_REG   1

Definition at line 58 of file ext2.h.

◆ FILETYPE_SYMLINK

#define FILETYPE_SYMLINK   7

Definition at line 60 of file ext2.h.

◆ FILETYPE_UNKNOWN

#define FILETYPE_UNKNOWN   0

Definition at line 57 of file ext2.h.

◆ INDIRECT_BLOCKS

#define INDIRECT_BLOCKS   12

Definition at line 45 of file ext2.h.

◆ LOG2_BLOCK_SIZE

#define LOG2_BLOCK_SIZE (   sb)    (sb->log2_block_size + 10)

Definition at line 183 of file ext2.h.

Typedef Documentation

◆ EXT2_DIR_ENTRY

Definition at line 174 of file ext2.h.

◆ EXT2_GROUP_DESC

Definition at line 173 of file ext2.h.

◆ EXT2_INODE

Definition at line 172 of file ext2.h.

◆ EXT2_SUPER_BLOCK

Definition at line 171 of file ext2.h.

◆ PEXT2_DIR_ENTRY

Definition at line 174 of file ext2.h.

◆ PEXT2_FILE_INFO

◆ PEXT2_GROUP_DESC

Definition at line 173 of file ext2.h.

◆ PEXT2_INODE

Definition at line 172 of file ext2.h.

◆ PEXT2_SUPER_BLOCK

Definition at line 171 of file ext2.h.

◆ PEXT2_VOLUME_INFO

Definition at line 229 of file ext2.h.

Function Documentation

◆ Ext2Mount()

const DEVVTBL * Ext2Mount ( ULONG  DeviceId)

Definition at line 1298 of file ext2.c.

1299{
1301 EXT2_SUPER_BLOCK SuperBlock;
1303 ULONG Count;
1305
1306 TRACE("Enter Ext2Mount(%lu)\n", DeviceId);
1307
1308 /* Allocate data for volume information */
1310 if (!Volume)
1311 return NULL;
1313
1314 /* Read the SuperBlock */
1315 Position.QuadPart = 2 * 512;
1316 Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
1317 if (Status != ESUCCESS)
1318 {
1320 return NULL;
1321 }
1322 Status = ArcRead(DeviceId, &SuperBlock, sizeof(SuperBlock), &Count);
1323 if (Status != ESUCCESS || Count != sizeof(SuperBlock))
1324 {
1326 return NULL;
1327 }
1328
1329 /* Check if SuperBlock is valid. If yes, return Ext2 function table. */
1330 if (SuperBlock.magic != EXT2_MAGIC)
1331 {
1333 return NULL;
1334 }
1335
1336 Volume->DeviceId = DeviceId;
1337
1338 /* Really open the volume */
1339 if (!Ext2OpenVolume(Volume))
1340 {
1342 return NULL;
1343 }
1344
1345 /* Remember EXT2 volume information */
1346 Ext2Volumes[DeviceId] = Volume;
1347
1348 /* Return success */
1349 TRACE("Ext2Mount(%lu) success\n", DeviceId);
1350 return &Ext2FuncTable;
1351}
ARC_STATUS ArcSeek(ULONG FileId, LARGE_INTEGER *Position, SEEKMODE SeekMode)
Definition: fs.c:455
ARC_STATUS ArcRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
Definition: fs.c:448
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:188
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:197
#define NULL
Definition: types.h:112
#define TAG_EXT_VOLUME
Definition: ext2.c:72
PEXT2_VOLUME_INFO Ext2Volumes[MAX_FDS]
Definition: ext2.c:65
BOOLEAN Ext2OpenVolume(PEXT2_VOLUME_INFO Volume)
Definition: ext2.c:74
const DEVVTBL Ext2FuncTable
Definition: ext2.c:1288
#define EXT2_MAGIC
Definition: ext2.h:43
Status
Definition: gdiplustypes.h:25
UNICODE_STRING Volume
Definition: fltkernel.h:1172
int Count
Definition: noreturn.cpp:7
@ ESUCCESS
Definition: arc.h:32
ULONG ARC_STATUS
Definition: arc.h:4
@ SeekAbsolute
Definition: arc.h:59
#define TRACE(s)
Definition: solgame.cpp:4
USHORT magic
Definition: ext2.h:86
static COORD Position
Definition: mouse.c:34
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59