Page principale | Liste des namespaces | Hiérarchie des classes | Liste des classes | Répertoires | Liste des fichiers | Membres de namespace | Membres de classe | Membres de fichier

synchdisk.h

Aller à la documentation de ce fichier.
00001 // synchdisk.h 
00002 //      Data structures to export a synchronous interface to the raw 
00003 //      disk device.
00004 //
00005 // Copyright (c) 1992-1993 The Regents of the University of California.
00006 // All rights reserved.  See copyright.h for copyright notice and limitation 
00007 // of liability and disclaimer of warranty provisions.
00008 
00009 #include "copyright.h"
00010 
00011 #ifndef SYNCHDISK_H
00012 #define SYNCHDISK_H
00013 
00014 #include "disk.h"
00015 #include "synch.h"
00016 #include "callback.h"
00017 
00018 // The following class defines a "synchronous" disk abstraction.
00019 // As with other I/O devices, the raw physical disk is an asynchronous device --
00020 // requests to read or write portions of the disk return immediately,
00021 // and an interrupt occurs later to signal that the operation completed.
00022 // (Also, the physical characteristics of the disk device assume that
00023 // only one operation can be requested at a time).
00024 //
00025 // This class provides the abstraction that for any individual thread
00026 // making a request, it waits around until the operation finishes before
00027 // returning.
00028 
00029 class SynchDisk : public CallBackObj {
00030   public:
00031     SynchDisk();                        // Initialize a synchronous disk,
00032                                         // by initializing the raw Disk.
00033     ~SynchDisk();                       // De-allocate the synch disk data
00034     
00035     void ReadSector(int sectorNumber, char* data);
00036                                         // Read/write a disk sector, returning
00037                                         // only once the data is actually read 
00038                                         // or written.  These call
00039                                         // Disk::ReadRequest/WriteRequest and
00040                                         // then wait until the request is done.
00041     void WriteSector(int sectorNumber, char* data);
00042     
00043     void CallBack();                    // Called by the disk device interrupt
00044                                         // handler, to signal that the
00045                                         // current disk operation is complete.
00046 
00047   private:
00048     Disk *disk;                         // Raw disk device
00049     Semaphore *semaphore;               // To synchronize requesting thread 
00050                                         // with the interrupt handler
00051     Lock *lock;                         // Only one read/write request
00052                                         // can be sent to the disk at a time
00053 };
00054 
00055 #endif // SYNCHDISK_H

Généré le Sun Jan 15 00:45:45 2006 pour Système NachOS : par  doxygen 1.4.4