Revision: 5909 http://jnode.svn.sourceforge.net/jnode/?rev=5909&view=rev Author: galatnm Date: 2012-08-10 06:32:22 +0000 (Fri, 10 Aug 2012) Log Message: ----------- Fix a problem reading ext4 inode tables
Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/ext2/INodeTable.java Modified: trunk/fs/src/fs/org/jnode/fs/ext2/INodeTable.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/ext2/INodeTable.java 2012-08-10 06:29:21 UTC (rev 5908) +++ trunk/fs/src/fs/org/jnode/fs/ext2/INodeTable.java 2012-08-10 06:32:22 UTC (rev 5909) @@ -21,7 +21,6 @@ package org.jnode.fs.ext2; import java.io.IOException; - import org.jnode.fs.FileSystemException; /** @@ -46,15 +45,13 @@ blockSize = fs.getBlockSize(); blockCount = (int) Ext2Utils.ceilDiv( - fs.getSuperblock().getINodesPerGroup() * INode.INODE_LENGTH, blockSize); + fs.getSuperblock().getINodesPerGroup() * fs.getSuperblock().getINodeSize(), blockSize); } public static int getSizeInBlocks(Ext2FileSystem fs) { - int count = - (int) Ext2Utils.ceilDiv( - fs.getSuperblock().getINodesPerGroup() * INode.INODE_LENGTH, - fs.getBlockSize()); - return count; + return (int) Ext2Utils.ceilDiv( + fs.getSuperblock().getINodesPerGroup() * fs.getSuperblock().getINodeSize(), + fs.getBlockSize()); } /** @@ -100,13 +97,14 @@ * safe to synchronize to it */ public synchronized byte[] getInodeData(int index) throws IOException, FileSystemException { - byte data[] = new byte[INode.INODE_LENGTH]; + int iNodeSize = (int) fs.getSuperblock().getINodeSize(); + byte data[] = new byte[iNodeSize]; int indexCopied = 0; - while (indexCopied < INode.INODE_LENGTH) { - int blockNo = (index * INode.INODE_LENGTH + indexCopied) / blockSize; - int blockOffset = (index * INode.INODE_LENGTH + indexCopied) % blockSize; - int copyLength = Math.min(blockSize - blockOffset, INode.INODE_LENGTH); + while (indexCopied < iNodeSize) { + int blockNo = (index * iNodeSize + indexCopied) / blockSize; + int blockOffset = (index * iNodeSize + indexCopied) % blockSize; + int copyLength = Math.min(blockSize - blockOffset, iNodeSize); System.arraycopy(getINodeTableBlock(blockNo), blockOffset, data, indexCopied, copyLength); indexCopied += copyLength; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Jnode-svn-commits mailing list Jnode-svn-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jnode-svn-commits