El vie, 04-07-2008 a las 16:21 +0200, Robert Millan escribió:
> If you wish to send a patch for the user environment check you proposed,
> could send it separately?  I'm inclined to commit the flag check, but not
> the environment stuff.
Ok, here is the old version of the patch without the user override
thingy (and the extents reference removed).

> 
> Afterwards if you like we could discuss about whether we should be
> "best-effort" in real GRUB or not.  It's really not such a big deal,
> as long as we don't end up cluttering the user interface because of it.
By the way, it's true that UI should be carefully thought of and we
should exercise great care not to end like GRUB Legacy with its quirks
and such, but... this is a bootloader, not Mac OS X! Even though it
should have simple paths, it's supposed to be complex (within reason)

> 
> On Fri, Jul 04, 2008 at 03:32:43AM +0200, Javier Martín wrote:
> > -  grub_error (GRUB_ERR_BAD_FS, "not an ext2 filesystem");
> > +  grub_error (GRUB_ERR_BAD_FS, "not an ext2 filesystem, or incompatible"
> > +                               "features enabled (extents, etc.)");
> 
> I would avoid referring explicitly to the features involved, because it
> means the message will end up being obsolete when extents are supported
> (and we will likely forget to update it).
> 
True - parenthesized part removed form the patch.

By the way, I'm already using SVN (and thus svn diff) for this patch. Is
that right? Was the migration completed already?
Index: fs/ext2.c
===================================================================
--- fs/ext2.c	(revisión: 1687)
+++ fs/ext2.c	(copia de trabajo)
@@ -71,8 +71,39 @@
          ? EXT2_GOOD_OLD_INODE_SIZE \
          : grub_le_to_cpu16 (data->sblock.inode_size))
 
-#define EXT3_FEATURE_COMPAT_HAS_JOURNAL	0x0004
+/* Superblock filesystem feature flags (RW compatible) */
+#define EXT2_FEATURE_COMPAT_DIR_PREALLOC	0x0001
+#define EXT2_FEATURE_COMPAT_IMAGIC_INODES	0x0002
+#define EXT3_FEATURE_COMPAT_HAS_JOURNAL		0x0004
+#define EXT2_FEATURE_COMPAT_EXT_ATTR		0x0008
+#define EXT2_FEATURE_COMPAT_RESIZE_INODE	0x0010
+#define EXT2_FEATURE_COMPAT_DIR_INDEX		0x0020
+/* Superblock filesystem feature flags (RO compatible) */
+#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER	0x0001
+#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE	0x0002
+#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR	0x0004
+#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM		0x0010
+#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK	0x0020
+#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE	0x0040
+/* Superblock filesystem feature flags (back-incompatible) */
+#define EXT2_FEATURE_INCOMPAT_COMPRESSION	0x0001
+#define EXT2_FEATURE_INCOMPAT_FILETYPE		0x0002
+#define EXT3_FEATURE_INCOMPAT_RECOVER		0x0004 /* Needs recovery */
+#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV	0x0008 /* Journal device */
+#define EXT2_FEATURE_INCOMPAT_META_BG		0x0010
+#define EXT4_FEATURE_INCOMPAT_EXTENTS		0x0040 /* extents support */
+#define EXT4_FEATURE_INCOMPAT_64BIT		0x0080
+#define EXT4_FEATURE_INCOMPAT_FLEX_BG		0x0200
 
+/* The set of back-incompatible features this driver DOES support. Add (OR)
+ * flags here as the related features are implemented into the driver */
+#define EXT2_DRIVER_SUPPORTED_INCOMPAT ( EXT2_FEATURE_INCOMPAT_FILETYPE )
+/* The set of back-incompatible features this driver DOES NOT support but are
+ * ignored for some hackish reason. Flags here should be here _temporarily_!
+ * Remember that INCOMPAT_* features are so for a reason! */
+#define EXT2_DRIVER_IGNORED_INCOMPAT ( EXT3_FEATURE_INCOMPAT_RECOVER )
+
+
 #define EXT3_JOURNAL_MAGIC_NUMBER	0xc03b3998U
 
 #define EXT3_JOURNAL_DESCRIPTOR_BLOCK	1
@@ -394,6 +425,12 @@
   if (grub_le_to_cpu16 (data->sblock.magic) != EXT2_MAGIC)
     goto fail;
   
+  /* Check the FS doesn't have feature bits enabled that we don't support. */
+  if (grub_le_to_cpu32 (data->sblock.feature_incompat)
+        & ~(EXT2_DRIVER_SUPPORTED_INCOMPAT | EXT2_DRIVER_IGNORED_INCOMPAT))
+    goto fail;
+    
+  
   data->disk = disk;
 
   data->diropen.data = data;
@@ -409,7 +446,8 @@
   return data;
 
  fail:
-  grub_error (GRUB_ERR_BAD_FS, "not an ext2 filesystem");
+  grub_error (GRUB_ERR_BAD_FS, "not an ext2 filesystem, or incompatible"
+                               "features enabled");
   grub_free (data);
   return 0;
 }

Attachment: signature.asc
Description: Esta parte del mensaje está firmada digitalmente

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to