Hello,

New version with various fixes and suggestions from ML and IRC.
03_transparentio_indent.diff contains indetation fixes only not to blackout 
04_transparentio.diff.

This patch depends on 02_fileseek.diff from previous post.
Commenst and testing are welcome.

TODO:
disable filters where necessary

-- 
Szymon K. Janc
szy...@janc.net.pl // GG: 1383435
=== modified file 'io/bufio.c'
--- io/bufio.c	2008-08-01 04:06:55 +0000
+++ io/bufio.c	2010-04-06 19:53:03 +0000
@@ -45,7 +45,7 @@
   grub_bufio_t bufio = 0;
 
   file = (grub_file_t) grub_malloc (sizeof (*file));
-  if (! file)
+  if (!file)
     return 0;
 
   if (size == 0)
@@ -55,10 +55,10 @@
 
   if ((size < 0) || ((unsigned) size > io->size))
     size = ((io->size > GRUB_BUFIO_MAX_SIZE) ? GRUB_BUFIO_MAX_SIZE :
-            io->size);
+	    io->size);
 
   bufio = grub_malloc (sizeof (struct grub_bufio) + size);
-  if (! bufio)
+  if (!bufio)
     {
       grub_free (file);
       return 0;
@@ -84,11 +84,11 @@
   grub_file_t io, file;
 
   io = grub_file_open (name);
-  if (! io)
+  if (!io)
     return 0;
 
   file = grub_bufio_open (io, size);
-  if (! file)
+  if (!file)
     {
       grub_file_close (io);
       return 0;
@@ -112,12 +112,12 @@
       pos = file->offset - bufio->file->offset;
       n = bufio->buffer_len - pos;
       if (n > len)
-        n = len;
+	n = len;
 
       grub_memcpy (buf, &bufio->buffer[pos], n);
       len -= n;
-      if (! len)
-        return res;
+      if (!len)
+	return res;
 
       buf += n;
       bufio->file->offset += bufio->buffer_len;
@@ -126,45 +126,45 @@
   else
     {
       bufio->file->offset = grub_divmod64 (file->offset, bufio->block_size,
-                                           &pos);
+					   &pos);
       bufio->file->offset *= bufio->block_size;
     }
 
   if (pos + len >= bufio->block_size)
     {
       if (pos)
-        {
-          grub_size_t n;
-
-          bufio->file->fs->read (bufio->file, bufio->buffer,
-                                 bufio->block_size);
-          if (grub_errno)
-            return -1;
-
-          n = bufio->block_size - pos;
-          grub_memcpy (buf, &bufio->buffer[pos], n);
-          len -= n;
-          buf += n;
-          bufio->file->offset += bufio->block_size;
-          pos = 0;
-        }
+	{
+	  grub_size_t n;
+
+	  bufio->file->fs->read (bufio->file, bufio->buffer,
+				 bufio->block_size);
+	  if (grub_errno)
+	    return -1;
+
+	  n = bufio->block_size - pos;
+	  grub_memcpy (buf, &bufio->buffer[pos], n);
+	  len -= n;
+	  buf += n;
+	  bufio->file->offset += bufio->block_size;
+	  pos = 0;
+	}
 
       while (len >= bufio->block_size)
-        {
-          bufio->file->fs->read (bufio->file, buf, bufio->block_size);
-          if (grub_errno)
-            return -1;
-
-          len -= bufio->block_size;
-          buf += bufio->block_size;
-          bufio->file->offset += bufio->block_size;
-        }
-
-      if (! len)
-        {
-          bufio->buffer_len = 0;
-          return res;
-        }
+	{
+	  bufio->file->fs->read (bufio->file, buf, bufio->block_size);
+	  if (grub_errno)
+	    return -1;
+
+	  len -= bufio->block_size;
+	  buf += bufio->block_size;
+	  bufio->file->offset += bufio->block_size;
+	}
+
+      if (!len)
+	{
+	  bufio->buffer_len = 0;
+	  return res;
+	}
     }
 
   bufio->buffer_len = bufio->file->size - bufio->file->offset;
@@ -193,13 +193,12 @@
   return grub_errno;
 }
 
-static struct grub_fs grub_bufio_fs =
-  {
-    .name = "bufio",
-    .dir = 0,
-    .open = 0,
-    .read = grub_bufio_read,
-    .close = grub_bufio_close,
-    .label = 0,
-    .next = 0
-  };
+static struct grub_fs grub_bufio_fs = {
+  .name = "bufio",
+  .dir = 0,
+  .open = 0,
+  .read = grub_bufio_read,
+  .close = grub_bufio_close,
+  .label = 0,
+  .next = 0
+};

=== modified file 'commands/acpi.c'
--- commands/acpi.c	2010-01-05 21:04:15 +0000
+++ commands/acpi.c	2010-03-28 22:10:27 +0000
@@ -23,7 +23,6 @@
 #include <grub/disk.h>
 #include <grub/term.h>
 #include <grub/misc.h>
-#include <grub/gzio.h>
 #include <grub/acpi.h>
 #include <grub/mm.h>
 #include <grub/machine/memory.h>
@@ -627,7 +626,7 @@
       grub_size_t size;
       char *buf;
 
-      file = grub_gzfile_open (args[i], 1);
+      file = grub_file_open (args[i]);
       if (! file)
 	{
 	  free_tables ();

=== modified file 'commands/cat.c'
--- commands/cat.c	2010-03-01 19:24:34 +0000
+++ commands/cat.c	2010-04-01 19:38:09 +0000
@@ -22,7 +22,6 @@
 #include <grub/disk.h>
 #include <grub/term.h>
 #include <grub/misc.h>
-#include <grub/gzio.h>
 #include <grub/command.h>
 #include <grub/i18n.h>
 
@@ -39,7 +38,7 @@
   if (argc != 1)
     return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
 
-  file = grub_gzfile_open (args[0], 1);
+  file = grub_file_open (args[0]);
   if (! file)
     return grub_errno;
 

=== modified file 'commands/cmp.c'
--- commands/cmp.c	2010-01-03 22:05:07 +0000
+++ commands/cmp.c	2010-03-28 22:12:09 +0000
@@ -21,7 +21,6 @@
 #include <grub/misc.h>
 #include <grub/file.h>
 #include <grub/mm.h>
-#include <grub/gzio.h>
 #include <grub/command.h>
 #include <grub/i18n.h>
 
@@ -44,8 +43,8 @@
   grub_printf ("Compare file `%s' with `%s':\n", args[0],
 	       args[1]);
 
-  file1 = grub_gzfile_open (args[0], 1);
-  file2 = grub_gzfile_open (args[1], 1);
+  file1 = grub_file_open (args[0]);
+  file2 = grub_file_open (args[1]);
   if (! file1 || ! file2)
     goto cleanup;
 

=== modified file 'commands/hexdump.c'
--- commands/hexdump.c	2010-01-03 22:05:07 +0000
+++ commands/hexdump.c	2010-03-29 23:06:23 +0000
@@ -21,7 +21,6 @@
 #include <grub/file.h>
 #include <grub/disk.h>
 #include <grub/misc.h>
-#include <grub/gzio.h>
 #include <grub/lib/hexdump.h>
 #include <grub/extcmd.h>
 #include <grub/i18n.h>
@@ -89,7 +88,8 @@
     {
       grub_file_t file;
 
-      file = grub_gzfile_open (args[0], 1);
+      grub_io_filter_disable_all();
+      file = grub_file_open (args[0]);
       if (! file)
 	return 0;
 

=== modified file 'gettext/gettext.c'
--- gettext/gettext.c	2010-03-05 14:30:44 +0000
+++ gettext/gettext.c	2010-03-28 22:13:09 +0000
@@ -26,7 +26,6 @@
 #include <grub/normal.h>
 #include <grub/file.h>
 #include <grub/kernel.h>
-#include <grub/gzio.h>
 #include <grub/i18n.h>
 
 /*
@@ -229,7 +228,7 @@
   /* Using fd_mo and not another variable because
      it's needed for grub_gettext_get_info.  */
 
-  fd_mo = grub_gzfile_open (filename, 1);
+  fd_mo = grub_file_open (filename);
   grub_errno = GRUB_ERR_NONE;
 
   if (!fd_mo)

=== modified file 'include/grub/err.h'
--- include/grub/err.h	2010-02-06 23:46:09 +0000
+++ include/grub/err.h	2010-03-28 20:36:54 +0000
@@ -50,7 +50,7 @@
     GRUB_ERR_BAD_FONT,
     GRUB_ERR_NOT_IMPLEMENTED_YET,
     GRUB_ERR_SYMLINK_LOOP,
-    GRUB_ERR_BAD_GZIP_DATA,
+    GRUB_ERR_BAD_IOFILTER_DATA,
     GRUB_ERR_MENU,
     GRUB_ERR_TIMEOUT,
     GRUB_ERR_IO,

=== modified file 'include/grub/file.h'
--- include/grub/file.h	2010-03-21 23:51:44 +0000
+++ include/grub/file.h	2010-04-01 21:27:23 +0000
@@ -23,6 +23,7 @@
 #include <grub/err.h>
 #include <grub/device.h>
 #include <grub/fs.h>
+#include <grub/list.h>
 
 /* File description.  */
 struct grub_file
@@ -51,6 +52,40 @@
 };
 typedef struct grub_file *grub_file_t;
 
+/* IO filter priorities.  */
+typedef enum
+{
+  GRUB_IOFILTER_PRIO_GZIO = 0
+}
+grub_io_filter_prio_t;
+
+/* The io filter structure.  */
+struct grub_io_filter
+{
+  struct grub_io_filter *next;
+  char *name;
+  grub_io_filter_prio_t prio;
+  int active;
+    grub_file_t (*grub_io_open) (grub_file_t file);
+};
+typedef struct grub_io_filter *grub_io_filter_t;
+
+/* Register io filter.  */
+static inline void
+grub_io_register (grub_io_filter_t filter);
+
+/* Unregister io filter.  */
+static inline void
+grub_io_unregister (grub_io_filter_t filter);
+
+/* Disable selected filter for next opened file.  */
+static inline void
+grub_io_filter_disable (char *filter_name);
+
+/* Disable all filters for next opened file.  */
+static inline void
+grub_io_filter_disable_all (void);
+
 /* Get a device name from NAME.  */
 char *EXPORT_FUNC (grub_file_get_device_name) (const char *name);
 
@@ -78,4 +113,67 @@
   return !file->not_easly_seekable;
 }
 
+static inline int
+disable_filter (grub_list_t item)
+{
+  grub_io_filter_t filter = (grub_io_filter_t) item;
+  filter->active = 0;
+  return 0;
+}
+
+static inline int
+enable_filter (grub_list_t item)
+{
+  grub_io_filter_t filter = (grub_io_filter_t) item;
+  filter->active = 1;
+  return 0;
+}
+
+static inline int
+is_filter_enabled (grub_list_t item)
+{
+  grub_io_filter_t filter = (grub_io_filter_t) item;
+  return filter->active;
+}
+
+extern grub_io_filter_t EXPORT_VAR(grub_io_filter_list);
+
+static inline void
+grub_io_register (grub_io_filter_t filter)
+{
+  auto inline int test (grub_list_t new_item, grub_list_t item);
+  inline int test (grub_list_t new_item, grub_list_t item)
+  {
+    grub_io_filter_t new = (grub_io_filter_t) new_item;
+    grub_io_filter_t current = (grub_io_filter_t) item;
+    return (new->prio >= current->prio);
+  }
+
+  grub_list_insert (GRUB_AS_LIST_P (&grub_io_filter_list),
+                    GRUB_AS_LIST (filter), test);
+}
+
+static inline void
+grub_io_unregister (grub_io_filter_t filter)
+{
+  grub_list_remove (GRUB_AS_LIST_P (&grub_io_filter_list),
+                    GRUB_AS_LIST (filter));
+}
+
+static inline void
+grub_io_filter_disable (char *filter_name)
+{
+  grub_io_filter_t filter;
+  filter = grub_named_list_find (GRUB_AS_NAMED_LIST (grub_io_filter_list),
+                                 filter_name);
+  if (!filter)
+    disable_filter (GRUB_AS_LIST (filter));
+}
+
+static inline void
+grub_io_filter_disable_all (void)
+{
+  grub_list_iterate (GRUB_AS_LIST (grub_io_filter_list), disable_filter);
+}
+
 #endif /* ! GRUB_FILE_HEADER */

=== removed file 'include/grub/gzio.h'
--- include/grub/gzio.h	2007-07-21 23:32:33 +0000
+++ include/grub/gzio.h	1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
-/* gzio.h - prototypes for gzio */
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2007  Free Software Foundation, Inc.
- *
- *  GRUB is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_GZIO_H
-#define GRUB_GZIO_H	1
-
-#include <grub/file.h>
-
-grub_file_t grub_gzio_open (grub_file_t io, int transparent);
-grub_file_t grub_gzfile_open (const char *name, int transparent);
-
-#endif /* ! GRUB_GZIO_H */

=== modified file 'io/bufio.c'
--- io/bufio.c	2010-04-06 19:54:08 +0000
+++ io/bufio.c	2010-04-06 20:15:15 +0000
@@ -83,6 +83,7 @@
 {
   grub_file_t io, file;
 
+  grub_io_filter_disable_all ();
   io = grub_file_open (name);
   if (!io)
     return 0;
@@ -94,6 +95,8 @@
       return 0;
     }
 
+
+
   return file;
 }
 

=== modified file 'io/gzio.c'
--- io/gzio.c	2010-03-21 23:51:44 +0000
+++ io/gzio.c	2010-04-01 21:16:31 +0000
@@ -40,7 +40,7 @@
 #include <grub/misc.h>
 #include <grub/fs.h>
 #include <grub/file.h>
-#include <grub/gzio.h>
+#include <grub/dl.h>
 
 /*
  *  Window Size
@@ -175,7 +175,7 @@
   } hdr;
 
   grub_uint16_t extra_len;
-  grub_uint32_t orig_len;
+  grub_uint32_t orig_len = (grub_uint32_t) (-1);
   grub_gzio_t gzio = file->data;
 
   if (grub_file_tell (gzio->file) != 0)
@@ -207,7 +207,7 @@
       || ((hdr.flags & ORIG_NAME) && eat_field (gzio->file, -1))
       || ((hdr.flags & COMMENT) && eat_field (gzio->file, -1)))
     {
-      grub_error (GRUB_ERR_BAD_GZIP_DATA, "unsupported gzip format");
+      grub_error (GRUB_ERR_BAD_IOFILTER_DATA, "unsupported gzip format");
       return 0;
     }
 
@@ -219,7 +219,7 @@
     {
       if (grub_file_read (gzio->file, &orig_len, 4) != 4)
 	{
-	  grub_error (GRUB_ERR_BAD_FILE_TYPE, "unsupported gzip format");
+	  grub_error (GRUB_ERR_BAD_IOFILTER_DATA, "unsupported gzip format");
 	  return 0;
 	}
     }
@@ -651,7 +651,7 @@
 	      {
 		if (e == 99)
 		  {
-		    grub_error (GRUB_ERR_BAD_GZIP_DATA,
+		    grub_error (GRUB_ERR_BAD_IOFILTER_DATA,
 				"an unused code found");
 		    return 1;
 		  }
@@ -691,7 +691,7 @@
 		  {
 		    if (e == 99)
 		      {
-			grub_error (GRUB_ERR_BAD_GZIP_DATA,
+			grub_error (GRUB_ERR_BAD_IOFILTER_DATA,
 				    "an unused code found");
 			return 1;
 		      }
@@ -777,7 +777,7 @@
   DUMPBITS (16);
   NEEDBITS (16);
   if (gzio->block_len != (int) ((~b) & 0xffff))
-    grub_error (GRUB_ERR_BAD_GZIP_DATA,
+    grub_error (GRUB_ERR_BAD_IOFILTER_DATA,
 		"the length of a stored block does not match");
   DUMPBITS (16);
 
@@ -811,7 +811,7 @@
   if (huft_build (l, 288, 257, cplens, cplext, &gzio->tl, &gzio->bl) != 0)
     {
       if (grub_errno == GRUB_ERR_NONE)
-	grub_error (GRUB_ERR_BAD_GZIP_DATA,
+	grub_error (GRUB_ERR_BAD_IOFILTER_DATA,
 		    "failed in building a Huffman code table");
       return;
     }
@@ -823,7 +823,7 @@
   if (huft_build (l, 30, 0, cpdist, cpdext, &gzio->td, &gzio->bd) > 1)
     {
       if (grub_errno == GRUB_ERR_NONE)
-	grub_error (GRUB_ERR_BAD_GZIP_DATA,
+	grub_error (GRUB_ERR_BAD_IOFILTER_DATA,
 		    "failed in building a Huffman code table");
       huft_free (gzio->tl);
       gzio->tl = 0;
@@ -870,7 +870,7 @@
   DUMPBITS (4);
   if (nl > 286 || nd > 30)
     {
-      grub_error (GRUB_ERR_BAD_GZIP_DATA, "too much data");
+      grub_error (GRUB_ERR_BAD_IOFILTER_DATA, "too much data");
       return;
     }
 
@@ -888,7 +888,7 @@
   gzio->bl = 7;
   if (huft_build (ll, 19, 19, NULL, NULL, &gzio->tl, &gzio->bl) != 0)
     {
-      grub_error (GRUB_ERR_BAD_GZIP_DATA,
+      grub_error (GRUB_ERR_BAD_IOFILTER_DATA,
 		  "failed in building a Huffman code table");
       return;
     }
@@ -912,7 +912,7 @@
 	  DUMPBITS (2);
 	  if ((unsigned) i + j > n)
 	    {
-	      grub_error (GRUB_ERR_BAD_GZIP_DATA, "too many codes found");
+	      grub_error (GRUB_ERR_BAD_IOFILTER_DATA, "too many codes found");
 	      return;
 	    }
 	  while (j--)
@@ -925,7 +925,7 @@
 	  DUMPBITS (3);
 	  if ((unsigned) i + j > n)
 	    {
-	      grub_error (GRUB_ERR_BAD_GZIP_DATA, "too many codes found");
+	      grub_error (GRUB_ERR_BAD_IOFILTER_DATA, "too many codes found");
 	      return;
 	    }
 	  while (j--)
@@ -940,7 +940,7 @@
 	  DUMPBITS (7);
 	  if ((unsigned) i + j > n)
 	    {
-	      grub_error (GRUB_ERR_BAD_GZIP_DATA, "too many codes found");
+	      grub_error (GRUB_ERR_BAD_IOFILTER_DATA, "too many codes found");
 	      return;
 	    }
 	  while (j--)
@@ -962,7 +962,7 @@
   gzio->bl = lbits;
   if (huft_build (ll, nl, 257, cplens, cplext, &gzio->tl, &gzio->bl) != 0)
     {
-      grub_error (GRUB_ERR_BAD_GZIP_DATA,
+      grub_error (GRUB_ERR_BAD_IOFILTER_DATA,
 		  "failed in building a Huffman code table");
       return;
     }
@@ -971,7 +971,7 @@
     {
       huft_free (gzio->tl);
       gzio->tl = 0;
-      grub_error (GRUB_ERR_BAD_GZIP_DATA,
+      grub_error (GRUB_ERR_BAD_IOFILTER_DATA,
 		  "failed in building a Huffman code table");
       return;
     }
@@ -1047,7 +1047,7 @@
 	}
 
       if (gzio->block_type > INFLATE_DYNAMIC)
-	grub_error (GRUB_ERR_BAD_GZIP_DATA,
+	grub_error (GRUB_ERR_BAD_IOFILTER_DATA,
 		    "unknown block type %d", gzio->block_type);
 
       if (grub_errno != GRUB_ERR_NONE)
@@ -1119,8 +1119,8 @@
 /* Open a new decompressing object on the top of IO. If TRANSPARENT is true,
    even if IO does not contain data compressed by gzip, return a valid file
    object. Note that this function won't close IO, even if an error occurs.  */
-grub_file_t
-grub_gzio_open (grub_file_t io, int transparent)
+static grub_file_t
+grub_gzio_open (grub_file_t io)
 {
   grub_file_t file;
   grub_gzio_t gzio = 0;
@@ -1151,32 +1151,6 @@
       grub_free (file);
       grub_file_seek (io, 0);
 
-      if (grub_errno == GRUB_ERR_BAD_FILE_TYPE && transparent)
-	{
-	  grub_errno = GRUB_ERR_NONE;
-	  return io;
-	}
-      else
-	return 0;
-    }
-
-  return file;
-}
-
-/* This is similar to grub_gzio_open, but takes a file name as an argument.  */
-grub_file_t
-grub_gzfile_open (const char *name, int transparent)
-{
-  grub_file_t io, file;
-
-  io = grub_file_open (name);
-  if (!io)
-    return 0;
-
-  file = grub_gzio_open (io, transparent);
-  if (!file)
-    {
-      grub_file_close (io);
       return 0;
     }
 
@@ -1246,7 +1220,6 @@
   return grub_errno;
 }
 
-
 static struct grub_fs grub_gzio_fs = {
   .name = "gzio",
   .dir = 0,
@@ -1256,3 +1229,22 @@
   .label = 0,
   .next = 0
 };
+
+static struct grub_io_filter grub_gzio_filter = {
+  .next = 0,
+  .name = "gzio",
+  .prio = GRUB_IOFILTER_PRIO_GZIO,
+  .active = 1,
+  .grub_io_open = grub_gzio_open
+};
+
+
+GRUB_MOD_INIT (gzio)
+{
+  grub_io_register (&grub_gzio_filter);
+}
+
+GRUB_MOD_FINI (gzio)
+{
+  grub_io_unregister (&grub_gzio_filter);
+}

=== modified file 'kern/elf.c'
--- kern/elf.c	2010-01-20 20:31:39 +0000
+++ kern/elf.c	2010-03-28 22:12:48 +0000
@@ -21,7 +21,6 @@
 #include <grub/elf.h>
 #include <grub/elfload.h>
 #include <grub/file.h>
-#include <grub/gzio.h>
 #include <grub/misc.h>
 #include <grub/mm.h>
 
@@ -95,7 +94,7 @@
   grub_file_t file;
   grub_elf_t elf;
 
-  file = grub_gzfile_open (name, 1);
+  file = grub_file_open (name);
   if (! file)
     return 0;
 

=== modified file 'kern/file.c'
--- kern/file.c	2010-03-31 20:47:14 +0000
+++ kern/file.c	2010-04-06 20:07:41 +0000
@@ -23,6 +23,10 @@
 #include <grub/mm.h>
 #include <grub/fs.h>
 #include <grub/device.h>
+#include <grub/list.h>
+
+/* Registered filters list.  */
+grub_io_filter_t grub_io_filter_list = NULL;
 
 /* Get the device part of the filename NAME. It is enclosed by parentheses.  */
 char *
@@ -51,6 +55,41 @@
   return 0;
 }
 
+static grub_file_t
+grub_check_filters (grub_file_t file)
+{
+  if (!file)
+    return 0;
+
+  grub_file_t ffile;
+  grub_io_filter_t filter;
+
+  auto inline int checkfilter (grub_list_t item);
+  inline int checkfilter (grub_list_t item)
+  {
+    if (is_filter_enabled (item))
+      {
+	filter = (grub_io_filter_t) item;
+	ffile = filter->grub_io_open (file);
+	if (ffile || grub_errno != GRUB_ERR_BAD_FILE_TYPE)
+	  return 1;
+      }
+    else
+	enable_filter (item);
+
+    return 0;
+  }
+
+  if (grub_list_iterate (GRUB_AS_LIST (grub_io_filter_list), checkfilter)
+      && grub_errno == GRUB_ERR_NONE)
+      return ffile;
+
+  if (grub_errno == GRUB_ERR_BAD_FILE_TYPE)
+      grub_errno = GRUB_ERR_NONE;
+
+  return 0;
+}
+
 grub_file_t
 grub_file_open (const char *name)
 {
@@ -94,7 +133,14 @@
   if ((file->fs->open) (file, file_name) != GRUB_ERR_NONE)
     goto fail;
 
-  return file;
+  /* Check available filters.  */
+   grub_file_t ffile = grub_check_filters (file);
+
+  if (ffile)
+    return ffile;
+
+  if (grub_errno == GRUB_ERR_NONE)
+    return file;
 
 fail:
   if (device)

=== modified file 'loader/i386/bsd.c'
--- loader/i386/bsd.c	2010-03-26 14:44:13 +0000
+++ loader/i386/bsd.c	2010-04-06 19:30:02 +0000
@@ -30,7 +30,6 @@
 #include <grub/elfload.h>
 #include <grub/env.h>
 #include <grub/misc.h>
-#include <grub/gzio.h>
 #include <grub/aout.h>
 #include <grub/command.h>
 #include <grub/extcmd.h>
@@ -904,7 +903,7 @@
       goto fail;
     }
 
-  file = grub_gzfile_open (argv[0], 1);
+  file = grub_file_open (argv[0]);
   if (!file)
     goto fail;
 
@@ -970,7 +969,7 @@
 	  if (err)
 	    return err;
 
-	  file = grub_gzfile_open (argv[0], 1);
+	  file = grub_file_open (argv[0]);
 	  if (! file)
 	    return grub_errno;
 
@@ -1086,7 +1085,7 @@
       goto fail;
     }
 
-  file = grub_gzfile_open (argv[0], 1);
+  file = grub_file_open (argv[0]);
   if ((!file) || (!file->size))
     goto fail;
 
@@ -1191,7 +1190,7 @@
       return 0;
     }
 
-  file = grub_gzfile_open (argv[0], 1);
+  file = grub_file_open (argv[0]);
   if ((!file) || (!file->size))
     goto fail;
 
@@ -1257,7 +1256,7 @@
       return 0;
     }
 
-  file = grub_gzfile_open (argv[0], 1);
+  file = grub_file_open (argv[0]);
   if (!file)
     return grub_errno;
   if (!file->size)

=== modified file 'loader/i386/efi/linux.c'
--- loader/i386/efi/linux.c	2010-02-10 19:27:12 +0000
+++ loader/i386/efi/linux.c	2010-03-29 21:26:08 +0000
@@ -919,6 +919,7 @@
       goto fail;
     }
 
+  grub_io_filter_disable_all();
   file = grub_file_open (argv[0]);
   if (! file)
     goto fail;

=== modified file 'loader/i386/ieee1275/linux.c'
--- loader/i386/ieee1275/linux.c	2010-01-10 01:43:42 +0000
+++ loader/i386/ieee1275/linux.c	2010-03-29 21:33:47 +0000
@@ -274,6 +274,7 @@
       goto fail;
     }
 
+  grub_io_filter_disable_all();
   file = grub_file_open (argv[0]);
   if (! file)
     goto fail;

=== modified file 'loader/i386/linux.c'
--- loader/i386/linux.c	2010-02-10 19:27:12 +0000
+++ loader/i386/linux.c	2010-03-28 23:31:12 +0000
@@ -934,6 +934,7 @@
       goto fail;
     }
 
+  grub_io_filter_disable_all();
   file = grub_file_open (argv[0]);
   if (! file)
     goto fail;

=== modified file 'loader/i386/pc/linux.c'
--- loader/i386/pc/linux.c	2010-01-17 16:52:01 +0000
+++ loader/i386/pc/linux.c	2010-03-28 23:36:53 +0000
@@ -359,6 +359,7 @@
 
   addr_min = (grub_addr_t) grub_linux_tmp_addr + GRUB_LINUX_CL_END_OFFSET;
 
+  grub_io_filter_disable_all();
   file = grub_file_open (argv[0]);
   if (!file)
     goto fail;

=== modified file 'loader/i386/xnu.c'
--- loader/i386/xnu.c	2010-01-20 06:36:17 +0000
+++ loader/i386/xnu.c	2010-03-28 22:10:48 +0000
@@ -31,7 +31,6 @@
 #include <grub/charset.h>
 #include <grub/term.h>
 #include <grub/command.h>
-#include <grub/gzio.h>
 #include <grub/i18n.h>
 
 char grub_xnu_cmdline[1024];
@@ -530,7 +529,7 @@
   if (argc != 1)
     return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
 
-  file = grub_gzfile_open (args[0], 1);
+  file = grub_file_open (args[0]);
   if (! file)
     return grub_error (GRUB_ERR_FILE_NOT_FOUND,
 		       "couldn't load device-propertie dump");

=== modified file 'loader/macho.c'
--- loader/macho.c	2009-12-24 22:53:05 +0000
+++ loader/macho.c	2010-03-28 22:11:00 +0000
@@ -26,7 +26,6 @@
 #include <grub/cpu/macho.h>
 #include <grub/machoload.h>
 #include <grub/file.h>
-#include <grub/gzio.h>
 #include <grub/misc.h>
 #include <grub/mm.h>
 
@@ -149,7 +148,7 @@
   grub_file_t file;
   grub_macho_t macho;
 
-  file = grub_gzfile_open (name, 1);
+  file = grub_file_open (name);
   if (! file)
     return 0;
 

=== modified file 'loader/mips/linux.c'
--- loader/mips/linux.c	2010-01-24 21:04:29 +0000
+++ loader/mips/linux.c	2010-03-29 21:35:10 +0000
@@ -333,6 +333,7 @@
   if (initrd_loaded)
     return grub_error (GRUB_ERR_BAD_ARGUMENT, "only one initrd can be loaded.");
 
+  grub_io_filter_disable_all();
   file = grub_file_open (argv[0]);
   if (! file)
     return grub_errno;

=== modified file 'loader/multiboot.c'
--- loader/multiboot.c	2010-04-03 12:29:11 +0000
+++ loader/multiboot.c	2010-04-06 19:30:02 +0000
@@ -39,7 +39,6 @@
 #include <grub/dl.h>
 #include <grub/mm.h>
 #include <grub/misc.h>
-#include <grub/gzio.h>
 #include <grub/env.h>
 #include <grub/cpu/relocator.h>
 #include <grub/video.h>
@@ -247,7 +246,7 @@
   if (argc == 0)
     return grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
 
-  file = grub_gzfile_open (argv[0], 1);
+  file = grub_file_open (argv[0]);
   if (! file)
     return grub_error (GRUB_ERR_BAD_ARGUMENT, "couldn't open file");
 
@@ -297,7 +296,7 @@
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
 		       "you need to load the multiboot kernel first");
 
-  file = grub_gzfile_open (argv[0], 1);
+  file = grub_file_open (argv[0]);
   if (! file)
     return grub_errno;
 

=== modified file 'loader/powerpc/ieee1275/linux.c'
--- loader/powerpc/ieee1275/linux.c	2010-01-10 12:34:48 +0000
+++ loader/powerpc/ieee1275/linux.c	2010-03-29 21:36:20 +0000
@@ -302,6 +302,7 @@
       goto fail;
     }
 
+  grub_io_filter_disable_all();
   file = grub_file_open (argv[0]);
   if (! file)
     goto fail;

=== modified file 'loader/sparc64/ieee1275/linux.c'
--- loader/sparc64/ieee1275/linux.c	2010-02-14 13:32:21 +0000
+++ loader/sparc64/ieee1275/linux.c	2010-03-28 23:39:46 +0000
@@ -306,7 +306,7 @@
       goto out;
     }
 
-  file = grub_gzfile_open (argv[0], 1);
+  file = grub_file_open (argv[0]);
   if (!file)
     goto out;
 
@@ -394,6 +394,7 @@
       goto fail;
     }
 
+  grub_io_filter_disable_all();
   file = grub_file_open (argv[0]);
   if (! file)
     goto fail;

=== modified file 'loader/xnu.c'
--- loader/xnu.c	2010-02-07 03:23:44 +0000
+++ loader/xnu.c	2010-03-28 22:11:11 +0000
@@ -28,7 +28,6 @@
 #include <grub/machoload.h>
 #include <grub/macho.h>
 #include <grub/cpu/macho.h>
-#include <grub/gzio.h>
 #include <grub/command.h>
 #include <grub/misc.h>
 #include <grub/extcmd.h>
@@ -667,7 +666,7 @@
     macho = 0;
 
   if (infoplistname)
-    infoplist = grub_gzfile_open (infoplistname, 1);
+    infoplist = grub_file_open (infoplistname);
   else
     infoplist = 0;
   grub_errno = GRUB_ERR_NONE;
@@ -761,7 +760,7 @@
   if (! grub_xnu_heap_size)
     return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
 
-  file = grub_gzfile_open (args[0], 1);
+  file = grub_file_open (args[0]);
   if (! file)
     return grub_error (GRUB_ERR_FILE_NOT_FOUND,
 		       "couldn't load driver package");
@@ -873,7 +872,7 @@
   if (! grub_xnu_heap_size)
     return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
 
-  file = grub_gzfile_open (args[0], 1);
+  file = grub_file_open (args[0]);
   if (! file)
     return grub_error (GRUB_ERR_FILE_NOT_FOUND,
 		       "couldn't load ramdisk");
@@ -913,7 +912,7 @@
   if (binname)
     *binname = 0;
 
-  file = grub_gzfile_open (plistname, 1);
+  file = grub_file_open (plistname);
   if (! file)
     {
       grub_file_close (file);
@@ -1170,7 +1169,7 @@
 		grub_strcpy (binname + grub_strlen (binname), "/");
 	      grub_strcpy (binname + grub_strlen (binname), binsuffix);
 	      grub_dprintf ("xnu", "%s:%s\n", plistname, binname);
-	      binfile = grub_gzfile_open (binname, 1);
+	      binfile = grub_file_open (binname);
 	      if (! binfile)
 		grub_errno = GRUB_ERR_NONE;
 
@@ -1208,7 +1207,7 @@
       /* User explicitly specified plist and binary. */
       if (grub_strcmp (args[1], "-") != 0)
 	{
-	  binfile = grub_gzfile_open (args[1], 1);
+	  binfile = grub_file_open (args[1]);
 	  if (! binfile)
 	    {
 	      grub_error (GRUB_ERR_BAD_OS, "can't open file");

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

Reply via email to