ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

Group.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:          Mke2fs
00003  * FILE:             Group.c
00004  * PROGRAMMER:       Matt Wu <mattwu@163.com>
00005  * HOMEPAGE:         http://ext2.yeah.net
00006  */
00007 
00008 /* INCLUDES **************************************************************/
00009 
00010 #include "Mke2fs.h"
00011 
00012 /* DEFINITIONS ***********************************************************/
00013 
00014 /* FUNCTIONS *************************************************************/
00015 
00016 int test_root(int a, int b)
00017 {
00018     if (a == 0)
00019         return 1;
00020     while (1)
00021     {
00022         if (a == 1)
00023             return 1;
00024         if (a % b)
00025             return 0;
00026         a = a / b;
00027     }
00028 }
00029 
00030 bool ext2_bg_has_super(PEXT2_SUPER_BLOCK pExt2Sb, int group_block)
00031 {
00032     if (!(pExt2Sb->s_feature_ro_compat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER))
00033         return true;
00034 
00035     if (test_root(group_block, 3) || (test_root(group_block, 5)) ||
00036         test_root(group_block, 7))
00037         return true;
00038     
00039     return false;
00040 }
00041 
00042 
00043 bool ext2_allocate_group_desc(PEXT2_FILESYS Ext2Sys)
00044 {
00045     ULONG size;
00046 
00047     size = Ext2Sys->desc_blocks * Ext2Sys->blocksize;
00048 
00049     Ext2Sys->group_desc =
00050         (PEXT2_GROUP_DESC)RtlAllocateHeap(RtlGetProcessHeap(), 0, size);
00051 
00052     if (Ext2Sys->group_desc)
00053     {
00054         memset(Ext2Sys->group_desc, 0, size);
00055         return true;
00056     }
00057 
00058     return false;
00059 }
00060 
00061 void ext2_free_group_desc(PEXT2_FILESYS Ext2Sys)
00062 {
00063     if (Ext2Sys->group_desc)
00064     {
00065         RtlFreeHeap(RtlGetProcessHeap(), 0, Ext2Sys->group_desc);
00066         Ext2Sys->group_desc = NULL;
00067     }
00068 }

Generated on Sat May 26 2012 04:35:03 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.