From: <ga...@us...> - 2009-01-14 11:01:34
|
Revision: 4859 http://jnode.svn.sourceforge.net/jnode/?rev=4859&view=rev Author: galatnm Date: 2009-01-14 11:01:26 +0000 (Wed, 14 Jan 2009) Log Message: ----------- Correctly set attributes in volume header. Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java trunk/fs/src/fs/org/jnode/fs/hfsplus/Superblock.java trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/BTHeaderRecord.java trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/NodeDescriptor.java Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java 2009-01-13 16:05:19 UTC (rev 4858) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java 2009-01-14 11:01:26 UTC (rev 4859) @@ -32,7 +32,7 @@ * @throws FileSystemException */ public HfsPlusFileSystem(final Device device, final boolean readOnly, final HfsPlusFileSystemType type) - throws FileSystemException { + throws FileSystemException { super(device, readOnly, type); } @@ -85,20 +85,28 @@ log.debug("Root entry : No record found."); return null; } - + /* + * (non-Javadoc) + * @see org.jnode.fs.FileSystem#getFreeSpace() + */ public final long getFreeSpace() { return sb.getFreeBlocks() * sb.getBlockSize(); } - + /* + * (non-Javadoc) + * @see org.jnode.fs.FileSystem#getTotalSpace() + */ public final long getTotalSpace() { return sb.getTotalBlocks() * sb.getBlockSize(); } - + /* + * (non-Javadoc) + * @see org.jnode.fs.FileSystem#getUsableSpace() + */ public final long getUsableSpace() { - // TODO Auto-generated method stub return -1; } - + public final Catalog getCatalog() { return catalog; } @@ -118,6 +126,12 @@ try { params.initializeDefaultsValues(this.getApi().getLength(), this.getFSApi().getSectorSize()); sb.create(params); + //--- + long volumeBlockUsed = sb.getTotalBlocks() - sb.getFreeBlocks(); + if(sb.getBlockSize() != 512) volumeBlockUsed++; + //--- + log.debug("Write allocation bitmap bits to disk."); + //--- log.debug("Write volume header to disk."); this.getApi().write(1024, ByteBuffer.wrap(sb.getBytes())); flush(); Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/Superblock.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/Superblock.java 2009-01-13 16:05:19 UTC (rev 4858) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/Superblock.java 2009-01-14 11:01:26 UTC (rev 4859) @@ -210,7 +210,7 @@ } public final void setAttribute(final int attributeMaskBit) { - BigEndian.setInt32(data, 4, (getAttributes() >> attributeMaskBit) | 0x1); + BigEndian.setInt32(data, 4, getAttributes() | (1 << attributeMaskBit)); } // 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-13 16:05:19 UTC (rev 4858) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/BTHeaderRecord.java 2009-01-14 11:01:26 UTC (rev 4859) @@ -119,6 +119,10 @@ BigEndian.setInt32(data, 39, attrs); } + public byte[] getBytes() { + return data; + } + public final String toString() { return ("Root node: " + getRootNode() + "\n" + "First leaf: " + getFirstLeafNode() + "\n" + "Last leaf: " Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/NodeDescriptor.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/NodeDescriptor.java 2009-01-13 16:05:19 UTC (rev 4858) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/tree/NodeDescriptor.java 2009-01-14 11:01:26 UTC (rev 4859) @@ -47,6 +47,10 @@ BigEndian.setInt16(data, 10, count); } + public byte[] getBytes() { + return data; + } + public final String toString() { return ("FLink: " + getFLink() + "\n" + "BLink: " + getBLink() + "\n" + "Kind: " + getKind() + "\n" + "height: " + getHeight() + "\n" + "#rec: " + getNumRecords() + "\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |