From: <ga...@us...> - 2009-02-09 16:04:07
|
Revision: 5015 http://jnode.svn.sourceforge.net/jnode/?rev=5015&view=rev Author: galatnm Date: 2009-02-09 16:04:03 +0000 (Mon, 09 Feb 2009) Log Message: ----------- Correct creation of filesystem. Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusConstants.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/AbstractNode.java trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/AbstractNodeRecord.java trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/LeafRecord.java Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java 2009-02-09 15:42:45 UTC (rev 5014) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java 2009-02-09 16:04:03 UTC (rev 5015) @@ -65,8 +65,7 @@ Calendar now = Calendar.getInstance(); now.setTime(new Date()); - int macDate = (int) HFSUtils - .getDate(now.getTimeInMillis() / 1000, true); + int macDate = (int) HFSUtils.getDate(now.getTimeInMillis() / 1000, true); HFSUnicodeString dirName = new HFSUnicodeString(name); CatalogThread thread = new CatalogThread( Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusConstants.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusConstants.java 2009-02-09 15:42:45 UTC (rev 5014) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusConstants.java 2009-02-09 16:04:03 UTC (rev 5015) @@ -52,6 +52,9 @@ public static final byte EK_DATA_FORK = (byte) 0x00; public static final byte EK_RESOURCE_FORK = (byte) 0xFF; + + public static final int BYTES_PER_SECTOR = 512; + public static final int BITS_PER_SECTOR = 4096; Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java 2009-02-09 15:42:45 UTC (rev 5014) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java 2009-02-09 16:04:03 UTC (rev 5015) @@ -162,6 +162,7 @@ - ((sb.getBlockSize() == 512) ? 2 : 1); // --- log.debug("Write allocation bitmap bits to disk."); + writeAllocationFile((int) volumeBlockUsed); // --- log.debug("Write Catalog to disk."); long offset = sb.getCatalogFile().getExtents()[0].getStartBlock() * sb.getBlockSize(); @@ -176,4 +177,9 @@ throw new FileSystemException("Unable to create HFS+ filesystem", e); } } + + private void writeAllocationFile(int blockUsed) { + int bytes = blockUsed >> 3; + int bits = blockUsed & 0x0007; + } } Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/AbstractNode.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/AbstractNode.java 2009-02-09 15:42:45 UTC (rev 5014) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/AbstractNode.java 2009-02-09 16:04:03 UTC (rev 5015) @@ -58,4 +58,12 @@ public byte[] getBytes() { return datas; } + + public String toString() { + StringBuffer b = new StringBuffer(); + b.append((this.isLeafNode()) ? "Leaf node" : "Index node").append("\n"); + b.append(this.getNodeDescriptor().toString()); + return b.toString(); + + } } Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/AbstractNodeRecord.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/AbstractNodeRecord.java 2009-02-09 15:42:45 UTC (rev 5014) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/AbstractNodeRecord.java 2009-02-09 16:04:03 UTC (rev 5015) @@ -39,8 +39,8 @@ public byte[] getBytes() { byte[] data = new byte[key.getKeyLength() + this.recordData.length]; - System.arraycopy(data, 0, key.getBytes(), 0, key.getKeyLength()); - System.arraycopy(data, key.getKeyLength(), this.recordData, 0, this.recordData.length); + System.arraycopy(key.getBytes(), 0, data, 0, key.getKeyLength()); + System.arraycopy(this.recordData, 0, data, key.getKeyLength(), this.recordData.length); return data; } } Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/LeafRecord.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/LeafRecord.java 2009-02-09 15:42:45 UTC (rev 5014) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/LeafRecord.java 2009-02-09 16:04:03 UTC (rev 5015) @@ -33,7 +33,7 @@ public LeafRecord(final Key key, final byte[] nodeData, final int offset, final int recordDataSize) { this.key = key; this.recordData = new byte[recordDataSize]; - System.arraycopy(nodeData, offset + key.getKeyLength() + 2, this.recordData, 0, recordDataSize); + System.arraycopy(nodeData, offset + key.getKeyLength(), this.recordData, 0, recordDataSize); } public final int getType() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |