Improve gettext support. Stylistic fixes and error handling fixes while
on it.
This commit is contained in:
parent
215c90cb82
commit
9c4b5c13e6
184 changed files with 1175 additions and 959 deletions
|
@ -1,3 +1,8 @@
|
|||
2012-02-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Improve gettext support. Stylistic fixes and error handling fixes while
|
||||
on it.
|
||||
|
||||
2012-02-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/lib/i386/relocator16.S: Revert moving A20 code into PM
|
||||
|
|
|
@ -36,6 +36,16 @@ grub_memalign_dma32 (grub_size_t align, grub_size_t size)
|
|||
align = 64;
|
||||
size = ALIGN_UP (size, align);
|
||||
ret = grub_memalign (align, size);
|
||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
||||
if ((grub_addr_t) ret >> 32)
|
||||
{
|
||||
/* Shouldn't happend since the only platform in this case is
|
||||
x86_64-efi and it skips any regions > 4GiB because
|
||||
of EFI bugs anyway. */
|
||||
grub_error (GRUB_ERR_BUG, "allocation outside 32-bit range");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (!ret)
|
||||
return 0;
|
||||
grub_arch_sync_dma_caches (ret, size);
|
||||
|
|
|
@ -294,13 +294,15 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
|||
o->hcca_chunk, o->hcca, o->hcca_addr);
|
||||
|
||||
/* Reserve memory for ctrl EDs. */
|
||||
o->ed_ctrl_chunk = grub_memalign_dma32 (16, sizeof(struct grub_ohci_ed)*GRUB_OHCI_CTRL_EDS);
|
||||
o->ed_ctrl_chunk = grub_memalign_dma32 (16, sizeof(struct grub_ohci_ed)
|
||||
* GRUB_OHCI_CTRL_EDS);
|
||||
if (! o->ed_ctrl_chunk)
|
||||
goto fail;
|
||||
o->ed_ctrl = grub_dma_get_virt (o->ed_ctrl_chunk);
|
||||
o->ed_ctrl_addr = grub_dma_get_phys (o->ed_ctrl_chunk);
|
||||
/* Preset EDs */
|
||||
grub_memset ((void*)o->ed_ctrl, 0, sizeof(struct grub_ohci_ed) * GRUB_OHCI_CTRL_EDS);
|
||||
grub_memset ((void *) o->ed_ctrl, 0, sizeof (struct grub_ohci_ed)
|
||||
* GRUB_OHCI_CTRL_EDS);
|
||||
for (j=0; j < GRUB_OHCI_CTRL_EDS; j++)
|
||||
o->ed_ctrl[j].target = grub_cpu_to_le32 (1 << 14); /* skip */
|
||||
|
||||
|
@ -308,7 +310,8 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
|||
o->ed_ctrl_chunk, o->ed_ctrl, o->ed_ctrl_addr);
|
||||
|
||||
/* Reserve memory for bulk EDs. */
|
||||
o->ed_bulk_chunk = grub_memalign_dma32 (16, sizeof(struct grub_ohci_ed)*GRUB_OHCI_BULK_EDS);
|
||||
o->ed_bulk_chunk = grub_memalign_dma32 (16, sizeof (struct grub_ohci_ed)
|
||||
* GRUB_OHCI_BULK_EDS);
|
||||
if (! o->ed_bulk_chunk)
|
||||
goto fail;
|
||||
o->ed_bulk = grub_dma_get_virt (o->ed_bulk_chunk);
|
||||
|
|
|
@ -41,8 +41,8 @@ static const struct grub_arg_option options[] = {
|
|||
0, ARG_TYPE_STRING},
|
||||
{"load-only", 'n', 0,
|
||||
N_("Load only tables specified by comma-separated list."), 0, ARG_TYPE_STRING},
|
||||
{"v1", '1', 0, N_("Expose v1 tables."), 0, ARG_TYPE_NONE},
|
||||
{"v2", '2', 0, N_("Expose v2 and v3 tables."), 0, ARG_TYPE_NONE},
|
||||
{"v1", '1', 0, N_("Export version 1 tables to the OS."), 0, ARG_TYPE_NONE},
|
||||
{"v2", '2', 0, N_("Export version 2 and version 3 tables to the OS."), 0, ARG_TYPE_NONE},
|
||||
{"oemid", 'o', 0, N_("Set OEMID of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING},
|
||||
{"oemtable", 't', 0,
|
||||
N_("Set OEMTABLE ID of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING},
|
||||
|
@ -553,8 +553,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
|||
free_tables ();
|
||||
grub_free (exclude);
|
||||
grub_free (load_only);
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't allocate table");
|
||||
return grub_errno;
|
||||
}
|
||||
grub_memcpy (table_dsdt, dsdt, dsdt->length);
|
||||
}
|
||||
|
@ -580,8 +579,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
|||
free_tables ();
|
||||
grub_free (exclude);
|
||||
grub_free (load_only);
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't allocate table structure");
|
||||
return grub_errno;
|
||||
}
|
||||
table->size = curtable->length;
|
||||
table->addr = grub_malloc (table->size);
|
||||
|
@ -589,8 +587,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
|||
if (! table->addr)
|
||||
{
|
||||
free_tables ();
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't allocate table");
|
||||
return grub_errno;
|
||||
}
|
||||
table->next = acpi_tables;
|
||||
acpi_tables = table;
|
||||
|
@ -633,7 +630,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
|||
if (! file)
|
||||
{
|
||||
free_tables ();
|
||||
return grub_error (GRUB_ERR_BAD_OS, "couldn't open file %s", args[i]);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
size = grub_file_size (file);
|
||||
|
@ -641,7 +638,8 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
|||
{
|
||||
grub_file_close (file);
|
||||
free_tables ();
|
||||
return grub_error (GRUB_ERR_BAD_OS, "file %s is too small", args[i]);
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
|
||||
args[i]);
|
||||
}
|
||||
|
||||
buf = (char *) grub_malloc (size);
|
||||
|
@ -678,8 +676,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
|||
if (! table)
|
||||
{
|
||||
free_tables ();
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't allocate table structure");
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
table->size = size;
|
||||
|
@ -771,7 +768,7 @@ GRUB_MOD_INIT(acpi)
|
|||
{
|
||||
cmd = grub_register_extcmd ("acpi", grub_cmd_acpi, 0,
|
||||
N_("[-1|-2] [--exclude=TABLE1,TABLE2|"
|
||||
"--load-only=table1,table2] FILE1"
|
||||
"--load-only=TABLE1,TABLE2] FILE1"
|
||||
" [FILE2] [...]"),
|
||||
N_("Load host ACPI tables and tables "
|
||||
"specified by arguments."),
|
||||
|
|
|
@ -82,7 +82,7 @@ grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
if (argc < 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (args[0]);
|
||||
|
|
|
@ -64,10 +64,7 @@ grub_loader_register_preboot_hook (grub_err_t (*preboot_func) (int noreturn),
|
|||
new_preboot = (struct grub_preboot *)
|
||||
grub_malloc (sizeof (struct grub_preboot));
|
||||
if (! new_preboot)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "hook not added");
|
||||
return 0;
|
||||
}
|
||||
|
||||
new_preboot->preboot_func = preboot_func;
|
||||
new_preboot->preboot_rest_func = preboot_rest_func;
|
||||
|
@ -146,7 +143,8 @@ grub_loader_boot (void)
|
|||
struct grub_preboot *cur;
|
||||
|
||||
if (! grub_loader_loaded)
|
||||
return grub_error (GRUB_ERR_NO_KERNEL, "no loaded kernel");
|
||||
return grub_error (GRUB_ERR_NO_KERNEL,
|
||||
N_("you need to load the kernel first"));
|
||||
|
||||
if (grub_loader_noreturn)
|
||||
grub_machine_fini ();
|
||||
|
|
|
@ -31,14 +31,16 @@ grub_rescue_cmd_info (struct grub_command *cmd __attribute__ ((unused)),
|
|||
unsigned long hits, misses;
|
||||
|
||||
grub_disk_cache_get_performance (&hits, &misses);
|
||||
grub_printf_ (N_("Disk cache: hits = %lu, misses = %lu "), hits, misses);
|
||||
if (hits + misses)
|
||||
{
|
||||
unsigned long ratio = hits * 10000 / (hits + misses);
|
||||
grub_printf ("(%lu.%lu%%)\n", ratio / 100, ratio % 100);
|
||||
grub_printf_ (N_("Disk cache statistics: hits = %lu (%lu.%02lu%%),"
|
||||
" misses = %lu\n"), ratio / 100, ratio % 100,
|
||||
hits, misses);
|
||||
}
|
||||
else
|
||||
grub_puts_ (N_("(N/A)"));
|
||||
grub_printf ("%s\n", _("No disk cache statistics available\n"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
dos = 1;
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
file = grub_file_open (args[0]);
|
||||
if (! file)
|
||||
|
|
|
@ -40,7 +40,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
|||
char *buf2 = 0;
|
||||
|
||||
if (argc != 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
|
||||
|
||||
grub_printf_ (N_("Compare file `%s' with `%s':\n"), args[0],
|
||||
args[1]);
|
||||
|
|
|
@ -32,7 +32,7 @@ grub_cmd_source (grub_command_t cmd, int argc, char **args)
|
|||
int new_env, extractor;
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
extractor = (cmd->name[0] == 'e');
|
||||
new_env = (cmd->name[extractor ? sizeof ("extract_entries_") - 1 : 0] == 'c');
|
||||
|
|
|
@ -165,7 +165,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
|
|||
int size;
|
||||
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no ROM image specified");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
|
@ -206,7 +206,9 @@ static grub_command_t cmd_fakebios, cmd_loadbios;
|
|||
GRUB_MOD_INIT(loadbios)
|
||||
{
|
||||
cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios,
|
||||
0, N_("Fake BIOS."));
|
||||
0, N_("Create BIOS-like structures for"
|
||||
" backward compatibility with"
|
||||
" existing OS."));
|
||||
|
||||
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
|
||||
N_("BIOS_DUMP [INT10_DUMP]"),
|
||||
|
|
|
@ -30,7 +30,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||
|
||||
static const struct grub_arg_option options[] = {
|
||||
{"hash", 'h', 0, N_("Specify hash to use."), N_("HASH"), ARG_TYPE_STRING},
|
||||
{"check", 'c', 0, N_("Check hash list file."), N_("FILE"), ARG_TYPE_STRING},
|
||||
{"check", 'c', 0, N_("Check hashes of files with hash list FILE."),
|
||||
N_("FILE"), ARG_TYPE_STRING},
|
||||
{"prefix", 'p', 0, N_("Base directory for hash list."), N_("DIR"),
|
||||
ARG_TYPE_STRING},
|
||||
{"keep-going", 'k', 0, N_("Don't stop after first error."), 0, 0},
|
||||
|
|
|
@ -47,7 +47,7 @@ static const struct grub_arg_option options[] = {
|
|||
{"sleep", 'Y', 0, N_("Set drive to sleep mode."), 0, ARG_TYPE_NONE},
|
||||
{"identify", 'i', 0, N_("Print drive identity and settings."),
|
||||
0, ARG_TYPE_NONE},
|
||||
{"dumpid", 'I', 0, N_("Dump contents of ATA IDENTIFY sector."),
|
||||
{"dumpid", 'I', 0, N_("Show raw contents of ATA IDENTIFY sector."),
|
||||
0, ARG_TYPE_NONE},
|
||||
{"smart", -1, 0, N_("Disable/enable SMART (0/1)."), 0, ARG_TYPE_INT},
|
||||
{"quiet", 'q', 0, N_("Do not print messages."), 0, ARG_TYPE_NONE},
|
||||
|
|
|
@ -44,7 +44,7 @@ grub_cmd_hexdump (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
int namelen;
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
namelen = grub_strlen (args[0]);
|
||||
skip = (state[0].set) ? grub_strtoull (state[0].arg, 0, 0) : 0;
|
||||
|
@ -123,7 +123,7 @@ GRUB_MOD_INIT (hexdump)
|
|||
{
|
||||
cmd = grub_register_extcmd ("hexdump", grub_cmd_hexdump, 0,
|
||||
N_("[OPTIONS] FILE_OR_DEVICE"),
|
||||
N_("Dump the contents of a file or memory."),
|
||||
N_("Show raw contents of a file or memory."),
|
||||
options);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,11 +30,11 @@ parse_args (int argc, char *argv[], int *byte, int *bit)
|
|||
char *rest;
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "address required");
|
||||
|
||||
*byte = grub_strtoul (argv[0], &rest, 0);
|
||||
if (*rest != ':')
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "address required");
|
||||
|
||||
*bit = grub_strtoul (rest + 1, 0, 0);
|
||||
|
||||
|
|
|
@ -107,8 +107,7 @@ drivemap_set (grub_uint8_t newdrive, grub_uint8_t redirto)
|
|||
{
|
||||
mapping = grub_malloc (sizeof (drivemap_node_t));
|
||||
if (! mapping)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"cannot allocate map entry, not enough memory");
|
||||
return grub_errno;
|
||||
mapping->newdrive = newdrive;
|
||||
mapping->redirto = redirto;
|
||||
mapping->next = map_head;
|
||||
|
@ -230,7 +229,7 @@ grub_cmd_drivemap (struct grub_extcmd_context *ctxt, int argc, char **args)
|
|||
grub_err_t err;
|
||||
|
||||
if (argc != 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
|
||||
|
||||
err = tryparse_diskstring (args[0], &mapfrom);
|
||||
if (err != GRUB_ERR_NONE)
|
||||
|
|
|
@ -74,7 +74,7 @@ grub_cmd_lsapm (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (!grub_apm_get_info (&info))
|
||||
return grub_error (GRUB_ERR_IO, "no APM found");
|
||||
|
||||
grub_printf_ (N_("Vesion %u.%u\n"
|
||||
grub_printf_ (N_("Version %u.%u\n"
|
||||
"32-bit CS = 0x%x, len = 0x%x, offset = 0x%x\n"
|
||||
"16-bit CS = 0x%x, len = 0x%x\n"
|
||||
"DS = 0x%x, len = 0x%x\n"),
|
||||
|
|
|
@ -192,13 +192,15 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
|||
file = grub_file_open (args[0]);
|
||||
|
||||
if (! file)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", args[0]);
|
||||
return grub_errno;
|
||||
|
||||
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
|
||||
{
|
||||
grub_file_close (file);
|
||||
return grub_error (GRUB_ERR_FILE_READ_ERROR,
|
||||
"file doesn't even contains a full tempo record");
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
|
||||
args[0]);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
tempo = grub_le_to_cpu32 (tempo);
|
||||
|
@ -227,7 +229,7 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
if (*end)
|
||||
/* Was not a number either, assume it was supposed to be a file name. */
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", args[0]);
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), args[0]);
|
||||
|
||||
grub_dprintf ("play","tempo = %d\n", tempo);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ static grub_command_t cmd;
|
|||
GRUB_MOD_INIT(ieee1275_suspend)
|
||||
{
|
||||
cmd = grub_register_command ("suspend", grub_cmd_suspend,
|
||||
0, N_("Return to Open Firmware prompt."));
|
||||
0, N_("Return to IEEE1275 prompt."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(ieee1275_suspend)
|
||||
|
|
|
@ -44,7 +44,7 @@ grub_cmd_read (grub_extcmd_context_t ctxt, int argc, char **argv)
|
|||
grub_uint32_t value = 0;
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
|
||||
|
||||
addr = grub_strtoul (argv[0], 0, 0);
|
||||
switch (ctxt->extcmd->cmd->name[sizeof ("in") - 1])
|
||||
|
@ -82,7 +82,7 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
|
|||
grub_uint32_t mask = 0xffffffff;
|
||||
|
||||
if (argc != 2 && argc != 3)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
|
||||
|
||||
addr = grub_strtoul (argv[0], 0, 0);
|
||||
value = grub_strtoul (argv[1], 0, 0);
|
||||
|
@ -120,25 +120,28 @@ GRUB_MOD_INIT(memrw)
|
|||
{
|
||||
cmd_read_byte =
|
||||
grub_register_extcmd ("inb", grub_cmd_read, 0,
|
||||
N_("PORT"), N_("Read byte from PORT."), options);
|
||||
N_("PORT"), N_("Read 8-bit value from PORT."),
|
||||
options);
|
||||
cmd_read_word =
|
||||
grub_register_extcmd ("inw", grub_cmd_read, 0,
|
||||
N_("PORT"), N_("Read word from PORT."), options);
|
||||
N_("PORT"), N_("Read 16-bit value from PORT."),
|
||||
options);
|
||||
cmd_read_dword =
|
||||
grub_register_extcmd ("inl", grub_cmd_read, 0,
|
||||
N_("PORT"), N_("Read dword from PORT."), options);
|
||||
N_("PORT"), N_("Read 32-bit value from PORT."),
|
||||
options);
|
||||
cmd_write_byte =
|
||||
grub_register_command ("outb", grub_cmd_write,
|
||||
N_("PORT VALUE [MASK]"),
|
||||
N_("Write byte VALUE to PORT."));
|
||||
N_("Write 8-bit VALUE to PORT."));
|
||||
cmd_write_word =
|
||||
grub_register_command ("outw", grub_cmd_write,
|
||||
N_("PORT VALUE [MASK]"),
|
||||
N_("Write word VALUE to PORT."));
|
||||
N_("Write 16-bit VALUE to PORT."));
|
||||
cmd_write_dword =
|
||||
grub_register_command ("outl", grub_cmd_write,
|
||||
N_("ADDR VALUE [MASK]"),
|
||||
N_("Write dword VALUE to PORT."));
|
||||
N_("Write 32-bit VALUE to PORT."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(memrw)
|
||||
|
|
|
@ -207,7 +207,7 @@ grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)),
|
|||
{
|
||||
const char *prefix = grub_env_get ("prefix");
|
||||
if (!prefix)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "No prefix set");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("variable `%s' isn't set"), "prefix");
|
||||
filename = grub_xasprintf ("%s/layouts/%s.gkb", prefix, argv[0]);
|
||||
if (!filename)
|
||||
return grub_errno;
|
||||
|
@ -222,7 +222,8 @@ grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)),
|
|||
if (grub_file_read (file, magic, sizeof (magic)) != sizeof (magic))
|
||||
{
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "file is too short");
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
|
||||
filename);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -236,7 +237,8 @@ grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)),
|
|||
if (grub_file_read (file, &version, sizeof (version)) != sizeof (version))
|
||||
{
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "file is too short");
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
|
||||
filename);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -253,7 +255,8 @@ grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)),
|
|||
if (grub_file_read (file, newmap, sizeof (*newmap)) != sizeof (*newmap))
|
||||
{
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "file is too short");
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
|
||||
filename);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ grub_cmd_legacy_source (struct grub_command *cmd,
|
|||
grub_err_t ret;
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
extractor = (cmd->name[0] == 'e');
|
||||
new_env = (cmd->name[extractor ? (sizeof ("extract_legacy_entries_") - 1)
|
||||
|
@ -299,7 +299,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
if (argc < 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "filename required");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
cutargs = grub_malloc (sizeof (cutargs[0]) * (argc - 1));
|
||||
cutargc = argc - 1;
|
||||
|
@ -481,7 +481,7 @@ grub_cmd_legacy_initrd (struct grub_command *mycmd __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"no kernel with module support is loaded in legacy way");
|
||||
"you need to load the kernel first");
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
|
@ -517,7 +517,7 @@ grub_cmd_legacy_initrdnounzip (struct grub_command *mycmd __attribute__ ((unused
|
|||
}
|
||||
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"no kernel with module support is loaded in legacy way");
|
||||
"you need to load the kernel first");
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
|
@ -696,7 +696,7 @@ grub_cmd_legacy_password (struct grub_command *mycmd __attribute__ ((unused)),
|
|||
struct legacy_md5_password *pw = NULL;
|
||||
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "arguments expected");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
|
||||
if (args[0][0] != '-' || args[0][1] != '-')
|
||||
return grub_normal_set_password ("legacy", args[0]);
|
||||
|
||||
|
@ -722,7 +722,7 @@ grub_cmd_legacy_check_password (struct grub_command *mycmd __attribute__ ((unuse
|
|||
char entered[GRUB_AUTH_MAX_PASSLEN];
|
||||
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "arguments expected");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
|
||||
grub_puts_ (N_("Enter password: "));
|
||||
if (!grub_password_get (entered, GRUB_AUTH_MAX_PASSLEN))
|
||||
return GRUB_ACCESS_DENIED;
|
||||
|
|
|
@ -65,7 +65,7 @@ open_envblk_file (char *filename)
|
|||
}
|
||||
else
|
||||
{
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "prefix is not found");
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -93,8 +93,6 @@ read_envblk_file (grub_file_t file)
|
|||
ret = grub_file_read (file, buf + offset, size);
|
||||
if (ret <= 0)
|
||||
{
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, "cannot read");
|
||||
grub_free (buf);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||
|
||||
static const char *names[] =
|
||||
{
|
||||
[GRUB_MEMORY_AVAILABLE] = N_("available"),
|
||||
[GRUB_MEMORY_RESERVED] = N_("reserved"),
|
||||
[GRUB_MEMORY_ACPI] = N_("ACPI reclamaible"),
|
||||
[GRUB_MEMORY_NVS] = N_("ACPI non-volatile storage"),
|
||||
[GRUB_MEMORY_BADRAM] = N_("BadRAM"),
|
||||
[GRUB_MEMORY_CODE] = N_("firmware code"),
|
||||
[GRUB_MEMORY_HOLE] = N_("hole")
|
||||
[GRUB_MEMORY_AVAILABLE] = N_("available RAM"),
|
||||
[GRUB_MEMORY_RESERVED] = N_("reserved RAM"),
|
||||
[GRUB_MEMORY_ACPI] = N_("ACPI reclaimable RAM"),
|
||||
[GRUB_MEMORY_NVS] = N_("ACPI non-volatile storage RAM"),
|
||||
[GRUB_MEMORY_BADRAM] = N_("faulty RAM (BadRAM)"),
|
||||
[GRUB_MEMORY_CODE] = N_("RAM holding firmware code"),
|
||||
[GRUB_MEMORY_HOLE] = N_("Address range not associated with RAM")
|
||||
};
|
||||
|
||||
static grub_err_t
|
||||
|
|
|
@ -44,7 +44,7 @@ grub_cmd_read (grub_extcmd_context_t ctxt, int argc, char **argv)
|
|||
char buf[sizeof ("XXXXXXXX")];
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
|
||||
|
||||
addr = grub_strtoul (argv[0], 0, 0);
|
||||
switch (ctxt->extcmd->cmd->name[sizeof ("read_") - 1])
|
||||
|
@ -81,7 +81,7 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
|
|||
grub_uint32_t mask = 0xffffffff;
|
||||
|
||||
if (argc != 2 && argc != 3)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
|
||||
|
||||
addr = grub_strtoul (argv[0], 0, 0);
|
||||
value = grub_strtoul (argv[1], 0, 0);
|
||||
|
@ -122,22 +122,28 @@ GRUB_MOD_INIT(memrw)
|
|||
{
|
||||
cmd_read_byte =
|
||||
grub_register_extcmd ("read_byte", grub_cmd_read, 0,
|
||||
N_("ADDR"), N_("Read byte from ADDR."), options);
|
||||
N_("ADDR"), N_("Read 8-bit value from ADDR."),
|
||||
options);
|
||||
cmd_read_word =
|
||||
grub_register_extcmd ("read_word", grub_cmd_read, 0,
|
||||
N_("ADDR"), N_("Read word from ADDR."), options);
|
||||
N_("ADDR"), N_("Read 16-bit value from ADDR."),
|
||||
options);
|
||||
cmd_read_dword =
|
||||
grub_register_extcmd ("read_dword", grub_cmd_read, 0,
|
||||
N_("ADDR"), N_("Read dword from ADDR."), options);
|
||||
N_("ADDR"), N_("Read 32-bit value from ADDR."),
|
||||
options);
|
||||
cmd_write_byte =
|
||||
grub_register_command ("write_byte", grub_cmd_write,
|
||||
N_("ADDR VALUE [MASK]"), N_("Write byte VALUE to ADDR."));
|
||||
N_("ADDR VALUE [MASK]"),
|
||||
N_("Write 8-bit VALUE to ADDR."));
|
||||
cmd_write_word =
|
||||
grub_register_command ("write_word", grub_cmd_write,
|
||||
N_("ADDR VALUE [MASK]"), N_("Write word VALUE to ADDR."));
|
||||
N_("ADDR VALUE [MASK]"),
|
||||
N_("Write 16-bit VALUE to ADDR."));
|
||||
cmd_write_dword =
|
||||
grub_register_command ("write_dword", grub_cmd_write,
|
||||
N_("ADDR VALUE [MASK]"), N_("Write dword VALUE to ADDR."));
|
||||
N_("ADDR VALUE [MASK]"),
|
||||
N_("Write 32-bit VALUE to ADDR."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(memrw)
|
||||
|
|
|
@ -30,11 +30,12 @@ static const struct grub_arg_option options[] =
|
|||
{"class", 1, GRUB_ARG_OPTION_REPEATABLE,
|
||||
N_("Menu entry type."), N_("STRING"), ARG_TYPE_STRING},
|
||||
{"users", 2, 0,
|
||||
N_("Users allowed to boot this entry."), N_("USERNAME"), ARG_TYPE_STRING},
|
||||
N_("List of users allowed to boot this entry."), N_("USERNAME[,USERNAME]"),
|
||||
ARG_TYPE_STRING},
|
||||
{"hotkey", 3, 0,
|
||||
N_("Keyboard key to quickly boot this entry."), N_("KEYBOARD_KEY"), ARG_TYPE_STRING},
|
||||
{"source", 4, 0,
|
||||
N_("Menu entry definition as a string."), N_("STRING"), ARG_TYPE_STRING},
|
||||
N_("Use STRING as menu entry body."), N_("STRING"), ARG_TYPE_STRING},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ grub_mini_cmd_cat (struct grub_command *cmd __attribute__ ((unused)),
|
|||
grub_ssize_t size;
|
||||
|
||||
if (argc < 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
file = grub_file_open (argv[0]);
|
||||
if (! file)
|
||||
|
@ -187,7 +187,7 @@ GRUB_MOD_INIT(minicmd)
|
|||
0, N_("Show this message."));
|
||||
cmd_dump =
|
||||
grub_register_command ("dump", grub_mini_cmd_dump,
|
||||
N_("ADDR [SIZE]"), N_("Dump memory."));
|
||||
N_("ADDR [SIZE]"), N_("Show memory contents."));
|
||||
cmd_rmmod =
|
||||
grub_register_command ("rmmod", grub_mini_cmd_rmmod,
|
||||
N_("MODULE"), N_("Remove a module."));
|
||||
|
|
|
@ -49,14 +49,15 @@ grub_cmd_lsspd (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
grub_printf_ (N_("SMB base = 0x%x\n"), smbbase);
|
||||
grub_printf_ (N_("System management bus controller I/O space is at 0x%x\n"),
|
||||
smbbase);
|
||||
|
||||
for (i = GRUB_SMB_RAM_START_ADDR;
|
||||
i < GRUB_SMB_RAM_START_ADDR + GRUB_SMB_RAM_NUM_MAX; i++)
|
||||
{
|
||||
struct grub_smbus_spd spd;
|
||||
grub_memset (&spd, 0, sizeof (spd));
|
||||
grub_printf_ (N_("Device %d\n"), i);
|
||||
grub_printf_ (N_("RAM slot number %d\n"), i);
|
||||
err = grub_cs5536_read_spd (smbbase, i, &spd);
|
||||
if (err)
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
|
|||
int argc, char **args)
|
||||
{
|
||||
if (argc != 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments expected");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
|
||||
return grub_normal_set_password (args[0], args[1]);
|
||||
}
|
||||
|
||||
|
|
|
@ -90,11 +90,11 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
|
|||
struct pbkdf2_password *pass;
|
||||
|
||||
if (argc != 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Two arguments expected.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
|
||||
|
||||
if (grub_memcmp (args[1], "grub.pbkdf2.sha512.",
|
||||
sizeof ("grub.pbkdf2.sha512.") - 1) != 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "incorrect PBKDF2 password");
|
||||
|
||||
ptr = args[1] + sizeof ("grub.pbkdf2.sha512.") - 1;
|
||||
|
||||
|
@ -106,7 +106,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (*ptr != '.')
|
||||
{
|
||||
grub_free (pass);
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "incorrect PBKDF2 password");
|
||||
}
|
||||
ptr++;
|
||||
|
||||
|
@ -114,7 +114,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (!ptr2 || ((ptr2 - ptr) & 1) || grub_strlen (ptr2 + 1) & 1)
|
||||
{
|
||||
grub_free (pass);
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "incorrect PBKDF2 password");
|
||||
}
|
||||
|
||||
pass->saltlen = (ptr2 - ptr) >> 1;
|
||||
|
@ -137,7 +137,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_free (pass->salt);
|
||||
grub_free (pass);
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"Incorrect PBKDF2 password.");
|
||||
"incorrect PBKDF2 password");
|
||||
}
|
||||
|
||||
*ptro = (hex1 << 4) | hex2;
|
||||
|
@ -166,7 +166,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_free (pass->salt);
|
||||
grub_free (pass);
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"Incorrect PBKDF2 password.");
|
||||
"incorrect PBKDF2 password");
|
||||
}
|
||||
|
||||
*ptro = (hex1 << 4) | hex2;
|
||||
|
|
|
@ -68,7 +68,7 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
else
|
||||
dev = grub_device_open (args[0]);
|
||||
if (! dev)
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE, "couldn't open device");
|
||||
return grub_errno;
|
||||
|
||||
if (state[1].set)
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
}
|
||||
fs = grub_fs_probe (dev);
|
||||
if (! fs)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_FS, "unrecognised fs");
|
||||
return grub_errno;
|
||||
if (state[3].set)
|
||||
{
|
||||
if (state[0].set)
|
||||
|
|
|
@ -32,7 +32,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{ "set", 's', GRUB_ARG_OPTION_REPEATABLE,
|
||||
N_("Variable names to update with matches."),
|
||||
N_("Store matched component NUMBER in VARNAME."),
|
||||
N_("[NUMBER:]VARNAME"), ARG_TYPE_STRING },
|
||||
{ 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
@ -42,7 +42,6 @@ set_matches (char **varnames, char *str, grub_size_t nmatches,
|
|||
regmatch_t *matches)
|
||||
{
|
||||
int i;
|
||||
char ch;
|
||||
char *p;
|
||||
char *q;
|
||||
grub_err_t err;
|
||||
|
@ -51,6 +50,7 @@ set_matches (char **varnames, char *str, grub_size_t nmatches,
|
|||
auto void setvar (char *v, regmatch_t *m);
|
||||
void setvar (char *v, regmatch_t *m)
|
||||
{
|
||||
char ch;
|
||||
ch = str[m->rm_eo];
|
||||
str[m->rm_eo] = '\0';
|
||||
err = grub_env_set (v, str + m->rm_so);
|
||||
|
@ -59,7 +59,8 @@ set_matches (char **varnames, char *str, grub_size_t nmatches,
|
|||
|
||||
for (i = 0; varnames && varnames[i]; i++)
|
||||
{
|
||||
if (! (p = grub_strchr (varnames[i], ':')))
|
||||
p = grub_strchr (varnames[i], ':');
|
||||
if (! p)
|
||||
{
|
||||
/* varname w/o index defaults to 1 */
|
||||
if (nmatches < 2 || matches[1].rm_so == -1)
|
||||
|
@ -97,7 +98,7 @@ grub_cmd_regexp (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
regmatch_t *matches = 0;
|
||||
|
||||
if (argc != 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "2 arguments expected");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
|
||||
|
||||
ret = regcomp (®ex, args[0], REG_EXTENDED);
|
||||
if (ret)
|
||||
|
|
|
@ -277,7 +277,7 @@ grub_cmd_do_search (grub_command_t cmd __attribute__ ((unused)), int argc,
|
|||
char **args)
|
||||
{
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
|
||||
|
||||
FUNC_NAME (args[0], argc == 1 ? 0 : args[1], 0, (args + 2),
|
||||
argc > 2 ? argc - 2 : 0);
|
||||
|
|
|
@ -158,7 +158,7 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
break;
|
||||
|
||||
if (argc == j)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
|
||||
|
||||
if (state[SEARCH_SET].set)
|
||||
var = state[SEARCH_SET].arg ? state[SEARCH_SET].arg : "root";
|
||||
|
|
|
@ -179,7 +179,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
|||
if (grub_errno)
|
||||
return grub_errno;
|
||||
if (*ptr != ':')
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Colon expected.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':');
|
||||
ptr++;
|
||||
pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff)
|
||||
<< 16;
|
||||
|
@ -210,7 +210,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
|||
if (grub_errno)
|
||||
return grub_errno;
|
||||
if (*ptr != ':')
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Colon expected.");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':');
|
||||
ptr++;
|
||||
optr = ptr;
|
||||
device = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
|
@ -238,11 +238,8 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
|||
|
||||
write_mask = 0;
|
||||
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Command expected.");
|
||||
|
||||
if (argc > 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Only one command is supported.");
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
|
||||
|
||||
ptr = argv[0];
|
||||
|
||||
|
@ -257,7 +254,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
|||
regsize = 0;
|
||||
regaddr = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
if (grub_errno)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown register");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown register");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -298,7 +295,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
|||
|
||||
if (!regsize)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"Unknown register size.");
|
||||
"unknown register size");
|
||||
|
||||
write_mask = 0;
|
||||
if (*ptr == '=')
|
||||
|
@ -321,7 +318,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
|||
|
||||
if (write_mask && varname)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"Option -v isn't valid for writes.");
|
||||
"option -v isn't valid for writes");
|
||||
|
||||
grub_pci_iterate (grub_setpci_iter);
|
||||
return GRUB_ERR_NONE;
|
||||
|
|
|
@ -67,7 +67,7 @@ grub_cmd_sleep (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
int n;
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "missing operand");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
|
||||
|
||||
n = grub_strtoul (args[0], 0, 10);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ grub_cmd_testload (struct grub_command *cmd __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
if (argc < 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
file = grub_file_open (argv[0]);
|
||||
if (! file)
|
||||
|
|
|
@ -46,9 +46,13 @@ GRUB_MOD_INIT(true)
|
|||
{
|
||||
cmd_true =
|
||||
grub_register_command ("true", grub_cmd_true,
|
||||
/* TRANSLATORS: it's imperative, not
|
||||
infinitive. */
|
||||
0, N_("Do nothing, successfully."));
|
||||
cmd_false =
|
||||
grub_register_command ("false", grub_cmd_false,
|
||||
/* TRANSLATORS: it's imperative, not
|
||||
infinitive. */
|
||||
0, N_("Do nothing, unsuccessfully."));
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
|
|||
{
|
||||
if (adapter->init ())
|
||||
{
|
||||
grub_puts_ (N_(" Failed"));
|
||||
grub_puts_ (N_(" Failed to initialize video adapter"));
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -543,10 +543,10 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
|
|||
(unsigned long long) parms->cmdsize);
|
||||
|
||||
if (parms->cmdsize != 0 && parms->cmdsize != 12 && parms->cmdsize != 16)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "incorrect ATAPI command size");
|
||||
return grub_error (GRUB_ERR_BUG, "incorrect ATAPI command size");
|
||||
|
||||
if (parms->size > GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "too big data buffer");
|
||||
return grub_error (GRUB_ERR_BUG, "too big data buffer");
|
||||
|
||||
bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1));
|
||||
|
||||
|
@ -626,7 +626,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
|
|||
dev->hba->ports[dev->port].command_issue,
|
||||
dev->hba->ports[dev->port].intstatus,
|
||||
dev->hba->ports[dev->port].task_file_data);
|
||||
err = grub_error (GRUB_ERR_IO, "AHCI transfer timeouted");
|
||||
err = grub_error (GRUB_ERR_IO, "AHCI transfer timed out");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/arc/arc.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static grub_arc_fileno_t last_handle = 0;
|
||||
static char *last_path = NULL;
|
||||
|
@ -255,7 +256,11 @@ grub_arcdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
{
|
||||
if (GRUB_ARC_FIRMWARE_VECTOR->read (last_handle, buf,
|
||||
totl, &count))
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "read failed");
|
||||
return grub_error (GRUB_ERR_READ_ERROR,
|
||||
N_("failure reading sector 0x%llx "
|
||||
" from `%s'"),
|
||||
(unsigned long long) sector,
|
||||
disk->name);
|
||||
totl -= count;
|
||||
buf += count;
|
||||
}
|
||||
|
@ -288,7 +293,10 @@ grub_arcdisk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
{
|
||||
if (GRUB_ARC_FIRMWARE_VECTOR->write (last_handle, buf,
|
||||
totl, &count))
|
||||
return grub_error (GRUB_ERR_WRITE_ERROR, "write failed");
|
||||
return grub_error (GRUB_ERR_WRITE_ERROR, N_("failure writing sector 0x%llx "
|
||||
" from `%s'"),
|
||||
(unsigned long long) sector,
|
||||
disk->name);
|
||||
totl -= count;
|
||||
buf += count;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ static const struct grub_arg_option options[] =
|
|||
{
|
||||
{"uuid", 'u', 0, N_("Mount by UUID."), 0, 0},
|
||||
{"all", 'a', 0, N_("Mount all."), 0, 0},
|
||||
{"boot", 'b', 0, N_("Mount all volumes marked as boot."), 0, 0},
|
||||
{"boot", 'b', 0, N_("Mount all volumes with `boot' flag set."), 0, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -501,7 +501,7 @@ grub_cryptodisk_open (const char *name, grub_disk_t disk)
|
|||
if (dev->cheat_fd == -1)
|
||||
dev->cheat_fd = open (dev->cheat, O_RDONLY);
|
||||
if (dev->cheat_fd == -1)
|
||||
return grub_error (GRUB_ERR_IO, "couldn't open %s: %s",
|
||||
return grub_error (GRUB_ERR_IO, N_("cannot open `%s': %s"),
|
||||
dev->cheat, strerror (errno));
|
||||
}
|
||||
#endif
|
||||
|
@ -560,8 +560,8 @@ grub_cryptodisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
return err;
|
||||
if (grub_util_fd_read (dev->cheat_fd, buf, size << disk->log_sector_size)
|
||||
!= (ssize_t) (size << disk->log_sector_size))
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "cannot read from `%s'",
|
||||
dev->cheat);
|
||||
return grub_error (GRUB_ERR_READ_ERROR, N_("cannot read `%s': %s"),
|
||||
dev->cheat, strerror (errno));
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
#endif
|
||||
|
@ -604,8 +604,8 @@ grub_cryptodisk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
return err;
|
||||
if (grub_util_fd_write (dev->cheat_fd, buf, size << disk->log_sector_size)
|
||||
!= (ssize_t) (size << disk->log_sector_size))
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "cannot read from `%s'",
|
||||
dev->cheat);
|
||||
return grub_error (GRUB_ERR_READ_ERROR, N_("cannot read `%s': %s"),
|
||||
dev->cheat, strerror (errno));
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -249,8 +249,8 @@ grub_diskfilter_memberlist (grub_disk_t disk)
|
|||
for (pv = lv->vg->pvs; pv; pv = pv->next)
|
||||
{
|
||||
if (!pv->disk)
|
||||
grub_util_error (_("Couldn't find PV %s. Check your device.map"),
|
||||
pv->name);
|
||||
grub_util_error (_("Couldn't find physical volume `%s'."
|
||||
" Check your device.map"), pv->name);
|
||||
tmp = grub_malloc (sizeof (*tmp));
|
||||
tmp->disk = pv->disk;
|
||||
tmp->next = list;
|
||||
|
|
|
@ -408,7 +408,7 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
|||
|
||||
sector = grub_disk_get_size (source);
|
||||
if (sector == GRUB_DISK_SIZE_UNKNOWN || sector == 0)
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "not a geli");
|
||||
return grub_error (GRUB_ERR_BUG, "not a geli");
|
||||
|
||||
/* Read the GELI header. */
|
||||
err = grub_disk_read (source, sector - 1, 0, sizeof (header), &header);
|
||||
|
|
|
@ -472,7 +472,10 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
|
|||
break;
|
||||
|
||||
if (i == GRUB_BIOSDISK_CDROM_RETRY_COUNT)
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "cdrom read error");
|
||||
return grub_error (GRUB_ERR_READ_ERROR, N_("failure reading sector 0x%llx "
|
||||
" from `%s'"),
|
||||
(unsigned long long) sector,
|
||||
disk->name);
|
||||
}
|
||||
else
|
||||
if (grub_biosdisk_rw_int13_extensions (cmd + 0x42, data->drive, dap))
|
||||
|
@ -502,7 +505,9 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
|
|||
coff = head / data->heads;
|
||||
|
||||
if (coff >= data->cylinders)
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "%s out of disk", disk->name);
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("attempt to read or write outside of disk `%s'"),
|
||||
disk->name);
|
||||
|
||||
if (grub_biosdisk_rw_standard (cmd + 0x02, data->drive,
|
||||
coff, hoff, soff, size, segment))
|
||||
|
@ -510,9 +515,15 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
|
|||
switch (cmd)
|
||||
{
|
||||
case GRUB_BIOSDISK_READ:
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "%s read error", disk->name);
|
||||
return grub_error (GRUB_ERR_READ_ERROR, N_("failure reading sector 0x%llx "
|
||||
" from `%s'"),
|
||||
(unsigned long long) sector,
|
||||
disk->name);
|
||||
case GRUB_BIOSDISK_WRITE:
|
||||
return grub_error (GRUB_ERR_WRITE_ERROR, "%s write error", disk->name);
|
||||
return grub_error (GRUB_ERR_WRITE_ERROR, N_("failure writing sector 0x%llx "
|
||||
" from `%s'"),
|
||||
(unsigned long long) sector,
|
||||
disk->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -627,7 +638,8 @@ GRUB_MOD_INIT(biosdisk)
|
|||
|
||||
if (grub_disk_firmware_is_tainted)
|
||||
{
|
||||
grub_puts_ (N_("Firmware is marked as tainted, refusing to initialize."));
|
||||
grub_puts_ (N_("Native disk drivers are in use. "
|
||||
"Refusing to use firmware disk interface."));
|
||||
return;
|
||||
}
|
||||
grub_disk_firmware_fini = grub_disk_biosdisk_fini;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -177,7 +178,10 @@ grub_nand_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
args.result = 1;
|
||||
|
||||
if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "read error");
|
||||
return grub_error (GRUB_ERR_READ_ERROR, N_("failure reading sector 0x%llx "
|
||||
" from `%s'"),
|
||||
(unsigned long long) sector,
|
||||
disk->name);
|
||||
|
||||
ofs = 0;
|
||||
size -= len;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
#include <grub/ieee1275/ofdisk.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static char *last_devpath;
|
||||
static grub_ieee1275_ihandle_t last_ihandle;
|
||||
|
@ -273,7 +274,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
|
|||
if (grub_strcmp (prop, "block"))
|
||||
{
|
||||
grub_free (devpath);
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE, "not a block device");
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a block device");
|
||||
}
|
||||
|
||||
/* XXX: There is no property to read the number of blocks. There
|
||||
|
@ -364,8 +365,10 @@ grub_ofdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
grub_ieee1275_read (last_ihandle, buf, size << GRUB_DISK_SECTOR_BITS,
|
||||
&actual);
|
||||
if (actual != (grub_ssize_t) (size << GRUB_DISK_SECTOR_BITS))
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "read error on block: %llu",
|
||||
(long long) sector);
|
||||
return grub_error (GRUB_ERR_READ_ERROR, N_("failure reading sector 0x%llx "
|
||||
" from `%s'"),
|
||||
(unsigned long long) sector,
|
||||
disk->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -382,8 +385,10 @@ grub_ofdisk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
grub_ieee1275_write (last_ihandle, buf, size << GRUB_DISK_SECTOR_BITS,
|
||||
&actual);
|
||||
if (actual != (grub_ssize_t) (size << GRUB_DISK_SECTOR_BITS))
|
||||
return grub_error (GRUB_ERR_WRITE_ERROR, "write error on block: %llu",
|
||||
(long long) sector);
|
||||
return grub_error (GRUB_ERR_WRITE_ERROR, N_("failure writing sector 0x%llx "
|
||||
" from `%s'"),
|
||||
(unsigned long long) sector,
|
||||
disk->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/diskfilter.h>
|
||||
#include <grub/gpt_partition.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
#include <grub/emu/misc.h>
|
||||
|
@ -919,10 +920,10 @@ grub_util_ldm_embed (struct grub_disk *disk, unsigned int *nsectors,
|
|||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"LDM curently supports only PC-BIOS embedding");
|
||||
if (disk->partition)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "disk isn't LDM");
|
||||
return grub_error (GRUB_ERR_BUG, "disk isn't LDM");
|
||||
pv = grub_diskfilter_get_pv_from_disk (disk, &vg);
|
||||
if (!pv)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "disk isn't LDM");
|
||||
return grub_error (GRUB_ERR_BUG, "disk isn't LDM");
|
||||
for (lv = vg->lvs; lv; lv = lv->next)
|
||||
{
|
||||
struct grub_diskfilter_lv *comp;
|
||||
|
@ -961,8 +962,8 @@ grub_util_ldm_embed (struct grub_disk *disk, unsigned int *nsectors,
|
|||
#endif
|
||||
if (lv->size < *nsectors)
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"Your LDM embed Partition is too small;"
|
||||
" embedding won't be possible!");
|
||||
N_("your LDM embed Partition is too small;"
|
||||
" embedding won't be possible"));
|
||||
*nsectors = lv->size;
|
||||
*sectors = grub_malloc (*nsectors * sizeof (**sectors));
|
||||
if (!*sectors)
|
||||
|
@ -975,8 +976,8 @@ grub_util_ldm_embed (struct grub_disk *disk, unsigned int *nsectors,
|
|||
}
|
||||
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND,
|
||||
"This LDM no Embedding Partition;"
|
||||
" embedding won't be possible!");
|
||||
N_("this LDM has no Embedding Partition;"
|
||||
" embedding won't be possible"));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ static struct grub_loopback *loopback_list;
|
|||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"delete", 'd', 0, N_("Delete the loopback device entry."), 0, 0},
|
||||
{"delete", 'd', 0, N_("Delete the specified loopback drive."), 0, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -86,7 +86,7 @@ grub_cmd_loopback (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
return delete_loopback (args[0]);
|
||||
|
||||
if (argc < 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
file = grub_file_open (args[1]);
|
||||
if (! file)
|
||||
|
@ -224,7 +224,7 @@ GRUB_MOD_INIT(loopback)
|
|||
{
|
||||
cmd = grub_register_extcmd ("loopback", grub_cmd_loopback, 0,
|
||||
N_("[-d] DEVICENAME FILE."),
|
||||
N_("Make a device of a file."), options);
|
||||
N_("Make a virtual drive from a file."), options);
|
||||
grub_disk_dev_register (&grub_loopback_dev);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/efiemu/efiemu.h>
|
||||
#include <grub/cpu/efiemu.h>
|
||||
#include <grub/elf.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* Check if EHDR is a valid ELF header. */
|
||||
int
|
||||
|
@ -101,8 +102,9 @@ grub_arch_efiemu_relocate_symbols32 (grub_efiemu_segment_t segs,
|
|||
return err;
|
||||
break;
|
||||
default:
|
||||
return grub_error (GRUB_ERR_BAD_OS,
|
||||
"unrecognised relocation");
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%x is not implemented yet"),
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/efiemu/efiemu.h>
|
||||
#include <grub/cpu/efiemu.h>
|
||||
#include <grub/elf.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* Check if EHDR is a valid ELF header. */
|
||||
int
|
||||
|
@ -109,8 +110,9 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs,
|
|||
return err;
|
||||
break;
|
||||
default:
|
||||
return grub_error (GRUB_ERR_BAD_OS,
|
||||
"unrecognised relocation");
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%x is not implemented yet"),
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/efiemu/efiemu.h>
|
||||
#include <grub/cpu/efiemu.h>
|
||||
#include <grub/elf.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* ELF symbols and their values */
|
||||
static struct grub_efiemu_elf_sym *grub_efiemu_elfsyms = 0;
|
||||
|
@ -193,7 +194,7 @@ grub_efiemu_count_symbols (const Elf_Ehdr *e)
|
|||
break;
|
||||
|
||||
if (i == e->e_shnum)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "no symbol table");
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("no symbol table"));
|
||||
|
||||
grub_efiemu_nelfsyms = (unsigned) s->sh_size / (unsigned) s->sh_entsize;
|
||||
grub_efiemu_elfsyms = (struct grub_efiemu_elf_sym *)
|
||||
|
@ -230,7 +231,7 @@ grub_efiemu_resolve_symbols (grub_efiemu_segment_t segs, Elf_Ehdr *e)
|
|||
break;
|
||||
|
||||
if (i == e->e_shnum)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "no symbol table");
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("no symbol table"));
|
||||
|
||||
sym = (Elf_Sym *) ((char *) e + s->sh_offset);
|
||||
size = s->sh_size;
|
||||
|
@ -328,7 +329,7 @@ SUFFIX (grub_efiemu_loadcore_init) (void *core, grub_size_t core_size,
|
|||
grub_err_t err;
|
||||
|
||||
if (e->e_type != ET_REL)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, "invalid ELF file type");
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("this ELF file is not of the right type"));
|
||||
|
||||
/* Make sure that every section is within the core. */
|
||||
if ((grub_size_t) core_size < e->e_shoff + e->e_shentsize * e->e_shnum)
|
||||
|
|
|
@ -140,8 +140,9 @@ grub_efiemu_loadcore_init (grub_file_t file)
|
|||
switch (grub_efiemu_mode)
|
||||
{
|
||||
case GRUB_EFIEMU32:
|
||||
if ((err = grub_efiemu_loadcore_init32 (efiemu_core, efiemu_core_size,
|
||||
&efiemu_segments)))
|
||||
err = grub_efiemu_loadcore_init32 (efiemu_core, efiemu_core_size,
|
||||
&efiemu_segments);
|
||||
if (err)
|
||||
{
|
||||
grub_free (efiemu_core);
|
||||
efiemu_core = 0;
|
||||
|
@ -151,8 +152,9 @@ grub_efiemu_loadcore_init (grub_file_t file)
|
|||
break;
|
||||
|
||||
case GRUB_EFIEMU64:
|
||||
if ((err = grub_efiemu_loadcore_init64 (efiemu_core, efiemu_core_size,
|
||||
&efiemu_segments)))
|
||||
err = grub_efiemu_loadcore_init64 (efiemu_core, efiemu_core_size,
|
||||
&efiemu_segments);
|
||||
if (err)
|
||||
{
|
||||
grub_free (efiemu_core);
|
||||
efiemu_core = 0;
|
||||
|
@ -162,7 +164,7 @@ grub_efiemu_loadcore_init (grub_file_t file)
|
|||
break;
|
||||
|
||||
default:
|
||||
return grub_error (GRUB_ERR_BAD_OS, "unknown EFI runtime");
|
||||
return grub_error (GRUB_ERR_BUG, "unknown EFI runtime");
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -184,6 +186,6 @@ grub_efiemu_loadcore_load (void)
|
|||
grub_efiemu_loadcore_unload ();
|
||||
return err;
|
||||
default:
|
||||
return grub_error (GRUB_ERR_BAD_OS, "unknown EFI runtime");
|
||||
return grub_error (GRUB_ERR_BUG, "unknown EFI runtime");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,11 +121,9 @@ grub_efiemu_register_prepare_hook (grub_err_t (*hook) (void *data),
|
|||
void *data)
|
||||
{
|
||||
struct grub_efiemu_prepare_hook *nhook;
|
||||
if (! hook)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "you must supply the hook");
|
||||
nhook = (struct grub_efiemu_prepare_hook *) grub_malloc (sizeof (*nhook));
|
||||
if (! nhook)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't prepare hook");
|
||||
return grub_errno;
|
||||
nhook->hook = hook;
|
||||
nhook->unload = unload;
|
||||
nhook->data = data;
|
||||
|
@ -146,16 +144,13 @@ grub_efiemu_register_configuration_table (grub_efi_guid_t guid,
|
|||
struct grub_efiemu_configuration_table *tbl;
|
||||
grub_err_t err;
|
||||
|
||||
if (! get_table && ! data)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"you must set at least get_table or data");
|
||||
err = grub_efiemu_unregister_configuration_table (guid);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
tbl = (struct grub_efiemu_configuration_table *) grub_malloc (sizeof (*tbl));
|
||||
if (! tbl)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't register table");
|
||||
return grub_errno;
|
||||
|
||||
tbl->guid = guid;
|
||||
tbl->get_table = get_table;
|
||||
|
@ -201,7 +196,7 @@ grub_efiemu_load_file (const char *filename)
|
|||
{
|
||||
grub_file_close (file);
|
||||
grub_efiemu_unload ();
|
||||
return grub_error (grub_errno, "couldn't init memory management");
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
grub_dprintf ("efiemu", "mm initialized\n");
|
||||
|
@ -237,16 +232,14 @@ grub_efiemu_autocore (void)
|
|||
|
||||
if (! prefix)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND,
|
||||
"couldn't find efiemu core because prefix "
|
||||
"isn't set");
|
||||
N_("variable `%s' isn't set"), "prefix");
|
||||
|
||||
suffix = grub_efiemu_get_default_core_name ();
|
||||
|
||||
filename = grub_xasprintf ("%s/" GRUB_TARGET_CPU "-" GRUB_PLATFORM "/%s",
|
||||
prefix, suffix);
|
||||
if (! filename)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't allocate temporary space");
|
||||
return grub_errno;
|
||||
|
||||
err = grub_efiemu_load_file (filename);
|
||||
grub_free (filename);
|
||||
|
@ -297,7 +290,7 @@ grub_cmd_efiemu_load (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_efiemu_unload ();
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "filename required");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
err = grub_efiemu_load_file (args[0]);
|
||||
if (err)
|
||||
|
|
|
@ -62,12 +62,17 @@ grub_efiemu_add_to_mmap (grub_uint64_t start, grub_uint64_t size,
|
|||
/* Extend map if necessary*/
|
||||
if (mmap_num >= mmap_reserved_size)
|
||||
{
|
||||
void *old;
|
||||
mmap_reserved_size = 2 * (mmap_reserved_size + 1);
|
||||
old = efiemu_mmap;
|
||||
efiemu_mmap = (grub_efi_memory_descriptor_t *)
|
||||
grub_realloc (efiemu_mmap, (++mmap_reserved_size)
|
||||
grub_realloc (efiemu_mmap, mmap_reserved_size
|
||||
* sizeof (grub_efi_memory_descriptor_t));
|
||||
if (!efiemu_mmap)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"not enough space for memory map");
|
||||
{
|
||||
grub_free (old);
|
||||
return grub_errno;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fill slot*/
|
||||
|
@ -176,8 +181,7 @@ efiemu_alloc_requests (void)
|
|||
/* Allocate the whole memory in one block */
|
||||
resident_memory = grub_memalign (GRUB_EFIEMU_PAGESIZE, total_alloc);
|
||||
if (!resident_memory)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't allocate resident memory");
|
||||
return grub_errno;
|
||||
|
||||
/* Split the memory into blocks by type */
|
||||
curptr = resident_memory;
|
||||
|
@ -540,8 +544,7 @@ grub_efiemu_mmap_sort_and_uniq (void)
|
|||
{
|
||||
grub_free (result);
|
||||
grub_free (scanline_events);
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't allocate space for new memory map");
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
/* Register scanline events */
|
||||
|
@ -642,12 +645,14 @@ grub_efiemu_mm_do_alloc (void)
|
|||
if (!efiemu_mmap)
|
||||
{
|
||||
grub_efiemu_unload ();
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't initialize mmap");
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
if ((err = efiemu_alloc_requests ()))
|
||||
err = efiemu_alloc_requests ();
|
||||
if (err)
|
||||
return err;
|
||||
if ((err = grub_efiemu_mmap_fill ()))
|
||||
err = grub_efiemu_mmap_fill ();
|
||||
if (err)
|
||||
return err;
|
||||
return grub_efiemu_mmap_sort_and_uniq ();
|
||||
}
|
||||
|
|
|
@ -171,12 +171,6 @@ nvram_set (void * data __attribute__ ((unused)))
|
|||
(nvramsize - (nvramptr - nvram)) / 2,
|
||||
(grub_uint8_t *) varname, len, NULL);
|
||||
|
||||
if (len < 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "broken UTF-8 in variable name");
|
||||
return 1;
|
||||
}
|
||||
|
||||
nvramptr += 2 * len;
|
||||
*((grub_uint16_t *) nvramptr) = 0;
|
||||
nvramptr += 2;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/efiemu/efiemu.h>
|
||||
#include <grub/efiemu/runtime.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static int ptv_written = 0;
|
||||
static int ptv_alloc = 0;
|
||||
|
@ -69,7 +70,7 @@ grub_efiemu_request_symbols (int num)
|
|||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"symbols have already been allocated");
|
||||
if (num < 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
return grub_error (GRUB_ERR_BUG,
|
||||
"can't request negative symbols");
|
||||
ptv_requested += num;
|
||||
return GRUB_ERR_NONE;
|
||||
|
@ -88,7 +89,7 @@ grub_efiemu_resolve_symbol (const char *name, int *handle, grub_off_t *off)
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
grub_dprintf ("efiemu", "%s not found\n", name);
|
||||
return grub_error (GRUB_ERR_BAD_OS, "symbol %s isn't found", name);
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("symbol `%s' not found"), name);
|
||||
}
|
||||
|
||||
/* Register symbol named NAME in memory handle HANDLE at offset OFF */
|
||||
|
@ -99,7 +100,7 @@ grub_efiemu_register_symbol (const char *name, int handle, grub_off_t off)
|
|||
cur = (struct grub_efiemu_sym *) grub_malloc (sizeof (*cur));
|
||||
grub_dprintf ("efiemu", "registering symbol '%s'\n", name);
|
||||
if (!cur)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't register symbol");
|
||||
return grub_errno;
|
||||
cur->name = grub_strdup (name);
|
||||
cur->next = efiemu_syms;
|
||||
cur->handle = handle;
|
||||
|
@ -153,7 +154,7 @@ grub_efiemu_write_value (void *addr, grub_uint32_t value, int plus_handle,
|
|||
= grub_efiemu_mm_obtain_request (ptv_handle);
|
||||
|
||||
if (ptv_needed && ptv_written >= ptv_alloc)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
return grub_error (GRUB_ERR_BUG,
|
||||
"your module didn't declare efiemu "
|
||||
" relocators correctly");
|
||||
|
||||
|
@ -200,7 +201,7 @@ grub_efiemu_write_value (void *addr, grub_uint32_t value, int plus_handle,
|
|||
*((grub_uint8_t *) addr) = value;
|
||||
break;
|
||||
default:
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "wrong symbol size");
|
||||
return grub_error (GRUB_ERR_BUG, "wrong symbol size");
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
|
|
|
@ -29,7 +29,7 @@ loadfont_command (grub_command_t cmd __attribute__ ((unused)),
|
|||
char **args)
|
||||
{
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no font specified");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
while (argc--)
|
||||
if (grub_font_load (*args++) != 0)
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -529,7 +530,7 @@ find_in_b_tree (grub_disk_t disk,
|
|||
if (err)
|
||||
return err;
|
||||
if (node.count_keys == 0)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found",
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"),
|
||||
name);
|
||||
{
|
||||
char key_data[grub_bfs_to_cpu_treehead (node.total_key_len) + 1];
|
||||
|
@ -600,7 +601,7 @@ find_in_b_tree (grub_disk_t disk,
|
|||
level--;
|
||||
continue;
|
||||
}
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found",
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"),
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
@ -615,7 +616,7 @@ hop_level (grub_disk_t disk,
|
|||
grub_uint64_t res;
|
||||
|
||||
if (((grub_bfs_to_cpu32 (ino->mode) & ATTR_TYPE) != ATTR_DIR))
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
|
||||
err = find_in_b_tree (disk, sb, ino, name, &res);
|
||||
if (err)
|
||||
|
@ -677,7 +678,7 @@ find_file (const char *path, grub_disk_t disk,
|
|||
{
|
||||
grub_free (alloc);
|
||||
return grub_error (GRUB_ERR_SYMLINK_LOOP,
|
||||
"too deep nesting of symlinks");
|
||||
N_("too deep nesting of symlinks"));
|
||||
}
|
||||
|
||||
#ifndef MODE_AFS
|
||||
|
@ -829,7 +830,7 @@ grub_bfs_dir (grub_device_t device, const char *path,
|
|||
if (err)
|
||||
return err;
|
||||
if (((grub_bfs_to_cpu32 (ino.ino.mode) & ATTR_TYPE) != ATTR_DIR))
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
iterate_in_b_tree (device->disk, &sb, &ino.ino, hook);
|
||||
}
|
||||
|
||||
|
@ -857,7 +858,7 @@ grub_bfs_open (struct grub_file *file, const char *name)
|
|||
if (err)
|
||||
return err;
|
||||
if (((grub_bfs_to_cpu32 (ino.ino.mode) & ATTR_TYPE) != ATTR_REG))
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a regular file");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
|
||||
|
||||
data = grub_zalloc (sizeof (struct grub_bfs_data)
|
||||
+ grub_bfs_to_cpu32 (sb.bsize));
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <grub/lib/crc.h>
|
||||
#include <grub/deflate.h>
|
||||
#include <minilzo.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -1204,7 +1205,7 @@ find_path (struct grub_btrfs_data *data,
|
|||
{
|
||||
grub_free (path_alloc);
|
||||
grub_free (origpath);
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
}
|
||||
|
||||
key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM;
|
||||
|
@ -1223,7 +1224,7 @@ find_path (struct grub_btrfs_data *data,
|
|||
{
|
||||
grub_free (direl);
|
||||
grub_free (path_alloc);
|
||||
err = grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
|
||||
err = grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), origpath);
|
||||
grub_free (origpath);
|
||||
return err;
|
||||
}
|
||||
|
@ -1267,7 +1268,7 @@ find_path (struct grub_btrfs_data *data,
|
|||
{
|
||||
grub_free (direl);
|
||||
grub_free (path_alloc);
|
||||
err = grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
|
||||
err = grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), origpath);
|
||||
grub_free (origpath);
|
||||
return err;
|
||||
}
|
||||
|
@ -1285,7 +1286,7 @@ find_path (struct grub_btrfs_data *data,
|
|||
grub_free (path_alloc);
|
||||
grub_free (origpath);
|
||||
return grub_error (GRUB_ERR_SYMLINK_LOOP,
|
||||
"too deep nesting of symlinks");
|
||||
N_("too deep nesting of symlinks"));
|
||||
}
|
||||
|
||||
err = grub_btrfs_read_inode (data, &inode,
|
||||
|
@ -1355,7 +1356,7 @@ find_path (struct grub_btrfs_data *data,
|
|||
{
|
||||
grub_free (direl);
|
||||
grub_free (path_alloc);
|
||||
err = grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
|
||||
err = grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), origpath);
|
||||
grub_free (origpath);
|
||||
return err;
|
||||
}
|
||||
|
@ -1378,7 +1379,7 @@ find_path (struct grub_btrfs_data *data,
|
|||
{
|
||||
grub_free (direl);
|
||||
grub_free (path_alloc);
|
||||
err = grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
|
||||
err = grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), origpath);
|
||||
grub_free (origpath);
|
||||
return err;
|
||||
}
|
||||
|
@ -1430,7 +1431,7 @@ grub_btrfs_dir (grub_device_t device, const char *path,
|
|||
if (type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY)
|
||||
{
|
||||
grub_btrfs_unmount (data);
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
}
|
||||
|
||||
err = lower_bound (data, &key_in, &key_out, tree, &elemaddr, &elemsize, &desc);
|
||||
|
@ -1535,7 +1536,7 @@ grub_btrfs_open (struct grub_file *file, const char *name)
|
|||
if (type != GRUB_BTRFS_DIR_ITEM_TYPE_REGULAR)
|
||||
{
|
||||
grub_btrfs_unmount (data);
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a regular file");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
|
||||
}
|
||||
|
||||
data->inode = key_in.object_id;
|
||||
|
@ -1628,8 +1629,8 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)),
|
|||
|
||||
if (64 * 2 - 1 < *nsectors)
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"Your core.img is unusually large. "
|
||||
"It won't fit in the embedding area.");
|
||||
N_("your core.img is unusually large. "
|
||||
"It won't fit in the embedding area"));
|
||||
|
||||
*nsectors = 64 * 2 - 1;
|
||||
*sectors = grub_malloc (*nsectors * sizeof (**sectors));
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -564,7 +565,7 @@ grub_cpio_dir (grub_device_t device, const char *path_in,
|
|||
if (++symlinknest == 8)
|
||||
{
|
||||
grub_error (GRUB_ERR_SYMLINK_LOOP,
|
||||
"too deep nesting of symlinks");
|
||||
N_("too deep nesting of symlinks"));
|
||||
goto fail;
|
||||
}
|
||||
ofs = 0;
|
||||
|
@ -622,7 +623,7 @@ grub_cpio_open (grub_file_t file, const char *name_in)
|
|||
|
||||
if (!ofs)
|
||||
{
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), name_in);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -638,7 +639,7 @@ grub_cpio_open (grub_file_t file, const char *name_in)
|
|||
if (++symlinknest == 8)
|
||||
{
|
||||
grub_error (GRUB_ERR_SYMLINK_LOOP,
|
||||
"too deep nesting of symlinks");
|
||||
N_("too deep nesting of symlinks"));
|
||||
goto fail;
|
||||
}
|
||||
goto no_match;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/charset.h>
|
||||
#include <grub/fat.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -687,7 +688,7 @@ grub_fat_iterate_dir (grub_disk_t disk, struct grub_fat_data *data,
|
|||
grub_ssize_t offset = -sizeof(dir);
|
||||
|
||||
if (! (data->attr & GRUB_FAT_ATTR_DIRECTORY))
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
|
||||
/* Allocate space enough to hold a long name. */
|
||||
filename = grub_malloc (0x40 * 13 * GRUB_MAX_UTF8_PER_UTF16 + 1);
|
||||
|
@ -864,7 +865,7 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data,
|
|||
|
||||
if (! (data->attr & GRUB_FAT_ATTR_DIRECTORY))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -896,7 +897,7 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data,
|
|||
|
||||
grub_fat_iterate_dir (disk, data, iter_hook);
|
||||
if (grub_errno == GRUB_ERR_NONE && ! found && !call_hook)
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), origpath);
|
||||
|
||||
fail:
|
||||
grub_free (dirname);
|
||||
|
@ -972,7 +973,7 @@ grub_fat_open (grub_file_t file, const char *name)
|
|||
|
||||
if (data->attr & GRUB_FAT_ATTR_DIRECTORY)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a file");
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -1086,7 +1087,7 @@ grub_fat_label (grub_device_t device, char **label)
|
|||
|
||||
if (! (data->attr & GRUB_FAT_ATTR_DIRECTORY))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/fshelp.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -128,7 +129,7 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
|
|||
if (type != GRUB_FSHELP_DIR)
|
||||
{
|
||||
free_node (currnode);
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
}
|
||||
|
||||
/* Iterate over the directory. */
|
||||
|
@ -152,7 +153,7 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
|
|||
free_node (currnode);
|
||||
free_node (oldnode);
|
||||
return grub_error (GRUB_ERR_SYMLINK_LOOP,
|
||||
"too deep nesting of symlinks");
|
||||
N_("too deep nesting of symlinks"));
|
||||
}
|
||||
|
||||
symlink = read_symlink (currnode);
|
||||
|
@ -196,12 +197,12 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
|
|||
name = next;
|
||||
}
|
||||
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path);
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), path);
|
||||
}
|
||||
|
||||
if (!path || path[0] != '/')
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, N_("invalid file name `%s'"), path);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
@ -211,9 +212,9 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
|
|||
|
||||
/* Check if the node that was found was of the expected type. */
|
||||
if (expecttype == GRUB_FSHELP_REG && foundtype != expecttype)
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a regular file");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
|
||||
else if (expecttype == GRUB_FSHELP_DIR && foundtype != expecttype)
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/hfs.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -1079,7 +1080,7 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
|
|||
|
||||
if (path[0] != '/')
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, N_("invalid file name `%s'"), path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1096,7 +1097,7 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
|
|||
grub_ssize_t slen;
|
||||
if (fdrec.frec.type != GRUB_HFS_FILETYPE_DIR)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -1114,7 +1115,7 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
|
|||
slen = utf8_to_macroman (key.str, path);
|
||||
if (slen < 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path);
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), path);
|
||||
goto fail;
|
||||
}
|
||||
key.strlen = slen;
|
||||
|
@ -1123,7 +1124,7 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
|
|||
if (! grub_hfs_find_node (data, (char *) &key, data->cat_root,
|
||||
0, (char *) &fdrec.frec, sizeof (fdrec.frec)))
|
||||
{
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), origpath);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -1207,7 +1208,7 @@ grub_hfs_dir (grub_device_t device, const char *path,
|
|||
|
||||
if (frec.type != GRUB_HFS_FILETYPE_DIR)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -1243,7 +1244,7 @@ grub_hfs_open (struct grub_file *file, const char *name)
|
|||
if (frec.type != GRUB_HFS_FILETYPE_FILE)
|
||||
{
|
||||
grub_free (data);
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a file");
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
|
||||
grub_dl_unref (my_mod);
|
||||
return grub_errno;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/charset.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -403,7 +404,7 @@ grub_jfs_opendir (struct grub_jfs_data *data, struct grub_jfs_inode *inode)
|
|||
if (!((grub_le_to_cpu32 (inode->mode)
|
||||
& GRUB_JFS_FILETYPE_MASK) == GRUB_JFS_FILETYPE_DIR))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -704,7 +705,7 @@ grub_jfs_find_file (struct grub_jfs_data *data, const char *path,
|
|||
}
|
||||
|
||||
grub_jfs_closedir (diro);
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path);
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), path);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
@ -716,7 +717,7 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino)
|
|||
char symlink[size + 1];
|
||||
|
||||
if (++data->linknest > GRUB_JFS_MAX_SYMLNK_CNT)
|
||||
return grub_error (GRUB_ERR_SYMLINK_LOOP, "too deep nesting of symlinks");
|
||||
return grub_error (GRUB_ERR_SYMLINK_LOOP, N_("too deep nesting of symlinks"));
|
||||
|
||||
if (size <= sizeof (data->currinode.symlink.path))
|
||||
grub_strncpy (symlink, (char *) (data->currinode.symlink.path), size);
|
||||
|
@ -730,8 +731,6 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino)
|
|||
ino = 2;
|
||||
|
||||
grub_jfs_find_file (data, symlink, ino);
|
||||
if (grub_errno)
|
||||
grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
@ -810,7 +809,7 @@ grub_jfs_open (struct grub_file *file, const char *name)
|
|||
if (! ((grub_le_to_cpu32 (data->currinode.mode)
|
||||
& GRUB_JFS_FILETYPE_MASK) == GRUB_JFS_FILETYPE_REG))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a regular file");
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -332,7 +333,7 @@ grub_minix_lookup_symlink (struct grub_minix_data *data, int ino)
|
|||
char symlink[GRUB_MINIX_INODE_SIZE (data) + 1];
|
||||
|
||||
if (++data->linknest > GRUB_MINIX_MAX_SYMLNK_CNT)
|
||||
return grub_error (GRUB_ERR_SYMLINK_LOOP, "too deep nesting of symlinks");
|
||||
return grub_error (GRUB_ERR_SYMLINK_LOOP, N_("too deep nesting of symlinks"));
|
||||
|
||||
if (grub_minix_read_file (data, 0, 0,
|
||||
GRUB_MINIX_INODE_SIZE (data), symlink) < 0)
|
||||
|
@ -349,8 +350,6 @@ grub_minix_lookup_symlink (struct grub_minix_data *data, int ino)
|
|||
return grub_errno;
|
||||
|
||||
grub_minix_find_file (data, symlink);
|
||||
if (grub_errno)
|
||||
grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
@ -433,7 +432,7 @@ grub_minix_find_file (struct grub_minix_data *data, const char *path)
|
|||
|
||||
if ((GRUB_MINIX_INODE_MODE (data)
|
||||
& GRUB_MINIX_IFDIR) != GRUB_MINIX_IFDIR)
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -441,7 +440,7 @@ grub_minix_find_file (struct grub_minix_data *data, const char *path)
|
|||
pos += sizeof (ino) + data->filename_size;
|
||||
} while (pos < GRUB_MINIX_INODE_SIZE (data));
|
||||
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path);
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), path);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
@ -532,7 +531,7 @@ grub_minix_dir (grub_device_t device, const char *path,
|
|||
|
||||
if ((GRUB_MINIX_INODE_MODE (data) & GRUB_MINIX_IFDIR) != GRUB_MINIX_IFDIR)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -600,7 +599,7 @@ grub_minix_open (struct grub_file *file, const char *name)
|
|||
|
||||
if (!name || name[0] != '/')
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, N_("invalid file name `%s'"), name);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/fshelp.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -477,6 +478,7 @@ grub_reiserfs_get_item (struct grub_reiserfs_data *data,
|
|||
grub_uint16_t previous_level = ~0;
|
||||
struct grub_reiserfs_item_header *item_headers = 0;
|
||||
|
||||
#if 0
|
||||
if (! data)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS, "data is NULL");
|
||||
|
@ -494,6 +496,7 @@ grub_reiserfs_get_item (struct grub_reiserfs_data *data,
|
|||
grub_error (GRUB_ERR_BAD_FS, "item is NULL");
|
||||
goto fail;
|
||||
}
|
||||
#endif
|
||||
|
||||
block_size = grub_le_to_cpu16 (data->superblock.block_size);
|
||||
block_number = grub_le_to_cpu32 (data->superblock.root_block);
|
||||
|
@ -725,8 +728,7 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item,
|
|||
|
||||
if (item->type != GRUB_REISERFS_DIRECTORY)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
"grub_reiserfs_iterate_dir called on a non-directory item");
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
goto fail;
|
||||
}
|
||||
block_size = grub_le_to_cpu16 (data->superblock.block_size);
|
||||
|
@ -754,7 +756,7 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item,
|
|||
#if 0
|
||||
if (grub_le_to_cpu16 (block_header->level) != 1)
|
||||
{
|
||||
grub_error (GRUB_ERR_TEST_FAILURE,
|
||||
grub_error (GRUB_ERR_BAD_FS,
|
||||
"reiserfs: block %d is not a leaf block",
|
||||
block_number);
|
||||
goto fail;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -398,7 +399,7 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino)
|
|||
char symlink[INODE_SIZE (data) + 1];
|
||||
|
||||
if (++data->linknest > GRUB_UFS_MAX_SYMLNK_CNT)
|
||||
return grub_error (GRUB_ERR_SYMLINK_LOOP, "too deep nesting of symlinks");
|
||||
return grub_error (GRUB_ERR_SYMLINK_LOOP, N_("too deep nesting of symlinks"));
|
||||
|
||||
if (INODE_SIZE (data) <= sizeof (data->inode.symlink))
|
||||
grub_strcpy (symlink, (char *) INODE (data, symlink));
|
||||
|
@ -415,8 +416,6 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino)
|
|||
return grub_errno;
|
||||
|
||||
grub_ufs_find_file (data, symlink);
|
||||
if (grub_errno)
|
||||
grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
@ -504,7 +503,7 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path)
|
|||
}
|
||||
|
||||
if ((INODE_MODE(data) & GRUB_UFS_ATTR_TYPE) != GRUB_UFS_ATTR_DIR)
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -513,7 +512,7 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path)
|
|||
pos += grub_le_to_cpu16 (dirent.direntlen);
|
||||
} while (pos < INODE_SIZE (data));
|
||||
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path);
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), path);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
@ -589,7 +588,7 @@ grub_ufs_dir (grub_device_t device, const char *path,
|
|||
|
||||
if (!path || path[0] != '/')
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, N_("invalid file name `%s'"), path);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
@ -599,7 +598,7 @@ grub_ufs_dir (grub_device_t device, const char *path,
|
|||
|
||||
if ((INODE_MODE (data) & GRUB_UFS_ATTR_TYPE) != GRUB_UFS_ATTR_DIR)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -669,7 +668,7 @@ grub_ufs_open (struct grub_file *file, const char *name)
|
|||
|
||||
if (!name || name[0] != '/')
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, N_("invalid file name `%s'"), name);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include <grub/zfs/dsl_dataset.h>
|
||||
#include <grub/deflate.h>
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -1766,7 +1767,7 @@ mzap_lookup (mzap_phys_t * zapobj, grub_zfs_endian_t endian,
|
|||
}
|
||||
}
|
||||
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "couldn't find %s", name);
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), name);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1971,7 +1972,7 @@ zap_leaf_lookup (zap_leaf_phys_t * l, grub_zfs_endian_t endian,
|
|||
}
|
||||
}
|
||||
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "couldn't find %s", name);
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2487,7 +2488,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
|
|||
if (dnode_path->dn.dn.dn_type != DMU_OT_DIRECTORY_CONTENTS)
|
||||
{
|
||||
grub_free (path_buf);
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
}
|
||||
err = zap_lookup (&(dnode_path->dn), cname, &objnum,
|
||||
data, subvol->case_insensitive);
|
||||
|
@ -3483,14 +3484,14 @@ grub_zfs_open (struct grub_file *file, const char *fsfilename)
|
|||
if (isfs)
|
||||
{
|
||||
zfs_unmount (data);
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "Missing @ or / separator");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("missing `%c' symbol"), '@');
|
||||
}
|
||||
|
||||
/* We found the dnode for this file. Verify if it is a plain file. */
|
||||
if (data->dnode.dn.dn_type != DMU_OT_PLAIN_FILE_CONTENTS)
|
||||
{
|
||||
zfs_unmount (data);
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a file");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
|
||||
}
|
||||
|
||||
/* get the file size and set the file position to 0 */
|
||||
|
@ -3882,7 +3883,7 @@ grub_zfs_dir (grub_device_t device, const char *path,
|
|||
if (data->dnode.dn.dn_type != DMU_OT_DIRECTORY_CONTENTS)
|
||||
{
|
||||
zfs_unmount (data);
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
}
|
||||
zap_iterate_u64 (&(data->dnode), iterate_zap, data);
|
||||
}
|
||||
|
@ -3905,8 +3906,8 @@ grub_zfs_embed (grub_device_t device __attribute__ ((unused)),
|
|||
|
||||
if ((VDEV_BOOT_SIZE >> GRUB_DISK_SECTOR_BITS) < *nsectors)
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"Your core.img is unusually large. "
|
||||
"It won't fit in the embedding area.");
|
||||
N_("your core.img is unusually large. "
|
||||
"It won't fit in the embedding area"));
|
||||
|
||||
*nsectors = (VDEV_BOOT_SIZE >> GRUB_DISK_SECTOR_BITS);
|
||||
*sectors = grub_malloc (*nsectors * sizeof (**sectors));
|
||||
|
|
|
@ -45,31 +45,32 @@ print_state (char *nvlist, int tab)
|
|||
int isok = 1;
|
||||
|
||||
print_tabs (tab);
|
||||
grub_xputs (_("State: "));
|
||||
|
||||
if (grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_REMOVED, &ival))
|
||||
{
|
||||
grub_xputs (_("removed "));
|
||||
grub_puts_ (N_("Virtual device is removed"));
|
||||
isok = 0;
|
||||
}
|
||||
|
||||
if (grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_FAULTED, &ival))
|
||||
{
|
||||
grub_xputs (_("faulted "));
|
||||
grub_puts_ (N_("Virtual device is faulted"));
|
||||
isok = 0;
|
||||
}
|
||||
|
||||
if (grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_OFFLINE, &ival))
|
||||
{
|
||||
grub_xputs (_("offline "));
|
||||
grub_puts_ (N_("Virtual device is offline"));
|
||||
isok = 0;
|
||||
}
|
||||
|
||||
if (grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_FAULTED, &ival))
|
||||
grub_xputs (_("degraded "));
|
||||
/* TRANSLATORS: degraded doesn't mean broken but that some of
|
||||
component are missing but virtual device as whole is still usable. */
|
||||
grub_puts_ (N_("Virtual device is degraded"));
|
||||
|
||||
if (isok)
|
||||
grub_xputs (_("online"));
|
||||
grub_puts_ (N_("Virtual device is online"));
|
||||
grub_xputs ("\n");
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
|
@ -85,7 +86,7 @@ print_vdev_info (char *nvlist, int tab)
|
|||
if (!type)
|
||||
{
|
||||
print_tabs (tab);
|
||||
grub_puts_ (N_("Incorrect VDEV: no type available"));
|
||||
grub_puts_ (N_("Incorrect virtual device: no type available"));
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
@ -96,7 +97,7 @@ print_vdev_info (char *nvlist, int tab)
|
|||
char *devid = 0;
|
||||
|
||||
print_tabs (tab);
|
||||
grub_puts_ (N_("Leaf VDEV"));
|
||||
grub_puts_ (N_("Leaf virtual device (file or disk)"));
|
||||
|
||||
print_state (nvlist, tab);
|
||||
|
||||
|
@ -137,10 +138,10 @@ print_vdev_info (char *nvlist, int tab)
|
|||
print_tabs (tab);
|
||||
if (nelm <= 0)
|
||||
{
|
||||
grub_puts_ (N_("Incorrect mirror VDEV"));
|
||||
grub_puts_ (N_("Incorrect mirror"));
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
grub_printf_ (N_("Mirror VDEV with %d children\n"), nelm);
|
||||
grub_printf_ (N_("Mirror with %d children\n"), nelm);
|
||||
print_state (nvlist, tab);
|
||||
for (i = 0; i < nelm; i++)
|
||||
{
|
||||
|
@ -152,11 +153,11 @@ print_vdev_info (char *nvlist, int tab)
|
|||
print_tabs (tab);
|
||||
if (!child)
|
||||
{
|
||||
grub_printf_ (N_("Mirror VDEV element %d isn't correct\n"), i);
|
||||
grub_printf_ (N_("Mirror element %d isn't correct\n"), i);
|
||||
continue;
|
||||
}
|
||||
|
||||
grub_printf_ (N_("Mirror VDEV element %d:\n"), i);
|
||||
grub_printf_ (N_("Mirror element %d:\n"), i);
|
||||
print_vdev_info (child, tab + 1);
|
||||
|
||||
grub_free (child);
|
||||
|
@ -165,7 +166,7 @@ print_vdev_info (char *nvlist, int tab)
|
|||
}
|
||||
|
||||
print_tabs (tab);
|
||||
grub_printf_ (N_("Unknown VDEV type: %s\n"), type);
|
||||
grub_printf_ (N_("Unknown virtual device type: %s\n"), type);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -298,7 +299,7 @@ grub_cmd_zfsinfo (grub_command_t cmd __attribute__ ((unused)), int argc,
|
|||
nv = grub_zfs_nvlist_lookup_nvlist (nvlist, ZPOOL_CONFIG_VDEV_TREE);
|
||||
|
||||
if (!nv)
|
||||
grub_puts_ (N_("No vdev tree available"));
|
||||
grub_puts_ (N_("No virtual device tree available"));
|
||||
else
|
||||
print_vdev_info (nv, 1);
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <grub/gfxmenu_model.h>
|
||||
#include <grub/gfxmenu_view.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -58,7 +59,8 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
|
|||
|
||||
theme_path = grub_env_get ("theme");
|
||||
if (! theme_path)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no theme specified");
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"),
|
||||
"theme");
|
||||
|
||||
instance = grub_zalloc (sizeof (*instance));
|
||||
if (!instance)
|
||||
|
|
|
@ -151,11 +151,6 @@ rescale_image (grub_gui_image_t self)
|
|||
height,
|
||||
self->raw_bitmap,
|
||||
GRUB_VIDEO_BITMAP_SCALE_METHOD_BEST);
|
||||
if (grub_errno != GRUB_ERR_NONE)
|
||||
{
|
||||
grub_error_push ();
|
||||
grub_error (grub_errno, "failed to scale bitmap for image component");
|
||||
}
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
@ -224,7 +219,7 @@ image_set_property (void *vself, const char *name, const char *value)
|
|||
|
||||
/* Resolve to an absolute path. */
|
||||
if (! self->theme_dir)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unspecified theme_dir");
|
||||
return grub_error (GRUB_ERR_BUG, "unspecified theme_dir");
|
||||
absvalue = grub_resolve_relative_path (self->theme_dir, value);
|
||||
if (! absvalue)
|
||||
return grub_errno;
|
||||
|
|
|
@ -169,11 +169,7 @@ try_loading_icon (grub_gfxmenu_icon_manager_t mgr,
|
|||
GRUB_VIDEO_BITMAP_SCALE_METHOD_BEST);
|
||||
grub_video_bitmap_destroy (raw_bitmap);
|
||||
if (! scaled_bitmap)
|
||||
{
|
||||
grub_error_push ();
|
||||
grub_error (grub_errno, "failed to scale icon");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return scaled_bitmap;
|
||||
}
|
||||
|
|
|
@ -130,12 +130,6 @@ scale_pixmap (grub_gfxmenu_box_t self, int i, int w, int h)
|
|||
if (w != 0 && h != 0)
|
||||
grub_video_bitmap_create_scaled (scaled, w, h, raw,
|
||||
GRUB_VIDEO_BITMAP_SCALE_METHOD_BEST);
|
||||
if (grub_errno != GRUB_ERR_NONE)
|
||||
{
|
||||
grub_error_push ();
|
||||
grub_error (grub_errno,
|
||||
"failed to scale bitmap for styled box pixmap #%d", i);
|
||||
}
|
||||
}
|
||||
|
||||
return grub_errno;
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <grub/file.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/deflate.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -193,10 +194,7 @@ test_gzip_header (grub_file_t file)
|
|||
if (grub_file_read (gzio->file, &hdr, 10) != 10
|
||||
|| ((hdr.magic != GZIP_MAGIC)
|
||||
&& (hdr.magic != OLD_GZIP_MAGIC)))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "no gzip magic found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This does consistency checking on the header data. If a
|
||||
|
@ -211,10 +209,7 @@ test_gzip_header (grub_file_t file)
|
|||
grub_le_to_cpu16 (extra_len))))
|
||||
|| ((hdr.flags & ORIG_NAME) && eat_field (gzio->file, -1))
|
||||
|| ((hdr.flags & COMMENT) && eat_field (gzio->file, -1)))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, "unsupported gzip format");
|
||||
return 0;
|
||||
}
|
||||
|
||||
gzio->data_offset = grub_file_tell (gzio->file);
|
||||
|
||||
|
@ -222,10 +217,7 @@ test_gzip_header (grub_file_t file)
|
|||
{
|
||||
grub_file_seek (gzio->file, grub_file_size (gzio->file) - 4);
|
||||
if (grub_file_read (gzio->file, &orig_len, 4) != 4)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "unsupported gzip format");
|
||||
return 0;
|
||||
}
|
||||
/* FIXME: this does not handle files whose original size is over 4GB.
|
||||
But how can we know the real original size? */
|
||||
file->size = grub_le_to_cpu32 (orig_len);
|
||||
|
@ -402,7 +394,7 @@ gzio_seek (grub_gzio_t gzio, grub_off_t off)
|
|||
{
|
||||
if (off > gzio->mem_input_size)
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"attempt to seek outside of the file");
|
||||
N_("attempt to seek outside of the file"));
|
||||
else
|
||||
gzio->mem_input_off = off;
|
||||
}
|
||||
|
@ -1158,10 +1150,10 @@ grub_gzio_open (grub_file_t io)
|
|||
|
||||
if (! test_gzip_header (file))
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
grub_free (gzio);
|
||||
grub_free (file);
|
||||
grub_file_seek (io, 0);
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
return io;
|
||||
}
|
||||
|
|
|
@ -299,31 +299,17 @@ test_header (grub_file_t file)
|
|||
grub_uint8_t *name = NULL;
|
||||
|
||||
if (grub_file_read (lzopio->file, &header, sizeof (header)) != sizeof (header))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "no lzop magic found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (grub_memcmp (header.magic, LZOP_MAGIC, LZOP_MAGIC_SIZE) != 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "no lzop magic found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (grub_be_to_cpu16(header.lib_version) < LZOP_NEW_LIB)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_COMPRESSED_DATA,
|
||||
"unsupported (too old) LZOP version");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Too new version, should upgrade minilzo? */
|
||||
if (grub_be_to_cpu16 (header.lib_version_ext) > MINILZO_VERSION)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_COMPRESSED_DATA,
|
||||
"unsupported (too new) LZO version");
|
||||
return 0;
|
||||
}
|
||||
|
||||
flags = grub_be_to_cpu32 (header.flags);
|
||||
|
||||
|
@ -417,8 +403,6 @@ test_header (grub_file_t file)
|
|||
return 1;
|
||||
|
||||
CORRUPTED:
|
||||
grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, "lzop file corrupted");
|
||||
|
||||
grub_free(name);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -98,24 +98,15 @@ test_header (grub_file_t file)
|
|||
STREAM_HEADER_SIZE);
|
||||
|
||||
if (xzio->buf.in_size != STREAM_HEADER_SIZE)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "no xz magic found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = xz_dec_run (xzio->dec, &xzio->buf);
|
||||
|
||||
if (ret == XZ_FORMAT_ERROR)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "no xz magic found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ret != XZ_OK)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, "not supported xz options");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -174,7 +165,6 @@ test_footer (grub_file_t file)
|
|||
return 1;
|
||||
|
||||
ERROR:
|
||||
grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, "bad footer magic");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
grub_net_t (*grub_net_open) (const char *name) = NULL;
|
||||
|
||||
|
@ -39,7 +40,7 @@ grub_device_open (const char *name)
|
|||
name = grub_env_get ("root");
|
||||
if (name == NULL || *name == '\0')
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_DEVICE, "no device is set");
|
||||
grub_error (GRUB_ERR_BAD_DEVICE, N_("variable `%s' isn't set"), "root");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#define GRUB_CACHE_TIMEOUT 2
|
||||
|
||||
|
@ -263,7 +264,8 @@ grub_disk_open (const char *name)
|
|||
|
||||
if (! dev)
|
||||
{
|
||||
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no such disk");
|
||||
grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' not found"),
|
||||
name);
|
||||
goto fail;
|
||||
}
|
||||
if (disk->log_sector_size > GRUB_DISK_CACHE_BITS + GRUB_DISK_SECTOR_BITS
|
||||
|
@ -360,7 +362,8 @@ grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
|
|||
if (*sector >= len
|
||||
|| len - *sector < ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1)
|
||||
>> GRUB_DISK_SECTOR_BITS))
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of partition");
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("attempt to read or write outside of partition"));
|
||||
|
||||
*sector += start;
|
||||
}
|
||||
|
@ -371,7 +374,8 @@ grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
|
|||
>> GRUB_DISK_SECTOR_BITS) > (disk->total_sectors
|
||||
<< (disk->log_sector_size
|
||||
- GRUB_DISK_SECTOR_BITS)) - *sector))
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk");
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("attempt to read or write outside of disk `%s'"), disk->name);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <grub/file.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/cache.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* Platforms where modules are in a readonly area of memory. */
|
||||
#if defined(GRUB_MACHINE_QEMU)
|
||||
|
@ -208,20 +209,24 @@ static grub_err_t
|
|||
grub_dl_check_header (void *ehdr, grub_size_t size)
|
||||
{
|
||||
Elf_Ehdr *e = ehdr;
|
||||
grub_err_t err;
|
||||
|
||||
/* Check the header size. */
|
||||
if (size < sizeof (Elf_Ehdr))
|
||||
return grub_error (GRUB_ERR_BAD_OS, "ELF header smaller than expected");
|
||||
|
||||
/* Check the magic numbers. */
|
||||
if (grub_arch_dl_check_header (ehdr)
|
||||
|| e->e_ident[EI_MAG0] != ELFMAG0
|
||||
if (e->e_ident[EI_MAG0] != ELFMAG0
|
||||
|| e->e_ident[EI_MAG1] != ELFMAG1
|
||||
|| e->e_ident[EI_MAG2] != ELFMAG2
|
||||
|| e->e_ident[EI_MAG3] != ELFMAG3
|
||||
|| e->e_ident[EI_VERSION] != EV_CURRENT
|
||||
|| e->e_version != EV_CURRENT)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid arch independent ELF magic");
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch independent ELF magic"));
|
||||
|
||||
err = grub_arch_dl_check_header (ehdr);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -345,7 +350,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
|
|||
break;
|
||||
|
||||
if (i == e->e_shnum)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, "no symbol table");
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
||||
|
||||
#ifdef GRUB_MODULES_MACHINE_READONLY
|
||||
mod->symtab = grub_malloc (s->sh_size);
|
||||
|
@ -378,7 +383,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
|
|||
grub_symbol_t nsym = grub_dl_resolve_symbol (name);
|
||||
if (! nsym)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||
"symbol not found: `%s'", name);
|
||||
N_("symbol `%s' not found"), name);
|
||||
sym->st_value = (Elf_Addr) nsym->addr;
|
||||
if (nsym->isfunc)
|
||||
sym->st_info = ELF_ST_INFO (bind, STT_FUNC);
|
||||
|
@ -596,7 +601,7 @@ grub_dl_load_core (void *addr, grub_size_t size)
|
|||
|
||||
if (e->e_type != ET_REL)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_MODULE, "invalid ELF file type");
|
||||
grub_error (GRUB_ERR_BAD_MODULE, N_("this ELF file is not of the right type"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -704,7 +709,7 @@ grub_dl_load (const char *name)
|
|||
return mod;
|
||||
|
||||
if (! grub_dl_dir) {
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "\"prefix\" is not set");
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -39,7 +40,7 @@ grub_elf_check_header (grub_elf_t elf)
|
|||
|| e->e_ident[EI_MAG3] != ELFMAG3
|
||||
|| e->e_ident[EI_VERSION] != EV_CURRENT
|
||||
|| e->e_version != EV_CURRENT)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid arch independent ELF magic");
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch independent ELF magic"));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -59,7 +60,7 @@ grub_elf_close (grub_elf_t elf)
|
|||
}
|
||||
|
||||
grub_elf_t
|
||||
grub_elf_file (grub_file_t file)
|
||||
grub_elf_file (grub_file_t file, const char *filename)
|
||||
{
|
||||
grub_elf_t elf;
|
||||
|
||||
|
@ -75,8 +76,9 @@ grub_elf_file (grub_file_t file)
|
|||
if (grub_file_read (elf->file, &elf->ehdr, sizeof (elf->ehdr))
|
||||
!= sizeof (elf->ehdr))
|
||||
{
|
||||
grub_error_push ();
|
||||
grub_error (GRUB_ERR_READ_ERROR, "cannot read ELF header");
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
|
||||
filename);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -101,7 +103,7 @@ grub_elf_open (const char *name)
|
|||
if (! file)
|
||||
return 0;
|
||||
|
||||
elf = grub_elf_file (file);
|
||||
elf = grub_elf_file (file, name);
|
||||
if (! elf)
|
||||
grub_file_close (file);
|
||||
|
||||
|
@ -118,7 +120,7 @@ grub_elf_is_elf32 (grub_elf_t elf)
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_elf32_load_phdrs (grub_elf_t elf)
|
||||
grub_elf32_load_phdrs (grub_elf_t elf, const char *filename)
|
||||
{
|
||||
grub_ssize_t phdrs_size;
|
||||
|
||||
|
@ -135,8 +137,10 @@ grub_elf32_load_phdrs (grub_elf_t elf)
|
|||
if ((grub_file_seek (elf->file, elf->ehdr.ehdr32.e_phoff) == (grub_off_t) -1)
|
||||
|| (grub_file_read (elf->file, elf->phdrs, phdrs_size) != phdrs_size))
|
||||
{
|
||||
grub_error_push ();
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "cannot read program headers");
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
|
||||
filename);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
|
@ -144,6 +148,7 @@ grub_elf32_load_phdrs (grub_elf_t elf)
|
|||
|
||||
grub_err_t
|
||||
grub_elf32_phdr_iterate (grub_elf_t elf,
|
||||
const char *filename,
|
||||
int NESTED_FUNC_ATTR (*hook) (grub_elf_t, Elf32_Phdr *, void *),
|
||||
void *hook_arg)
|
||||
{
|
||||
|
@ -151,7 +156,7 @@ grub_elf32_phdr_iterate (grub_elf_t elf,
|
|||
unsigned int i;
|
||||
|
||||
if (! elf->phdrs)
|
||||
if (grub_elf32_load_phdrs (elf))
|
||||
if (grub_elf32_load_phdrs (elf, filename))
|
||||
return grub_errno;
|
||||
phdrs = elf->phdrs;
|
||||
|
||||
|
@ -174,7 +179,8 @@ grub_elf32_phdr_iterate (grub_elf_t elf,
|
|||
|
||||
/* Calculate the amount of memory spanned by the segments. */
|
||||
grub_size_t
|
||||
grub_elf32_size (grub_elf_t elf, Elf32_Addr *base, grub_uint32_t *max_align)
|
||||
grub_elf32_size (grub_elf_t elf, const char *filename,
|
||||
Elf32_Addr *base, grub_uint32_t *max_align)
|
||||
{
|
||||
Elf32_Addr segments_start = (Elf32_Addr) -1;
|
||||
Elf32_Addr segments_end = 0;
|
||||
|
@ -201,7 +207,7 @@ grub_elf32_size (grub_elf_t elf, Elf32_Addr *base, grub_uint32_t *max_align)
|
|||
return 0;
|
||||
}
|
||||
|
||||
grub_elf32_phdr_iterate (elf, calcsize, 0);
|
||||
grub_elf32_phdr_iterate (elf, filename, calcsize, 0);
|
||||
|
||||
if (base)
|
||||
*base = 0;
|
||||
|
@ -228,7 +234,8 @@ grub_elf32_size (grub_elf_t elf, Elf32_Addr *base, grub_uint32_t *max_align)
|
|||
|
||||
/* Load every loadable segment into memory specified by `_load_hook'. */
|
||||
grub_err_t
|
||||
grub_elf32_load (grub_elf_t _elf, grub_elf32_load_hook_t _load_hook,
|
||||
grub_elf32_load (grub_elf_t _elf, const char *filename,
|
||||
grub_elf32_load_hook_t _load_hook,
|
||||
grub_addr_t *base, grub_size_t *size)
|
||||
{
|
||||
grub_addr_t load_base = (grub_addr_t) -1ULL;
|
||||
|
@ -257,11 +264,7 @@ grub_elf32_load (grub_elf_t _elf, grub_elf32_load_hook_t _load_hook,
|
|||
(unsigned long long) phdr->p_memsz);
|
||||
|
||||
if (grub_file_seek (elf->file, phdr->p_offset) == (grub_off_t) -1)
|
||||
{
|
||||
grub_error_push ();
|
||||
return grub_error (GRUB_ERR_BAD_OS,
|
||||
"invalid offset in program header");
|
||||
}
|
||||
return grub_errno;
|
||||
|
||||
if (phdr->p_filesz)
|
||||
{
|
||||
|
@ -270,11 +273,10 @@ grub_elf32_load (grub_elf_t _elf, grub_elf32_load_hook_t _load_hook,
|
|||
if (read != (grub_ssize_t) phdr->p_filesz)
|
||||
{
|
||||
/* XXX How can we free memory from `load_hook'? */
|
||||
grub_error_push ();
|
||||
return grub_error (GRUB_ERR_BAD_OS,
|
||||
"couldn't read segment from file: "
|
||||
"wanted 0x%lx bytes; read 0x%lx bytes",
|
||||
phdr->p_filesz, read);
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
|
||||
filename);
|
||||
return grub_errno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,7 +289,8 @@ grub_elf32_load (grub_elf_t _elf, grub_elf32_load_hook_t _load_hook,
|
|||
return 0;
|
||||
}
|
||||
|
||||
err = grub_elf32_phdr_iterate (_elf, grub_elf32_load_segment, _load_hook);
|
||||
err = grub_elf32_phdr_iterate (_elf, filename,
|
||||
grub_elf32_load_segment, _load_hook);
|
||||
|
||||
if (base)
|
||||
*base = load_base;
|
||||
|
@ -307,7 +310,7 @@ grub_elf_is_elf64 (grub_elf_t elf)
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_elf64_load_phdrs (grub_elf_t elf)
|
||||
grub_elf64_load_phdrs (grub_elf_t elf, const char *filename)
|
||||
{
|
||||
grub_ssize_t phdrs_size;
|
||||
|
||||
|
@ -324,8 +327,10 @@ grub_elf64_load_phdrs (grub_elf_t elf)
|
|||
if ((grub_file_seek (elf->file, elf->ehdr.ehdr64.e_phoff) == (grub_off_t) -1)
|
||||
|| (grub_file_read (elf->file, elf->phdrs, phdrs_size) != phdrs_size))
|
||||
{
|
||||
grub_error_push ();
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "cannot read program headers");
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
|
||||
filename);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
|
@ -333,6 +338,7 @@ grub_elf64_load_phdrs (grub_elf_t elf)
|
|||
|
||||
grub_err_t
|
||||
grub_elf64_phdr_iterate (grub_elf_t elf,
|
||||
const char *filename,
|
||||
int NESTED_FUNC_ATTR (*hook) (grub_elf_t, Elf64_Phdr *, void *),
|
||||
void *hook_arg)
|
||||
{
|
||||
|
@ -340,7 +346,7 @@ grub_elf64_phdr_iterate (grub_elf_t elf,
|
|||
unsigned int i;
|
||||
|
||||
if (! elf->phdrs)
|
||||
if (grub_elf64_load_phdrs (elf))
|
||||
if (grub_elf64_load_phdrs (elf, filename))
|
||||
return grub_errno;
|
||||
phdrs = elf->phdrs;
|
||||
|
||||
|
@ -363,7 +369,8 @@ grub_elf64_phdr_iterate (grub_elf_t elf,
|
|||
|
||||
/* Calculate the amount of memory spanned by the segments. */
|
||||
grub_size_t
|
||||
grub_elf64_size (grub_elf_t elf, Elf64_Addr *base, grub_uint64_t *max_align)
|
||||
grub_elf64_size (grub_elf_t elf, const char *filename,
|
||||
Elf64_Addr *base, grub_uint64_t *max_align)
|
||||
{
|
||||
Elf64_Addr segments_start = (Elf64_Addr) -1;
|
||||
Elf64_Addr segments_end = 0;
|
||||
|
@ -390,7 +397,7 @@ grub_elf64_size (grub_elf_t elf, Elf64_Addr *base, grub_uint64_t *max_align)
|
|||
return 0;
|
||||
}
|
||||
|
||||
grub_elf64_phdr_iterate (elf, calcsize, 0);
|
||||
grub_elf64_phdr_iterate (elf, filename, calcsize, 0);
|
||||
|
||||
if (base)
|
||||
*base = 0;
|
||||
|
@ -417,7 +424,8 @@ grub_elf64_size (grub_elf_t elf, Elf64_Addr *base, grub_uint64_t *max_align)
|
|||
|
||||
/* Load every loadable segment into memory specified by `_load_hook'. */
|
||||
grub_err_t
|
||||
grub_elf64_load (grub_elf_t _elf, grub_elf64_load_hook_t _load_hook,
|
||||
grub_elf64_load (grub_elf_t _elf, const char *filename,
|
||||
grub_elf64_load_hook_t _load_hook,
|
||||
grub_addr_t *base, grub_size_t *size)
|
||||
{
|
||||
grub_addr_t load_base = (grub_addr_t) -1ULL;
|
||||
|
@ -447,11 +455,7 @@ grub_elf64_load (grub_elf_t _elf, grub_elf64_load_hook_t _load_hook,
|
|||
(unsigned long long) phdr->p_memsz);
|
||||
|
||||
if (grub_file_seek (elf->file, phdr->p_offset) == (grub_off_t) -1)
|
||||
{
|
||||
grub_error_push ();
|
||||
return grub_error (GRUB_ERR_BAD_OS,
|
||||
"invalid offset in program header");
|
||||
}
|
||||
return grub_errno;
|
||||
|
||||
if (phdr->p_filesz)
|
||||
{
|
||||
|
@ -460,11 +464,10 @@ grub_elf64_load (grub_elf_t _elf, grub_elf64_load_hook_t _load_hook,
|
|||
if (read != (grub_ssize_t) phdr->p_filesz)
|
||||
{
|
||||
/* XXX How can we free memory from `load_hook'? */
|
||||
grub_error_push ();
|
||||
return grub_error (GRUB_ERR_BAD_OS,
|
||||
"couldn't read segment from file: "
|
||||
"wanted 0x%lx bytes; read 0x%lx bytes",
|
||||
phdr->p_filesz, read);
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
|
||||
filename);
|
||||
return grub_errno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -477,7 +480,8 @@ grub_elf64_load (grub_elf_t _elf, grub_elf64_load_hook_t _load_hook,
|
|||
return 0;
|
||||
}
|
||||
|
||||
err = grub_elf64_phdr_iterate (_elf, grub_elf64_load_segment, _load_hook);
|
||||
err = grub_elf64_phdr_iterate (_elf, filename,
|
||||
grub_elf64_load_segment, _load_hook);
|
||||
|
||||
if (base)
|
||||
*base = load_base;
|
||||
|
|
|
@ -372,7 +372,8 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
|
|||
|
||||
fd = open (map[drive].device, O_RDONLY);
|
||||
if (fd == -1)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot open `%s' while attempting to get disk size", map[drive].device);
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("cannot open `%s': %s"),
|
||||
map[drive].device, strerror (errno));
|
||||
|
||||
disk->total_sectors = grub_util_get_fd_sectors (fd, map[drive].device,
|
||||
&disk->log_sector_size);
|
||||
|
@ -428,13 +429,19 @@ grub_util_follow_gpart_up (const char *name, grub_disk_addr_t *off_out, char **n
|
|||
|
||||
error = geom_gettree (&mesh);
|
||||
if (error != 0)
|
||||
/* TRANSLATORS: geom is the name of (k)FreeBSD device framework.
|
||||
Usually left untranslated.
|
||||
*/
|
||||
grub_util_error (_("couldn't open geom"));
|
||||
|
||||
LIST_FOREACH (class, &mesh.lg_class, lg_class)
|
||||
if (strcasecmp (class->lg_name, "part") == 0)
|
||||
break;
|
||||
if (!class)
|
||||
grub_util_error (_("couldn't open geom part"));
|
||||
/* TRANSLATORS: geom is the name of (k)FreeBSD device framework.
|
||||
Usually left untranslated.
|
||||
*/
|
||||
grub_util_error (_("couldn't find geom `part' class"));
|
||||
|
||||
LIST_FOREACH (geom, &class->lg_geom, lg_geom)
|
||||
{
|
||||
|
@ -563,12 +570,8 @@ devmapper_fail:
|
|||
fd = open (dev, O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_DEVICE,
|
||||
# if !defined(HAVE_DIOCGDINFO)
|
||||
"cannot open `%s' while attempting to get disk geometry", dev);
|
||||
# else /* defined(HAVE_DIOCGDINFO) */
|
||||
"cannot open `%s' while attempting to get disk label", dev);
|
||||
# endif /* !defined(HAVE_DIOCGDINFO) */
|
||||
grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot open `%s': %s"),
|
||||
dev, strerror (errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -736,9 +739,8 @@ grub_util_fd_seek (int fd, const char *name, grub_uint64_t off)
|
|||
|
||||
offset = (loff_t) off;
|
||||
if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET))
|
||||
{
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE, "cannot seek `%s'", name);
|
||||
}
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot seek `%s': %s"),
|
||||
name, strerror (errno));
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
#else
|
||||
|
@ -748,7 +750,8 @@ grub_util_fd_seek (int fd, const char *name, grub_uint64_t off)
|
|||
off_t offset = (off_t) off;
|
||||
|
||||
if (lseek (fd, offset, SEEK_SET) != offset)
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE, "cannot seek `%s'", name);
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot seek `%s': %s"),
|
||||
name, strerror (errno));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -842,7 +845,8 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
|
|||
fd = open (dev, flags);
|
||||
if (fd < 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s'", dev);
|
||||
grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot open `%s': %s"),
|
||||
dev, strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -922,7 +926,8 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
|
|||
|
||||
if (fd < 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s' in open_device()", map[disk->id].device);
|
||||
grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot open `%s': %s"),
|
||||
map[disk->id].device, strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
#endif /* ! __linux__ */
|
||||
|
@ -1030,7 +1035,8 @@ grub_util_biosdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
if (grub_util_fd_read (fd, buf, (1 << disk->log_sector_size))
|
||||
!= (1 << disk->log_sector_size))
|
||||
{
|
||||
grub_error (GRUB_ERR_READ_ERROR, "cannot read `%s'", map[disk->id].device);
|
||||
grub_error (GRUB_ERR_READ_ERROR, N_("cannot read `%s': %s"),
|
||||
map[disk->id].device, strerror (errno));
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
@ -1041,7 +1047,8 @@ grub_util_biosdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
|
||||
if (grub_util_fd_read (fd, buf, size << disk->log_sector_size)
|
||||
!= (ssize_t) (size << disk->log_sector_size))
|
||||
grub_error (GRUB_ERR_READ_ERROR, "cannot read from `%s'", map[disk->id].device);
|
||||
grub_error (GRUB_ERR_READ_ERROR, N_("cannot read `%s': %s"),
|
||||
map[disk->id].device, strerror (errno));
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
@ -1075,7 +1082,8 @@ grub_util_biosdisk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
|
||||
if (grub_util_fd_write (fd, buf, size << disk->log_sector_size)
|
||||
!= (ssize_t) (size << disk->log_sector_size))
|
||||
grub_error (GRUB_ERR_WRITE_ERROR, "cannot write to `%s'", map[disk->id].device);
|
||||
grub_error (GRUB_ERR_WRITE_ERROR, N_("cannot write to `%s': %s"),
|
||||
map[disk->id].device, strerror (errno));
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
@ -1172,7 +1180,11 @@ read_device_map (const char *dev_map)
|
|||
continue;
|
||||
|
||||
if (*p != '(')
|
||||
show_error (_("No open parenthesis found"));
|
||||
{
|
||||
char *tmp;
|
||||
tmp = xasprintf (_("missing `%c' symbol"), '(');
|
||||
show_error (tmp);
|
||||
}
|
||||
|
||||
p++;
|
||||
/* Find a free slot. */
|
||||
|
@ -1183,7 +1195,11 @@ read_device_map (const char *dev_map)
|
|||
e = p;
|
||||
p = strchr (p, ')');
|
||||
if (! p)
|
||||
show_error (_("No close parenthesis found"));
|
||||
{
|
||||
char *tmp;
|
||||
tmp = xasprintf (_("missing `%c' symbol"), ')');
|
||||
show_error (tmp);
|
||||
}
|
||||
|
||||
map[drive].drive = xmalloc (p - e + sizeof ('\0'));
|
||||
strncpy (map[drive].drive, e, p - e + sizeof ('\0'));
|
||||
|
@ -1196,7 +1212,7 @@ read_device_map (const char *dev_map)
|
|||
p++;
|
||||
|
||||
if (*p == '\0')
|
||||
show_error (_("No filename found"));
|
||||
show_error (_("filename expected"));
|
||||
|
||||
/* NUL-terminate the filename. */
|
||||
e = p;
|
||||
|
|
|
@ -21,8 +21,10 @@
|
|||
#include <grub/file.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
|
@ -54,6 +56,12 @@ is_dir (const char *path, const char *name)
|
|||
return S_ISDIR (st.st_mode);
|
||||
}
|
||||
|
||||
struct grub_hostfs_data
|
||||
{
|
||||
char *filename;
|
||||
FILE *f;
|
||||
};
|
||||
|
||||
static grub_err_t
|
||||
grub_hostfs_dir (grub_device_t device, const char *path,
|
||||
int (*hook) (const char *filename,
|
||||
|
@ -68,7 +76,8 @@ grub_hostfs_dir (grub_device_t device, const char *path,
|
|||
dir = opendir (path);
|
||||
if (! dir)
|
||||
return grub_error (GRUB_ERR_BAD_FILENAME,
|
||||
"can't open the hostfs directory `%s'", path);
|
||||
N_("can't open `%s': %s"), path,
|
||||
strerror (errno));
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
@ -95,12 +104,30 @@ static grub_err_t
|
|||
grub_hostfs_open (struct grub_file *file, const char *name)
|
||||
{
|
||||
FILE *f;
|
||||
struct grub_hostfs_data *data;
|
||||
|
||||
f = fopen (name, "rb");
|
||||
if (! f)
|
||||
return grub_error (GRUB_ERR_BAD_FILENAME,
|
||||
"can't open `%s'", name);
|
||||
file->data = f;
|
||||
N_("can't open `%s': %s"), name,
|
||||
strerror (errno));
|
||||
data = grub_malloc (sizeof (*data));
|
||||
if (!data)
|
||||
{
|
||||
fclose (f);
|
||||
return grub_errno;
|
||||
}
|
||||
data->filename = grub_strdup (name);
|
||||
if (!data->filename)
|
||||
{
|
||||
grub_free (data);
|
||||
fclose (f);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
data->f = f;
|
||||
|
||||
file->data = data;
|
||||
|
||||
#ifdef __MINGW32__
|
||||
file->size = grub_util_get_disk_size (name);
|
||||
|
@ -116,18 +143,20 @@ grub_hostfs_open (struct grub_file *file, const char *name)
|
|||
static grub_ssize_t
|
||||
grub_hostfs_read (grub_file_t file, char *buf, grub_size_t len)
|
||||
{
|
||||
FILE *f;
|
||||
struct grub_hostfs_data *data;
|
||||
|
||||
f = (FILE *) file->data;
|
||||
if (fseeko (f, file->offset, SEEK_SET) != 0)
|
||||
data = file->data;
|
||||
if (fseeko (data->f, file->offset, SEEK_SET) != 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE, "fseeko: %s", strerror (errno));
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE, N_("cannot seek `%s': %s"),
|
||||
data->filename, strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
unsigned int s = fread (buf, 1, len, f);
|
||||
unsigned int s = fread (buf, 1, len, data->f);
|
||||
if (s != len)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, "fread: %s", strerror (errno));
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("cannot read `%s': %s"),
|
||||
data->filename, strerror (errno));
|
||||
|
||||
return (signed) s;
|
||||
}
|
||||
|
@ -136,9 +165,12 @@ static grub_err_t
|
|||
grub_hostfs_close (grub_file_t file)
|
||||
{
|
||||
FILE *f;
|
||||
struct grub_hostfs_data *data;
|
||||
|
||||
f = (FILE *) file->data;
|
||||
fclose (f);
|
||||
data = file->data;
|
||||
fclose (data->f);
|
||||
grub_free (data->filename);
|
||||
grub_free (data);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/mm.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
void *
|
||||
grub_malloc (grub_size_t size)
|
||||
|
@ -30,7 +31,7 @@ grub_malloc (grub_size_t size)
|
|||
void *ret;
|
||||
ret = malloc (size);
|
||||
if (!ret)
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -58,7 +59,7 @@ grub_realloc (void *ptr, grub_size_t size)
|
|||
void *ret;
|
||||
ret = realloc (ptr, size);
|
||||
if (!ret)
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -77,11 +78,11 @@ grub_memalign (grub_size_t align, grub_size_t size)
|
|||
#else
|
||||
(void) align;
|
||||
(void) size;
|
||||
grub_util_error (_("grub_memalign is not supported"));
|
||||
grub_util_error (_("grub_memalign is not supported on your system"));
|
||||
#endif
|
||||
|
||||
if (!p)
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/fs.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
void (*EXPORT_VAR (grub_grubnet_fini)) (void);
|
||||
|
||||
|
@ -41,7 +42,7 @@ grub_file_get_device_name (const char *name)
|
|||
|
||||
if (! p)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, "missing `)'");
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, N_("missing `%c' symbol"), ')');
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -138,7 +139,7 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len)
|
|||
if (file->offset > file->size)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"attempt to read past the end of file");
|
||||
N_("attempt to read past the end of file"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -178,7 +179,7 @@ grub_file_seek (grub_file_t file, grub_off_t offset)
|
|||
if (offset > file->size)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"attempt to seek outside of the file");
|
||||
N_("attempt to seek outside of the file"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
grub_fs_t grub_fs_list = 0;
|
||||
|
||||
|
@ -97,7 +98,7 @@ grub_fs_probe (grub_device_t device)
|
|||
else if (device->net && device->net->fs)
|
||||
return device->net->fs;
|
||||
|
||||
grub_error (GRUB_ERR_UNKNOWN_FS, "unknown filesystem");
|
||||
grub_error (GRUB_ERR_UNKNOWN_FS, N_("unknown filesystem"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -145,7 +146,7 @@ grub_fs_blocklist_open (grub_file_t file, const char *name)
|
|||
if (grub_errno != GRUB_ERR_NONE || *p != '+')
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILENAME,
|
||||
"invalid file name `%s'", name);
|
||||
N_("invalid file name `%s'"), name);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +158,7 @@ grub_fs_blocklist_open (grub_file_t file, const char *name)
|
|||
|| (*p && *p != ',' && ! grub_isspace (*p)))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILENAME,
|
||||
"invalid file name `%s'", name);
|
||||
N_("invalid file name `%s'"), name);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <grub/elf.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* Check if EHDR is a valid ELF header. */
|
||||
grub_err_t
|
||||
|
@ -32,7 +33,7 @@ grub_arch_dl_check_header (void *ehdr)
|
|||
if (e->e_ident[EI_CLASS] != ELFCLASS32
|
||||
|| e->e_ident[EI_DATA] != ELFDATA2LSB
|
||||
|| e->e_machine != EM_386)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -54,7 +55,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
break;
|
||||
|
||||
if (i == e->e_shnum)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
||||
|
||||
entsize = s->sh_entsize;
|
||||
|
||||
|
@ -100,6 +101,10 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
*addr += (sym->st_value - (Elf_Word) seg->addr
|
||||
- rel->r_offset);
|
||||
break;
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%x is not implemented yet"),
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* Check if EHDR is a valid ELF header. */
|
||||
grub_err_t
|
||||
|
@ -33,7 +34,7 @@ grub_arch_dl_check_header (void *ehdr)
|
|||
if (e->e_ident[EI_CLASS] != ELFCLASS64
|
||||
|| e->e_ident[EI_DATA] != ELFDATA2LSB
|
||||
|| e->e_machine != EM_IA_64)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -181,7 +182,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
break;
|
||||
|
||||
if (i == e->e_shnum)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
||||
|
||||
entsize = s->sh_entsize;
|
||||
|
||||
|
@ -265,7 +266,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
break;
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"this relocation (0x%x) is not implemented yet",
|
||||
N_("relocation 0x%x is not implemented yet"),
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/cpu/types.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* Dummy __gnu_local_gp. Resolved by linker. */
|
||||
static char __gnu_local_gp_dummy;
|
||||
|
@ -43,7 +44,7 @@ grub_arch_dl_check_header (void *ehdr)
|
|||
|| e->e_ident[EI_DATA] != ELFDATA2LSB
|
||||
|| e->e_machine != EM_MIPS)
|
||||
#endif
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -69,7 +70,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
break;
|
||||
|
||||
if (i == e->e_shnum)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
||||
|
||||
entsize = s->sh_entsize;
|
||||
|
||||
|
@ -233,7 +234,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
{
|
||||
grub_free (gp);
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"Unknown relocation type %d\n",
|
||||
N_("relocation 0x%x is not implemented yet"),
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <grub/elf.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* Check if EHDR is a valid ELF header. */
|
||||
grub_err_t
|
||||
|
@ -32,7 +33,7 @@ grub_arch_dl_check_header (void *ehdr)
|
|||
if (e->e_ident[EI_CLASS] != ELFCLASS32
|
||||
|| e->e_ident[EI_DATA] != ELFDATA2MSB
|
||||
|| e->e_machine != EM_PPC)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -112,7 +113,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
break;
|
||||
|
||||
if (i == e->e_shnum)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
||||
|
||||
entsize = s->sh_entsize;
|
||||
|
||||
|
@ -195,7 +196,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"this relocation (%d) is not implemented yet",
|
||||
N_("relocation 0x%x is not implemented yet"),
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <grub/elf.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* Check if EHDR is a valid ELF header. */
|
||||
grub_err_t
|
||||
|
@ -32,7 +33,7 @@ grub_arch_dl_check_header (void *ehdr)
|
|||
if (e->e_ident[EI_CLASS] != ELFCLASS64
|
||||
|| e->e_ident[EI_DATA] != ELFDATA2MSB
|
||||
|| e->e_machine != EM_SPARCV9)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -55,7 +56,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
break;
|
||||
|
||||
if (i == e->e_shnum)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
||||
|
||||
entsize = s->sh_entsize;
|
||||
|
||||
|
@ -134,7 +135,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
break;
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"this relocation (%d) is not implemented yet",
|
||||
N_("relocation 0x%x is not implemented yet"),
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <grub/elf.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* Check if EHDR is a valid ELF header. */
|
||||
grub_err_t
|
||||
|
@ -32,7 +33,7 @@ grub_arch_dl_check_header (void *ehdr)
|
|||
if (e->e_ident[EI_CLASS] != ELFCLASS64
|
||||
|| e->e_ident[EI_DATA] != ELFDATA2LSB
|
||||
|| e->e_machine != EM_X86_64)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -54,7 +55,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
break;
|
||||
|
||||
if (i == e->e_shnum)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
||||
|
||||
entsize = s->sh_entsize;
|
||||
|
||||
|
@ -110,7 +111,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"this relocation (%d) is not implemented yet",
|
||||
N_("relocation 0x%x is not implemented yet"),
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -277,8 +277,9 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
|||
|
||||
if (! opt)
|
||||
{
|
||||
char tmp[3] = { '-', *curshort, 0 };
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"unknown argument `-%c'", *curshort);
|
||||
N_("unknown argument `%s'"), tmp);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -344,7 +345,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
|||
|
||||
if (! opt)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown argument `%s'", arg);
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"), arg);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +356,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
|||
if (! option)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"missing mandatory option for `%s'", opt->longarg);
|
||||
N_("missing mandatory option for `%s'"), opt->longarg);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -377,7 +378,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
|||
if (tail == 0 || tail == option || *tail != '\0' || grub_errno)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"the argument `%s' requires an integer",
|
||||
N_("the argument `%s' requires an integer"),
|
||||
arg);
|
||||
|
||||
goto fail;
|
||||
|
@ -400,8 +401,8 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
|||
if (option)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"a value was assigned to the argument `%s' while it "
|
||||
"doesn't require an argument", arg);
|
||||
N_("a value was assigned to the argument `%s' while it "
|
||||
"doesn't require an argument"), arg);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
#include <termios.h>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <grub/i386/relocator.h>
|
||||
#include <grub/relocator_private.h>
|
||||
#include <grub/cpu/relocator_private.h>
|
||||
#include <grub/i386/relocator_private.h>
|
||||
|
||||
extern grub_uint8_t grub_relocator_forward_start;
|
||||
extern grub_uint8_t grub_relocator_forward_end;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#define PSEUDO_REAL_DSEG 0x20
|
||||
|
||||
#include <grub/cpu/relocator_private.h>
|
||||
#include <grub/i386/relocator_private.h>
|
||||
|
||||
#include "relocator_common.S"
|
||||
|
||||
|
|
|
@ -801,7 +801,7 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
|
|||
len = grub_strlen (corig);
|
||||
if (!slash)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "bad color specification %s",
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid color specification `%s'",
|
||||
args[0]);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -1209,14 +1209,14 @@ grub_relocator_alloc_chunk_addr (struct grub_relocator *rel,
|
|||
grub_phys_addr_t min_addr = 0, max_addr;
|
||||
|
||||
if (target > ~size)
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "address is out of range");
|
||||
return grub_error (GRUB_ERR_BUG, "address is out of range");
|
||||
|
||||
adjust_limits (rel, &min_addr, &max_addr, target, target);
|
||||
|
||||
for (chunk = rel->chunks; chunk; chunk = chunk->next)
|
||||
if ((chunk->target <= target && target < chunk->target + chunk->size)
|
||||
|| (target <= chunk->target && chunk->target < target + size))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "overlap detected");
|
||||
return grub_error (GRUB_ERR_BUG, "overlap detected");
|
||||
|
||||
chunk = grub_malloc (sizeof (struct grub_relocator_chunk));
|
||||
if (!chunk)
|
||||
|
@ -1256,7 +1256,7 @@ grub_relocator_alloc_chunk_addr (struct grub_relocator *rel,
|
|||
|
||||
grub_dprintf ("relocator", "not allocated\n");
|
||||
grub_free (chunk);
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||
}
|
||||
while (0);
|
||||
|
||||
|
@ -1486,7 +1486,7 @@ grub_relocator_prepare_relocs (struct grub_relocator *rel, grub_addr_t addr,
|
|||
if (!malloc_in_range (rel, 0, ~(grub_addr_t)0 - rel->relocators_size + 1,
|
||||
grub_relocator_align,
|
||||
rel->relocators_size, &movers_chunk, 1, 1))
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||
movers_chunk.srcv = rels = rels0
|
||||
= grub_map_memory (movers_chunk.src, movers_chunk.size);
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ static grub_command_t cmd;
|
|||
GRUB_MOD_INIT(appleloader)
|
||||
{
|
||||
cmd = grub_register_command ("appleloader", grub_cmd_appleloader,
|
||||
N_("[OPTS]"), N_("Boot legacy system."));
|
||||
N_("[OPTS]"), N_("Boot BIOS-based system."));
|
||||
my_mod = mod;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,10 +88,10 @@ grub_chainloader_boot (void)
|
|||
grub_error (GRUB_ERR_BAD_OS, buf);
|
||||
grub_free (buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
grub_error (GRUB_ERR_BAD_OS, "unknown error");
|
||||
}
|
||||
}
|
||||
|
||||
if (exit_data)
|
||||
efi_call_1 (b->free_pool, exit_data);
|
||||
|
@ -197,7 +197,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
|||
char *filename;
|
||||
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
filename = argv[0];
|
||||
|
||||
grub_dl_ref (my_mod);
|
||||
|
@ -258,7 +258,8 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (grub_file_read (file, (void *) ((grub_addr_t) address), size) != size)
|
||||
{
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
grub_error (GRUB_ERR_BAD_OS, "too small");
|
||||
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
|
||||
filename);
|
||||
|
||||
goto fail;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue