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

static byte_t* getBlock ( struct Image image,
byte_t  track,
byte_t  sector 
) [static]

Get a pointer to the block in the specified track and sector.

image the disk image
track the track number
sector the sector number
pointer to the first byte in the sector, or NULL

Definition at line 265 of file image.c.

References Image::buf, getGeometry(), and Image::type.

Referenced by allocBlock(), backupBAM(), blocksFree(), deleteDirEnt(), deleteInode(), FormatImage(), freeBlock(), isFreeBlock(), mapInode(), ReadImage(), readInode(), restoreBAM(), and writeInode().

  const struct DiskGeometry* geom;
  int t, b;

  if (!image || !image->buf || !(geom = getGeometry (image->type)))
    return 0;

  if (track < 1 || track > geom->tracks || sector >= geom->sectors[track])
    return 0; /* illegal track or sector */

  for (t = 1, b = 0; t < track; t++)
    b += geom->sectors[t];

  b += sector;

  return &image->buf[b << 8];

Generated by  Doxygen 1.6.0   Back to index