Skip to content

Instantly share code, notes, and snippets.

@aerodame
Created May 27, 2015 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aerodame/195e8a7a6620583add74 to your computer and use it in GitHub Desktop.
Save aerodame/195e8a7a6620583add74 to your computer and use it in GitHub Desktop.
FileTable
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