tac0S
Template Affectional Command Operating System
Public Member Functions | List of all members
SynchDisk Class Reference

The following class defines a "synchronous" disk abstraction. As with other I/O devices, the raw physical disk is an asynchronous device – requests to read or write portions of the disk return immediately, and an interrupt occurs later to signal that the operation completed. (Also, the physical characteristics of the disk device assume that only one operation can be requested at a time). More...

#include <synchdisk.h>

Public Member Functions

 SynchDisk (const char *name)
 SynchDisk::SynchDisk Initialize the synchronous interface to the physical disk, in turn initializing the physical disk. More...
 
 ~SynchDisk ()
 SynchDisk::~SynchDisk De-allocate data structures needed for the synchronous disk abstraction.
 
void ReadSector (int sectorNumber, char *data)
 SynchDisk::ReadSector Read the contents of a disk sector into a buffer. Return only after the data has been read. More...
 
void WriteSector (int sectorNumber, char *data)
 SynchDisk::WriteSector Write the contents of a buffer into a disk sector. Return only after the data has been written. More...
 
void RequestDone ()
 SynchDisk::RequestDone Disk interrupt handler. Wake up any thread waiting for the disk request to finish.
 

Detailed Description

The following class defines a "synchronous" disk abstraction. As with other I/O devices, the raw physical disk is an asynchronous device – requests to read or write portions of the disk return immediately, and an interrupt occurs later to signal that the operation completed. (Also, the physical characteristics of the disk device assume that only one operation can be requested at a time).

This class provides the abstraction that for any individual thread making a request, it waits around until the operation finishes before returning.

Constructor & Destructor Documentation

SynchDisk::SynchDisk ( const char *  name)

SynchDisk::SynchDisk Initialize the synchronous interface to the physical disk, in turn initializing the physical disk.

Parameters
name– UNIX file name to be used as storage for the disk data (usually, "DISK")

Member Function Documentation

void SynchDisk::ReadSector ( int  sectorNumber,
char *  data 
)

SynchDisk::ReadSector Read the contents of a disk sector into a buffer. Return only after the data has been read.

Parameters
sectorNumber– the disk sector to read
data– the buffer to hold the contents of the disk sector
void SynchDisk::WriteSector ( int  sectorNumber,
char *  data 
)

SynchDisk::WriteSector Write the contents of a buffer into a disk sector. Return only after the data has been written.

Parameters
sectorNumber– the disk sector to be written
data– the new contents of the disk sector

The documentation for this class was generated from the following files: