Revision: 5919
          http://jnode.svn.sourceforge.net/jnode/?rev=5919&view=rev
Author:   galatnm
Date:     2012-08-10 07:12:00 +0000 (Fri, 10 Aug 2012)
Log Message:
-----------
Fix a bug in extent block lookups

Modified Paths:
--------------
    trunk/fs/src/fs/org/jnode/fs/ext2/Extent.java
    trunk/fs/src/fs/org/jnode/fs/ext2/ExtentHeader.java

Modified: trunk/fs/src/fs/org/jnode/fs/ext2/Extent.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ext2/Extent.java       2012-08-10 07:08:00 UTC 
(rev 5918)
+++ trunk/fs/src/fs/org/jnode/fs/ext2/Extent.java       2012-08-10 07:12:00 UTC 
(rev 5919)
@@ -24,6 +24,11 @@
     public Extent(byte[] data) {
         this.data = new byte[EXTENT_LENGTH];
         System.arraycopy(data, 0, this.data, 0, EXTENT_LENGTH);
+
+        // Safety check
+        if (getStartHigh() != 0) {
+            throw new UnsupportedOperationException("Extents that use the high 
bits aren't supported yet");
+        }
     }
 
     public long getBlockIndex() {
@@ -41,4 +46,10 @@
     public int getStartHigh() {
         return Ext2Utils.get16(data, 6);
     }
+
+    @Override
+    public String toString() {
+        return String.format("Extent: blockindex:%d count:%d start(low:%d 
high:%d)", getBlockIndex(), getBlockCount(),
+                             getStartLow(), getStartHigh());
+    }
 }

Modified: trunk/fs/src/fs/org/jnode/fs/ext2/ExtentHeader.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/ext2/ExtentHeader.java 2012-08-10 07:08:00 UTC 
(rev 5918)
+++ trunk/fs/src/fs/org/jnode/fs/ext2/ExtentHeader.java 2012-08-10 07:12:00 UTC 
(rev 5919)
@@ -128,7 +128,12 @@
                 }
             }
 
-            return extent.getStartLow();
+            return index - extent.getBlockIndex() + extent.getStartLow();
         }
     }
+
+    @Override
+    public String toString() {
+        return String.format("ExtentHeader: depth:%d entries:%d/%d", 
getDepth(), getEntryCount(), getMaximumEntryCount());
+    }
 }

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

Reply via email to