Example #1
0
/*
 *  memfile_free_blocks_in_table
 *
 *  This is a support routine for IMFS_memfile_remove.  It frees all the
 *  blocks in one of the indirection tables.
 */
static void memfile_free_blocks_in_table(
  block_p **block_table,
  int       entries
)
{
  int      i;
  block_p *b;

  /*
   *  Perform internal consistency checks
   */
  IMFS_assert( block_table );

  /*
   *  Now go through all the slots in the table and free the memory.
   */
  b = *block_table;

  for ( i=0 ; i<entries ; i++ ) {
    if ( b[i] ) {
      memfile_free_block( b[i] );
      b[i] = 0;
    }
  }

  /*
   *  Now that all the blocks in the block table are free, we can
   *  free the block table itself.
   */
  memfile_free_block( *block_table );
  *block_table = 0;
}
Example #2
0
/*
 *  IMFS_memfile_remove_block
 *
 *  This routine removes the specified block from the in-memory file.
 *
 *  NOTE:  This is a support routine and is called only to remove
 *         the last block or set of blocks in a file.  Removing a
 *         block from the middle of a file would be exceptionally
 *         dangerous and the results unpredictable.
 */
MEMFILE_STATIC void IMFS_memfile_remove_block(
   IMFS_jnode_t  *the_jnode,
   unsigned int   block
)
{
  block_p *block_ptr;
  block_p  ptr;

  block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
  if ( block_ptr ) {
    ptr = *block_ptr;
    *block_ptr = 0;
    memfile_free_block( ptr );
  }
}
Example #3
0
/*
 *  IMFS_memfile_remove_block
 *
 *  This routine removes the specified block from the in-memory file.
 *
 *  NOTE:  This is a support routine and is called only to remove
 *         the last block or set of blocks in a file.  Removing a
 *         block from the middle of a file would be exceptionally
 *         dangerous and the results unpredictable.
 */
static void IMFS_memfile_remove_block(
   IMFS_memfile_t *memfile,
   unsigned int    block
)
{
  block_p *block_ptr;
  block_p  ptr;

  block_ptr = IMFS_memfile_get_block_pointer( memfile, block, 0 );
  if ( block_ptr ) {
    ptr = *block_ptr;
    *block_ptr = 0;
    memfile_free_block( ptr );
  }
}
Example #4
0
/*
 *  IMFS_memfile_remove_block
 *
 *  This routine removes the specified block from the in-memory file.
 *
 *  NOTE:  This is a support routine and is called only to remove
 *         the last block or set of blocks in a file.  Removing a
 *         block from the middle of a file would be exceptionally
 *         dangerous and the results unpredictable.
 */
MEMFILE_STATIC int IMFS_memfile_remove_block(
   IMFS_jnode_t  *the_jnode,
   unsigned int   block
)
{
  block_p *block_ptr;
  block_p  ptr;

  block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
  IMFS_assert( block_ptr );

  ptr = *block_ptr;
  *block_ptr = 0;
  memfile_free_block( ptr );

  return 1;
}