25 return (ino - 1) /
fs->ext2_sb->s_inodes_per_group;
33 return (
blk -
fs->ext2_sb->s_first_data_block) /
34 fs->ext2_sb->s_blocks_per_group;
47 fs->group_desc[
group].bg_free_inodes_count -= inuse;
50 fs->group_desc[
group].bg_used_dirs_count += inuse;
52 fs->ext2_sb->s_free_inodes_count -= inuse;
70 fs->group_desc[
group].bg_free_blocks_count -= inuse;
71 fs->ext2_sb->s_free_blocks_count -= inuse;
96 ULONG group_blk, start_blk, last_blk, new_blk,
blk,
j;
98 group_blk =
fs->ext2_sb->s_first_data_block +
99 (
group *
fs->ext2_sb->s_blocks_per_group);
101 last_blk = group_blk +
fs->ext2_sb->s_blocks_per_group;
102 if (last_blk >=
fs->ext2_sb->s_blocks_count)
103 last_blk =
fs->ext2_sb->s_blocks_count - 1;
105 start_blk = group_blk + 3 +
fs->desc_blocks;
106 if (start_blk > last_blk)
107 start_blk = group_blk;
115 if (!
fs->group_desc[
group].bg_inode_table)
118 fs->inode_blocks_per_group,
123 for (
j=0,
blk = new_blk;
124 j <
fs->inode_blocks_per_group;
128 fs->group_desc[
group].bg_inode_table = new_blk;
136 start_blk +=
fs->inode_blocks_per_group;
137 start_blk += ((
fs->stride *
group) %
138 (last_blk - start_blk));
139 if (start_blk > last_blk)
141 start_blk = group_blk;
145 start_blk = group_blk;
148 if (!
fs->group_desc[
group].bg_block_bitmap)
155 last_blk, 1,
bmap, &new_blk);
161 fs->group_desc[
group].bg_block_bitmap = new_blk;
164 if (!
fs->group_desc[
group].bg_inode_bitmap)
170 last_blk, 1,
bmap, &new_blk);
175 fs->group_desc[
group].bg_inode_bitmap = new_blk;
194 b =
fs->ext2_sb->s_first_data_block;
204 if (
b+
num-1 >
fs->ext2_sb->s_blocks_count)
205 b =
fs->ext2_sb->s_first_data_block;
227 for (
i = 0; (
ULONG)i < fs->group_desc_count;
i++)
229 blk =
fs->group_desc[
i].bg_inode_table;
230 num =
fs->inode_blocks_per_group;
235 DPRINT1(
"\nMke2fs: Could not write %lu blocks "
236 "in inode table starting at %lu.\n",
265 if (!goal || (goal >=
fs->ext2_sb->s_blocks_count))
266 goal =
fs->ext2_sb->s_first_data_block;
280 if (
i >=
fs->ext2_sb->s_blocks_count)
281 i =
fs->ext2_sb->s_first_data_block;
318 fs->blocksize, (
unsigned char *)
buf));
362 dir->rec_len =
fs->blocksize;
366 if (
fs->ext2_sb->s_feature_incompat &
372 dir->inode = dir_ino;
383 dir->inode = parent_ino;
401 fs->blocksize, (
unsigned char *)
inbuf));
413 fs->blocksize, (
unsigned char *)
inbuf));
bool ext2_test_block_bitmap(PEXT2_BLOCK_BITMAP bitmap, ULONG block)
bool ext2_test_block_bitmap_range(PEXT2_BLOCK_BITMAP bitmap, ULONG block, int num)
bool ext2_read_block_bitmap(PEXT2_FILESYS fs)
NTSTATUS Ext2WriteDisk(PEXT2_FILESYS Ext2Sys, ULONGLONG Offset, ULONG Length, PVOID Buffer)
int ext2_group_of_ino(PEXT2_FILESYS fs, ULONG ino)
void ext2_inode_alloc_stats2(PEXT2_FILESYS fs, ULONG ino, int inuse, int isdir)
bool ext2_allocate_group_table(PEXT2_FILESYS fs, ULONG group, PEXT2_BLOCK_BITMAP bmap)
void ext2_block_alloc_stats(PEXT2_FILESYS fs, ULONG blk, int inuse)
int ext2_group_of_blk(PEXT2_FILESYS fs, ULONG blk)
bool ext2_new_block(PEXT2_FILESYS fs, ULONG goal, PEXT2_BLOCK_BITMAP map, ULONG *ret)
bool ext2_read_block(PEXT2_FILESYS fs, ULONG block, void *inbuf)
bool ext2_get_free_blocks(PEXT2_FILESYS fs, ULONG start, ULONG finish, int num, PEXT2_BLOCK_BITMAP map, ULONG *ret)
void ext2_inode_alloc_stats(PEXT2_FILESYS fs, ULONG ino, int inuse)
bool ext2_write_block(PEXT2_FILESYS fs, ULONG block, void *inbuf)
bool ext2_new_dir_block(PEXT2_FILESYS fs, ULONG dir_ino, ULONG parent_ino, char **block)
bool ext2_alloc_block(PEXT2_FILESYS fs, ULONG goal, ULONG *ret)
bool ext2_allocate_tables(PEXT2_FILESYS Ext2Sys)
bool write_inode_tables(PEXT2_FILESYS fs)
bool zero_blocks(PEXT2_FILESYS fs, ULONG blk, ULONG num, ULONG *ret_blk, ULONG *ret_count)
#define ext2_unmark_inode_bitmap
#define ext2_mark_block_bitmap
#define ext2_unmark_block_bitmap
#define ext2_mark_inode_bitmap
struct ext2_dirent * PEXT2_DIR_ENTRY
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)
#define EXT2_FEATURE_INCOMPAT_FILETYPE
#define EXT2_DIR_REC_LEN(name_len)
ULONGLONG bmap(struct inode *i, ULONGLONG b)
NTSTATUS Ext2ReadDisk(IN PEXT2_VCB Vcb, IN ULONGLONG Offset, IN ULONG Size, IN PVOID Buffer, IN BOOLEAN bVerify)
GLboolean GLboolean GLboolean b
GLenum GLuint GLenum GLsizei const GLchar * buf
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
PEXT2_BLOCK_BITMAP block_map
static unsigned int block