public int getFileOff(int off, Ext2SuperBlock sb) { if (off > i_size) { return -1; } int block = off / sb.getBlockSize(); int innerOff = off % sb.getBlockSize(); if (block > 12) { return -1; } return (int) (i_block[block] * sb.getBlockSize() + innerOff); }
public int getRemain(int off, Ext2SuperBlock sb) { return sb.getBlockSize() - off % sb.getBlockSize(); }