src/group.c

Go to the documentation of this file.
00001 /*
00002 * /giis/group.c This file sets the group descriptor for processing.
00003 *
00004 * Copyright (C) 2005. G.Lakshmipathi.<lakshmipathi_g@rediffmail.com>
00005 *
00006 */
00007 
00008 #include "giis.h"
00009 
00010 /*
00011 * get_group_desc() This procedure sets the group number into global structure.
00012 */
00013 
00014 int get_group_desc ()
00015 {
00016   int i;
00017   if (fs.group_offset <= RANGE)
00018     lseek (fd, fs.group_offset, 0);     /* fd is global */
00019   else
00020     lseek64 (fd, fs.group_offset, 0);
00021   i = read (fd, igd.buffer, GROUP_DESC_SIZE);
00022   CHECK fs.block_bitmap = igd.gd.bg_block_bitmap;
00023   fs.inode_bitmap = igd.gd.bg_inode_bitmap;
00024   fs.inode_table = igd.gd.bg_inode_table;
00025   fs.free_blocks_count = igd.gd.bg_free_blocks_count;
00026   fs.free_inodes_count = igd.gd.bg_free_inodes_count;
00027   return 1;
00028 }
00029 
00030 /*
00031 * eye_on_gd() : Check Group descriptor of the block.
00032 */
00033 int eye_on_gd ()
00034 {
00035   int i;
00036   /* Check all */
00037   gd++;
00038   fs.group_number = 0;
00039   while (fs.group_number < fs.groups_count)
00040   {
00041     fs.group_offset = fs.first_group_desc + fs.group_number * GROUP_DESC_SIZE;
00042     i = get_group_desc ();
00043     CHECK
00044       if ((fs.block_number > fs.block_bitmap)
00045           && (fs.block_number < (fs.block_bitmap + fs.blocks_per_group)))
00046       return 1;
00047     else
00048       fs.group_number++;
00049   }
00050   return -1;
00051 }

Generated on Wed Jul 25 20:43:33 2007 for giis by  doxygen 1.5.1