Revision: 5908 http://jnode.svn.sourceforge.net/jnode/?rev=5908&view=rev Author: galatnm Date: 2012-08-10 06:29:21 +0000 (Fri, 10 Aug 2012) Log Message: ----------- Add support to detect Ext4 features.
Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/ext2/Ext2Constants.java trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystem.java Modified: trunk/fs/src/fs/org/jnode/fs/ext2/Ext2Constants.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/ext2/Ext2Constants.java 2012-08-10 06:19:44 UTC (rev 5907) +++ trunk/fs/src/fs/org/jnode/fs/ext2/Ext2Constants.java 2012-08-10 06:29:21 UTC (rev 5908) @@ -93,6 +93,10 @@ public static final long EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER = 0x0001; public static final long EXT2_FEATURE_RO_COMPAT_LARGE_FILE = 0x0002; public static final long EXT2_FEATURE_RO_COMPAT_BTREE_DIR = 0x0004; + public static final long EXT4_FEATURE_ROCOMPAT_HUGE_FILE = 0x0008; + public static final long EXT4_FEATURE_ROCOMPAT_GDT_CSUM = 0x0010; + public static final long EXT4_FEATURE_ROCOMPAT_DIR_NLINK = 0x0020; + public static final long EXT4_FEATURE_ROCOMPAT_EXTRA_ISIZE = 0x0040; // S_FEATURE_INCOMPAT constants public static final long EXT2_FEATURE_INCOMPAT_COMPRESSION = 0x0001; @@ -100,6 +104,10 @@ public static final long EXT3_FEATURE_INCOMPAT_RECOVER = 0x0004; public static final long EXT3_FEATURE_INCOMPAT_JOURNAL_DEV = 0x0008; public static final long EXT2_FEATURE_INCOMPAT_META_BG = 0x0010; + public static final long EXT4_FEATURE_INCOMPAT_EXTENTS = 0x0040; + public static final long EXT4_FEATURE_INCOMPAT_64BIT = 0x0080; + public static final long EXT4_FEATURE_INCOMPAT_MMP = 0x0100; + public static final long EXT4_FEATURE_INCOMPAT_FLEX_BG = 0X0200; // constants specific to this (JNode) implementation /** Modified: trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystem.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystem.java 2012-08-10 06:19:44 UTC (rev 5907) +++ trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystem.java 2012-08-10 06:29:21 UTC (rev 5908) @@ -24,7 +24,6 @@ import java.nio.ByteBuffer; import java.text.SimpleDateFormat; import java.util.Date; - import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.jnode.driver.Device; @@ -119,16 +118,28 @@ // at all) if (hasIncompatFeature(Ext2Constants.EXT2_FEATURE_INCOMPAT_COMPRESSION)) throw new FileSystemException(getDevice().getId() + - " Unsupported filesystem feature (COMPRESSION) disallows mounting"); + " Unsupported filesystem feature (COMPRESSION) disallows mounting"); if (hasIncompatFeature(Ext2Constants.EXT2_FEATURE_INCOMPAT_META_BG)) throw new FileSystemException(getDevice().getId() + - " Unsupported filesystem feature (META_BG) disallows mounting"); + " Unsupported filesystem feature (META_BG) disallows mounting"); if (hasIncompatFeature(Ext2Constants.EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) throw new FileSystemException(getDevice().getId() + - " Unsupported filesystem feature (JOURNAL_DEV) disallows mounting"); - if (hasIncompatFeature(Ext2Constants.EXT3_FEATURE_INCOMPAT_RECOVER)) + " Unsupported filesystem feature (JOURNAL_DEV) disallows mounting"); +// if (hasIncompatFeature(Ext2Constants.EXT3_FEATURE_INCOMPAT_RECOVER)) +// throw new FileSystemException(getDevice().getId() + +// " Unsupported filesystem feature (RECOVER) disallows mounting"); +// if (hasIncompatFeature(Ext2Constants.EXT4_FEATURE_INCOMPAT_EXTENTS)) +// throw new FileSystemException(getDevice().getId() + +// " Unsupported filesystem feature (EXTENTS) disallows mounting"); + if (hasIncompatFeature(Ext2Constants.EXT4_FEATURE_INCOMPAT_64BIT)) throw new FileSystemException(getDevice().getId() + - " Unsupported filesystem feature (RECOVER) disallows mounting"); + " Unsupported filesystem feature (64BIT) disallows mounting"); + if (hasIncompatFeature(Ext2Constants.EXT4_FEATURE_INCOMPAT_MMP)) + throw new FileSystemException(getDevice().getId() + + " Unsupported filesystem feature (MMP) disallows mounting"); + if (hasIncompatFeature(Ext2Constants.EXT4_FEATURE_INCOMPAT_FLEX_BG)) + throw new FileSystemException(getDevice().getId() + + " Unsupported filesystem feature (FLEX_BG) disallows mounting"); // an unsupported RO_COMPAT feature means that the filesystem can only // be mounted readonly @@ -140,6 +151,22 @@ log.info(getDevice().getId() + " Unsupported filesystem feature (BTREE_DIR) forces readonly mode"); setReadOnly(true); } + if (hasROFeature(Ext2Constants.EXT4_FEATURE_ROCOMPAT_HUGE_FILE)) { + log.info(getDevice().getId() + " Unsupported filesystem feature (HUGE_FILE) forces readonly mode"); + setReadOnly(true); + } + if (hasROFeature(Ext2Constants.EXT4_FEATURE_ROCOMPAT_GDT_CSUM)) { + log.info(getDevice().getId() + " Unsupported filesystem feature (GDT_CSUM) forces readonly mode"); + setReadOnly(true); + } + if (hasROFeature(Ext2Constants.EXT4_FEATURE_ROCOMPAT_DIR_NLINK)) { + log.info(getDevice().getId() + " Unsupported filesystem feature (DIR_NLINK) forces readonly mode"); + setReadOnly(true); + } + if (hasROFeature(Ext2Constants.EXT4_FEATURE_ROCOMPAT_EXTRA_ISIZE)) { + log.info(getDevice().getId() + " Unsupported filesystem feature (EXTRA_ISIZE) forces readonly mode"); + setReadOnly(true); + } // if the filesystem has not been cleanly unmounted, mount it readonly if (superblock.getState() == Ext2Constants.EXT2_ERROR_FS) { 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