Skip to content

Instantly share code, notes, and snippets.

@aerodame
Created May 27, 2015 03:56
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/dcb1175be50086872c83 to your computer and use it in GitHub Desktop.
Save aerodame/dcb1175be50086872c83 to your computer and use it in GitHub Desktop.
Inode.java
public class Inode {
private final static int iNodeSize = 32; // fix to 32 bytes
private final static int directSize = 11; // # direct pointers
public int length; // file size in bytes
public short count; // # file-table entries pointing to this
public short flag; // 0 = unused, 1 = used, ...
public short direct[] = new short[directSize]; // direct pointers
public short indirect; // a indirect pointer
Inode( ) { // a default constructor
length = 0;
count = 0;
flag = 1;
for ( int i = 0; i < directSize; i++ )
direct[i] = -1;
indirect = -1;
}
Inode( short iNumber ) { // retrieving inode from disk
// design it by yourself.
}
int toDisk( short iNumber ) { // save to disk as the i-th inode
// design it by yourself.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment