Skip to content

Instantly share code, notes, and snippets.

@aerodame
Created May 27, 2015 04:06
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/f0b1c25b8fee0e6bc55a to your computer and use it in GitHub Desktop.
Save aerodame/f0b1c25b8fee0e6bc55a to your computer and use it in GitHub Desktop.
FileTableEntry
public class FileTableEntry { // Each table entry should have
public int seekPtr; // a file seek pointer
public final Inode inode; // a reference to its inode
public final short iNumber; // this inode number
public int count; // # threads sharing this entry
public final String mode; // "r", "w", "w+", or "a"
public FileTableEntry ( Inode i, short inumber, String m ) {
seekPtr = 0; // the seek pointer is set to the file top
inode = i;
iNumber = inumber;
count = 1; // at least on thread is using this entry
mode = m; // once access mode is set, it never changes
if ( mode.compareTo( "a" ) == 0 ) // if mode is append,
seekPtr = inode.length; // seekPtr points to the end of file
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment