Category : Recently Uploaded Files
Archive   : EXT2TOOL.ZIP
Filename : CHK_DESC.C

 
Output of file : CHK_DESC.C contained in archive : EXT2TOOL.ZIP
/*
* check_desc.c --- Check the group descriptors of an ext2 filesystem
*
* Copyright (C) 1993, 1994 Theodore Ts'o. This file may be redistributed
* under the terms of the GNU Public License.
*/

#include
#include
#include
#include
#include
#include
#include
#include
#include

#include

#include "ext2fs.h"

/*
* This routine sanity checks the group descriptors
*/
errcode_t ext2fs_check_desc(ext2_filsys fs)
{
int i;
int block = fs->super->s_first_data_block;
int next, inode_blocks_per_group;

EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);

inode_blocks_per_group = fs->super->s_inodes_per_group /
EXT2_INODES_PER_BLOCK (fs->super);

for (i = 0; i < fs->group_desc_count; i++) {
next = block + fs->super->s_blocks_per_group;
/*
* Check to make sure block bitmap for group is
* located within the group.
*/
if (fs->group_desc[i].bg_block_bitmap < block ||
fs->group_desc[i].bg_block_bitmap >= next)
return EXT2_ET_GDESC_BAD_BLOCK_MAP;
/*
* Check to make sure inode bitmap for group is
* located within the group
*/
if (fs->group_desc[i].bg_inode_bitmap < block ||
fs->group_desc[i].bg_inode_bitmap >= next)
return EXT2_ET_GDESC_BAD_INODE_MAP;
/*
* Check to make sure inode table for group is located
* within the group
*/
if (fs->group_desc[i].bg_inode_table < block ||
fs->group_desc[i].bg_inode_table+inode_blocks_per_group >=
next)
return EXT2_ET_GDESC_BAD_INODE_TABLE;

block = next;
}
return 0;
}


  3 Responses to “Category : Recently Uploaded Files
Archive   : EXT2TOOL.ZIP
Filename : CHK_DESC.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/