Created
May 27, 2015 04:09
-
-
Save aerodame/195e8a7a6620583add74 to your computer and use it in GitHub Desktop.
FileTable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FileTable { | |
private Vector table; // the actual entity of this file table | |
private Directory dir; // the root directory | |
public FileTable( Directory directory ) { // constructor | |
table = new Vector( ); // instantiate a file (structure) table | |
dir = directory; // receive a reference to the Director | |
} // from the file system | |
// major public methods | |
public synchronized FileTableEntry falloc( String filename, String mode ) { | |
// allocate a new file (structure) table entry for this file name | |
// allocate/retrieve and register the corresponding inode using dir | |
// increment this inode's count | |
// immediately write back this inode to the disk | |
// return a reference to this file (structure) table entry | |
} | |
public synchronized boolean ffree( FileTableEntry e ) { | |
// receive a file table entry reference | |
// save the corresponding inode to the disk | |
// free this file table entry. | |
// return true if this file table entry found in my table | |
} | |
public synchronized boolean fempty( ) { | |
return table.isEmpty( ); // return if table is empty | |
} // should be called before starting a format | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment