Created
May 27, 2015 04:06
-
-
Save aerodame/f0b1c25b8fee0e6bc55a to your computer and use it in GitHub Desktop.
FileTableEntry
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 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