ReactOS 0.4.15-dev-5666-gc548b97
Group.c File Reference
#include "Mke2fs.h"
Include dependency graph for Group.c:

Go to the source code of this file.

Functions

int test_root (int a, int b)
 
bool ext2_bg_has_super (PEXT2_SUPER_BLOCK pExt2Sb, int group_block)
 
bool ext2_allocate_group_desc (PEXT2_FILESYS Ext2Sys)
 
void ext2_free_group_desc (PEXT2_FILESYS Ext2Sys)
 

Function Documentation

◆ ext2_allocate_group_desc()

bool ext2_allocate_group_desc ( PEXT2_FILESYS  Ext2Sys)

Definition at line 43 of file Group.c.

44{
45 ULONG size;
46
47 size = Ext2Sys->desc_blocks * Ext2Sys->blocksize;
48
49 Ext2Sys->group_desc =
50 (PEXT2_GROUP_DESC)RtlAllocateHeap(RtlGetProcessHeap(), 0, size);
51
52 if (Ext2Sys->group_desc)
53 {
54 memset(Ext2Sys->group_desc, 0, size);
55 return true;
56 }
57
58 return false;
59}
struct ext2_block_group * PEXT2_GROUP_DESC
Definition: ext2.h:173
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
GLsizeiptr size
Definition: glext.h:5919
unsigned int ULONG
Definition: retypes.h:1
#define memset(x, y, z)
Definition: compat.h:39
int blocksize
Definition: Mke2fs.h:154
unsigned long desc_blocks
Definition: Mke2fs.h:157
PEXT2_GROUP_DESC group_desc
Definition: Mke2fs.h:158

Referenced by ext2_initialize_sb().

◆ ext2_bg_has_super()

bool ext2_bg_has_super ( PEXT2_SUPER_BLOCK  pExt2Sb,
int  group_block 
)

Definition at line 30 of file Group.c.

31{
32 if (!(pExt2Sb->s_feature_ro_compat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER))
33 return true;
34
35 if (test_root(group_block, 3) || (test_root(group_block, 5)) ||
36 test_root(group_block, 7))
37 return true;
38
39 return false;
40}
int test_root(int a, int b)
Definition: Group.c:16
#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER
Definition: ext2_fs.h:465

Referenced by ext2_flush(), and ext2_initialize_sb().

◆ ext2_free_group_desc()

void ext2_free_group_desc ( PEXT2_FILESYS  Ext2Sys)

Definition at line 61 of file Group.c.

62{
63 if (Ext2Sys->group_desc)
64 {
65 RtlFreeHeap(RtlGetProcessHeap(), 0, Ext2Sys->group_desc);
66 Ext2Sys->group_desc = NULL;
67 }
68}
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define NULL
Definition: types.h:112

Referenced by ext2_initialize_sb(), and Ext2Format().

◆ test_root()

int test_root ( int  a,
int  b 
)

Definition at line 16 of file Group.c.

17{
18 if (a == 0)
19 return 1;
20 while (1)
21 {
22 if (a == 1)
23 return 1;
24 if (a % b)
25 return 0;
26 a = a / b;
27 }
28}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define b
Definition: ke_i.h:79

Referenced by ext2_bg_has_super().