25 if (no < 1 || no > pExt2Sb->s_inodes_count)
27 DPRINT1(
"Mke2fs: Inode value %lu was out of range in load_inode.(1-%ld)\n",
28 no, pExt2Sb->s_inodes_count);
34 ((
no - 1) % pExt2Sb->s_inodes_per_group) *
sizeof(
EXT2_INODE);
52 (
unsigned char *)pInode));
70 (
unsigned char *)pInode));
114 if (
i >
fs->ext2_sb->s_inodes_count)
117 }
while (
i != start_inode);
135 ULONG dwNewBlk = newBlk;
166 temp = 1 << ((10 + pExt2Sb->s_log_block_size - 2) * (
layer - 1));
190 DPRINT1(
"Mke2fs: ext2_expand_block: ... error recuise...\n");
216 ULONG dwSizes[4] = {12, 1, 1, 1};
228 for (
i = 0;
i < 4;
i++)
230 dwSizes[
i] = dwSizes[
i] << ((10 + pExt2Sb->s_log_block_size - 2) *
i);
231 dwTotal += dwSizes[
i];
234 if (
Index >= dwTotal)
236 DPRINT1(
"Mke2fs: ext2_expand_inode: beyond the maxinum size of an inode.\n");
240 for (
i = 0;
i < 4;
i++)
250 dwBlk = Inode->
i_block[(
i + 12 - 1)];
256 Inode->
i_block[(
i + 12 - 1)] = dwBlk;
322 temp = 1 << ((10 + pExt2Sb->s_log_block_size - 2) * (
layer - 1));
330 DPRINT1(
"Mke2fs: ext2_get_block: ... error recuise...\n");
348 ULONG dwSizes[4] = { 12, 1, 1, 1 };
357 for (
i = 0;
i < 4;
i++)
359 dwSizes[
i] = dwSizes[
i] << ((10 + pExt2Sb->s_log_block_size - 2) *
i);
364 DPRINT1(
"Mke2fs: ext2_block_map: beyond the size of the inode.\n");
368 for (
i = 0;
i < 4;
i++)
398 ULONG nBeg, nEnd, nBlocks;
410 DPRINT1(
"Mke2fs: ext2_build_bdl: beyond the file range.\n");
424 nBlocks = nEnd - nBeg;
436 for (
i = nBeg;
i < nEnd;
i++)
450 ext2bdl[
i - nBeg].
Length = dwBytes;
459 ext2bdl[
i - nBeg].
Length = dwBytes;
462 else if (
i == nEnd - 1)
466 ext2bdl[
i - nBeg].
Offset = dwBytes;
473 ext2bdl[
i - nBeg].
Offset = dwBytes;
648 if ((
dir->inode == 0 &&
dir->rec_len >= rec_len) ||
649 (
dir->rec_len >=
dir->name_len + rec_len) )
690 fs->group_desc[
group].bg_free_inodes_count--;
691 fs->ext2_sb->s_free_inodes_count--;
bool ext2_test_inode_bitmap(PEXT2_BLOCK_BITMAP bitmap, ULONG inode)
NTSTATUS Ext2WriteDisk(PEXT2_FILESYS Ext2Sys, ULONGLONG Offset, ULONG Length, PVOID Buffer)
bool ext2_add_entry(PEXT2_FILESYS Ext2Sys, ULONG parent, ULONG inode, int filetype, char *name)
bool ext2_read_inode(PEXT2_FILESYS Ext2Sys, ULONG ino, ULONG offset, PVOID Buffer, ULONG size, PULONG dwReturn)
bool ext2_expand_block(PEXT2_FILESYS Ext2Sys, PEXT2_INODE Inode, ULONG dwContent, ULONG Index, int layer, ULONG newBlk, ULONG *dwRet, ULONG *off)
bool ext2_expand_inode(PEXT2_FILESYS Ext2Sys, PEXT2_INODE Inode, ULONG newBlk)
bool ext2_reserve_inodes(PEXT2_FILESYS fs)
bool ext2_get_block(PEXT2_FILESYS Ext2Sys, ULONG dwContent, ULONG Index, int layer, ULONG *dwRet)
ULONG ext2_build_bdl(PEXT2_FILESYS Ext2Sys, PEXT2_INODE ext2_inode, IN ULONG offset, IN ULONG size, OUT PEXT2_BDL *ext2_bdl)
bool ext2_load_inode(PEXT2_FILESYS Ext2Sys, ULONG no, PEXT2_INODE pInode)
bool ext2_get_inode_lba(PEXT2_FILESYS Ext2Sys, ULONG no, LONGLONG *offset)
bool ext2_new_inode(PEXT2_FILESYS fs, ULONG dir, int mode, PEXT2_INODE_BITMAP map, ULONG *ret)
bool ext2_block_map(PEXT2_FILESYS Ext2Sys, PEXT2_INODE inode, ULONG block, ULONG *dwRet)
bool ext2_save_inode(PEXT2_FILESYS Ext2Sys, ULONG no, PEXT2_INODE pInode)
bool ext2_write_inode(PEXT2_FILESYS Ext2Sys, ULONG ino, ULONG offset, PVOID Buffer, ULONG size, PULONG dwReturn)
int ext2_group_of_ino(PEXT2_FILESYS fs, ULONG ino)
bool ext2_read_block(PEXT2_FILESYS fs, ULONG block, void *inbuf)
bool ext2_write_block(PEXT2_FILESYS fs, ULONG block, void *inbuf)
bool ext2_alloc_block(PEXT2_FILESYS fs, ULONG goal, ULONG *ret)
ULONG Ext2DataBlocks(PEXT2_FILESYS Ext2Sys, ULONG TotalBlocks)
struct _EXT2_BDL * PEXT2_BDL
#define EXT2_FIRST_INODE(s)
struct _EXT2_BDL EXT2_BDL
#define ext2_mark_inode_bitmap
ACPI_SIZE strlen(const char *String)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
#define NT_SUCCESS(StatCode)
static WCHAR no[MAX_STRING_RESOURCE_LEN]
#define EXT2_DIR_REC_LEN(name_len)
#define EXT2_INODES_PER_GROUP(s)
struct ext3_dir_entry_2 * PEXT2_DIR_ENTRY2
NTSTATUS Ext2ReadDisk(IN PEXT2_VCB Vcb, IN ULONGLONG Offset, IN ULONG Size, IN PVOID Buffer, IN BOOLEAN bVerify)
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLuint GLint GLint layer
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
#define memcpy(s1, s2, n)
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
PEXT2_SUPER_BLOCK ext2_sb
PEXT2_GROUP_DESC group_desc
__u32 i_block[EXT2_N_BLOCKS]
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
_In_ WDFCOLLECTION _In_ ULONG Index
static unsigned int block