tac0S
Template Affectional Command Operating System
|
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. | |
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.
SynchDisk::SynchDisk | ( | const char * | name | ) |
SynchDisk::SynchDisk Initialize the synchronous interface to the physical disk, in turn initializing the physical disk.
name | – UNIX file name to be used as storage for the disk data (usually, "DISK") |
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.
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.
sectorNumber | – the disk sector to be written |
data | – the new contents of the disk sector |