mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 11:33:43 +00:00
Create a branch for cmake bringup.
svn path=/branches/cmake-bringup/; revision=48236
This commit is contained in:
parent
a28e798006
commit
c424146e2c
20602 changed files with 0 additions and 1140137 deletions
68
lib/fslib/ext2lib/Group.c
Normal file
68
lib/fslib/ext2lib/Group.c
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* PROJECT: Mke2fs
|
||||
* FILE: Group.c
|
||||
* PROGRAMMER: Matt Wu <mattwu@163.com>
|
||||
* HOMEPAGE: http://ext2.yeah.net
|
||||
*/
|
||||
|
||||
/* INCLUDES **************************************************************/
|
||||
|
||||
#include "Mke2fs.h"
|
||||
|
||||
/* DEFINITIONS ***********************************************************/
|
||||
|
||||
/* FUNCTIONS *************************************************************/
|
||||
|
||||
int test_root(int a, int b)
|
||||
{
|
||||
if (a == 0)
|
||||
return 1;
|
||||
while (1)
|
||||
{
|
||||
if (a == 1)
|
||||
return 1;
|
||||
if (a % b)
|
||||
return 0;
|
||||
a = a / b;
|
||||
}
|
||||
}
|
||||
|
||||
bool ext2_bg_has_super(PEXT2_SUPER_BLOCK pExt2Sb, int group_block)
|
||||
{
|
||||
if (!(pExt2Sb->s_feature_ro_compat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER))
|
||||
return true;
|
||||
|
||||
if (test_root(group_block, 3) || (test_root(group_block, 5)) ||
|
||||
test_root(group_block, 7))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool ext2_allocate_group_desc(PEXT2_FILESYS Ext2Sys)
|
||||
{
|
||||
ULONG size;
|
||||
|
||||
size = Ext2Sys->desc_blocks * Ext2Sys->blocksize;
|
||||
|
||||
Ext2Sys->group_desc =
|
||||
(PEXT2_GROUP_DESC)RtlAllocateHeap(RtlGetProcessHeap(), 0, size);
|
||||
|
||||
if (Ext2Sys->group_desc)
|
||||
{
|
||||
memset(Ext2Sys->group_desc, 0, size);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ext2_free_group_desc(PEXT2_FILESYS Ext2Sys)
|
||||
{
|
||||
if (Ext2Sys->group_desc)
|
||||
{
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Ext2Sys->group_desc);
|
||||
Ext2Sys->group_desc = NULL;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue