From: <ga...@us...> - 2009-01-13 16:05:30
|
Revision: 4858 http://jnode.svn.sourceforge.net/jnode/?rev=4858&view=rev Author: galatnm Date: 2009-01-13 16:05:19 +0000 (Tue, 13 Jan 2009) Log Message: ----------- Add extents overflow file definition and complete BTree header record to access attributes. Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusParams.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java trunk/fs/src/fs/org/jnode/fs/hfsplus/extent/ExtentKey.java trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/BTHeaderRecord.java Added Paths: ----------- trunk/fs/src/fs/org/jnode/fs/hfsplus/extent/Extent.java Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusParams.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusParams.java 2009-01-12 15:07:59 UTC (rev 4857) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusParams.java 2009-01-13 16:05:19 UTC (rev 4858) @@ -250,4 +250,8 @@ public void setBitmapClumpBlocks(int bitmapClumpBlocks) { this.bitmapClumpBlocks = bitmapClumpBlocks; } + + public int getExtentNodeSize() { + return extentNodeSize; + } } Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java 2009-01-12 15:07:59 UTC (rev 4857) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java 2009-01-13 16:05:19 UTC (rev 4858) @@ -118,6 +118,7 @@ try { params.initializeDefaultsValues(this.getApi().getLength(), this.getFSApi().getSectorSize()); sb.create(params); + log.debug("Write volume header to disk."); this.getApi().write(1024, ByteBuffer.wrap(sb.getBytes())); flush(); } catch (IOException e) { Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java 2009-01-12 15:07:59 UTC (rev 4857) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java 2009-01-13 16:05:19 UTC (rev 4858) @@ -6,6 +6,9 @@ import org.jnode.util.BigEndian; public class CatalogKey extends AbstractKey { + + public final static int MAXIMUM_KEY_LENGTH = 516; + private int keyLength; private CatalogNodeId parentID; private HFSUnicodeString nodeName; Added: trunk/fs/src/fs/org/jnode/fs/hfsplus/extent/Extent.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/extent/Extent.java (rev 0) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/extent/Extent.java 2009-01-13 16:05:19 UTC (rev 4858) @@ -0,0 +1,31 @@ +package org.jnode.fs.hfsplus.extent; + +import org.jnode.fs.hfsplus.HFSPlusParams; +import org.jnode.fs.hfsplus.HfsPlusConstants; +import org.jnode.fs.hfsplus.tree.BTHeaderRecord; +import org.jnode.fs.hfsplus.tree.NodeDescriptor; + +public class Extent { + private NodeDescriptor btnd; + private BTHeaderRecord bthr; + + public Extent(HFSPlusParams params) { + btnd = new NodeDescriptor(); + btnd.setKind(HfsPlusConstants.BT_HEADER_NODE); + btnd.setHeight(0); + btnd.setRecordCount(3); + // + bthr = new BTHeaderRecord(); + bthr.setTreeDepth(0); + bthr.setRootNode(0); + bthr.settFirstLeafNode(0); + bthr.setLastLeafNode(0); + bthr.setLeafRecords(0); + bthr.setNodeSize(params.getExtentNodeSize()); + bthr.setTotalNodes(params.getExtentClumpSize() + / params.getExtentNodeSize()); + bthr.setFreeNodes(bthr.getTotalNodes() - 1); + bthr.setClumpSize(params.getExtentClumpSize()); + bthr.setMaxKeyLength(ExtentKey.KEY_LENGTH); + } +} Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/extent/ExtentKey.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/extent/ExtentKey.java 2009-01-12 15:07:59 UTC (rev 4857) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/extent/ExtentKey.java 2009-01-13 16:05:19 UTC (rev 4858) @@ -6,7 +6,7 @@ import org.jnode.util.BigEndian; public class ExtentKey extends AbstractKey { - + public static final byte DATA_FORK = (byte) 0x00; public static final byte RESOURCE_FORK = (byte) 0xFF; public static final int KEY_LENGTH = 12; Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/BTHeaderRecord.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/BTHeaderRecord.java 2009-01-12 15:07:59 UTC (rev 4857) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/BTHeaderRecord.java 2009-01-13 16:05:19 UTC (rev 4858) @@ -111,8 +111,17 @@ BigEndian.setInt8(data, 38, type); } + public long getAttributes() { + return BigEndian.getInt32(data, 39); + } + + public void setAttributes(int attrs) { + BigEndian.setInt32(data, 39, attrs); + } + public final String toString() { - return ("Root node: " + getRootNode() + "\n" + "First leaf: " + getFirstLeafNode() + "\n" + "Last leaf: " + return ("Root node: " + getRootNode() + "\n" + "First leaf: " + + getFirstLeafNode() + "\n" + "Last leaf: " + getLastLeafNode() + "\n" + "node size: " + getNodeSize() + "\n"); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |