Main Page   Compound List   File List   Compound Members   File Members  

SynchDisk Class Reference

#include <synchdisk.h>

List of all members.

Public Methods

 SynchDisk (char *name)
 ~SynchDisk ()
void ReadSector (int sectorNumber, char *data)
void WriteSector (int sectorNumber, char *data)
void RequestDone ()

Private Attributes

Diskdisk
Semaphoresemaphore
Locklock


Constructor & Destructor Documentation

SynchDisk::SynchDisk char *    name
 

Definition at line 43 of file synchdisk.cc.

References disk, DiskRequestDone, lock, and semaphore.

00044 {
00045     semaphore = new Semaphore("synch disk", 0);
00046     lock = new Lock("synch disk lock");
00047     disk = new Disk(name, DiskRequestDone, (int) this);
00048 }

SynchDisk::~SynchDisk  
 

Definition at line 56 of file synchdisk.cc.

References disk, lock, and semaphore.

00057 {
00058     delete disk;
00059     delete lock;
00060     delete semaphore;
00061 }


Member Function Documentation

void SynchDisk::ReadSector int    sectorNumber,
char *    data
 

Definition at line 73 of file synchdisk.cc.

References Lock::Acquire, disk, lock, Semaphore::P, Disk::ReadRequest, Lock::Release, and semaphore.

00074 {
00075     lock->Acquire();                    // only one disk I/O at a time
00076     disk->ReadRequest(sectorNumber, data);
00077     semaphore->P();                     // wait for interrupt
00078     lock->Release();
00079 }

void SynchDisk::RequestDone  
 

Definition at line 106 of file synchdisk.cc.

References semaphore, and Semaphore::V.

Referenced by DiskRequestDone.

00107 { 
00108     semaphore->V();
00109 }

void SynchDisk::WriteSector int    sectorNumber,
char *    data
 

Definition at line 91 of file synchdisk.cc.

References Lock::Acquire, disk, lock, Semaphore::P, Lock::Release, semaphore, and Disk::WriteRequest.

00092 {
00093     lock->Acquire();                    // only one disk I/O at a time
00094     disk->WriteRequest(sectorNumber, data);
00095     semaphore->P();                     // wait for interrupt
00096     lock->Release();
00097 }


Member Data Documentation

Disk* SynchDisk::disk [private]
 

Definition at line 46 of file synchdisk.h.

Referenced by ReadSector, SynchDisk, WriteSector, and ~SynchDisk.

Lock* SynchDisk::lock [private]
 

Definition at line 49 of file synchdisk.h.

Referenced by ReadSector, SynchDisk, WriteSector, and ~SynchDisk.

Semaphore* SynchDisk::semaphore [private]
 

Definition at line 47 of file synchdisk.h.

Referenced by ReadSector, RequestDone, SynchDisk, WriteSector, and ~SynchDisk.


The documentation for this class was generated from the following files:
Generated on Mon Feb 10 09:54:59 2003 for nachos by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002
The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees