mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 00:55:48 +00:00
Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.
This commit is contained in:
parent
b94e2d8ca0
commit
c2c66aff7d
24198 changed files with 0 additions and 37285 deletions
68
sdk/lib/fslib/ext2lib/Group.c
Normal file
68
sdk/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