* grub-core/io/gzio.c (grub_gzio_open): Removed "transparent" parameter.

Made static.
	(grub_gzfile_open): Removed. All users updated.
	(GRUB_MOD_INIT): New function.
	(GRUB_MOD_FINI): Likewise.
	* grub-core/kern/file.c (grub_file_filters_all): New variable.
	(grub_file_filters_enabled): Likewise.
	(grub_file_open): Handle filters.
	* grub-core/loader/i386/bsd.c (GRUB_MOD_INIT): Load gzio.
	* grub-core/normal/main.c (GRUB_MOD_INIT): Likewise.
	* include/grub/file.h (grub_file_filter_id_t): New type.
	(grub_file_filter_t): Likewise.
	(grub_file_filters_all): New extern variable.
	(grub_file_filters_enabled): Likewise.
	(grub_file_filter_register): New inline function.
	(grub_file_filter_unregister): Likewise.
	(grub_file_filter_disable): Likewise.
	(grub_file_filter_disable_compression): Likewise.
	* include/grub/gzio.h: Removed.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-05 13:05:36 +02:00
parent 35ee15e09a
commit fc2ef1172c
35 changed files with 165 additions and 98 deletions

View file

@ -1,3 +1,25 @@
2010-09-05 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/io/gzio.c (grub_gzio_open): Removed "transparent" parameter.
Made static.
(grub_gzfile_open): Removed. All users updated.
(GRUB_MOD_INIT): New function.
(GRUB_MOD_FINI): Likewise.
* grub-core/kern/file.c (grub_file_filters_all): New variable.
(grub_file_filters_enabled): Likewise.
(grub_file_open): Handle filters.
* grub-core/loader/i386/bsd.c (GRUB_MOD_INIT): Load gzio.
* grub-core/normal/main.c (GRUB_MOD_INIT): Likewise.
* include/grub/file.h (grub_file_filter_id_t): New type.
(grub_file_filter_t): Likewise.
(grub_file_filters_all): New extern variable.
(grub_file_filters_enabled): Likewise.
(grub_file_filter_register): New inline function.
(grub_file_filter_unregister): Likewise.
(grub_file_filter_disable): Likewise.
(grub_file_filter_disable_compression): Likewise.
* include/grub/gzio.h: Removed.
2010-09-04 BVK Chaitanya <bvk.groups@gmail.com>
Filename expansion support for wildcards in GRUB script.

View file

@ -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>
@ -628,7 +627,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
grub_size_t size;
char *buf;
file = grub_gzfile_open (args[i], 1);
file = grub_file_open (args[i]);
if (! file)
{
free_tables ();

View file

@ -82,6 +82,7 @@ grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
if (argc < 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
grub_file_filter_disable_compression ();
file = grub_file_open (args[0]);
if (! file)
return grub_errno;

View file

@ -22,7 +22,6 @@
#include <grub/disk.h>
#include <grub/term.h>
#include <grub/misc.h>
#include <grub/gzio.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
@ -48,7 +47,7 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
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;

View file

@ -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_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
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;

View file

@ -38,6 +38,7 @@ grub_cmd_crc (grub_command_t cmd __attribute__ ((unused)),
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
grub_file_filter_disable_compression ();
file = grub_file_open (args[0]);
if (! file)
return 0;

View file

@ -115,11 +115,15 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
filename = grub_xasprintf ("%s/%s", prefix, p);
if (!filename)
return grub_errno;
grub_file_filter_disable_compression ();
file = grub_file_open (filename);
grub_free (filename);
}
else
{
grub_file_filter_disable_compression ();
file = grub_file_open (p);
}
if (!file)
{
grub_file_close (hashlist);
@ -206,6 +210,7 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
grub_file_t file;
grub_err_t err;
unsigned j;
grub_file_filter_disable_compression ();
file = grub_file_open (args[i]);
if (!file)
{

View file

@ -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,7 @@ grub_cmd_hexdump (grub_extcmd_context_t ctxt, int argc, char **args)
{
grub_file_t file;
file = grub_gzfile_open (args[0], 1);
file = grub_file_open (args[0]);
if (! file)
return 0;

View file

@ -56,6 +56,7 @@ open_envblk_file (char *filename)
grub_strcpy (filename, prefix);
filename[len] = '/';
grub_strcpy (filename + len + 1, GRUB_ENVBLK_DEFCFG);
grub_file_filter_disable_compression ();
file = grub_file_open (filename);
grub_free (filename);
return file;
@ -67,6 +68,7 @@ open_envblk_file (char *filename)
}
}
grub_file_filter_disable_compression ();
return grub_file_open (filename);
}

View file

@ -105,6 +105,7 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
/* XXX: For ext2fs symlinks are detected as files while they
should be reported as directories. */
grub_file_filter_disable_compression ();
file = grub_file_open (pathname);
if (! file)
{
@ -211,6 +212,7 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
struct grub_dirhook_info info;
grub_errno = 0;
grub_file_filter_disable_compression ();
file = grub_file_open (dirname);
if (! file)
goto fail;

View file

@ -54,6 +54,7 @@ FUNC_NAME (const char *key, const char *var, int no_floppy)
if (! buf)
return 1;
grub_file_filter_disable_compression ();
file = grub_file_open (buf);
if (file)
{

View file

@ -334,6 +334,7 @@ test_parse (char **args, int *argn, int argc)
if (grub_strcmp (args[*argn], "-s") == 0)
{
grub_file_t file;
grub_file_filter_disable_compression ();
file = grub_file_open (args[*argn + 1]);
update_val (file && (grub_file_size (file) != 0));
if (file)

View file

@ -26,7 +26,6 @@
#include <grub/normal.h>
#include <grub/file.h>
#include <grub/kernel.h>
#include <grub/gzio.h>
#include <grub/i18n.h>
/*
@ -219,7 +218,7 @@ grub_gettext_translate (const char *orig)
return ret;
}
/* This is similar to grub_gzfile_open. */
/* This is similar to grub_file_open. */
static grub_file_t
grub_mofile_open (const char *filename)
{
@ -229,7 +228,7 @@ grub_mofile_open (const char *filename)
/* 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)

View file

@ -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
@ -1113,8 +1113,8 @@ initialize_tables (grub_file_t file)
/* 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;
@ -1145,33 +1145,11 @@ grub_gzio_open (grub_file_t io, int transparent)
grub_free (file);
grub_file_seek (io, 0);
if (grub_errno == GRUB_ERR_BAD_FILE_TYPE && transparent)
if (grub_errno == GRUB_ERR_BAD_FILE_TYPE)
{
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;
}
return file;
@ -1252,3 +1230,13 @@ static struct grub_fs grub_gzio_fs =
.label = 0,
.next = 0
};
GRUB_MOD_INIT(gzio)
{
grub_file_filter_register (GRUB_FILE_FILTER_GZIO, grub_gzio_open);
}
GRUB_MOD_FINI(gzio)
{
grub_file_filter_unregister (GRUB_FILE_FILTER_GZIO);
}

View file

@ -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_elf_open (const char *name)
grub_file_t file;
grub_elf_t elf;
file = grub_gzfile_open (name, 1);
file = grub_file_open (name);
if (! file)
return 0;

View file

@ -24,6 +24,9 @@
#include <grub/fs.h>
#include <grub/device.h>
grub_file_filter_t grub_file_filters_all[GRUB_FILE_FILTER_MAX];
grub_file_filter_t grub_file_filters_enabled[GRUB_FILE_FILTER_MAX];
/* Get the device part of the filename NAME. It is enclosed by parentheses. */
char *
grub_file_get_device_name (const char *name)
@ -54,14 +57,15 @@ grub_file_get_device_name (const char *name)
grub_file_t
grub_file_open (const char *name)
{
grub_device_t device;
grub_file_t file = 0;
grub_device_t device = 0;
grub_file_t file = 0, last_file = 0;
char *device_name;
char *file_name;
grub_file_filter_id_t filter;
device_name = grub_file_get_device_name (name);
if (grub_errno)
return 0;
goto fail;
/* Get the file part of NAME. */
file_name = grub_strchr (name, ')');
@ -94,6 +98,19 @@ grub_file_open (const char *name)
if ((file->fs->open) (file, file_name) != GRUB_ERR_NONE)
goto fail;
for (filter = 0; file && filter < ARRAY_SIZE (grub_file_filters_enabled);
filter++)
if (grub_file_filters_enabled[filter])
{
last_file = file;
file = grub_file_filters_enabled[filter] (file);
}
if (!file)
grub_file_close (last_file);
grub_memcpy (grub_file_filters_enabled, grub_file_filters_all,
sizeof (grub_file_filters_enabled));
return file;
fail:
@ -104,6 +121,9 @@ grub_file_open (const char *name)
grub_free (file);
grub_memcpy (grub_file_filters_enabled, grub_file_filters_all,
sizeof (grub_file_filters_enabled));
return 0;
}

View file

@ -28,7 +28,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>
@ -1326,7 +1325,7 @@ grub_bsd_load (int argc, char *argv[])
goto fail;
}
file = grub_gzfile_open (argv[0], 1);
file = grub_file_open (argv[0]);
if (!file)
goto fail;
@ -1396,7 +1395,7 @@ grub_cmd_freebsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
if (err)
return err;
file = grub_gzfile_open (argv[0], 1);
file = grub_file_open (argv[0]);
if (! file)
return grub_errno;
@ -1526,7 +1525,7 @@ grub_cmd_netbsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
{
grub_file_t file;
file = grub_gzfile_open (argv[0], 1);
file = grub_file_open (argv[0]);
if (! file)
return grub_errno;
@ -1630,7 +1629,7 @@ grub_cmd_freebsd_loadenv (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
file = grub_gzfile_open (argv[0], 1);
file = grub_file_open (argv[0]);
if ((!file) || (!file->size))
goto fail;
@ -1731,7 +1730,7 @@ grub_cmd_freebsd_module (grub_command_t cmd __attribute__ ((unused)),
return 0;
}
file = grub_gzfile_open (argv[0], 1);
file = grub_file_open (argv[0]);
if ((!file) || (!file->size))
goto fail;
@ -1782,7 +1781,7 @@ grub_netbsd_module_load (char *filename, grub_uint32_t type)
void *src;
grub_err_t err;
file = grub_gzfile_open (filename, 1);
file = grub_file_open (filename);
if ((!file) || (!file->size))
goto fail;
@ -1868,7 +1867,7 @@ grub_cmd_freebsd_module_elf (grub_command_t cmd __attribute__ ((unused)),
return 0;
}
file = grub_gzfile_open (argv[0], 1);
file = grub_file_open (argv[0]);
if (!file)
return grub_errno;
if (!file->size)
@ -1904,7 +1903,7 @@ grub_cmd_openbsd_ramdisk (grub_command_t cmd __attribute__ ((unused)),
if (!openbsd_ramdisk.max_size)
return grub_error (GRUB_ERR_BAD_OS, "your kOpenBSD doesn't support ramdisk");
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");
@ -1940,6 +1939,9 @@ static grub_command_t cmd_netbsd_module_elf, cmd_openbsd_ramdisk;
GRUB_MOD_INIT (bsd)
{
/* Net and OpenBSD kernels are often compressed. */
grub_dl_load ("gzio");
cmd_freebsd = grub_register_extcmd ("kfreebsd", grub_cmd_freebsd,
GRUB_COMMAND_FLAG_BOTH,
N_("FILE"), N_("Load kernel of FreeBSD."),

View file

@ -1069,6 +1069,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
grub_file_filter_disable_compression ();
file = grub_file_open (argv[0]);
if (! file)
goto fail;

View file

@ -69,6 +69,7 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags)
grub_dl_ref (my_mod);
grub_file_filter_disable_compression ();
file = grub_file_open (filename);
if (! file)
goto fail;

View file

@ -401,6 +401,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
addr_min = GRUB_LINUX_BZIMAGE_ADDR + grub_linux16_prot_size;
grub_file_filter_disable_compression ();
file = grub_file_open (argv[0]);
if (!file)
goto fail;

View file

@ -31,7 +31,6 @@
#include <grub/charset.h>
#include <grub/term.h>
#include <grub/command.h>
#include <grub/gzio.h>
#include <grub/i18n.h>
#include <grub/bitmap_scale.h>
@ -535,7 +534,7 @@ grub_cmd_devprop_load (grub_command_t cmd __attribute__ ((unused)),
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");

View file

@ -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_macho_open (const char *name)
grub_file_t file;
grub_macho_t macho;
file = grub_gzfile_open (name, 1);
file = grub_file_open (name);
if (! file)
return 0;

View file

@ -344,6 +344,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
if (initrd_loaded)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "only one initrd can be loaded.");
grub_file_filter_disable_compression ();
file = grub_file_open (argv[0]);
if (! file)
return grub_errno;

View file

@ -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>
@ -225,7 +224,7 @@ grub_cmd_multiboot (grub_command_t cmd __attribute__ ((unused)),
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");
@ -291,9 +290,9 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
"you need to load the multiboot kernel first");
if (nounzip)
grub_file_filter_disable_compression ();
file = grub_file_open (argv[0]);
else
file = grub_gzfile_open (argv[0], 1);
if (! file)
return grub_errno;

View file

@ -301,6 +301,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
grub_file_filter_disable_compression ();
file = grub_file_open (argv[0]);
if (! file)
goto fail;

View file

@ -305,7 +305,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
goto out;
}
file = grub_gzfile_open (argv[0], 1);
file = grub_file_open (argv[0]);
if (!file)
goto out;
@ -393,6 +393,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
grub_file_filter_disable_compression ();
file = grub_file_open (argv[0]);
if (! file)
goto fail;

View file

@ -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>
@ -661,7 +660,7 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile)
macho = 0;
if (infoplistname)
infoplist = grub_gzfile_open (infoplistname, 1);
infoplist = grub_file_open (infoplistname);
else
infoplist = 0;
grub_errno = GRUB_ERR_NONE;
@ -756,7 +755,7 @@ grub_cmd_xnu_mkext (grub_command_t cmd __attribute__ ((unused)),
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");
@ -869,7 +868,7 @@ grub_cmd_xnu_ramdisk (grub_command_t cmd __attribute__ ((unused)),
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");
@ -909,7 +908,7 @@ grub_xnu_check_os_bundle_required (char *plistname, char *osbundlereq,
if (binname)
*binname = 0;
file = grub_gzfile_open (plistname, 1);
file = grub_file_open (plistname);
if (! file)
{
grub_file_close (file);
@ -1166,7 +1165,7 @@ grub_xnu_load_kext_from_dir (char *dirname, char *osbundlerequired,
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;
@ -1204,7 +1203,7 @@ grub_cmd_xnu_kext (grub_command_t cmd __attribute__ ((unused)),
/* 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");

View file

@ -52,6 +52,7 @@ grub_xnu_resume (char *imagename)
grub_addr_t target_image;
grub_err_t err;
grub_file_filter_disable_compression ();
file = grub_file_open (imagename);
if (! file)
return 0;

View file

@ -474,6 +474,9 @@ static void (*grub_xputs_saved) (const char *str);
GRUB_MOD_INIT(normal)
{
/* Previously many modules depended on gzio. Be nice to user and load it. */
grub_dl_load ("gzio");
grub_context_init ();
grub_script_init ();
grub_menu_init ();

View file

@ -51,6 +51,50 @@ struct grub_file
};
typedef struct grub_file *grub_file_t;
/* Filters with lower ID are executed first. */
typedef enum grub_file_filter_id
{
GRUB_FILE_FILTER_GZIO,
GRUB_FILE_FILTER_MAX,
GRUB_FILE_FILTER_COMPRESSION_FIRST = GRUB_FILE_FILTER_GZIO,
GRUB_FILE_FILTER_COMPRESSION_LAST = GRUB_FILE_FILTER_GZIO,
} grub_file_filter_id_t;
typedef grub_file_t (*grub_file_filter_t) (grub_file_t in);
extern grub_file_filter_t EXPORT_VAR(grub_file_filters_all)[GRUB_FILE_FILTER_MAX];
extern grub_file_filter_t EXPORT_VAR(grub_file_filters_enabled)[GRUB_FILE_FILTER_MAX];
static inline void
grub_file_filter_register (grub_file_filter_id_t id, grub_file_filter_t filter)
{
grub_file_filters_all[id] = filter;
grub_file_filters_enabled[id] = filter;
};
static inline void
grub_file_filter_unregister (grub_file_filter_id_t id)
{
grub_file_filters_all[id] = 0;
grub_file_filters_enabled[id] = 0;
};
static inline void
grub_file_filter_disable (grub_file_filter_id_t id)
{
grub_file_filters_enabled[id] = 0;
};
static inline void
grub_file_filter_disable_compression (void)
{
grub_file_filter_id_t id;
for (id = GRUB_FILE_FILTER_COMPRESSION_FIRST;
id <= GRUB_FILE_FILTER_COMPRESSION_LAST; id++)
grub_file_filters_enabled[id] = 0;
};
/* Get a device name from NAME. */
char *EXPORT_FUNC(grub_file_get_device_name) (const char *name);

View file

@ -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 */

View file

@ -107,6 +107,7 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len))
return;
}
grub_file_filter_disable_compression ();
file = grub_file_open (pathname);
if (!file)
{

View file

@ -245,6 +245,7 @@ probe (const char *path, char *device_name)
grub_path = xasprintf ("(%s)%s", drive_name, rel_path);
free (rel_path);
grub_util_info ("reading %s via GRUB facilities", grub_path);
grub_file_filter_disable_compression ();
file = grub_file_open (grub_path);
if (! file)
grub_util_error ("cannot open %s via GRUB facilities", grub_path);

View file

@ -454,6 +454,7 @@ unable_to_embed:
grub_disk_cache_invalidate_all ();
grub_file_filter_disable_compression ();
file = grub_file_open (core_path_dev);
if (file)
{
@ -524,6 +525,7 @@ unable_to_embed:
}
/* Now read the core image to determine where the sectors are. */
grub_file_filter_disable_compression ();
file = grub_file_open (core_path_dev);
if (! file)
grub_util_error ("%s", grub_errmsg);

View file

@ -228,6 +228,7 @@ setup (const char *prefix, const char *dir,
grub_disk_cache_invalidate_all ();
grub_file_filter_disable_compression ();
file = grub_file_open (core_path);
if (file)
{
@ -297,6 +298,7 @@ setup (const char *prefix, const char *dir,
}
/* Now read the core image to determine where the sectors are. */
grub_file_filter_disable_compression ();
file = grub_file_open (core_path);
if (! file)
grub_util_error ("%s", grub_errmsg);