on it.
+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
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);
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 */
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);
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},
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);
}
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);
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;
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);
{
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);
if (! table)
{
free_tables ();
- return grub_error (GRUB_ERR_OUT_OF_MEMORY,
- "couldn't allocate table structure");
+ return grub_errno;
}
table->size = size;
{
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."),
}
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]);
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;
- }
+ return 0;
new_preboot->preboot_func = preboot_func;
new_preboot->preboot_rest_func = preboot_rest_func;
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 ();
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;
}
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)
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]);
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');
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)
{
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]"),
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},
{"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},
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;
{
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);
}
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);
{
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;
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)
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"),
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);
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);
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)
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])
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);
{
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)
{
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;
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;
}
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;
}
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;
}
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)
}
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;
}
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
}
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
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]);
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;
}
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;
}
}
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;
}
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
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])
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);
{
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)
{"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}
};
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)
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."));
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)
{
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]);
}
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;
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++;
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;
grub_free (pass->salt);
grub_free (pass);
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- "Incorrect PBKDF2 password.");
+ "incorrect PBKDF2 password");
}
*ptro = (hex1 << 4) | hex2;
grub_free (pass->salt);
grub_free (pass);
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- "Incorrect PBKDF2 password.");
+ "incorrect PBKDF2 password");
}
*ptro = (hex1 << 4) | hex2;
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)
{
}
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)
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 }
};
regmatch_t *matches)
{
int i;
- char ch;
char *p;
char *q;
grub_err_t err;
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);
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)
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)
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);
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";
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;
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);
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];
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
{
if (!regsize)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- "Unknown register size.");
+ "unknown register size");
write_mask = 0;
if (*ptr == '=')
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;
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);
}
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)
{
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."));
}
{
if (adapter->init ())
{
- grub_puts_ (N_(" Failed"));
+ grub_puts_ (N_(" Failed to initialize video adapter"));
grub_errno = GRUB_ERR_NONE;
continue;
}
(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));
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;
}
#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;
{
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;
}
{
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;
}
{
{"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}
};
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
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
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
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;
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);
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))
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))
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);
}
}
}
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;
#include <grub/mm.h>
#include <grub/dl.h>
#include <grub/ieee1275/ieee1275.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
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;
#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;
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
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;
}
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;
}
#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>
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;
#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)
}
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
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}
};
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)
{
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);
}
#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
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));
}
}
}
#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
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));
}
}
}
#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;
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 *)
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;
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)
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;
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;
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;
}
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");
}
}
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;
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;
{
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");
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);
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)
/* 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*/
/* 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;
{
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 */
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 ();
}
(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;
#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;
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;
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 */
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;
= 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");
*((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;
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)
#include <grub/disk.h>
#include <grub/dl.h>
#include <grub/types.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
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];
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);
}
}
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)
{
grub_free (alloc);
return grub_error (GRUB_ERR_SYMLINK_LOOP,
- "too deep nesting of symlinks");
+ N_("too deep nesting of symlinks"));
}
#ifndef MODE_AFS
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);
}
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));
#include <grub/lib/crc.h>
#include <grub/deflate.h>
#include <minilzo.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
{
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;
{
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;
}
{
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;
}
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,
{
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;
}
{
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;
}
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);
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;
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));
#include <grub/misc.h>
#include <grub/disk.h>
#include <grub/dl.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
if (++symlinknest == 8)
{
grub_error (GRUB_ERR_SYMLINK_LOOP,
- "too deep nesting of symlinks");
+ N_("too deep nesting of symlinks"));
goto fail;
}
ofs = 0;
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;
}
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;
#include <grub/dl.h>
#include <grub/charset.h>
#include <grub/fat.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
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);
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;
}
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);
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;
}
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;
}
#include <grub/disk.h>
#include <grub/fshelp.h>
#include <grub/dl.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
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. */
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);
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;
}
/* 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;
}
#include <grub/dl.h>
#include <grub/types.h>
#include <grub/hfs.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
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;
}
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;
}
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;
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;
}
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;
}
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;
}
#include <grub/dl.h>
#include <grub/types.h>
#include <grub/charset.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
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;
}
}
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;
}
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);
ino = 2;
grub_jfs_find_file (data, symlink, ino);
- if (grub_errno)
- grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
return grub_errno;
}
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;
}
#include <grub/disk.h>
#include <grub/dl.h>
#include <grub/types.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
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)
return grub_errno;
grub_minix_find_file (data, symlink);
- if (grub_errno)
- grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
return grub_errno;
}
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;
}
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;
}
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;
}
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;
}
#include <grub/dl.h>
#include <grub/types.h>
#include <grub/fshelp.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
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");
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);
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);
#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;
#include <grub/disk.h>
#include <grub/dl.h>
#include <grub/types.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
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));
return grub_errno;
grub_ufs_find_file (data, symlink);
- if (grub_errno)
- grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
return grub_errno;
}
}
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;
}
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;
}
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;
}
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;
}
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;
}
#include <grub/zfs/dsl_dataset.h>
#include <grub/deflate.h>
#include <grub/crypto.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
}
}
- 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
}
}
- 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);
}
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);
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 */
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);
}
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));
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;
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;
}
char *devid = 0;
print_tabs (tab);
- grub_puts_ (N_("Leaf VDEV"));
+ grub_puts_ (N_("Leaf virtual device (file or disk)"));
print_state (nvlist, 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++)
{
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);
}
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;
}
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);
#include <grub/gfxmenu_model.h>
#include <grub/gfxmenu_view.h>
#include <grub/time.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
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)
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;
}
/* 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;
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 0;
return scaled_bitmap;
}
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;
#include <grub/file.h>
#include <grub/dl.h>
#include <grub/deflate.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
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;
- }
+ return 0;
/*
* This does consistency checking on the header data. If a
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;
- }
+ return 0;
gzio->data_offset = grub_file_tell (gzio->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;
- }
+ 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);
{
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;
}
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;
}
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;
- }
+ 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;
- }
+ 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;
- }
+ 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;
- }
+ return 0;
flags = grub_be_to_cpu32 (header.flags);
return 1;
CORRUPTED:
- grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, "lzop file corrupted");
-
grub_free(name);
return 0;
STREAM_HEADER_SIZE);
if (xzio->buf.in_size != STREAM_HEADER_SIZE)
- {
- grub_error (GRUB_ERR_BAD_FILE_TYPE, "no xz magic found");
- return 0;
- }
+ 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;
- }
+ return 0;
if (ret != XZ_OK)
- {
- grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, "not supported xz options");
- return 0;
- }
+ return 0;
return 1;
}
return 1;
ERROR:
- grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, "bad footer magic");
return 0;
}
#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;
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;
}
}
#include <grub/misc.h>
#include <grub/time.h>
#include <grub/file.h>
+#include <grub/i18n.h>
#define GRUB_CACHE_TIMEOUT 2
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
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;
}
>> 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;
}
#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)
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;
}
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);
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);
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;
}
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;
}
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/dl.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
|| 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;
}
}
grub_elf_t
-grub_elf_file (grub_file_t file)
+grub_elf_file (grub_file_t file, const char *filename)
{
grub_elf_t elf;
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;
}
if (! file)
return 0;
- elf = grub_elf_file (file);
+ elf = grub_elf_file (file, name);
if (! elf)
grub_file_close (file);
}
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;
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;
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)
{
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;
/* 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;
return 0;
}
- grub_elf32_phdr_iterate (elf, calcsize, 0);
+ grub_elf32_phdr_iterate (elf, filename, calcsize, 0);
if (base)
*base = 0;
/* 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;
(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)
{
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;
}
}
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;
}
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;
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;
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)
{
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;
/* 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;
return 0;
}
- grub_elf64_phdr_iterate (elf, calcsize, 0);
+ grub_elf64_phdr_iterate (elf, filename, calcsize, 0);
if (base)
*base = 0;
/* 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;
(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)
{
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;
}
}
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;
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);
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)
{
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;
}
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
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
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;
}
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__ */
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;
}
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;
}
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;
}
continue;
if (*p != '(')
- show_error (_("No open parenthesis found"));
+ {
+ char *tmp;
+ tmp = xasprintf (_("missing `%c' symbol"), '(');
+ show_error (tmp);
+ }
p++;
/* Find a free slot. */
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'));
p++;
if (*p == '\0')
- show_error (_("No filename found"));
+ show_error (_("filename expected"));
/* NUL-terminate the filename. */
e = p;
#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>
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,
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)
{
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);
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;
}
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;
}
#include <grub/mm.h>
#include <stdlib.h>
#include <string.h>
+#include <grub/i18n.h>
void *
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;
}
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;
}
#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;
}
#include <grub/mm.h>
#include <grub/fs.h>
#include <grub/device.h>
+#include <grub/i18n.h>
void (*EXPORT_VAR (grub_grubnet_fini)) (void);
if (! p)
{
- grub_error (GRUB_ERR_BAD_FILENAME, "missing `)'");
+ grub_error (GRUB_ERR_BAD_FILENAME, N_("missing `%c' symbol"), ')');
return 0;
}
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;
}
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;
}
#include <grub/types.h>
#include <grub/mm.h>
#include <grub/term.h>
+#include <grub/i18n.h>
grub_fs_t grub_fs_list = 0;
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;
}
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;
}
}
|| (*p && *p != ',' && ! grub_isspace (*p)))
{
grub_error (GRUB_ERR_BAD_FILENAME,
- "invalid file name `%s'", name);
+ N_("invalid file name `%s'"), name);
goto fail;
}
#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
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;
}
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;
*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));
}
}
}
#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
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;
}
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;
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));
}
}
#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;
|| 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;
}
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;
{
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;
#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
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;
}
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;
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));
}
}
#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
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;
}
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;
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));
}
}
#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
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;
}
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;
*addr32 += rel->r_addend + sym->st_value;
break;
- default:
+ 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));
}
}
if (! opt)
{
+ char tmp[3] = { '-', *curshort, 0 };
grub_error (GRUB_ERR_BAD_ARGUMENT,
- "unknown argument `-%c'", *curshort);
+ N_("unknown argument `%s'"), tmp);
goto fail;
}
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;
}
}
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;
}
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;
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;
}
#include <grub/mm.h>
#include <grub/term.h>
#include <grub/dl.h>
+#include <grub/i18n.h>
#ifdef GRUB_UTIL
#include <termios.h>
#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;
#define PSEUDO_REAL_DSEG 0x20
-#include <grub/cpu/relocator_private.h>
+#include <grub/i386/relocator_private.h>
#include "relocator_common.S"
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;
}
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)
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);
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);
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;
}
grub_error (GRUB_ERR_BAD_OS, buf);
grub_free (buf);
}
- else
- grub_error (GRUB_ERR_BAD_OS, "unknown error");
}
+ else
+ grub_error (GRUB_ERR_BAD_OS, "unknown error");
}
if (exit_data)
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);
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;
}
{"nointr", 'n', 0, "", 0, 0},
{"pause", 'p', 0, N_("Wait for keypress after every line of output."), 0, 0},
{"quiet", 'q', 0, "", 0, 0},
- {"dfltroot", 'r', 0, N_("Use compiled-in rootdev."), 0, 0},
+ {"dfltroot", 'r', 0, N_("Use compiled-in root device."), 0, 0},
{"single", 's', 0, N_("Boot into single mode."), 0, 0},
{"verbose", 'v', 0, N_("Boot with verbose messages."), 0, 0},
{0, 0, 0, 0, 0, 0}
{"kdb", 'd', 0, N_("Enter in KDB on boot."), 0, 0},
{"root", 'r', 0, N_("Set root device."), "wdXY", ARG_TYPE_STRING},
{"serial", 'h', GRUB_ARG_OPTION_OPTIONAL,
- N_("Use serial console."), N_("comUNIT[,SPEED]"), ARG_TYPE_STRING},
+ N_("Use serial console."),
+ /* TRANSLATORS: "com" is static and not to be translated. It refers to
+ serial ports e.g. com1.
+ */
+ N_("comUNIT[,SPEED]"), ARG_TYPE_STRING},
{0, 0, 0, 0, 0, 0}
};
{"single", 's', 0, N_("Boot into single mode."), 0, 0},
{"verbose", 'v', 0, N_("Boot with verbose messages."), 0, 0},
{"debug", 'x', 0, N_("Boot with debug messages."), 0, 0},
- {"silent", 'z', 0, N_("Supress normal output (warnings remain)."), 0, 0},
+ {"silent", 'z', 0, N_("Suppress normal output (warnings remain)."), 0, 0},
{"root", 'r', 0, N_("Set root device."), N_("DEVICE"), ARG_TYPE_STRING},
{"serial", 'h', GRUB_ARG_OPTION_OPTIONAL,
- N_("Use serial console."), N_("[ADDR|comUNIT][,SPEED]"), ARG_TYPE_STRING},
+ N_("Use serial console."),
+ /* TRANSLATORS: "com" is static and not to be translated. It refers to
+ serial ports e.g. com1.
+ */
+ N_("[ADDR|comUNIT][,SPEED]"), ARG_TYPE_STRING},
{0, 0, 0, 0, 0, 0}
};
}
static grub_err_t
-grub_bsd_load_elf (grub_elf_t elf)
+grub_bsd_load_elf (grub_elf_t elf, const char *filename)
{
grub_err_t err;
grub_relocator_chunk_t ch;
entry = elf->ehdr.ehdr32.e_entry & 0xFFFFFF;
- err = grub_elf32_phdr_iterate (elf, grub_bsd_elf32_size_hook, NULL);
+ err = grub_elf32_phdr_iterate (elf, filename,
+ grub_bsd_elf32_size_hook, NULL);
if (err)
return err;
err = grub_relocator_alloc_chunk_addr (relocator, &ch,
kern_chunk_src = get_virtual_current_address (ch);
- err = grub_elf32_load (elf, grub_bsd_elf32_hook, 0, 0);
+ err = grub_elf32_load (elf, filename, grub_bsd_elf32_hook, 0, 0);
if (err)
return err;
if (kernel_type != KERNEL_TYPE_OPENBSD)
return GRUB_ERR_NONE;
- return grub_openbsd_find_ramdisk32 (elf->file, kern_start,
+ return grub_openbsd_find_ramdisk32 (elf->file, filename, kern_start,
kern_chunk_src, &openbsd_ramdisk);
}
else if (grub_elf_is_elf64 (elf))
entry_hi = 0;
}
- err = grub_elf64_phdr_iterate (elf, grub_bsd_elf64_size_hook, NULL);
+ err = grub_elf64_phdr_iterate (elf, filename,
+ grub_bsd_elf64_size_hook, NULL);
if (err)
return err;
kern_chunk_src = get_virtual_current_address (ch);
}
- err = grub_elf64_load (elf, grub_bsd_elf64_hook, 0, 0);
+ err = grub_elf64_load (elf, filename,
+ grub_bsd_elf64_hook, 0, 0);
if (err)
return err;
if (kernel_type != KERNEL_TYPE_OPENBSD)
return GRUB_ERR_NONE;
- return grub_openbsd_find_ramdisk64 (elf->file, kern_start,
+ return grub_openbsd_find_ramdisk64 (elf->file, filename, kern_start,
kern_chunk_src, &openbsd_ramdisk);
}
else
- return grub_error (GRUB_ERR_BAD_OS, "invalid ELF");
+ return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
}
static grub_err_t
if (argc == 0)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
goto fail;
}
- elf = grub_elf_file (file);
+ elf = grub_elf_file (file, argv[0]);
if (elf)
{
is_elf_kernel = 1;
- grub_bsd_load_elf (elf);
+ grub_bsd_load_elf (elf, argv[0]);
grub_elf_close (elf);
}
else
return grub_errno;
if (is_64bit)
- err = grub_freebsd_load_elf_meta64 (relocator, file, &kern_end);
+ err = grub_freebsd_load_elf_meta64 (relocator, file, argv[0],
+ &kern_end);
else
- err = grub_freebsd_load_elf_meta32 (relocator, file, &kern_end);
+ err = grub_freebsd_load_elf_meta32 (relocator, file, argv[0],
+ &kern_end);
if (err)
return err;
return grub_errno;
if (is_64bit)
- err = grub_netbsd_load_elf_meta64 (relocator, file, &kern_end);
+ err = grub_netbsd_load_elf_meta64 (relocator, file, argv[0], &kern_end);
else
- err = grub_netbsd_load_elf_meta32 (relocator, file, &kern_end);
+ err = grub_netbsd_load_elf_meta32 (relocator, file, argv[0], &kern_end);
if (err)
return err;
}
if (! grub_loader_is_loaded ())
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- "you need to load the kernel first");
+ N_("you need to load the kernel first"));
if (kernel_type != KERNEL_TYPE_FREEBSD)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
if (argc == 0)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "no filename");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
if (! grub_loader_is_loaded ())
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- "you need to load the kernel first");
+ N_("you need to load the kernel first"));
if (kernel_type != KERNEL_TYPE_FREEBSD)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
grub_size_t size;
if (argc != 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
if (kernel_type != KERNEL_TYPE_OPENBSD)
return grub_error (GRUB_ERR_BAD_OS, "no kOpenBSD loaded");
#include <grub/elf.h>
#include <grub/misc.h>
#include <grub/i386/relocator.h>
+#include <grub/i18n.h>
#define ALIGN_PAGE(a) ALIGN_UP (a, 4096)
static inline grub_err_t
-load (grub_file_t file, void *where, grub_off_t off, grub_size_t size)
+load (grub_file_t file, const char *filename, void *where, grub_off_t off, grub_size_t size)
{
if (grub_file_seek (file, off) == (grub_off_t) -1)
return grub_errno;
{
if (grub_errno)
return grub_errno;
- else
- return grub_error (GRUB_ERR_BAD_OS, "file is truncated");
+ return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
}
return GRUB_ERR_NONE;
}
static inline grub_err_t
-read_headers (grub_file_t file, Elf_Ehdr *e, char **shdr)
+read_headers (grub_file_t file, const char *filename, Elf_Ehdr *e, char **shdr)
{
if (grub_file_seek (file, 0) == (grub_off_t) -1)
return grub_errno;
{
if (grub_errno)
return grub_errno;
- else
- return grub_error (GRUB_ERR_BAD_OS, "file is too short");
+ return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
}
if (e->e_ident[EI_MAG0] != ELFMAG0
|| 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"));
if (e->e_ident[EI_CLASS] != SUFFIX (ELFCLASS))
- return grub_error (GRUB_ERR_BAD_OS, "invalid arch dependent ELF magic");
+ return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
*shdr = grub_malloc (e->e_shnum * e->e_shentsize);
if (! *shdr)
{
if (grub_errno)
return grub_errno;
- else
- return grub_error (GRUB_ERR_BAD_OS, "file is truncated");
+ return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
}
return GRUB_ERR_NONE;
grub_size_t chunk_size = 0;
void *chunk_src;
- err = read_headers (file, &e, &shdr);
+ err = read_headers (file, argv[0], &e, &shdr);
if (err)
return err;
{
default:
case SHT_PROGBITS:
- err = load (file, (grub_uint8_t *) chunk_src + curload - *kern_end,
+ err = load (file, argv[0], (grub_uint8_t *) chunk_src + curload - *kern_end,
s->sh_offset, s->sh_size);
if (err)
return err;
grub_size_t chunk_size = 0;
void *chunk_src;
- err = read_headers (file, &e, &shdr);
+ err = read_headers (file, argv[0], &e, &shdr);
if (err)
return err;
{
default:
case SHT_PROGBITS:
- err = load (file, (grub_uint8_t *) chunk_src + module
+ err = load (file, argv[0],
+ (grub_uint8_t *) chunk_src + module
+ s->sh_addr - *kern_end,
s->sh_offset, s->sh_size);
if (err)
curload = module + s->sh_addr + s->sh_size;
}
- load (file, (grub_uint8_t *) chunk_src + module - *kern_end, 0, sizeof (e));
+ load (file, argv[0], (grub_uint8_t *) chunk_src + module - *kern_end, 0, sizeof (e));
if (curload < module + sizeof (e))
curload = module + sizeof (e);
- load (file, (grub_uint8_t *) chunk_src + curload - *kern_end, e.e_shoff,
+ load (file, argv[0], (grub_uint8_t *) chunk_src + curload - *kern_end, e.e_shoff,
e.e_shnum * e.e_shentsize);
e.e_shoff = curload - module;
curload += e.e_shnum * e.e_shentsize;
- load (file, (grub_uint8_t *) chunk_src + curload - *kern_end, e.e_phoff,
+ load (file, argv[0], (grub_uint8_t *) chunk_src + curload - *kern_end, e.e_phoff,
e.e_phnum * e.e_phentsize);
e.e_phoff = curload - module;
curload += e.e_phnum * e.e_phentsize;
grub_freebsd_add_meta_module (argv[0], FREEBSD_MODTYPE_ELF_MODULE,
argc - 1, argv + 1, module,
curload - module);
- return SUFFIX (grub_freebsd_load_elf_meta) (relocator, file, kern_end);
+ return SUFFIX (grub_freebsd_load_elf_meta) (relocator, file, argv[0], kern_end);
}
#endif
grub_err_t
SUFFIX (grub_freebsd_load_elf_meta) (struct grub_relocator *relocator,
- grub_file_t file, grub_addr_t *kern_end)
+ grub_file_t file,
+ const char *filename,
+ grub_addr_t *kern_end)
{
grub_err_t err;
Elf_Ehdr e;
unsigned i;
grub_size_t chunk_size;
- err = read_headers (file, &e, &shdr);
+ err = read_headers (file, filename, &e, &shdr);
if (err)
return err;
break;
if (s >= (Elf_Shdr *) ((char *) shdr
+ e.e_shnum * e.e_shentsize))
- return grub_error (GRUB_ERR_BAD_OS, "no symbol table");
+ return grub_error (GRUB_ERR_BAD_OS, N_("no symbol table"));
symoff = s->sh_offset;
symsize = s->sh_size;
symentsize = s->sh_entsize;
if (grub_file_read (file, curload, symsize) != (grub_ssize_t) symsize)
{
if (! grub_errno)
- return grub_error (GRUB_ERR_BAD_OS, "invalid ELF");
+ return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
return grub_errno;
}
curload += symsize;
if (grub_file_read (file, curload, strsize) != (grub_ssize_t) strsize)
{
if (! grub_errno)
- return grub_error (GRUB_ERR_BAD_OS, "invalid ELF");
+ return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
return grub_errno;
}
grub_err_t
SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator,
- grub_file_t file, grub_addr_t *kern_end)
+ grub_file_t file, const char *filename,
+ grub_addr_t *kern_end)
{
grub_err_t err;
Elf_Ehdr e;
struct grub_netbsd_btinfo_symtab symtab;
grub_addr_t symtarget;
- err = read_headers (file, &e, &shdr);
+ err = read_headers (file, filename, &e, &shdr);
if (err)
return err;
if (grub_file_read (file, curload, symsize) != (grub_ssize_t) symsize)
{
if (! grub_errno)
- return grub_error (GRUB_ERR_BAD_OS, "invalid ELF");
+ return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
return grub_errno;
}
curload += ALIGN_UP (symsize, sizeof (grub_freebsd_addr_t));
if (grub_file_read (file, curload, strsize) != (grub_ssize_t) strsize)
{
if (! grub_errno)
- return grub_error (GRUB_ERR_BAD_OS, "invalid ELF");
+ return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
return grub_errno;
}
grub_err_t
SUFFIX(grub_openbsd_find_ramdisk) (grub_file_t file,
+ const char *filename,
grub_addr_t kern_start,
void *kern_chunk_src,
struct grub_openbsd_ramdisk_descriptor *desc)
Elf_Shdr *s;
char *shdr = NULL;
- err = read_headers (file, &e, &shdr);
+ err = read_headers (file, filename, &e, &shdr);
if (err)
return err;
{
grub_free (syms);
if (! grub_errno)
- return grub_error (GRUB_ERR_BAD_OS, "invalid ELF");
+ return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
return grub_errno;
}
grub_free (syms);
grub_free (strs);
if (! grub_errno)
- return grub_error (GRUB_ERR_BAD_OS, "invalid ELF");
+ return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
return grub_errno;
}
grub_elf_t elf;
if (argc != 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "filename expected");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_loader_unset ();
return grub_errno;
}
- elf = grub_elf_file (file);
+ elf = grub_elf_file (file, argv[0]);
if (!elf)
{
grub_relocator_unload (relocator);
entry = elf->ehdr.ehdr32.e_entry & 0xFFFFFF;
- err = grub_elf32_load (elf, grub_chain_elf32_hook, 0, 0);
+ err = grub_elf32_load (elf, argv[0], grub_chain_elf32_hook, 0, 0);
grub_elf_close (elf);
if (err)
GRUB_MOD_INIT (chain)
{
cmd_chain = grub_register_command ("chainloader", grub_cmd_chain,
- N_("FILE"), N_("Load another payload"));
+ N_("FILE"),
+ /* TRANSLATORS: "payload" is a term used
+ by coreboot and must be translated in
+ sync with coreboot. If unsure,
+ let it untranslated. */
+ N_("Load another coreboot payload"));
}
GRUB_MOD_FINI (chain)
if (argc == 0)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
{
if (!grub_errno)
- grub_error (GRUB_ERR_READ_ERROR, N_("premature end of file %s"),
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);
goto fail;
}
if (grub_file_read (file, (char *) real_mode_mem + sizeof (lh), len) != len)
{
if (!grub_errno)
- grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);
goto fail;
}
len = prot_size;
if (grub_file_read (file, prot_mode_mem, len) != len && !grub_errno)
- grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);
if (grub_errno == GRUB_ERR_NONE)
if (argc == 0)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
if (! loaded)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "you need to load the kernel first");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
goto fail;
}
#include <grub/video.h>
#include <grub/file.h>
#include <grub/net.h>
+#include <grub/i18n.h>
/* The bits in the required part of flags field we don't support. */
#define UNSUPPORTED_FLAGS 0x0000fff8
grub_err_t
-grub_multiboot_load (grub_file_t file)
+grub_multiboot_load (grub_file_t file, const char *filename)
{
char *buffer;
grub_ssize_t len;
if (len < 32)
{
grub_free (buffer);
- return grub_error (GRUB_ERR_BAD_OS, "file too small");
+ if (!grub_errno)
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
+ return grub_errno;
}
/* Look for the multiboot header in the buffer. The header should
}
else
{
- err = grub_multiboot_load_elf (file, buffer);
+ err = grub_multiboot_load_elf (file, filename, buffer);
if (err)
{
grub_free (buffer);
if (grub_file_read (file, bs, GRUB_DISK_SECTOR_SIZE)
!= GRUB_DISK_SECTOR_SIZE)
{
- if (grub_errno == GRUB_ERR_NONE)
- grub_error (GRUB_ERR_BAD_OS, "too small");
+ if (!grub_errno)
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
goto fail;
}
}
if (argc == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
- else
- grub_chainloader_cmd (argv[0], flags);
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
+
+ grub_chainloader_cmd (argv[0], flags);
return grub_errno;
}
grub_size_t kernelsyssize;
if (argc == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_dl_ref (my_mod);
if (argc == 0)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
{
if (!grub_errno)
- grub_error (GRUB_ERR_READ_ERROR, N_("premature end of file %s"),
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);
goto fail;
}
if (grub_file_read (file, grub_linux_real_chunk + sizeof (lh), len) != len)
{
if (!grub_errno)
- grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);
goto fail;
}
len = grub_linux16_prot_size;
if (grub_file_read (file, grub_linux_prot_chunk, grub_linux16_prot_size)
!= (grub_ssize_t) grub_linux16_prot_size && !grub_errno)
- grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);
if (grub_errno == GRUB_ERR_NONE)
if (argc == 0)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
if (!loaded)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "you need to load the kernel first");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
goto fail;
}
grub_device_t dev;
if (argc == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_dl_ref (my_mod);
}
if (argc == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_dl_ref (my_mod);
goto fail;
if (grub_file_read (file, &hdr, sizeof (hdr)) != (grub_ssize_t) sizeof (hdr))
- goto fail;
+ {
+ if (!grub_errno)
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ argv[0]);
+ goto fail;
+ }
if (grub_be_to_cpu32 (hdr.magic) != GRUB_PLAN9_MAGIC
|| hdr.zero)
if (grub_file_read (file, ptr, grub_be_to_cpu32 (hdr.text_size))
!= (grub_ssize_t) grub_be_to_cpu32 (hdr.text_size))
- goto fail;
+ {
+ if (!grub_errno)
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ argv[0]);
+ goto fail;
+ }
ptr += grub_be_to_cpu32 (hdr.text_size);
padsize = ALIGN_UP (grub_be_to_cpu32 (hdr.text_size) + sizeof (hdr),
GRUB_PLAN9_ALIGN) - grub_be_to_cpu32 (hdr.text_size)
if (grub_file_read (file, ptr, grub_be_to_cpu32 (hdr.data_size))
!= (grub_ssize_t) grub_be_to_cpu32 (hdr.data_size))
- goto fail;
+ {
+ if (!grub_errno)
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ argv[0]);
+ goto fail;
+ }
ptr += grub_be_to_cpu32 (hdr.data_size);
padsize = ALIGN_UP (grub_be_to_cpu32 (hdr.data_size), GRUB_PLAN9_ALIGN)
- grub_be_to_cpu32 (hdr.data_size);
char *fname;
if (argc == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_dl_ref (my_mod);
unsigned i, j;
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)
- return grub_error (GRUB_ERR_FILE_NOT_FOUND,
- "couldn't load device-properties dump");
+ return grub_errno;
size = grub_file_size (file);
buf = grub_malloc (size);
if (!buf)
grub_xnu_set_video (struct grub_xnu_boot_params *params)
{
struct grub_video_mode_info mode_info;
- int ret;
char *tmp;
const char *modevar;
void *framebuffer;
if (err)
return err;
- ret = grub_video_get_info (&mode_info);
- if (ret)
- return grub_error (GRUB_ERR_IO, "couldn't retrieve video parameters");
+ err = grub_video_get_info (&mode_info);
+ if (err)
+ return err;
if (grub_xnu_bitmap)
{
bitmap = 0;
}
- ret = grub_video_get_info_and_fini (&mode_info, &framebuffer);
- if (ret)
- return grub_error (GRUB_ERR_IO, "couldn't retrieve video parameters");
+ err = grub_video_get_info_and_fini (&mode_info, &framebuffer);
+ if (err)
+ return err;
params->lfb_width = mode_info.width;
params->lfb_height = mode_info.height;
{
cmd_devprop_load = grub_register_command ("xnu_devprop_load",
grub_cmd_devprop_load,
- 0, N_("Load device-properties dump."));
+ /* TRANSLATORS: `device-properties'
+ is a variable name,
+ not a program. */
+ 0, N_("Load `device-properties' dump."));
}
void
bs = grub_efi_system_table->boot_services;
status = bs->locate_handle (GRUB_EFI_BY_PROTOCOL,
- (void *)&fpswa_protocol,
+ (void *) &fpswa_protocol,
NULL, &size, &fpswa_image);
if (status != GRUB_EFI_SUCCESS)
{
- grub_printf (_("Could not locate FPSWA driver\n"));
+ grub_printf ("%s\n", _("Could not locate FPSWA driver"));
return;
}
status = bs->handle_protocol (fpswa_image,
- (void *)&fpswa_protocol, (void *)&fpswa);
+ (void *) &fpswa_protocol, (void *) &fpswa);
if (status != GRUB_EFI_SUCCESS)
{
- grub_printf (_("Fpswa protocol not able find the interface\n"));
+ grub_printf ("%s\n",
+ _("FPSWA protocol wasn't able to find the interface"));
return;
}
}
phdr->p_memsz, phdr->p_offset, phdr->p_flags);
if (grub_file_seek (file, phdr->p_offset) == (grub_off_t)-1)
- return grub_error (GRUB_ERR_BAD_OS,
- "invalid offset in program header");
+ return grub_errno;
if (grub_file_read (file, (void *) (phdr->p_paddr + reloc_offset),
phdr->p_filesz)
if (argc == 0)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "No kernel specified");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
len = grub_file_read (file, buffer, sizeof (buffer));
if (len < (grub_ssize_t) sizeof (Elf64_Ehdr))
{
- grub_error (GRUB_ERR_BAD_OS, "File too small");
+ if (!grub_errno)
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ argv[0]);
goto fail;
}
if (argc == 0)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "No filename specified");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
if (! loaded)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "You need to load the kernel first.");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
goto fail;
}
if (argc == 0)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "No module specified");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
if (!boot_param)
{
grub_error (GRUB_ERR_BAD_ARGUMENT,
- "You need to load the kernel first");
+ N_("you need to load the kernel first"));
goto fail;
}
#include <grub/file.h>
#include <grub/misc.h>
#include <grub/mm.h>
+#include <grub/i18n.h>
grub_err_t
grub_macho_close (grub_macho_t macho)
}
grub_macho_t
-grub_macho_file (grub_file_t file)
+grub_macho_file (grub_file_t file, const char *filename)
{
grub_macho_t macho;
union grub_macho_filestart filestart;
if (grub_file_read (macho->file, &filestart, sizeof (filestart))
!= sizeof (filestart))
{
- grub_error_push ();
- grub_error (GRUB_ERR_READ_ERROR, "cannot read Mach-O header");
+ if (!grub_errno)
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
goto fail;
}
goto fail;
if (grub_file_read (macho->file, archs,
sizeof (struct grub_macho_fat_arch) * narchs)
- != (grub_ssize_t)sizeof(struct grub_macho_fat_arch) * narchs)
+ != (grub_ssize_t) sizeof(struct grub_macho_fat_arch) * narchs)
{
grub_free (archs);
- grub_error_push ();
- grub_error (GRUB_ERR_READ_ERROR, "cannot read Mach-O header");
+ if (!grub_errno)
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
goto fail;
}
macho->end64 = grub_file_size (file);
}
- grub_macho_parse32 (macho);
- grub_macho_parse64 (macho);
+ grub_macho_parse32 (macho, filename);
+ grub_macho_parse64 (macho, filename);
return macho;
if (! file)
return 0;
- macho = grub_macho_file (file);
+ macho = grub_macho_file (file, name);
if (! macho)
grub_file_close (file);
#include <grub/file.h>
#include <grub/mm.h>
#include <grub/misc.h>
+#include <grub/i18n.h>
#define min(a,b) (((a) < (b)) ? (a) : (b))
}
void
-SUFFIX (grub_macho_parse) (grub_macho_t macho)
+SUFFIX (grub_macho_parse) (grub_macho_t macho, const char *filename)
{
grub_macho_header_t head;
|| grub_file_read (macho->file, &head, sizeof (head))
!= sizeof(head))
{
- grub_error (GRUB_ERR_READ_ERROR, "cannot read Mach-O header");
+ if (!grub_errno)
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
macho->offsetXX = -1;
return;
}
macho->cmdsizeXX = head.sizeofcmds;
macho->cmdsXX = grub_malloc(macho->cmdsizeXX);
if (! macho->cmdsXX)
- {
- grub_error (GRUB_ERR_OUT_OF_MEMORY, "not enough memory to read commands");
- return;
- }
+ return;
if (grub_file_read (macho->file, macho->cmdsXX,
(grub_size_t) macho->cmdsizeXX)
!= (grub_ssize_t) macho->cmdsizeXX)
{
- grub_error (GRUB_ERR_READ_ERROR, "cannot read Mach-O header");
+ if (!grub_errno)
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
macho->offsetXX = -1;
}
}
}
grub_err_t
-SUFFIX (grub_macho_readfile) (grub_macho_t macho, void *dest)
+SUFFIX (grub_macho_readfile) (grub_macho_t macho,
+ const char *filename,
+ void *dest)
{
grub_ssize_t read;
if (! SUFFIX (grub_macho_contains_macho) (macho))
"couldn't read architecture-specific part");
if (grub_file_seek (macho->file, macho->offsetXX) == (grub_off_t) -1)
- {
- grub_error_push ();
- return grub_error (GRUB_ERR_BAD_OS,
- "invalid offset in program header");
- }
+ return grub_errno;
read = grub_file_read (macho->file, dest,
macho->endXX - macho->offsetXX);
if (read != (grub_ssize_t) (macho->endXX - macho->offsetXX))
{
- grub_error_push ();
- return grub_error (GRUB_ERR_BAD_OS,
- "couldn't read architecture-specific part");
+ if (!grub_errno)
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
+ return grub_errno;
}
return GRUB_ERR_NONE;
}
/* Load every loadable segment into memory specified by `_load_hook'. */
grub_err_t
-SUFFIX (grub_macho_load) (grub_macho_t macho, char *offset, int flags)
+SUFFIX (grub_macho_load) (grub_macho_t macho, const char *filename,
+ char *offset, int flags)
{
- grub_err_t err = 0;
auto int NESTED_FUNC_ATTR do_load(grub_macho_t _macho,
struct grub_macho_cmd *hdr0,
void *_arg __attribute__ ((unused)));
if (grub_file_seek (_macho->file, hdr->fileoff
+ _macho->offsetXX) == (grub_off_t) -1)
- {
- grub_error_push ();
- grub_error (GRUB_ERR_BAD_OS,
- "invalid offset in program header");
- return 1;
- }
+ return 1;
if (hdr->filesize)
{
if (read != (grub_ssize_t) min (hdr->filesize, hdr->vmsize))
{
/* XXX How can we free memory from `load_hook'? */
- grub_error_push ();
- err=grub_error (GRUB_ERR_BAD_OS,
- "couldn't read segment from file: "
- "wanted 0x%lx bytes; read 0x%lx bytes",
- hdr->filesize, read);
+ if (!grub_errno)
+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+ filename);
+
return 1;
}
}
grub_macho_cmds_iterate (macho, do_load, 0);
- return err;
+ return grub_errno;
}
grub_macho_addr_t
}
static grub_err_t
-grub_linux_load32 (grub_elf_t elf, void **extra_mem, grub_size_t extra_size)
+grub_linux_load32 (grub_elf_t elf, const char *filename,
+ void **extra_mem, grub_size_t extra_size)
{
Elf32_Addr base;
int extraoff;
/* Linux's entry point incorrectly contains a virtual address. */
entry_addr = elf->ehdr.ehdr32.e_entry;
- linux_size = grub_elf32_size (elf, &base, 0);
+ linux_size = grub_elf32_size (elf, filename, &base, 0);
if (linux_size == 0)
return grub_errno;
target_addr = base;
*addr = (grub_addr_t) (phdr->p_paddr - base + playground);
return 0;
}
- return grub_elf32_load (elf, offset_phdr, 0, 0);
+ return grub_elf32_load (elf, filename, offset_phdr, 0, 0);
}
static grub_err_t
-grub_linux_load64 (grub_elf_t elf, void **extra_mem, grub_size_t extra_size)
+grub_linux_load64 (grub_elf_t elf, const char *filename,
+ void **extra_mem, grub_size_t extra_size)
{
Elf64_Addr base;
int extraoff;
/* Linux's entry point incorrectly contains a virtual address. */
entry_addr = elf->ehdr.ehdr64.e_entry;
- linux_size = grub_elf64_size (elf, &base, 0);
+ linux_size = grub_elf64_size (elf, filename, &base, 0);
if (linux_size == 0)
return grub_errno;
target_addr = base;
*addr = (grub_addr_t) (phdr->p_paddr - base + playground);
return 0;
}
- return grub_elf64_load (elf, offset_phdr, 0, 0);
+ return grub_elf64_load (elf, filename, offset_phdr, 0, 0);
}
static grub_err_t
#endif
if (argc == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
elf = grub_elf_open (argv[0]);
if (! elf)
{
grub_elf_close (elf);
return grub_error (GRUB_ERR_UNKNOWN_OS,
- "this ELF file is not of the right type\n");
+ N_("this ELF file is not of the right type"));
}
/* Release the previously used memory. */
#endif
if (grub_elf_is_elf32 (elf))
- err = grub_linux_load32 (elf, &extra, size);
+ err = grub_linux_load32 (elf, argv[0], &extra, size);
else
if (grub_elf_is_elf64 (elf))
- err = grub_linux_load64 (elf, &extra, size);
+ err = grub_linux_load64 (elf, argv[0], &extra, size);
else
- err = grub_error (GRUB_ERR_BAD_FILE_TYPE, "unknown ELF class");
+ err = grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
grub_elf_close (elf);
grub_uint8_t *ptr;
if (argc == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "no initrd specified");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
if (!loaded)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "you need to load Linux first.");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
if (initrd_loaded)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "only one initrd command can be issued.");
/* Load ELF32 or ELF64. */
grub_err_t
-grub_multiboot_load_elf (grub_file_t file, void *buffer)
+grub_multiboot_load_elf (grub_file_t file, const char *filename,
+ void *buffer)
{
if (grub_multiboot_is_elf32 (buffer))
- return grub_multiboot_load_elf32 (file, buffer);
+ return grub_multiboot_load_elf32 (file, filename, buffer);
else if (grub_multiboot_is_elf64 (buffer))
- return grub_multiboot_load_elf64 (file, buffer);
+ return grub_multiboot_load_elf64 (file, filename, buffer);
- return grub_error (GRUB_ERR_UNKNOWN_OS, "unknown ELF class");
+ return grub_error (GRUB_ERR_UNKNOWN_OS, N_("invalid arch dependent ELF magic"));
}
grub_err_t
grub_loader_unset ();
if (argc == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
file = grub_file_open (argv[0]);
if (! file)
if (!grub_multiboot_relocator)
goto fail;
- err = grub_multiboot_load (file);
+ err = grub_multiboot_load (file, argv[0]);
if (err)
goto fail;
int nounzip = 0;
if (argc == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
if (grub_strcmp (argv[0], "--nounzip") == 0)
{
}
if (argc == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
if (!grub_multiboot_relocator)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- "you need to load the multiboot kernel first");
+ N_("you need to load the kernel first"));
if (nounzip)
grub_file_filter_disable_compression ();
}
static grub_err_t
-CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, void *buffer)
+CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, const char *filename, void *buffer)
{
Elf_Ehdr *ehdr = (Elf_Ehdr *) buffer;
char *phdr_base;
int i;
- if (ehdr->e_ident[EI_CLASS] != ELFCLASSXX)
- return grub_error (GRUB_ERR_UNKNOWN_OS, "invalid ELF class");
-
if (ehdr->e_ident[EI_MAG0] != ELFMAG0
|| ehdr->e_ident[EI_MAG1] != ELFMAG1
|| ehdr->e_ident[EI_MAG2] != ELFMAG2
|| ehdr->e_ident[EI_MAG3] != ELFMAG3
- || ehdr->e_version != EV_CURRENT
- || ehdr->e_ident[EI_DATA] != ELFDATA2LSB
- || ehdr->e_machine != E_MACHINE)
- return grub_error(GRUB_ERR_UNKNOWN_OS, "no valid ELF header found");
+ || ehdr->e_ident[EI_DATA] != ELFDATA2LSB)
+ return grub_error(GRUB_ERR_UNKNOWN_OS, N_("invalid arch independent ELF magic"));
+
+ if (ehdr->e_ident[EI_CLASS] != ELFCLASSXX || ehdr->e_machine != E_MACHINE
+ || ehdr->e_version != EV_CURRENT)
+ return grub_error (GRUB_ERR_UNKNOWN_OS, N_("invalid arch dependent ELF magic"));
if (ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN)
- return grub_error (GRUB_ERR_UNKNOWN_OS, "invalid ELF file type");
+ return grub_error (GRUB_ERR_UNKNOWN_OS, N_("this ELF file is not of the right type"));
/* FIXME: Should we support program headers at strange locations? */
if (ehdr->e_phoff + ehdr->e_phnum * ehdr->e_phentsize > MULTIBOOT_SEARCH)
{
if (grub_file_seek (file, (grub_off_t) phdr(i)->p_offset)
== (grub_off_t) -1)
- return grub_error (GRUB_ERR_BAD_OS,
- "invalid offset in program header");
+ return grub_errno;
if (grub_file_read (file, source, phdr(i)->p_filesz)
!= (grub_ssize_t) phdr(i)->p_filesz)
- return grub_error (GRUB_ERR_BAD_OS,
- "couldn't read segment from file");
+ {
+ if (!grub_errno)
+ grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+ filename);
+ return grub_errno;
+ }
}
if (phdr(i)->p_filesz < phdr(i)->p_memsz)
return grub_errno;
if (grub_file_seek (file, ehdr->e_shoff) == (grub_off_t) -1)
- return grub_error (GRUB_ERR_BAD_OS,
- "invalid offset to section headers");
+ return grub_errno;
if (grub_file_read (file, shdr, ehdr->e_shnum * ehdr->e_shentsize)
!= (grub_ssize_t) ehdr->e_shnum * ehdr->e_shentsize)
- return grub_error (GRUB_ERR_BAD_OS,
- "couldn't read sections headers from file");
+ {
+ if (!grub_errno)
+ grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+ filename);
+ return grub_errno;
+ }
for (shdrptr = shdr, i = 0; i < ehdr->e_shnum;
shdrptr += ehdr->e_shentsize, i++)
}
if (grub_file_seek (file, sh->sh_offset) == (grub_off_t) -1)
- return grub_error (GRUB_ERR_BAD_OS,
- "invalid offset in section header");
+ return grub_errno;
if (grub_file_read (file, src, sh->sh_size)
!= (grub_ssize_t) sh->sh_size)
- return grub_error (GRUB_ERR_BAD_OS,
- "couldn't read segment from file");
+ {
+ if (!grub_errno)
+ grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+ filename);
+ return grub_errno;
+ }
sh->sh_addr = target;
}
grub_multiboot_add_elfsyms (ehdr->e_shnum, ehdr->e_shentsize,
}
grub_err_t
-grub_multiboot_load (grub_file_t file)
+grub_multiboot_load (grub_file_t file, const char *filename)
{
grub_properly_aligned_t *buffer;
grub_ssize_t len;
}
else
{
- err = grub_multiboot_load_elf (file, buffer);
+ err = grub_multiboot_load_elf (file, filename, buffer);
if (err)
{
grub_free (buffer);
}
static grub_err_t
-grub_linux_load32 (grub_elf_t elf)
+grub_linux_load32 (grub_elf_t elf, const char *filename)
{
Elf32_Addr base_addr;
grub_addr_t seg_addr;
grub_uint32_t offset;
Elf32_Addr entry;
- linux_size = grub_elf32_size (elf, &base_addr, &align);
+ linux_size = grub_elf32_size (elf, filename, &base_addr, &align);
if (linux_size == 0)
return grub_errno;
/* Pad it; the kernel scribbles over memory beyond its load address. */
*addr = (phdr->p_paddr - base_addr) + seg_addr;
return 0;
}
- return grub_elf32_load (elf, offset_phdr, 0, 0);
+ return grub_elf32_load (elf, filename, offset_phdr, 0, 0);
}
static grub_err_t
-grub_linux_load64 (grub_elf_t elf)
+grub_linux_load64 (grub_elf_t elf, const char *filename)
{
Elf64_Addr base_addr;
grub_addr_t seg_addr;
grub_uint64_t offset;
Elf64_Addr entry;
- linux_size = grub_elf64_size (elf, &base_addr, &align);
+ linux_size = grub_elf64_size (elf, filename, &base_addr, &align);
if (linux_size == 0)
return grub_errno;
/* Pad it; the kernel scribbles over memory beyond its load address. */
*addr = (phdr->p_paddr - base_addr) + seg_addr;
return 0;
}
- return grub_elf64_load (elf, offset_phdr, 0, 0);
+ return grub_elf64_load (elf, filename, offset_phdr, 0, 0);
}
static grub_err_t
if (argc == 0)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto out;
}
if (elf->ehdr.ehdr32.e_type != ET_EXEC && elf->ehdr.ehdr32.e_type != ET_DYN)
{
grub_error (GRUB_ERR_UNKNOWN_OS,
- "this ELF file is not of the right type");
+ N_("this ELF file is not of the right type"));
goto out;
}
grub_loader_unset ();
if (grub_elf_is_elf32 (elf))
- grub_linux_load32 (elf);
+ grub_linux_load32 (elf, argv[0]);
else
if (grub_elf_is_elf64 (elf))
- grub_linux_load64 (elf);
+ grub_linux_load64 (elf, argv[0]);
else
{
- grub_error (GRUB_ERR_BAD_FILE_TYPE, "unknown ELF class");
+ grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("invalid arch dependent ELF magic"));
goto out;
}
if (argc == 0)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "no initrd specified");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
if (!loaded)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "you need to load the kernel first");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
goto fail;
}
}
static grub_err_t
-grub_linux_load64 (grub_elf_t elf)
+grub_linux_load64 (grub_elf_t elf, const char *filename)
{
grub_addr_t off, paddr, base;
int ret;
linux_entry = elf->ehdr.ehdr64.e_entry;
linux_addr = 0x40004000;
off = 0x4000;
- linux_size = grub_elf64_size (elf, 0, 0);
+ linux_size = grub_elf64_size (elf, filename, 0, 0);
if (linux_size == 0)
return grub_errno;
*addr = (phdr->p_paddr - base) + (linux_addr - off);
return 0;
}
- return grub_elf64_load (elf, offset_phdr, 0, 0);
+ return grub_elf64_load (elf, filename, offset_phdr, 0, 0);
}
static grub_err_t
if (argc == 0)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto out;
}
if (!file)
goto out;
- elf = grub_elf_file (file);
+ elf = grub_elf_file (file, argv[0]);
if (! elf)
goto out;
if (elf->ehdr.ehdr32.e_type != ET_EXEC)
{
grub_error (GRUB_ERR_UNKNOWN_OS,
- "this ELF file is not of the right type");
+ N_("this ELF file is not of the right type"));
goto out;
}
grub_loader_unset ();
if (grub_elf_is_elf64 (elf))
- grub_linux_load64 (elf);
+ grub_linux_load64 (elf, argv[0]);
else
{
- grub_error (GRUB_ERR_BAD_FILE_TYPE, "unknown ELF class");
+ grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("invalid arch dependent ELF magic"));
goto out;
}
if (argc == 0)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "no initrd specified");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
if (!loaded)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "you need to load the kernel first");
+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
goto fail;
}
driverkey = (struct grub_xnu_devtree_key *) grub_malloc (sizeof (*driverkey));
if (! driverkey)
- return grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't write device tree");
+ return grub_errno;
driverkey->name = grub_strdup ("DeviceTree");
if (! driverkey->name)
- return grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't write device tree");
+ return grub_errno;
driverkey->datasize = sizeof (*extdesc);
driverkey->next = memorymap->first_child;
memorymap->first_child = driverkey;
driverkey->data = extdesc
= (struct grub_xnu_extdesc *) grub_malloc (sizeof (*extdesc));
if (! driverkey->data)
- return grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't write device tree");
+ return grub_errno;
/* Allocate the space based on the size with dummy value. */
*size = grub_xnu_writetree_get_size (grub_xnu_devtree_root, "/");
return ret;
ret = (struct grub_xnu_devtree_key *) grub_zalloc (sizeof (*ret));
if (! ret)
- {
- grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't create key %s", name);
- return 0;
- }
+ return 0;
ret->name = grub_strdup (name);
if (! ret->name)
{
grub_free (ret);
- grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't create key %s", name);
return 0;
}
ret->datasize = -1;
}
ret = (struct grub_xnu_devtree_key *) grub_zalloc (sizeof (*ret));
if (! ret)
- {
- grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't create value %s", name);
- return 0;
- }
+ return 0;
ret->name = grub_strdup (name);
if (! ret->name)
{
grub_free (ret);
- grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't create value %s", name);
return 0;
}
ret->next = *parent;
grub_addr_t loadaddr_target;
if (argc < 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_xnu_unload ();
}
/* Load kernel. */
- err = grub_macho_load32 (macho, (char *) loadaddr - startcode,
+ err = grub_macho_load32 (macho, args[0], (char *) loadaddr - startcode,
GRUB_MACHO_NOBSS);
if (err)
{
grub_addr_t loadaddr_target;
if (argc < 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_xnu_unload ();
}
/* Load kernel. */
- err = grub_macho_load64 (macho, (char *) loadaddr - startcode,
+ err = grub_macho_load64 (macho, args[0], (char *) loadaddr - startcode,
GRUB_MACHO_NOBSS);
if (err)
{
struct grub_xnu_extdesc *extdesc;
if (! grub_xnu_heap_size)
- return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
+ return grub_error (GRUB_ERR_BAD_OS, N_("you need to load the kernel first"));
chosen = grub_xnu_create_key (&grub_xnu_devtree_root, "chosen");
if (! chosen)
driverkey = (struct grub_xnu_devtree_key *) grub_malloc (sizeof (*driverkey));
if (! driverkey)
- return grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't register memory");
+ return grub_errno;
if (suffix)
- {
- driverkey->name = grub_xasprintf ("%s%d", prefix, (*suffix)++);
- if (!driverkey->name)
- return grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't register memory");
- }
+ driverkey->name = grub_xasprintf ("%s%d", prefix, (*suffix)++);
else
driverkey->name = grub_strdup (prefix);
- if (! driverkey->name)
- return grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't register extension");
+ if (!driverkey->name)
+ {
+ grub_free (driverkey);
+ return grub_errno;
+ }
driverkey->datasize = sizeof (*extdesc);
driverkey->next = memorymap->first_child;
- memorymap->first_child = driverkey;
driverkey->data = extdesc
= (struct grub_xnu_extdesc *) grub_malloc (sizeof (*extdesc));
if (! driverkey->data)
- return grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't register extension");
+ {
+ grub_free (driverkey->name);
+ grub_free (driverkey);
+ return grub_errno;
+ }
+ memorymap->first_child = driverkey;
extdesc->addr = addr;
extdesc->size = (grub_uint32_t) size;
return GRUB_ERR_NONE;
/* Load .kext. */
static grub_err_t
-grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile)
+grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile,
+ const char *filename)
{
grub_macho_t macho;
grub_err_t err;
neededspace += namelen + 1;
if (! grub_xnu_heap_size)
- return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
+ return grub_error (GRUB_ERR_BAD_OS, N_("you need to load the kernel first"));
/* Compute the needed space. */
if (binaryfile)
{
- macho = grub_macho_file (binaryfile);
+ macho = grub_macho_file (binaryfile, filename);
if (! macho || ! grub_macho_contains_macho32 (macho))
{
if (macho)
exthead->binaryaddr = buf_target + (buf - (grub_uint8_t *) buf0);
exthead->binarysize = machosize;
if (grub_xnu_is_64bit)
- err = grub_macho_readfile64 (macho, buf);
+ err = grub_macho_readfile64 (macho, filename, buf);
else
- err = grub_macho_readfile32 (macho, buf);
+ err = grub_macho_readfile32 (macho, filename, buf);
if (err)
{
grub_macho_close (macho);
int narchs, i;
if (argc != 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
if (! grub_xnu_heap_size)
- return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
+ return grub_error (GRUB_ERR_BAD_OS, N_("you need to load the kernel first"));
file = grub_file_open (args[0]);
if (! file)
grub_size_t size;
if (argc != 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
if (! grub_xnu_heap_size)
- return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
+ return grub_error (GRUB_ERR_BAD_OS, N_("you need to load the kernel first"));
file = grub_file_open (args[0]);
if (! file)
}
if (! grub_xnu_heap_size)
- return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
+ return grub_error (GRUB_ERR_BAD_OS, N_("you need to load the kernel first"));
device_name = grub_file_get_device_name (dirname);
dev = grub_device_open (device_name);
grub_errno = GRUB_ERR_NONE;
/* Load the extension. */
- grub_xnu_load_driver (plistname, binfile);
+ grub_xnu_load_driver (plistname, binfile,
+ binname);
grub_free (binname);
grub_free (binsuffix);
}
else
{
grub_dprintf ("xnu", "%s:0\n", plistname);
- grub_xnu_load_driver (plistname, 0);
+ grub_xnu_load_driver (plistname, 0, 0);
}
}
grub_free (plistname);
grub_file_t binfile = 0;
if (! grub_xnu_heap_size)
- return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
+ return grub_error (GRUB_ERR_BAD_OS, N_("you need to load the kernel first"));
if (argc == 2)
{
{
binfile = grub_file_open (args[1]);
if (! binfile)
- {
- grub_error (GRUB_ERR_BAD_OS, "can't open file");
- return GRUB_ERR_NONE;
- }
+ return grub_errno;
}
return grub_xnu_load_driver (grub_strcmp (args[0], "-") ? args[0] : 0,
- binfile);
+ binfile, args[1]);
}
/* load kext normally. */
if (argc == 1)
return grub_xnu_load_kext_from_dir (args[0], 0, 10);
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
}
/* Load a directory containing kexts. */
return grub_error (GRUB_ERR_BAD_ARGUMENT, "directory name required");
if (! grub_xnu_heap_size)
- return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
+ return grub_error (GRUB_ERR_BAD_OS, N_("you need to load the kernel first"));
if (argc == 1)
return grub_xnu_scan_dir_for_kexts (args[0],
{
grub_err_t err;
if (argc != 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
if (! grub_xnu_heap_size)
- return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
+ return grub_error (GRUB_ERR_BAD_OS, N_("you need to load the kernel first"));
if (ctxt->state[XNU_SPLASH_CMD_ARGINDEX_MODE].set &&
grub_strcmp (ctxt->state[XNU_SPLASH_CMD_ARGINDEX_MODE].arg,
int argc, char *args[])
{
if (argc != 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
return grub_xnu_resume (args[0]);
}
cmd_kext = grub_register_command ("xnu_kext", grub_cmd_xnu_kext, 0,
N_("Load XNU extension."));
cmd_kextdir = grub_register_command ("xnu_kextdir", grub_cmd_xnu_kextdir,
+ /* TRANSLATORS: OSBundleRequired is a
+ variable name in xnu extensions
+ manifests. It behaves mostly like
+ GNU/Linux runlevels.
+ */
N_("DIRECTORY [OSBundleRequired]"),
N_("Load XNU extension directory."));
cmd_ramdisk = grub_register_command ("xnu_ramdisk", grub_cmd_xnu_ramdisk, 0,
N_("Load XNU ramdisk. "
- "It will be seen as md0."));
+ "It will be available in OS as md0."));
cmd_splash = grub_register_extcmd ("xnu_splash",
grub_cmd_xnu_splash, 0, 0,
N_("Load a splash image for XNU."),
#ifndef GRUB_MACHINE_EMU
cmd_resume = grub_register_command ("xnu_resume", grub_cmd_xnu_resume,
- 0, N_("Load XNU hibernate image."));
+ 0, N_("Load an image of hibernated"
+ " XNU image."));
#endif
grub_cpu_xnu_init ();
return GRUB_ERR_NONE;
}
}
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "handle %d not found", handle);
+ return grub_error (GRUB_ERR_BUG, "handle %d not found", handle);
}
/* Result is always page-aligned. */
grub_malloc (sizeof (struct grub_mmap_scan) * 2 * mmap_num);
if (! scanline_events)
- {
- return grub_error (GRUB_ERR_OUT_OF_MEMORY,
- "couldn't allocate space for new memory map");
- }
+ return grub_errno;
i = 0;
#ifndef GRUB_MMAP_REGISTER_BY_FIRMWARE
cur = (struct grub_mmap_region *)
grub_malloc (sizeof (struct grub_mmap_region));
if (! cur)
- {
- grub_error (GRUB_ERR_OUT_OF_MEMORY,
- "couldn't allocate memory map overlay");
- return 0;
- }
+ return 0;
cur->next = grub_mmap_overlays;
cur->start = start;
{
struct grub_mmap_region *cur, *prev;
- for (cur = grub_mmap_overlays, prev = 0; cur; prev= cur, cur = cur->next)
+ for (cur = grub_mmap_overlays, prev = 0; cur; prev = cur, cur = cur->next)
if (handle == cur->handle)
{
grub_err_t err;
- if ((err = grub_machine_mmap_unregister (handle)))
+ err = grub_machine_mmap_unregister (handle);
+ if (err)
return err;
if (prev)
grub_free (cur);
return GRUB_ERR_NONE;
}
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "mmap overlay not found");
+ return grub_error (GRUB_ERR_BUG, "mmap overlay not found");
}
#endif /* ! GRUB_MMAP_REGISTER_BY_FIRMWARE */
}
if (argc != 2)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "argements required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
from = parsemem (args[0]);
if (grub_errno)
{
cmd = grub_register_command ("badram", grub_cmd_badram,
N_("ADDR1,MASK1[,ADDR2,MASK2[,...]]"),
- N_("Declare memory regions as badram."));
+ N_("Declare memory regions as faulty (badram)."));
cmd_cut = grub_register_command ("cutmem", grub_cmd_cutmem,
N_("FROM[K|M|G] TO[K|M|G]"),
N_("Remove any memory regions in specified range."));
etherpro = GRUB_NET_ETHERTYPE_IP;
}
else
- return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "unsupported address family");
+ return grub_error (GRUB_ERR_BUG, "unsupported address family");
/* Build a request packet. */
nb.head = arp_data;
if (!inter)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- N_("unrecognised interface %s"), args[1]);
+ N_("unrecognised network interface `%s'"), args[1]);
if (!inter->dhcp_ack)
return grub_error (GRUB_ERR_IO, N_("no DHCP info found"));
grub_size_t naddresses, i;
struct grub_net_network_level_address *addresses;
if (argc != 2)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "2 arguments expected");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
err = grub_net_resolve_address (args[1], &server);
if (err)
return err;
struct grub_net_network_level_address server;
if (argc != 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "1 argument expected");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
err = grub_net_resolve_address (args[0], &server);
if (err)
return err;
struct grub_net_network_level_address server;
if (argc != 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "1 argument expected");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
err = grub_net_resolve_address (args[1], &server);
if (err)
return err;
#include <grub/time.h>
#include <grub/efi/api.h>
#include <grub/efi/efi.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
st = efi_call_7 (net->transmit, net, 0, (pack->tail - pack->data),
pack->data, NULL, NULL, NULL);
if (st != GRUB_EFI_SUCCESS)
- return grub_error (GRUB_ERR_IO, "couldn't send network packet");
+ return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
while (1)
{
void *txbuf = NULL;
st = efi_call_3 (net->get_status, net, 0, &txbuf);
if (st != GRUB_EFI_SUCCESS)
- return grub_error (GRUB_ERR_IO, "couldn't send network packet");
+ return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
if (txbuf)
return GRUB_ERR_NONE;
if (limit_time < grub_get_time_ms ())
- return grub_error (GRUB_ERR_TIMEOUT, "couldn't send network packet");
+ return grub_error (GRUB_ERR_TIMEOUT, N_("couldn't send network packet"));
}
}
#include <fcntl.h>
#include <unistd.h>
#include <grub/term.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
actual = write (fd, pack->data, pack->tail - pack->data);
if (actual < 0)
- return grub_error (GRUB_ERR_IO, "couldn't send packets");
+ return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
return GRUB_ERR_NONE;
}
#include <grub/file.h>
#include <grub/misc.h>
#include <grub/env.h>
+#include <grub/i18n.h>
#include <grub/machine/pxe.h>
#include <grub/machine/int.h>
grub_pxe_call (GRUB_PXENV_UNDI_TRANSMIT, trans, pxe_rm_entry);
if (trans->status)
- return grub_error (GRUB_ERR_IO, "PXE send failed (status 0x%x)",
- trans->status);
+ return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
return 0;
}
#include <grub/dl.h>
#include <grub/net.h>
#include <grub/time.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
pack->tail - pack->data, &actual);
if (status)
- return grub_error (GRUB_ERR_IO, "Couldn't send network packet.");
+ return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
return GRUB_ERR_NONE;
}
#include <grub/mm.h>
#include <grub/dl.h>
#include <grub/file.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
grub_free (str);
return data->err;
}
- return grub_error (GRUB_ERR_TIMEOUT, "timeout opening http");
+ return grub_error (GRUB_ERR_TIMEOUT, N_("time out opening `%s'"), data->filename);
}
return GRUB_ERR_NONE;
}
case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6:
return grub_net_send_ip6_packet (inf, target, ll_target_addr, nb, proto);
default:
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "not an IP");
+ return grub_error (GRUB_ERR_BUG, "not an IP");
}
}
case GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV:
return grub_error (GRUB_ERR_BUG, "shouldn't reach here");
default:
- return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ return grub_error (GRUB_ERR_BUG,
"unsupported address type %d", proto_addr->type);
}
if (err)
return GRUB_ERR_NONE;
}
}
- return grub_error (GRUB_ERR_NET_BAD_ADDRESS, N_("unrecognised address %s"),
+ return grub_error (GRUB_ERR_NET_BAD_ADDRESS,
+ N_("unrecognised network address `%s'"),
name);
}
grub_net_network_level_netaddress_t target;
if (argc < 3)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- N_("At least 3 arguments are expected"));
+ N_("three arguments expected"));
grub_net_resolve_net_address (args[1], &target);
if (!inter)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- N_("unrecognised interface %s"), args[2]);
+ N_("unrecognised network interface `%s'"), args[2]);
return grub_net_add_route (args[0], target, inter);
}
}
const struct grub_dirhook_info *info) __attribute__ ((unused)))
{
if (!device->net)
- return grub_error (GRUB_ERR_BAD_FS, "invalid extent");
+ return grub_error (GRUB_ERR_BUG, "invalid net device");
return GRUB_ERR_NONE;
}
{
nb->tail += len;
if (nb->tail > nb->end)
- return grub_error (GRUB_ERR_OUT_OF_RANGE, "put out of the packet range.");
+ return grub_error (GRUB_ERR_BUG, "put out of the packet range.");
return GRUB_ERR_NONE;
}
{
nb->tail -= len;
if (nb->tail < nb->head)
- return grub_error (GRUB_ERR_OUT_OF_RANGE,
+ return grub_error (GRUB_ERR_BUG,
"unput out of the packet range.");
return GRUB_ERR_NONE;
}
{
nb->data -= len;
if (nb->data < nb->head)
- return grub_error (GRUB_ERR_OUT_OF_RANGE,
+ return grub_error (GRUB_ERR_BUG,
"push out of the packet range.");
return GRUB_ERR_NONE;
}
{
nb->data += len;
if (nb->data > nb->end)
- return grub_error (GRUB_ERR_OUT_OF_RANGE,
+ return grub_error (GRUB_ERR_BUG,
"pull out of the packet range.");
return GRUB_ERR_NONE;
}
nb->data += len;
nb->tail += len;
if ((nb->tail > nb->end) || (nb->data > nb->end))
- return grub_error (GRUB_ERR_OUT_OF_RANGE,
+ return grub_error (GRUB_ERR_BUG,
"reserve out of the packet range.");
return GRUB_ERR_NONE;
}
if (addr.type != GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4
&& addr.type != GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "not an IP address");
+ grub_error (GRUB_ERR_BUG, "not an IP address");
return NULL;
}
#include <grub/dl.h>
#include <grub/file.h>
#include <grub/priority_queue.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
}
if (!data->have_oack)
- grub_error (GRUB_ERR_TIMEOUT, "Time out opening tftp.");
+ grub_error (GRUB_ERR_TIMEOUT, N_("time out opening `%s'"), filename);
else
grub_error_load (&data->save_err);
if (grub_errno)
if (addr.type != GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4
&& addr.type != GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6)
{
- grub_error (GRUB_ERR_BAD_ARGUMENT, "not an IP address");
+ grub_error (GRUB_ERR_BUG, "not an IP address");
return NULL;
}
{
cmd = grub_register_command ("authenticate",
grub_cmd_authenticate,
- N_("[USERLIST]"), N_("Authenticate users"));
+ N_("[USERLIST]"),
+ N_("Check whether user is in USERLIST."));
}
at least DESTSIZE characters. If an invalid sequence is found, return -1.
If SRCEND is not NULL, then *SRCEND is set to the next byte after the
last byte used in SRC. */
-grub_ssize_t
+grub_size_t
grub_utf8_to_utf16 (grub_uint16_t *dest, grub_size_t destsize,
const grub_uint8_t *src, grub_size_t srcsize,
const grub_uint8_t **srcend)
GRUB_COMMAND_FLAG_BLOCKS
| GRUB_COMMAND_FLAG_EXTCMD
| GRUB_COMMAND_FLAG_DYNCMD,
- 0, N_("not loaded"), 0,
- prio);
+ 0, N_("module isn't loaded"),
+ 0, prio);
if (! cmd)
{
grub_free (name);
}
}
else
- grub_printf ("%s", _("Not a known filesystem"));
+ grub_printf ("%s", _("No known filesystem detected"));
if (dev->disk->partition)
grub_printf (_(" - Partition start at %llu"),
#include <grub/dl.h>
#include <grub/msdos_partition.h>
#include <grub/gpt_partition.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
if (len == 0)
return grub_error (GRUB_ERR_FILE_NOT_FOUND,
- "This GPT partition label has no BIOS Boot Partition;"
- " embedding won't be possible!");
+ N_("this GPT partition label has no BIOS Boot Partition;"
+ " embedding won't be possible"));
if (len < *nsectors)
return grub_error (GRUB_ERR_OUT_OF_RANGE,
- "Your BIOS Boot Partition is too small;"
- " embedding won't be possible!");
+ N_("your BIOS Boot Partition is too small;"
+ " embedding won't be possible"));
*nsectors = len;
*sectors = grub_malloc (*nsectors * sizeof (**sectors));
#include <grub/mm.h>
#include <grub/misc.h>
#include <grub/dl.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
if (end <= 1)
return grub_error (GRUB_ERR_FILE_NOT_FOUND,
- "This msdos-style partition label has no "
- "post-MBR gap; embedding won't be possible!");
+ N_("this msdos-style partition label has no "
+ "post-MBR gap; embedding won't be possible"));
if (*nsectors > 62)
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"));
return grub_error (GRUB_ERR_OUT_OF_RANGE,
- "Your embedding area is unusually small. "
- "core.img won't fit in it.");
+ N_("your embedding area is unusually small. "
+ "core.img won't fit in it."));
}
#endif
static struct grub_parttool_argdesc grub_pcpart_typeargs[] =
{
{"type", N_("Change partition type"), GRUB_PARTTOOL_ARG_VAL},
- {"hidden", N_("Make partition hidden"), GRUB_PARTTOOL_ARG_BOOL},
+ {"hidden", N_("Set `hidden' flag in partition type"), GRUB_PARTTOOL_ARG_BOOL},
{0, 0, 0}
};
struct grub_video_render_target *old_target;
if (argc != 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "missing operand");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
/* Check that we have video adapter active. */
if (grub_video_get_info (NULL) != GRUB_ERR_NONE)
if (x > grub_term_width (term) || y > grub_term_height (term))
{
- grub_error (GRUB_ERR_OUT_OF_RANGE, "invalid point (%u,%u)", x, y);
+ grub_error (GRUB_ERR_BUG, "invalid point (%u,%u)", x, y);
return;
}
[GRUB_TERM_CODE_TYPE_UTF8_LOGICAL >> GRUB_TERM_CODE_TYPE_SHIFT]
= _("UTF-8"),
[GRUB_TERM_CODE_TYPE_UTF8_VISUAL >> GRUB_TERM_CODE_TYPE_SHIFT]
- = _("UTF-8 visual"),
+ = _("visually-ordered UTF-8"),
[GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS >> GRUB_TERM_CODE_TYPE_SHIFT]
= "Glyph descriptors",
- _("Unknown"), _("Unknown"), _("Unknown")
+ _("Unknown encoding"), _("Unknown encoding"), _("Unknown encoding")
};
struct grub_term_output *cur;
{"utf8", 'u', 0, N_("Terminal is logical-ordered UTF-8."), 0, ARG_TYPE_NONE},
{"visual-utf8", 'v', 0, N_("Terminal is visually-ordered UTF-8."), 0,
ARG_TYPE_NONE},
- {"geometry", 'g', 0, N_("Terminal has given geometry."),
+ {"geometry", 'g', 0, N_("Terminal has specified geometry."),
N_("WIDTHxHEIGHT."), ARG_TYPE_STRING},
{0, 0, 0, 0, 0, 0}
};
unsigned int size;
if (!bitmap)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument");
+ return grub_error (GRUB_ERR_BUG, "invalid argument");
*bitmap = 0;
if (width == 0 || height == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument");
+ return grub_error (GRUB_ERR_BUG, "invalid argument");
*bitmap = (struct grub_video_bitmap *)grub_malloc (sizeof (struct grub_video_bitmap));
if (! *bitmap)
grub_free (*bitmap);
*bitmap = 0;
- return grub_error (GRUB_ERR_BAD_ARGUMENT,
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"unsupported bitmap format");
}
grub_video_bitmap_reader_t reader = bitmap_readers_list;
if (!bitmap)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument");
+ return grub_error (GRUB_ERR_BUG, "invalid argument");
*bitmap = 0;
reader = reader->next;
}
- return grub_error(GRUB_ERR_BAD_FILE_TYPE, "unsupported bitmap format");
+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, "unsupported bitmap format");
}
/* Return bitmap width. */
/* Verify the simplifying assumptions. */
if (src == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT,
+ return grub_error (GRUB_ERR_BUG,
"null src bitmap in grub_video_bitmap_create_scaled");
if (src->mode_info.red_field_pos % 8 != 0
|| src->mode_info.green_field_pos % 8 != 0
|| src->mode_info.blue_field_pos % 8 != 0
|| src->mode_info.reserved_field_pos % 8 != 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT,
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"src format not supported for scale");
if (src->mode_info.width == 0 || src->mode_info.height == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"source bitmap has a zero dimension");
if (dst_width <= 0 || dst_height <= 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT,
+ return grub_error (GRUB_ERR_BUG,
"requested to scale to a size w/ a zero dimension");
if (src->mode_info.bytes_per_pixel * 8 != src->mode_info.bpp)
- return grub_error (GRUB_ERR_BAD_ARGUMENT,
+ return grub_error (GRUB_ERR_BUG,
"bitmap to scale has inconsistent Bpp and bpp");
/* Create the new bitmap. */
ret = scale_bilinear (*dst, src);
break;
default:
- ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid scale_method value");
+ ret = grub_error (GRUB_ERR_BUG, "Invalid scale_method value");
break;
}
{
/* Verify the simplifying assumptions. */
if (dst == 0 || src == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "null bitmap in scale_nn");
+ return grub_error (GRUB_ERR_BUG, "null bitmap in scale_nn");
if (dst->mode_info.red_field_pos % 8 != 0
|| dst->mode_info.green_field_pos % 8 != 0
|| dst->mode_info.blue_field_pos % 8 != 0
|| dst->mode_info.reserved_field_pos % 8 != 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "dst format not supported");
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ "dst format not supported");
if (src->mode_info.red_field_pos % 8 != 0
|| src->mode_info.green_field_pos % 8 != 0
|| src->mode_info.blue_field_pos % 8 != 0
|| src->mode_info.reserved_field_pos % 8 != 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "src format not supported");
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ "src format not supported");
if (dst->mode_info.red_field_pos != src->mode_info.red_field_pos
|| dst->mode_info.red_mask_size != src->mode_info.red_mask_size
|| dst->mode_info.green_field_pos != src->mode_info.green_field_pos
src->mode_info.reserved_field_pos
|| dst->mode_info.reserved_mask_size !=
src->mode_info.reserved_mask_size)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "dst and src not compatible");
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ "dst and src not compatible");
if (dst->mode_info.bytes_per_pixel != src->mode_info.bytes_per_pixel)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "dst and src not compatible");
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ "dst and src not compatible");
if (dst->mode_info.width == 0 || dst->mode_info.height == 0
|| src->mode_info.width == 0 || src->mode_info.height == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "bitmap has a zero dimension");
+ return grub_error (GRUB_ERR_BUG, "bitmap has a zero dimension");
grub_uint8_t *ddata = dst->data;
grub_uint8_t *sdata = src->data;
{
/* Verify the simplifying assumptions. */
if (dst == 0 || src == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "null bitmap in scale func");
+ return grub_error (GRUB_ERR_BUG, "null bitmap in scale func");
if (dst->mode_info.red_field_pos % 8 != 0
|| dst->mode_info.green_field_pos % 8 != 0
|| dst->mode_info.blue_field_pos % 8 != 0
|| dst->mode_info.reserved_field_pos % 8 != 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "dst format not supported");
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "dst format not supported");
if (src->mode_info.red_field_pos % 8 != 0
|| src->mode_info.green_field_pos % 8 != 0
|| src->mode_info.blue_field_pos % 8 != 0
|| src->mode_info.reserved_field_pos % 8 != 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "src format not supported");
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "src format not supported");
if (dst->mode_info.red_field_pos != src->mode_info.red_field_pos
|| dst->mode_info.red_mask_size != src->mode_info.red_mask_size
|| dst->mode_info.green_field_pos != src->mode_info.green_field_pos
src->mode_info.reserved_field_pos
|| dst->mode_info.reserved_mask_size !=
src->mode_info.reserved_mask_size)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "dst and src not compatible");
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "dst and src not compatible");
if (dst->mode_info.bytes_per_pixel != src->mode_info.bytes_per_pixel)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "dst and src not compatible");
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "dst and src not compatible");
if (dst->mode_info.width == 0 || dst->mode_info.height == 0
|| src->mode_info.width == 0 || src->mode_info.height == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "bitmap has a zero dimension");
+ return grub_error (GRUB_ERR_BUG, "bitmap has a zero dimension");
grub_uint8_t *ddata = dst->data;
grub_uint8_t *sdata = src->data;
#include <grub/gui_string_util.h>
#include <grub/misc.h>
#include <grub/dl.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
if ((! result)
|| (width == 0)
|| (height == 0))
- return grub_error (GRUB_ERR_BAD_ARGUMENT,
+ return grub_error (GRUB_ERR_BUG,
"invalid argument given");
/* Allocate memory for render target. */
target = framebuffer.back_target;
if (! target->data)
- return grub_error (GRUB_ERR_BAD_ARGUMENT,
+ return grub_error (GRUB_ERR_BUG,
"invalid render target given");
framebuffer.render_target = target;
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot get preferred mode");
}
-grub_err_t
+static grub_err_t
grub_vbe_set_video_mode (grub_uint32_t vbe_mode,
struct grub_vbe_mode_info_block *vbe_mode_info)
{
struct grub_video_bitmap *bitmap = 0;
if (argc != 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("file name expected"));
grub_video_reader_jpeg (&bitmap, args[0]);
if (grub_errno != GRUB_ERR_NONE)
struct grub_video_bitmap *bitmap = 0;
if (argc != 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_video_reader_png (&bitmap, args[0]);
if (grub_errno != GRUB_ERR_NONE)
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/mm.h>
+#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
param = grub_strchr(param, 'x');
if (param == NULL)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- "Invalid mode: %s\n",
+ N_("invalid video mode specification `%s'"),
current_mode);
param++;
*width = grub_strtoul (value, 0, 0);
if (grub_errno != GRUB_ERR_NONE)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- "Invalid mode: %s\n",
+ N_("invalid video mode specification `%s'"),
current_mode);
/* Find height value. */
*height = grub_strtoul (value, 0, 0);
if (grub_errno != GRUB_ERR_NONE)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- "Invalid mode: %s\n",
+ N_("invalid video mode specification `%s'"),
current_mode);
}
else
*height = grub_strtoul (value, 0, 0);
if (grub_errno != GRUB_ERR_NONE)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- "Invalid mode: %s\n",
+ N_("invalid video mode specification `%s'"),
current_mode);
/* Convert color depth value. */
*depth = grub_strtoul (value, 0, 0);
if (grub_errno != GRUB_ERR_NONE)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
- "Invalid mode: %s\n",
+ N_("invalid video mode specification `%s'"),
current_mode);
}
return GRUB_ERR_NONE;
#define GRUB_UTF16_LOWER_SURROGATE(code) \
(0xDC00 + (((code) - GRUB_UCS2_LIMIT) & 0xfff))
-grub_ssize_t
+grub_size_t
grub_utf8_to_utf16 (grub_uint16_t *dest, grub_size_t destsize,
const grub_uint8_t *src, grub_size_t srcsize,
const grub_uint8_t **srcend);
grub_password_get (char buf[], unsigned buf_size);
/* For indistinguishibility. */
-#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "Access denied.")
+#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, N_("access denied"))
extern void (*grub_crypto_autoload_hook) (const char *name);
(Elf64_Phdr *phdr, grub_addr_t *addr, int *load);
grub_elf_t grub_elf_open (const char *);
-grub_elf_t grub_elf_file (grub_file_t);
+grub_elf_t grub_elf_file (grub_file_t file, const char *filename);
grub_err_t grub_elf_close (grub_elf_t);
int grub_elf_is_elf32 (grub_elf_t);
-grub_size_t grub_elf32_size (grub_elf_t, Elf32_Addr *, grub_uint32_t *);
-grub_err_t grub_elf32_load (grub_elf_t, grub_elf32_load_hook_t, grub_addr_t *,
+grub_size_t grub_elf32_size (grub_elf_t,
+ const char *filename,
+ Elf32_Addr *, grub_uint32_t *);
+grub_err_t grub_elf32_load (grub_elf_t, const char *filename,
+ grub_elf32_load_hook_t, grub_addr_t *,
grub_size_t *);
int grub_elf_is_elf64 (grub_elf_t);
-grub_size_t grub_elf64_size (grub_elf_t, Elf64_Addr *, grub_uint64_t *);
-grub_err_t grub_elf64_load (grub_elf_t, grub_elf64_load_hook_t, grub_addr_t *,
+grub_size_t grub_elf64_size (grub_elf_t,
+ const char *filename,
+ Elf64_Addr *, grub_uint64_t *);
+grub_err_t grub_elf64_load (grub_elf_t, const char *filename,
+ grub_elf64_load_hook_t, grub_addr_t *,
grub_size_t *);
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);
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);
grub_addr_t *kern_end);
grub_err_t grub_freebsd_load_elf_meta32 (struct grub_relocator *relocator,
grub_file_t file,
+ const char *filename,
grub_addr_t *kern_end);
grub_err_t grub_freebsd_load_elf_meta64 (struct grub_relocator *relocator,
grub_file_t file,
+ const char *filename,
grub_addr_t *kern_end);
grub_err_t grub_netbsd_load_elf_meta32 (struct grub_relocator *relocator,
grub_file_t file,
+ const char *filename,
grub_addr_t *kern_end);
grub_err_t grub_netbsd_load_elf_meta64 (struct grub_relocator *relocator,
grub_file_t file,
+ const char *filename,
grub_addr_t *kern_end);
grub_err_t grub_bsd_add_meta (grub_uint32_t type,
};
grub_err_t grub_openbsd_find_ramdisk32 (grub_file_t file,
+ const char *filename,
grub_addr_t kern_start,
void *kern_chunk_src,
struct grub_openbsd_ramdisk_descriptor *desc);
grub_err_t grub_openbsd_find_ramdisk64 (grub_file_t file,
+ const char *filename,
grub_addr_t kern_start,
void *kern_chunk_src,
struct grub_openbsd_ramdisk_descriptor *desc);
#define grub_vbe_bios_set_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(1, (width))
grub_err_t grub_vbe_probe (struct grub_vbe_info_block *info_block);
-grub_err_t grub_vbe_set_video_mode (grub_uint32_t mode,
- struct grub_vbe_mode_info_block *mode_info);
grub_err_t grub_vbe_get_video_mode (grub_uint32_t *mode);
grub_err_t grub_vbe_get_video_mode_info (grub_uint32_t mode,
struct grub_vbe_mode_info_block *mode_info);
typedef struct grub_macho_file *grub_macho_t;
grub_macho_t grub_macho_open (const char *);
-grub_macho_t grub_macho_file (grub_file_t);
+grub_macho_t grub_macho_file (grub_file_t file, const char *filename);
grub_err_t grub_macho_close (grub_macho_t);
int grub_macho_contains_macho32 (grub_macho_t);
/* Ignore BSS segments when loading. */
#define GRUB_MACHO_NOBSS 0x1
-grub_err_t grub_macho_load32 (grub_macho_t macho, char *offset, int flags);
-grub_err_t grub_macho_load64 (grub_macho_t macho, char *offset, int flags);
+grub_err_t grub_macho_load32 (grub_macho_t macho, const char *filename,
+ char *offset, int flags);
+grub_err_t grub_macho_load64 (grub_macho_t macho, const char *filename,
+ char *offset, int flags);
/* Like filesize and file_read but take only 32-bit part
for current architecture. */
grub_size_t grub_macho_filesize32 (grub_macho_t macho);
-grub_err_t grub_macho_readfile32 (grub_macho_t macho, void *dest);
+grub_err_t grub_macho_readfile32 (grub_macho_t macho, const char *filename,
+ void *dest);
grub_size_t grub_macho_filesize64 (grub_macho_t macho);
-grub_err_t grub_macho_readfile64 (grub_macho_t macho, void *dest);
+grub_err_t grub_macho_readfile64 (grub_macho_t macho, const char *filename,
+ void *dest);
-void grub_macho_parse32 (grub_macho_t macho);
-void grub_macho_parse64 (grub_macho_t macho);
+void grub_macho_parse32 (grub_macho_t macho, const char *filename);
+void grub_macho_parse64 (grub_macho_t macho, const char *filename);
#endif /* ! GRUB_MACHOLOAD_HEADER */
{
if (magnitude > (unsigned long) GRUB_LONG_MAX + 1)
{
- grub_error (GRUB_ERR_OUT_OF_RANGE, "negative overflow");
+ grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow is detected");
return GRUB_LONG_MIN;
}
return -((long) magnitude);
{
if (magnitude > GRUB_LONG_MAX)
{
- grub_error (GRUB_ERR_OUT_OF_RANGE, "positive overflow");
+ grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow is detected");
return GRUB_LONG_MAX;
}
return (long) magnitude;
int width, int height, int depth,
int console_required);
grub_err_t
-grub_multiboot_load (grub_file_t file);
+grub_multiboot_load (grub_file_t file, const char *filename);
/* Load ELF32 or ELF64. */
grub_err_t
-grub_multiboot_load_elf (grub_file_t file, void *buffer);
+grub_multiboot_load_elf (grub_file_t file, const char *filename,
+ void *buffer);
extern grub_size_t grub_multiboot_pure_size;
extern grub_size_t grub_multiboot_alloc_mbi;
extern grub_uint32_t grub_multiboot_payload_eip;
./grub-core/loader/i386/pc/linux.c
./grub-core/loader/i386/pc/ntldr.c
./grub-core/loader/i386/pc/plan9.c
+./grub-core/loader/i386/pc/pxechainloader.c
./grub-core/loader/i386/xnu.c
./grub-core/loader/ia64/efi/linux.c
./grub-core/loader/macho32.c
*tree = dm_tree_create ();
if (! *tree)
{
- grub_puts_ (N_("Failed to create tree"));
+ grub_puts_ (N_("Failed to create `device-mapper' tree"));
grub_dprintf ("hostdisk", "dm_tree_create failed\n");
return 0;
}
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)
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)
grub_err_t err;
err = grub_cryptodisk_cheat_mount (grdev, os_dev);
if (err)
- grub_util_error (_("Can't mount crypto: %s"), _(grub_errmsg));
+ grub_util_error (_("can't mount crypto volume `%s': %s"),
+ lastsubdev, _(grub_errmsg));
}
grub_free (grdev);
grub_err_t err;
err = grub_cryptodisk_cheat_mount (grdev, os_dev);
if (err)
- grub_util_error (_("Can't mount crypto: %s"), _(grub_errmsg));
+ grub_util_error (_("can't mount crypto volume `%s': %s"),
+ lastsubdev, _(grub_errmsg));
}
grub_free (grdev);
}
if (fd == -1)
{
grub_error (GRUB_ERR_BAD_DEVICE,
- "cannot open `%s' while attempting to get disk wedge info", os_dev);
+ N_("cannot open `%s': %s"), os_dev,
+ strerror (errno));
return xstrdup (os_dev);
}
/* We don't call configure_device_driver since this isn't a floppy device name. */
}
drive = find_system_device (os_dev, &st, 1, 1);
- if (!drive)
- {
- grub_error (GRUB_ERR_UNKNOWN_DEVICE,
- "no mapping exists for `%s'", os_dev);
- grub_util_info ("no mapping exists for `%s'", os_dev);
- return 0;
- }
-
sys_disk = convert_system_partition_to_system_disk (os_dev, &st);
if (grub_strcmp (os_dev, sys_disk) == 0)
{
os_dev);
drive = find_system_device (os_dev, &st, 0, 1);
- if (!drive)
- {
- grub_error (GRUB_ERR_UNKNOWN_DEVICE,
- "no mapping exists for `%s'", os_dev);
- return 0;
- }
-
return make_device_name (drive, -1, -1);
}
else
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)
DEFAULT_ENVBLK_SIZE - sizeof (GRUB_ENVBLK_SIGNATURE) + 1);
if (fwrite (buf, 1, DEFAULT_ENVBLK_SIZE, fp) != DEFAULT_ENVBLK_SIZE)
- grub_util_error (_("cannot write to the file `%s': %s"), namenew,
+ grub_util_error (_("cannot write to `%s': %s"), namenew,
strerror (errno));
fsync (fileno (fp));
}
if (fseek (fp, 0, SEEK_END) < 0)
- grub_util_error (_("cannot seek the file `%s': %s"), name,
+ grub_util_error (_("cannot seek `%s': %s"), name,
strerror (errno));
size = (size_t) ftell (fp);
if (fseek (fp, 0, SEEK_SET) < 0)
- grub_util_error (_("cannot seek the file `%s': %s"), name,
+ grub_util_error (_("cannot seek `%s': %s"), name,
strerror (errno));
buf = malloc (size);
grub_util_error (_("out of memory"));
if (fread (buf, 1, size, fp) != size)
- grub_util_error (_("cannot read the file `%s': %s"), name,
+ grub_util_error (_("cannot read `%s': %s"), name,
strerror (errno));
fclose (fp);
if (fwrite (grub_envblk_buffer (envblk), 1, grub_envblk_size (envblk), fp)
!= grub_envblk_size (envblk))
- grub_util_error (_("cannot write to the file `%s': %s"), name,
+ grub_util_error (_("cannot write to `%s': %s"), name,
strerror (errno));
fsync (fileno (fp));
if ((int) fwrite (buf, 1, len, ff) != len)
{
- grub_util_error (_("cannot write to the file `%s': %s"),
+ grub_util_error (_("cannot write to `%s': %s"),
dest, strerror (errno));
return 1;
}
}
if ((skip) && (fseeko (ff, skip, SEEK_SET)))
- grub_util_error (_("cannot seek the file `%s': %s"), dest,
+ grub_util_error (_("cannot seek `%s': %s"), dest,
strerror (errno));
read_file (src, cmp_hook);
argv[1] = host_file;
if (execute_command ("loopback", 2, argv))
- grub_util_error (_("\`loopback' command fails: %s"), grub_errmsg);
+ grub_util_error (_("`loopback' command fails: %s"), grub_errmsg);
grub_free (loop_name);
grub_free (host_file);
if (mount_crypt)
{
if (execute_command ("cryptomount", 1, argv))
- grub_util_error (_("\`cryptomount' command fails: %s"), grub_errmsg);
+ grub_util_error (_("`cryptomount' command fails: %s"), grub_errmsg);
}
}
{N_("cp FILE LOCAL"), 0, 0, OPTION_DOC, N_("Copy FILE to local file LOCAL."), 1},
{N_("cat FILE"), 0, 0 , OPTION_DOC, N_("Copy FILE to standard output."), 1},
{N_("cmp FILE LOCAL"), 0, 0, OPTION_DOC, N_("Compare FILE with local file LOCAL."), 1},
- {N_("hex FILE"), 0, 0 , OPTION_DOC, N_("Hex dump FILE."), 1},
+ {N_("hex FILE"), 0, 0 , OPTION_DOC, N_("Show contents of FILE in hex."), 1},
{N_("crc FILE"), 0, 0 , OPTION_DOC, N_("Get crc32 checksum of FILE."), 1},
{N_("blocklist FILE"), 0, 0, OPTION_DOC, N_("Display blocklist of FILE."), 1},
{N_("xnu_uuid DEVICE"), 0, 0, OPTION_DOC, N_("Compute XNU UUID of the device."), 1},
{"root", 'r', N_("DEVICE_NAME"), 0, N_("Set root device."), 2},
{"skip", 's', "N", 0, N_("Skip N bytes from output file."), 2},
{"length", 'n', "N", 0, N_("Handle N bytes in output file."), 2},
- {"diskcount", 'c', "N", 0, N_("N input files."), 2},
+ {"diskcount", 'c', "N", 0, N_("Specify the number of input files."), 2},
{"debug", 'd', "S", 0, N_("Set debug environment variable."), 2},
{"crypto", 'C', NULL, OPTION_ARG_OPTIONAL, N_("Mount crypto devices."), 2},
- {"zfs-key", 'K', N_("FILE|prompt"), 0, N_("Load zfs crypto key."), 2},
+ {"zfs-key", 'K',
+ /* TRANSLATORS: "prompt" is a keyword. */
+ N_("FILE|prompt"), 0, N_("Load zfs crypto key."), 2},
{"verbose", 'v', NULL, OPTION_ARG_OPTIONAL, N_("print verbose messages."), 2},
{"uncompress", 'u', NULL, OPTION_ARG_OPTIONAL, N_("Uncompress data."), 2},
{0, 0, 0, 0, 0, 0}
f = fopen (arg, "rb");
if (!f)
{
- printf (_("Error loading file %s: %s\n"), arg, strerror (errno));
+ printf (_("%s: error:"), program_name);
+ printf (_("cannot open `%s': %s"), arg, strerror (errno));
+ printf ("\n");
return 0;
}
real_size = fread (buf, 1, 1024, f);
if (real_size < 0)
{
- printf (_("Error loading file %s: %s\n"), arg, strerror (errno));
+ printf (_("%s: error:"), program_name);
+ printf (_("cannot read `%s': %s"), arg, strerror (errno));
+ printf ("\n");
fclose (f);
return 0;
}
}
if (args_count != 0)
{
+ /* TRANSLATORS: disk count is optional but if it's there it must
+ be before disk list. So please don't imply disk count as mandatory.
+ */
fprintf (stderr, "%s", _("Disk count must precede disks list.\n"));
argp_usage (state);
}
modules=
install_device=
-no_floppy=
force_lba=
recheck=no
debug=no
printf " --grub-mkimage=%-9s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
printf " --grub-mkrelpath=%-7s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-mkrelpath")"
printf " --grub-probe=%-11s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-probe")"
- printf " --no-floppy %s\n" "$(gettext "do not probe any floppy drive")"
printf " --allow-floppy %s\n" "$(gettext "Make the drive also bootable as floppy (default for fdX devices). May break on some BIOSes.")"
printf " --recheck %s\n" "$(gettext "delete device map if it already exists")"
printf " --force %s\n" "$(gettext "install even if problems are detected")"
grub_probe="`echo "$option" | sed 's/--grub-probe=//'`" ;;
--no-floppy)
- no_floppy="--no-floppy" ;;
+ ;;
--recheck)
recheck=yes ;;
--removable)
elif [ "$disk_module" = ata ]; then
gettext_printf "UUID needed with ata mod, but the filesystem containing %s does not support UUIDs.\n" "${grubdir}" 1>&2
else
+ # TRANSLATORS: cross-disk refers to /boot being on one disk
+ # but MBR on another.
gettext_printf "UUID needed with cross-disk installs, but the filesystem containing %s does not support UUIDs.\n" "${grubdir}" 1>&2
fi
dev="`echo $grub_device | sed -e 's/\/dev\///' -e 's/[0-9]\+//'`"
partno="`echo $grub_device | sed -e 's/.*[^0-9]\([0-9]\+\)$/\1/'`"
ofpath="`$ofpathname $dev`" || {
- gettext_printf "Couldn't find Open Firmware device tree path for %s.\nYou will have to set \`boot-device' variable manually.\n" "$dev" 1>&2
+ gettext_printf "Couldn't find IEEE1275 device tree path for %s.\nYou will have to set \`boot-device' variable manually.\n" "$dev" 1>&2
exit 1
}
"$nvsetenv" boot-device "$boot_device" || {
# TRANSLATORS: The %s will be replaced by an external program name.
gettext_printf "\`%s' failed.\n" "$nvsetenv" 1>&2
- gettext "You will have to set \`boot-device' variable manually. At the Open Firmware prompt, type:" 1>&2
+ gettext "You will have to set \`boot-device' variable manually. At the IEEE1275 prompt, type:" 1>&2
echo 1>&2
echo " setenv boot-device $boot_device" 1>&2
exit 1
fi
if [ -z "${GRUB_FONT_PATH}" ] ; then
if [ "x$termoutdefault" != "x1" ]; then
- gettext "No font for gfxterm found." >&2; echo >&2 ; exit 1
+ gettext "No font for video terminal found." >&2; echo >&2 ; exit 1
fi
GRUB_TERMINAL_OUTPUT=
fi
grub_mkrelpath="${bindir}/`echo grub-mkrelpath | sed "${transform}"`"
fi
-if $(which gettext >/dev/null 2>/dev/null) ; then
+if which gettext >/dev/null 2>/dev/null; then
:
else
gettext () {
grub_uint32_t feattag
= grub_be_to_cpu32 (features->features[i].feature_tag);
if (feature->params)
- printf (_("WARNING: unsupported feature parameters: %x\n"),
+ printf (_("WARNING: unsupported font feature parameters: %x\n"),
grub_be_to_cpu16 (feature->params));
switch (feattag)
{
for (j = 0; j < 4; j++)
if (!grub_isgraph (str[j]))
str[j] = '?';
- printf (_("Unknown gsub feature 0x%x (%s)\n"), feattag, str);
+ printf (_("Unknown gsub font feature 0x%x (%s)\n"),
+ feattag, str);
}
}
}
int x, y, xmax, xmin, ymax, ymin;
grub_uint8_t *bitmap, mask;
- printf (_("\nGlyph #%d, U+%04x\n"), num, glyph->char_code);
- printf (_("Width %d, Height %d, X offset %d, Y offset %d, Device width %d\n"),
+ printf ("\nGlyph #%d, U+%04x\n", num, glyph->char_code);
+ printf ("Width %d, Height %d, X offset %d, Y offset %d, Device width %d\n",
glyph->width, glyph->height, glyph->x_ofs, glyph->y_ofs,
glyph->device_width);
file = fopen (output_file, "wb");
if (! file)
- grub_util_error (_("cannot write to the file `%s': %s"), output_file,
+ grub_util_error (_("cannot write to `%s': %s"), output_file,
strerror (errno));
int correct_size;
file = fopen (output_file, "wb");
if (! file)
- grub_util_error (_("cannot write to the file `%s': %s"), output_file,
+ grub_util_error (_("cannot write to `%s': %s"), output_file,
strerror (errno));
for (glyph = font_info->glyphs_sorted;
file = fopen (output_file, "wb");
if (! file)
- grub_util_error (_("cannot write to the file `%s': %s"), output_file,
+ grub_util_error (_("cannot write to `%s': %s"), output_file,
strerror (errno));
offset = 0;
{"index", 'i', N_("NUM"), 0, N_("set face index"), 0},
{"range", 'r', N_("FROM-TO[,FROM-TO]"), 0, N_("set font range"), 0},
{"name", 'n', N_("NAME"), 0, N_("set font family name"), 0},
- {"size", 's', N_("STR"), 0, N_("set font size"), 0},
+ {"size", 's', N_("SIZE"), 0, N_("set font size"), 0},
{"desc", 'd', N_("NUM"), 0, N_("set font descent"), 0},
{"asce", 'c', N_("NUM"), 0, N_("set font ascent"), 0},
{"bold", 'b', 0, 0, N_("convert to bold font"), 0},
if (arguments.file_format == ASCII_BITMAPS
&& arguments.font_info.num_range > 0)
{
- grub_util_error (_("Option --ascii-bitmaps doesn't accept ranges (use ASCII)."));
+ grub_util_error (_("Option --ascii-bitmaps doesn't accept ranges (it always uses ASCII)."));
return 1;
}
else if (arguments.file_format == ASCII_BITMAPS)
static struct argp_option options[] = {
{"directory", 'd', N_("DIR"), 0, N_("use images and modules under DIR [default=%s/<platform>]"), 0},
- {"prefix", 'p', N_("DIR"), 0, N_("set grub_prefix directory [default=%s]"), 0},
+ {"prefix", 'p', N_("DIR"), 0, N_("set prefix directory [default=%s]"), 0},
{"memdisk", 'm', N_("FILE"), 0, N_("embed FILE as a memdisk image"), 0},
- {"config", 'c', N_("FILE"), 0, N_("embed FILE as boot config"), 0},
- {"note", 'n', 0, 0, N_("add NOTE segment for CHRP Open Firmware"), 0},
+ {"config", 'c', N_("FILE"), 0, N_("embed FILE as an early config"), 0},
+ /* TRANSLATORS: NOTE is a name of segment. */
+ {"note", 'n', 0, 0, N_("add NOTE segment for CHRP IEEE1275"), 0},
{"output", 'o', N_("FILE"), 0, N_("output a generated image to FILE [default=stdout]"), 0},
{"format", 'O', N_("FORMAT"), 0, 0, 0},
{"compression", 'C', "(xz|none|auto)", 0, N_("choose the compression to use"), 0},
*target, offset);
break;
default:
- grub_util_error ("unknown relocation type 0x%x",
+ grub_util_error (_("relocation 0x%x is not implemented yet"),
ELF_R_TYPE (info));
break;
}
}
default:
- grub_util_error ("unknown relocation type %d",
+ grub_util_error (_("relocation 0x%x is not implemented yet"),
ELF_R_TYPE (info));
break;
}
break;
default:
- grub_util_error ("unknown relocation type 0x%x",
+ grub_util_error (_("relocation 0x%x is not implemented yet"),
ELF_R_TYPE (info));
break;
}
#endif
break;
default:
- grub_util_error ("unknown relocation type 0x%x",
+ grub_util_error (_("relocation 0x%x is not implemented yet"),
ELF_R_TYPE (info));
break;
}
if (strcmp (code, console_grub_equivalences_common[i].layout) == 0)
return console_grub_equivalences_common[i].grub;
- fprintf (stderr, _("Unknown key %s\n"), code);
+ fprintf (stderr, _("Unknown keyboard scan identifier %s\n"), code);
return '\0';
}
if (keycode_usb == 0
|| keycode_usb >= GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE)
{
- fprintf (stderr, _("Unknown keycode 0x%02x\n"), keycode_linux);
+ fprintf (stderr, _("Unknown keyboard scan code 0x%02x\n"), keycode_linux);
continue;
}
if (keycode_usb < GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE)
if (ok == 0)
{
- fprintf (stderr, "%s", _("ERROR: no keycodes found. Check the input.\n"));
+ fprintf (stderr, "%s", _("ERROR: no valid keyboard layout found. Check the input.\n"));
exit (1);
}
.buflen = 64,
.saltlen = 64
};
- char *bufhex, *salthex;
+ char *bufhex, *salthex, *result;
gcry_err_code_t gcry_err;
grub_uint8_t *buf, *salt;
ssize_t nr;
hexify (bufhex, buf, arguments.buflen);
hexify (salthex, salt, arguments.saltlen);
- printf (_("Your PBKDF2 is grub.pbkdf2.sha512.%d.%s.%s\n"),
- arguments.count, salthex, bufhex);
+ result = xmalloc (sizeof ("grub.pbkdf2.sha512.XXXXXXXXXXXXXXXXXXX.S.S")
+ + arguments.buflen * 2 + arguments.saltlen * 2);
+ snprintf (result, sizeof ("grub.pbkdf2.sha512.XXXXXXXXXXXXXXXXXXX.S.S")
+ + arguments.buflen * 2 + arguments.saltlen * 2,
+ "grub.pbkdf2.sha512.%d.%s.%s",
+ arguments.count, salthex, bufhex);
+
+ printf (_("PBKDF2 hash of your password is %s\n"), result);
memset (buf, 0, arguments.buflen);
memset (bufhex, 0, 2 * arguments.buflen);
free (buf);
static struct argp argp = {
options, argp_parser, N_("PATH"),
- N_("Make a system path relative to its root."),
+ N_("Transform a sytem filename into GRUB one."),
NULL, NULL, NULL
};
# Print the usage.
usage () {
gettext_printf "Usage: %s [OPTION] SOURCE...\n" "$self"
- gettext "Make GRUB rescue image."; echo
+ gettext "Make GRUB CDROM, disk, pendrive and floppy bootable image."; echo
echo
printf " -h, --help %s\n" "$(gettext "print this message and exit")"
printf " -v, --version %s\n" "$(gettext "print the version information and exit")"
printf " --xorriso=%-14s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as xorriso [optional]")"
printf " --grub-mkimage=%-9s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
echo
- gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by: %s\n" "xorriso -as mkisofs -help" "$self"
+ gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "xorriso -as mkisofs -help" "$self"
echo
gettext "Option -- switches to native xorriso command mode."; echo
echo
usage () {
formats="i386-coreboot i386-multiboot i386-pc i386-pc-pxe i386-efi i386-ieee1275 i386-qemu x86_64-efi mipsel-yeeloong-flash mipsel-fuloong2f-flash mipsel-loongson-elf powerpc-ieee1275 sparc64-ieee1275-raw sparc64-ieee1275-aout ia64-efi mips-arc mipsel-qemu_mips-elf mips-qemu_mips-flash mipsel-qemu_mips-flash mips-qemu_mips-elf"
gettext_printf "Usage: %s [OPTION] SOURCE...\n" "$self"
+ gettext "Generate a standalone image (containing all modules) in the selected format"
+ echo
gettext "Make GRUB rescue image."; echo
echo
printf " -h, --help %s\n" "$(gettext "print this message and exit")"
printf " --modules=%-14s%s\n" "$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
printf " --grub-mkimage=%-9s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
echo
- gettext_printf "%s generates a standalone image (containing all modules) in the selected format" "$self"
- echo
gettext "Report bugs to <bug-grub@gnu.org>."; echo
}
{"root", 'r', N_("DEVICE_NAME"), 0, N_("Set root device."), 2},
{"debug", 'd', "S", 0, N_("Set debug environment variable."), 2},
{"crypto", 'C', NULL, OPTION_ARG_OPTIONAL, N_("Mount crypto devices."), 2},
- {"zfs-key", 'K', N_("FILE|prompt"), 0, N_("Load zfs crypto key."), 2},
+ {"zfs-key", 'K',
+ /* TRANSLATORS: "prompt" is a keyword. */
+ N_("FILE|prompt"), 0, N_("Load zfs crypto key."), 2},
{"verbose", 'v', NULL, OPTION_ARG_OPTIONAL, N_("print verbose messages."), 2},
{0, 0, 0, 0, 0, 0}
};
f = fopen (arg, "rb");
if (!f)
{
- printf (_("Error loading file %s: %s\n"), arg, strerror (errno));
+ printf (_("%s: error:"), program_name);
+ printf (_("cannot open `%s': %s"), arg, strerror (errno));
+ printf ("\n");
return 0;
}
real_size = fread (buf, 1, 1024, f);
if (real_size < 0)
{
- printf (_("Error loading file %s: %s\n"), arg, strerror (errno));
+ printf (_("%s: error:"), program_name);
+ printf (_("cannot read `%s': %s"), arg,
+ strerror (errno));
+ printf ("\n");
fclose (f);
return 0;
}
{
char *label;
if (! fs->label)
- grub_util_error (_("%s does not support labels"), fs->name);
+ grub_util_error (_("filesystem `%s' does not support labels"),
+ fs->name);
if (fs->label (dev, &label) != GRUB_ERR_NONE)
grub_util_error ("%s", _(grub_errmsg));
{"device-map", 'm', N_("FILE"), 0,
N_("use FILE as the device map [default=%s]"), 0},
{"target", 't', "(fs|fs_uuid|fs_label|drive|device|partmap|abstraction|cryptodisk_uuid|msdos_parttype)", 0,
- N_("print filesystem module, GRUB drive, system device, partition map module, abstraction module or CRYPTO UUID [default=fs]"), 0},
+ N_("print filesystem module, GRUB drive, system device, partition map module, abstraction module or cryptographic container UUID [default=fs]"), 0},
{"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
{ 0, 0, 0, 0, 0, 0 }
};
-
static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{
if (dest_partmap && !dest_partmap->embed)
{
- grub_util_warn (_("Partition style '%s' doesn't support embeding"),
+ grub_util_warn (_("Partition style '%s' doesn't support embedding"),
dest_partmap->name);
goto unable_to_embed;
}
if (fs && !fs->embed)
{
- grub_util_warn (_("File system '%s' doesn't support embeding"),
+ grub_util_warn (_("File system '%s' doesn't support embedding"),
fs->name);
goto unable_to_embed;
}
unable_to_embed:
-#ifdef GRUB_MACHINE_PCBIOS
- if (dest_dev->disk->id != root_dev->disk->id
- || dest_dev->disk->dev->id != root_dev->disk->dev->id)
- grub_util_error (_("embedding is not possible, but this is required for "
- "cross-disk, RAID and LVM install"));
-#else
if (dest_dev->disk->dev->id != root_dev->disk->dev->id)
grub_util_error (_("embedding is not possible, but this is required for "
"RAID and LVM install"));
+#ifdef GRUB_MACHINE_PCBIOS
+ if (dest_dev->disk->id != root_dev->disk->id
+ || dest_dev->disk->dev->id != root_dev->disk->dev->id)
+ /* TRANSLATORS: cross-disk refers to /boot being on one disk
+ but MBR on another. */
+ grub_util_error (_("embedding is not possible, but this is required for "
+ "cross-disk install"));
#endif
grub_util_warn (_("Embedding is not possible. GRUB can only be installed in this "
{"directory", 'd', N_("DIR"), 0,
N_("Use GRUB files in the directory DIR [default=%s]"), 0},
{"device-map", 'm', N_("FILE"), 0,
- N_("Use FILE as the device map [default=%s]"), 0},
- {"root-device", 'r', N_("DEVICE"), 0,
- N_("Use DEV as the root device [default=guessed]"), 0},
+ N_("use FILE as the device map [default=%s]"), 0},
{"force", 'f', 0, 0,
- N_("Install even if problems are detected"), 0},
+ N_("install even if problems are detected"), 0},
{"skip-fs-probe",'s',0, 0,
N_("Do not probe for filesystems in DEVICE"), 0},
{"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
# Check for Vista bootmgr.
if [ -f "$dir"/bootmgr -a -f "$dir"/boot/bcd ] ; then
- OS="$(gettext_quoted "Windows Vista bootmgr")"
+ OS="$(gettext_quoted "Windows Vista/7 (loader)")"
# Check for NTLDR.
elif [ -f "$dir"/ntldr -a -f "$dir"/ntdetect.com -a -f "$dir"/boot.ini ] ; then
- OS=`get_os_name_from_boot_ini "$dir"/boot.ini` || OS="$(gettext_quoted "Windows NT/2000/XP loader")"
+ OS=`get_os_name_from_boot_ini "$dir"/boot.ini` || OS="$(gettext_quoted "Windows NT/2000/XP (loader)")"
needmap=t
else
continue
fi
- # Get boot /dev/ice.
+ # Get boot device.
dev=`${grub_probe} -t device "$dir" 2>/dev/null` || continue
gettext_printf "Found %s on %s (%s)\n" "$OS" "$drv" "$dev" >&2
strerror (errno));
if (fread (img, 1, size, fp) != size)
- grub_util_error (_("cannot read the file `%s': %s"), path,
+ grub_util_error (_("cannot read `%s': %s"), path,
strerror (errno));
fclose (fp);
strerror (errno));
if (fread (buf, 1, size, fp) != size)
- grub_util_error (_("cannot read the file `%s': %s"), path,
+ grub_util_error (_("cannot read `%s': %s"), path,
strerror (errno));
fclose (fp);
{
grub_util_info ("writing 0x%x bytes at offset 0x%x", size, offset);
if (fseeko (out, offset, SEEK_SET) == -1)
- grub_util_error (_("cannot seek the file `%s': %s"),
+ grub_util_error (_("cannot seek `%s': %s"),
name, strerror (errno));
if (fwrite (img, 1, size, out) != size)
- grub_util_error (_("cannot write to the file `%s': %s"),
+ grub_util_error (_("cannot write to `%s': %s"),
name, strerror (errno));
}
{
grub_util_info ("writing 0x%x bytes", size);
if (fwrite (img, 1, size, out) != size)
- if (!name)
- grub_util_error (_("cannot write to the stdout: %s"),
- strerror (errno));
- else
- grub_util_error (_("cannot write to the file `%s': %s"),
- name, strerror (errno));
+ {
+ if (!name)
+ grub_util_error (_("cannot write to the stdout: %s"),
+ strerror (errno));
+ else
+ grub_util_error (_("cannot write to `%s': %s"),
+ name, strerror (errno));
+ }
}
char *
# Initialize some variables.
transform="@program_transform_name@"
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-libdir=@libdir@
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+bindir="@bindir@"
+libdir="@libdir@"
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
target_cpu=@target_cpu@
platform=@platform@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
+datarootdir="@datarootdir@"
+datadir="@datadir@"
self=`basename $0`
-grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
+grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`"
+
+. "${datadir}/@PACKAGE@/grub-mkconfig_lib"
# Usage: usage
# Print the usage.
usage () {
gettext_printf "Usage: %s [OPTION] SOURCE...\n" "$self"
- gettext "Make GRUB rescue image."; echo
+ gettext "Make GRUB CDROM, disk, pendrive and floppy bootable image."; echo
echo
printf " -h, --help %s\n" "$(gettext "print this message and exit")"
printf " -v, --version %s\n" "$(gettext "print the version information and exit")"
printf " --modules=%-14s%s\n" "$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
printf " --grub-mkimage=%-9s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
echo
- gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by: %s\n" "genisoimage -help" "$self"
+ gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "genisoimage -help" "$self"
echo
gettext "Report bugs to <bug-grub@gnu.org>."; echo
}