#include <filehdr.h>
Public Methods | |
| bool | Allocate (BitMap *bitMap, int fileSize) |
| Initialize a file header, including allocating space on disk for the file data. More... | |
| void | Deallocate (BitMap *bitMap) |
| De-allocate this file's data blocks. More... | |
| void | FetchFrom (int sectorNumber) |
| Initialize file header from disk. More... | |
| void | WriteBack (int sectorNumber) |
| Write modifications to file header back to disk. More... | |
| int | ByteToSector (int offset) |
| Convert a byte offset into the file to the disk sector containing the byte. More... | |
| int | FileLength () |
| Return the length of the file in bytes. More... | |
| void | Print () |
| Print the contents of the file. More... | |
Private Attributes | |
| int | numBytes |
| Number of bytes in the file. More... | |
| int | numSectors |
| Number of data sectors in the file. More... | |
| int | dataSectors [NumDirect] |
| Disk sector numbers for each data block in the file. More... | |
Definition at line 38 of file filehdr.h.
|
|
Initialize a file header, including allocating space on disk for the file data. FileHeader::Allocate Initialize a fresh file header for a newly created file. Allocate data blocks for the file out of the map of free disk blocks. Return FALSE if there are not enough free blocks to accomodate the new file. "freeMap" is the bit map of free disk sectors "fileSize" is the bit map of free disk sectors Definition at line 42 of file filehdr.cc. Referenced by FileSystem::Create(), and FileSystem::FileSystem().
|
|
|
Convert a byte offset into the file to the disk sector containing the byte. FileHeader::ByteToSector Return which disk sector is storing a particular byte within the file. This is essentially a translation from a virtual address (the offset in the file) to a physical address (the sector where the data at the offset is stored). "offset" is the location within the file of the byte in question Definition at line 107 of file filehdr.cc. Referenced by OpenFile::ReadAt(), and OpenFile::WriteAt().
|
|
|
De-allocate this file's data blocks. FileHeader::Deallocate De-allocate all the space allocated for data blocks for this file. "freeMap" is the bit map of free disk sectors Definition at line 62 of file filehdr.cc. Referenced by FileSystem::Remove().
|
|
|
Initialize file header from disk. FileHeader::FetchFrom Fetch contents of file header from disk. "sector" is the disk sector containing the file header Definition at line 78 of file filehdr.cc. Referenced by OpenFile::OpenFile(), FileSystem::Print(), Directory::Print(), and FileSystem::Remove().
|
|
|
Return the length of the file in bytes. FileHeader::FileLength Return the number of bytes in the file. Definition at line 118 of file filehdr.cc. Referenced by OpenFile::Length(), OpenFile::ReadAt(), and OpenFile::WriteAt().
|
|
|
Print the contents of the file. FileHeader::Print Print the contents of the file header, and the contents of all the data blocks pointed to by the file header. Definition at line 130 of file filehdr.cc. Referenced by FileSystem::Print(), and Directory::Print().
|
|
|
Write modifications to file header back to disk. FileHeader::WriteBack Write the modified contents of the file header back to disk. "sector" is the disk sector to contain the file header Definition at line 91 of file filehdr.cc. Referenced by FileSystem::Create(), and FileSystem::FileSystem().
|
|
|
Disk sector numbers for each data block in the file.
|
|
|
Number of bytes in the file.
|
|
|
Number of data sectors in the file.
|
1.2.8.1 written by Dimitri van Heesch,
© 1997-2001