Logo Search packages:      
Sourcecode: cbmconvert version File versions  Download package

static enum ImStatus deleteInode ( struct Image image,
byte_t  track,
byte_t  sector,
bool  do_it 
) [static]

Wipe out and delete the file starting at the specified track and sector.

image the disk image
track track number of the first file block
sector sector number of the first file block
do_it flag: really remove the file
status of the operation

Definition at line 1166 of file image.c.

References Image::buf, freeBlock(), getBlock(), ImFail, ImOK, and isFreeBlock().

Referenced by deleteDirEnt().

  int t, s;

  if (!image || !image->buf)
    return ImFail;

  /* Make sure that the whole file has been allocated. */
  for (t = track, s = sector; t; ) {
    byte_t* block;

    if (!(block = getBlock (image, t, s)))
      return ImFail;

    if (isFreeBlock (image, t, s))
      return ImFail;

    t = block[0];
    s = block[1];

  if (do_it) {
    /* Free the space allocated by the file. */

    for (t = track, s = sector; t; ) {
      byte_t* block = getBlock (image, t, s);
      freeBlock (image, t, s);
      t = block[0];
      s = block[1];
      /* clear the block */
      memset (block, 0, 256);

  return ImOK;

Generated by  Doxygen 1.6.0   Back to index