]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Improve gettext support. Stylistic fixes and error handling fixes while
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 8 Feb 2012 18:26:01 +0000 (19:26 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 8 Feb 2012 18:26:01 +0000 (19:26 +0100)
on it.

184 files changed:
ChangeLog
grub-core/bus/pci.c
grub-core/bus/usb/ohci.c
grub-core/commands/acpi.c
grub-core/commands/blocklist.c
grub-core/commands/boot.c
grub-core/commands/cacheinfo.c
grub-core/commands/cat.c
grub-core/commands/cmp.c
grub-core/commands/configfile.c
grub-core/commands/efi/loadbios.c
grub-core/commands/hashsum.c
grub-core/commands/hdparm.c
grub-core/commands/hexdump.c
grub-core/commands/i386/cmostest.c
grub-core/commands/i386/pc/drivemap.c
grub-core/commands/i386/pc/lsapm.c
grub-core/commands/i386/pc/play.c
grub-core/commands/ieee1275/suspend.c
grub-core/commands/iorw.c
grub-core/commands/keylayouts.c
grub-core/commands/legacycfg.c
grub-core/commands/loadenv.c
grub-core/commands/lsmmap.c
grub-core/commands/memrw.c
grub-core/commands/menuentry.c
grub-core/commands/minicmd.c
grub-core/commands/mips/loongson/lsspd.c
grub-core/commands/password.c
grub-core/commands/password_pbkdf2.c
grub-core/commands/probe.c
grub-core/commands/regexp.c
grub-core/commands/search.c
grub-core/commands/search_wrap.c
grub-core/commands/setpci.c
grub-core/commands/sleep.c
grub-core/commands/testload.c
grub-core/commands/true.c
grub-core/commands/videoinfo.c
grub-core/disk/ahci.c
grub-core/disk/arc/arcdisk.c
grub-core/disk/cryptodisk.c
grub-core/disk/diskfilter.c
grub-core/disk/geli.c
grub-core/disk/i386/pc/biosdisk.c
grub-core/disk/ieee1275/nand.c
grub-core/disk/ieee1275/ofdisk.c
grub-core/disk/ldm.c
grub-core/disk/loopback.c
grub-core/efiemu/i386/loadcore32.c
grub-core/efiemu/i386/loadcore64.c
grub-core/efiemu/loadcore.c
grub-core/efiemu/loadcore_common.c
grub-core/efiemu/main.c
grub-core/efiemu/mm.c
grub-core/efiemu/pnvram.c
grub-core/efiemu/symbols.c
grub-core/font/font_cmd.c
grub-core/fs/bfs.c
grub-core/fs/btrfs.c
grub-core/fs/cpio.c
grub-core/fs/fat.c
grub-core/fs/fshelp.c
grub-core/fs/hfs.c
grub-core/fs/jfs.c
grub-core/fs/minix.c
grub-core/fs/reiserfs.c
grub-core/fs/ufs.c
grub-core/fs/zfs/zfs.c
grub-core/fs/zfs/zfsinfo.c
grub-core/gfxmenu/gfxmenu.c
grub-core/gfxmenu/gui_image.c
grub-core/gfxmenu/icon_manager.c
grub-core/gfxmenu/widget-box.c
grub-core/io/gzio.c
grub-core/io/lzopio.c
grub-core/io/xzio.c
grub-core/kern/device.c
grub-core/kern/disk.c
grub-core/kern/dl.c
grub-core/kern/elf.c
grub-core/kern/emu/hostdisk.c
grub-core/kern/emu/hostfs.c
grub-core/kern/emu/mm.c
grub-core/kern/file.c
grub-core/kern/fs.c
grub-core/kern/i386/dl.c
grub-core/kern/ia64/dl.c
grub-core/kern/mips/dl.c
grub-core/kern/powerpc/dl.c
grub-core/kern/sparc64/dl.c
grub-core/kern/x86_64/dl.c
grub-core/lib/arg.c
grub-core/lib/crypto.c
grub-core/lib/i386/relocator.c
grub-core/lib/i386/relocator16.S
grub-core/lib/legacy_parse.c
grub-core/lib/relocator.c
grub-core/loader/efi/appleloader.c
grub-core/loader/efi/chainloader.c
grub-core/loader/i386/bsd.c
grub-core/loader/i386/bsdXX.c
grub-core/loader/i386/coreboot/chainloader.c
grub-core/loader/i386/linux.c
grub-core/loader/i386/multiboot_mbi.c
grub-core/loader/i386/pc/chainloader.c
grub-core/loader/i386/pc/freedos.c
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/macho.c
grub-core/loader/machoXX.c
grub-core/loader/mips/linux.c
grub-core/loader/multiboot.c
grub-core/loader/multiboot_elfxx.c
grub-core/loader/multiboot_mbi2.c
grub-core/loader/powerpc/ieee1275/linux.c
grub-core/loader/sparc64/ieee1275/linux.c
grub-core/loader/xnu.c
grub-core/mmap/efi/mmap.c
grub-core/mmap/mmap.c
grub-core/net/arp.c
grub-core/net/bootp.c
grub-core/net/dns.c
grub-core/net/drivers/efi/efinet.c
grub-core/net/drivers/emu/emunet.c
grub-core/net/drivers/i386/pc/pxe.c
grub-core/net/drivers/ieee1275/ofnet.c
grub-core/net/http.c
grub-core/net/ip.c
grub-core/net/net.c
grub-core/net/netbuff.c
grub-core/net/tcp.c
grub-core/net/tftp.c
grub-core/net/udp.c
grub-core/normal/auth.c
grub-core/normal/charset.c
grub-core/normal/dyncmd.c
grub-core/normal/misc.c
grub-core/partmap/gpt.c
grub-core/partmap/msdos.c
grub-core/parttool/msdospart.c
grub-core/term/gfxterm.c
grub-core/term/terminfo.c
grub-core/video/bitmap.c
grub-core/video/bitmap_scale.c
grub-core/video/colors.c
grub-core/video/fb/video_fb.c
grub-core/video/i386/pc/vbe.c
grub-core/video/readers/jpeg.c
grub-core/video/readers/png.c
grub-core/video/video.c
include/grub/charset.h
include/grub/crypto.h
include/grub/elfload.h
include/grub/i386/bsd.h
include/grub/i386/pc/vbe.h
include/grub/machoload.h
include/grub/misc.h
include/grub/multiboot.h
po/POTFILES.in
util/getroot.c
util/grub-editenv.c
util/grub-fstest.c
util/grub-install.in
util/grub-mkconfig.in
util/grub-mkconfig_lib.in
util/grub-mkfont.c
util/grub-mkimage.c
util/grub-mkimagexx.c
util/grub-mklayout.c
util/grub-mkpasswd-pbkdf2.c
util/grub-mkrelpath.c
util/grub-mkrescue.in
util/grub-mkstandalone.in
util/grub-mount.c
util/grub-probe.c
util/grub-setup.c
util/grub.d/10_windows.in
util/misc.c
util/powerpc/ieee1275/grub-mkrescue.in

index ede7f8e1e1be3b4325bcdfbae3ca95813a5ae87a..a3ad2aa006c6cb343017dc6b1f53102d235cdba6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-08  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Improve gettext support. Stylistic fixes and error handling fixes while
+       on it.
+
 2012-02-07  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/lib/i386/relocator16.S: Revert moving A20 code into PM
index f007ec33aaed7fff9c0608de4107dbd11b993b5a..ad85738dfc1342f780b697a5fe165ff45da66f38 100644 (file)
@@ -36,6 +36,16 @@ grub_memalign_dma32 (grub_size_t align, grub_size_t size)
     align = 64;
   size = ALIGN_UP (size, align);
   ret = grub_memalign (align, size);
+#if GRUB_CPU_SIZEOF_VOID_P == 8
+  if ((grub_addr_t) ret >> 32)
+    {
+      /* Shouldn't happend since the only platform in this case is
+        x86_64-efi and it skips any regions > 4GiB because
+        of EFI bugs anyway.  */
+      grub_error (GRUB_ERR_BUG, "allocation outside 32-bit range");
+      return 0;
+    }
+#endif
   if (!ret)
     return 0;
   grub_arch_sync_dma_caches (ret, size);
index 3f5ca7b031f57bdcc5cfeb103a3b89859bd76108..23cf63187abf6be043d68fc83a133da3a0bf8194 100644 (file)
@@ -294,13 +294,15 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
                 o->hcca_chunk, o->hcca, o->hcca_addr);
 
   /* Reserve memory for ctrl EDs.  */
-  o->ed_ctrl_chunk = grub_memalign_dma32 (16, sizeof(struct grub_ohci_ed)*GRUB_OHCI_CTRL_EDS);
+  o->ed_ctrl_chunk = grub_memalign_dma32 (16, sizeof(struct grub_ohci_ed)
+                                         * GRUB_OHCI_CTRL_EDS);
   if (! o->ed_ctrl_chunk)
     goto fail;
   o->ed_ctrl = grub_dma_get_virt (o->ed_ctrl_chunk);
   o->ed_ctrl_addr = grub_dma_get_phys (o->ed_ctrl_chunk);
   /* Preset EDs */
-  grub_memset ((void*)o->ed_ctrl, 0, sizeof(struct grub_ohci_ed) * GRUB_OHCI_CTRL_EDS);
+  grub_memset ((void *) o->ed_ctrl, 0, sizeof (struct grub_ohci_ed)
+              * GRUB_OHCI_CTRL_EDS);
   for (j=0; j < GRUB_OHCI_CTRL_EDS; j++)
     o->ed_ctrl[j].target = grub_cpu_to_le32 (1 << 14); /* skip */
     
@@ -308,7 +310,8 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
                 o->ed_ctrl_chunk, o->ed_ctrl, o->ed_ctrl_addr);
 
   /* Reserve memory for bulk EDs.  */
-  o->ed_bulk_chunk = grub_memalign_dma32 (16, sizeof(struct grub_ohci_ed)*GRUB_OHCI_BULK_EDS);
+  o->ed_bulk_chunk = grub_memalign_dma32 (16, sizeof (struct grub_ohci_ed)
+                                         * GRUB_OHCI_BULK_EDS);
   if (! o->ed_bulk_chunk)
     goto fail;
   o->ed_bulk = grub_dma_get_virt (o->ed_bulk_chunk);
index 048f8c0cb10111b8a6293bdf4b4a0f42091f61d1..bb09029a6fc97a45150ee47ef9c5158840d22245 100644 (file)
@@ -41,8 +41,8 @@ static const struct grub_arg_option options[] = {
    0, ARG_TYPE_STRING},
   {"load-only", 'n', 0,
    N_("Load only tables specified by comma-separated list."), 0, ARG_TYPE_STRING},
-  {"v1", '1', 0, N_("Expose v1 tables."), 0, ARG_TYPE_NONE},
-  {"v2", '2', 0, N_("Expose v2 and v3 tables."), 0, ARG_TYPE_NONE},
+  {"v1", '1', 0, N_("Export version 1 tables to the OS."), 0, ARG_TYPE_NONE},
+  {"v2", '2', 0, N_("Export version 2 and version 3 tables to the OS."), 0, ARG_TYPE_NONE},
   {"oemid", 'o', 0, N_("Set OEMID of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING},
   {"oemtable", 't', 0,
    N_("Set OEMTABLE ID of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING},
@@ -553,8 +553,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
                      free_tables ();
                      grub_free (exclude);
                      grub_free (load_only);
-                     return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-                                        "couldn't allocate table");
+                     return grub_errno;
                    }
                  grub_memcpy (table_dsdt, dsdt, dsdt->length);
                }
@@ -580,8 +579,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
              free_tables ();
              grub_free (exclude);
              grub_free (load_only);
-             return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-                                "couldn't allocate table structure");
+             return grub_errno;
            }
          table->size = curtable->length;
          table->addr = grub_malloc (table->size);
@@ -589,8 +587,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
          if (! table->addr)
            {
              free_tables ();
-             return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-                                "couldn't allocate table");
+             return grub_errno;
            }
          table->next = acpi_tables;
          acpi_tables = table;
@@ -633,7 +630,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
       if (! file)
        {
          free_tables ();
-         return grub_error (GRUB_ERR_BAD_OS, "couldn't open file %s", args[i]);
+         return grub_errno;
        }
 
       size = grub_file_size (file);
@@ -641,7 +638,8 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
        {
          grub_file_close (file);
          free_tables ();
-         return grub_error (GRUB_ERR_BAD_OS, "file %s is too small", args[i]);
+         return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+                            args[i]);
        }
 
       buf = (char *) grub_malloc (size);
@@ -678,8 +676,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
          if (! table)
            {
              free_tables ();
-             return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-                                "couldn't allocate table structure");
+             return grub_errno;
            }
 
          table->size = size;
@@ -771,7 +768,7 @@ GRUB_MOD_INIT(acpi)
 {
   cmd = grub_register_extcmd ("acpi", grub_cmd_acpi, 0,
                              N_("[-1|-2] [--exclude=TABLE1,TABLE2|"
-                             "--load-only=table1,table2] FILE1"
+                             "--load-only=TABLE1,TABLE2] FILE1"
                              " [FILE2] [...]"),
                              N_("Load host ACPI tables and tables "
                              "specified by arguments."),
index 5eb12e4348931a975564855bf89e31576de96d9e..164a6fea31c26f6ffc4db89703c3aa26c3688ea5 100644 (file)
@@ -82,7 +82,7 @@ grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
     }
 
   if (argc < 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
 
   grub_file_filter_disable_compression ();
   file = grub_file_open (args[0]);
index 5149074c71741c216cf41c39552b7972ee48aaa8..f27cb4266c6ca2c9367972218000954b25067451 100644 (file)
@@ -64,10 +64,7 @@ grub_loader_register_preboot_hook (grub_err_t (*preboot_func) (int noreturn),
   new_preboot = (struct grub_preboot *)
     grub_malloc (sizeof (struct grub_preboot));
   if (! new_preboot)
-    {
-      grub_error (GRUB_ERR_OUT_OF_MEMORY, "hook not added");
-      return 0;
-    }
+    return 0;
 
   new_preboot->preboot_func = preboot_func;
   new_preboot->preboot_rest_func = preboot_rest_func;
@@ -146,7 +143,8 @@ grub_loader_boot (void)
   struct grub_preboot *cur;
 
   if (! grub_loader_loaded)
-    return grub_error (GRUB_ERR_NO_KERNEL, "no loaded kernel");
+    return grub_error (GRUB_ERR_NO_KERNEL,
+                      N_("you need to load the kernel first"));
 
   if (grub_loader_noreturn)
     grub_machine_fini ();
index 92aaa218d1331f1ea599750f202978556b8fa3cb..ead6ff82cfcb046932f8d00eeabc02a1eff25c3e 100644 (file)
@@ -31,14 +31,16 @@ grub_rescue_cmd_info (struct grub_command *cmd __attribute__ ((unused)),
   unsigned long hits, misses;
 
   grub_disk_cache_get_performance (&hits, &misses);
-  grub_printf_ (N_("Disk cache: hits = %lu, misses = %lu "), hits, misses);
   if (hits + misses)
     {
       unsigned long ratio = hits * 10000 / (hits + misses);
       grub_printf ("(%lu.%lu%%)\n", ratio / 100, ratio % 100);
+      grub_printf_ (N_("Disk cache statistics: hits = %lu (%lu.%02lu%%),"
+                    " misses = %lu\n"), ratio / 100, ratio % 100,
+                   hits, misses);
     }
   else
-    grub_puts_ (N_("(N/A)"));
+    grub_printf ("%s\n", _("No disk cache statistics available\n"));    
 
  return 0;
 }
index 9be6cbc8ff99e1e81d366357a27b2b6a6c002668..4f05190a1136d432c7e7f6faba01b66307c4e8c5 100644 (file)
@@ -47,7 +47,7 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
     dos = 1;
 
   if (argc != 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
 
   file = grub_file_open (args[0]);
   if (! file)
index 5d5925dd5df116d477adbe32dd33ad61fe9bc557..cc23ee67ea372c6c0fc4014ce9cfaf56e3924545 100644 (file)
@@ -40,7 +40,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
   char *buf2 = 0;
 
   if (argc != 2)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
 
   grub_printf_ (N_("Compare file `%s' with `%s':\n"), args[0],
                args[1]);
index 124a09a9e0096c1e4e01b5bd9c76ae7a017bdce9..17ab397bf8a30e618614146c556f46847283b404 100644 (file)
@@ -32,7 +32,7 @@ grub_cmd_source (grub_command_t cmd, int argc, char **args)
   int new_env, extractor;
 
   if (argc != 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
 
   extractor = (cmd->name[0] == 'e');
   new_env = (cmd->name[extractor ? sizeof ("extract_entries_") - 1 : 0] == 'c');
index 5eb490fd4a017cc61ed523d6ef393e76497d481c..214adc3d2e205d756a07235ffac56e0f3e6573a5 100644 (file)
@@ -165,7 +165,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
   int size;
 
   if (argc == 0)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no ROM image specified");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
 
   if (argc > 1)
     {
@@ -206,7 +206,9 @@ static grub_command_t cmd_fakebios, cmd_loadbios;
 GRUB_MOD_INIT(loadbios)
 {
   cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios,
-                                       0, N_("Fake BIOS."));
+                                       0, N_("Create BIOS-like structures for"
+                                             " backward compatibility with"
+                                             " existing OS."));
 
   cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
                                        N_("BIOS_DUMP [INT10_DUMP]"),
index fb02aaabf125e73280fda02661f6154df447e47e..9593becc973f2a178be7909401309733b903fdb3 100644 (file)
@@ -30,7 +30,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
 
 static const struct grub_arg_option options[] = {
   {"hash", 'h', 0, N_("Specify hash to use."), N_("HASH"), ARG_TYPE_STRING},
-  {"check", 'c', 0, N_("Check hash list file."), N_("FILE"), ARG_TYPE_STRING},
+  {"check", 'c', 0, N_("Check hashes of files with hash list FILE."),
+   N_("FILE"), ARG_TYPE_STRING},
   {"prefix", 'p', 0, N_("Base directory for hash list."), N_("DIR"),
    ARG_TYPE_STRING},
   {"keep-going", 'k', 0, N_("Don't stop after first error."), 0, 0},
index 85189e8bcc010c7fe2bb6836c776af4306470579..41269f1d856d9ddc33e64046e2f6e46ddae2e240 100644 (file)
@@ -47,7 +47,7 @@ static const struct grub_arg_option options[] = {
   {"sleep",           'Y', 0, N_("Set drive to sleep mode."), 0, ARG_TYPE_NONE},
   {"identify",        'i', 0, N_("Print drive identity and settings."),
                              0, ARG_TYPE_NONE},
-  {"dumpid",          'I', 0, N_("Dump contents of ATA IDENTIFY sector."),
+  {"dumpid",          'I', 0, N_("Show raw contents of ATA IDENTIFY sector."),
                               0, ARG_TYPE_NONE},
   {"smart",            -1, 0, N_("Disable/enable SMART (0/1)."), 0, ARG_TYPE_INT},
   {"quiet",           'q', 0, N_("Do not print messages."), 0, ARG_TYPE_NONE},
index 9ba83598a866a34704c5ce774ceb97b62b90528a..4c884b3a19a47fc7470eafb4489b1e6fde1224b9 100644 (file)
@@ -44,7 +44,7 @@ grub_cmd_hexdump (grub_extcmd_context_t ctxt, int argc, char **args)
   int namelen;
 
   if (argc != 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
 
   namelen = grub_strlen (args[0]);
   skip = (state[0].set) ? grub_strtoull (state[0].arg, 0, 0) : 0;
@@ -123,7 +123,7 @@ GRUB_MOD_INIT (hexdump)
 {
   cmd = grub_register_extcmd ("hexdump", grub_cmd_hexdump, 0,
                              N_("[OPTIONS] FILE_OR_DEVICE"),
-                             N_("Dump the contents of a file or memory."),
+                             N_("Show raw contents of a file or memory."),
                              options);
 }
 
index 6a429015584f167e31bb0242100e67ab42a6f72b..a66192cddd15c6e123c9dee269d577d112a8a0dd 100644 (file)
@@ -30,11 +30,11 @@ parse_args (int argc, char *argv[], int *byte, int *bit)
   char *rest;
 
   if (argc != 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "address required");
 
   *byte = grub_strtoul (argv[0], &rest, 0);
   if (*rest != ':')
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "address required");
 
   *bit = grub_strtoul (rest + 1, 0, 0);
 
index 6e82be437d04522a0e24de6d0d10857a98524b95..c19c9ef621b3d5b1cfcd2867f65b3862ca0a00b0 100644 (file)
@@ -107,8 +107,7 @@ drivemap_set (grub_uint8_t newdrive, grub_uint8_t redirto)
     {
       mapping = grub_malloc (sizeof (drivemap_node_t));
       if (! mapping)
-       return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-                          "cannot allocate map entry, not enough memory");
+       return grub_errno;
       mapping->newdrive = newdrive;
       mapping->redirto = redirto;
       mapping->next = map_head;
@@ -230,7 +229,7 @@ grub_cmd_drivemap (struct grub_extcmd_context *ctxt, int argc, char **args)
   grub_err_t err;
 
   if (argc != 2)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
 
   err = tryparse_diskstring (args[0], &mapfrom);
   if (err != GRUB_ERR_NONE)
index 45b43b24249eee4440afbbc687800ce6f0166733..5d29f459ca81d49d89d3988ec53cd6b4500fc5a8 100644 (file)
@@ -74,7 +74,7 @@ grub_cmd_lsapm (grub_command_t cmd __attribute__ ((unused)),
   if (!grub_apm_get_info (&info))
     return grub_error (GRUB_ERR_IO, "no APM found");
 
-  grub_printf_ (N_("Vesion %u.%u\n"
+  grub_printf_ (N_("Version %u.%u\n"
                   "32-bit CS = 0x%x, len = 0x%x, offset = 0x%x\n"
                   "16-bit CS = 0x%x, len = 0x%x\n"
                   "DS = 0x%x, len = 0x%x\n"),
index 1adf296ec80b4b1546b7694f37bb566e7e23af5f..589b151acc9ce90d4fb7bd6760e305ce4d3b3f09 100644 (file)
@@ -192,13 +192,15 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
       file = grub_file_open (args[0]);
 
       if (! file)
-        return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", args[0]);
+        return grub_errno;
 
       if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
         {
           grub_file_close (file);
-          return grub_error (GRUB_ERR_FILE_READ_ERROR,
-                             "file doesn't even contains a full tempo record");
+         if (!grub_errno)
+           grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+                       args[0]);
+          return grub_errno;
         }
 
       tempo = grub_le_to_cpu32 (tempo);
@@ -227,7 +229,7 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
 
       if (*end)
         /* Was not a number either, assume it was supposed to be a file name.  */
-        return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", args[0]);
+        return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), args[0]);
 
       grub_dprintf ("play","tempo = %d\n", tempo);
 
index 8444850778682bde3fe5ffc9178ba9c66dac2fb9..49daaba085e46af89a3026b6c123aaa78db23d58 100644 (file)
@@ -42,7 +42,7 @@ static grub_command_t cmd;
 GRUB_MOD_INIT(ieee1275_suspend)
 {
   cmd = grub_register_command ("suspend", grub_cmd_suspend,
-                              0, N_("Return to Open Firmware prompt."));
+                              0, N_("Return to IEEE1275 prompt."));
 }
 
 GRUB_MOD_FINI(ieee1275_suspend)
index e7035b528d38adca0bf19b0aede6f7705ccd4a3f..2a06e976dfdd3f4a7b36c5f216a42c94b01b552f 100644 (file)
@@ -44,7 +44,7 @@ grub_cmd_read (grub_extcmd_context_t ctxt, int argc, char **argv)
   grub_uint32_t value = 0;
 
   if (argc != 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
 
   addr = grub_strtoul (argv[0], 0, 0);
   switch (ctxt->extcmd->cmd->name[sizeof ("in") - 1])
@@ -82,7 +82,7 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
   grub_uint32_t mask = 0xffffffff;
 
   if (argc != 2 && argc != 3)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
 
   addr = grub_strtoul (argv[0], 0, 0);
   value = grub_strtoul (argv[1], 0, 0);
@@ -120,25 +120,28 @@ GRUB_MOD_INIT(memrw)
 {
   cmd_read_byte =
     grub_register_extcmd ("inb", grub_cmd_read, 0,
-                         N_("PORT"), N_("Read byte from PORT."), options);
+                         N_("PORT"), N_("Read 8-bit value from PORT."),
+                         options);
   cmd_read_word =
     grub_register_extcmd ("inw", grub_cmd_read, 0,
-                         N_("PORT"), N_("Read word from PORT."), options);
+                         N_("PORT"), N_("Read 16-bit value from PORT."),
+                         options);
   cmd_read_dword =
     grub_register_extcmd ("inl", grub_cmd_read, 0,
-                         N_("PORT"), N_("Read dword from PORT."), options);
+                         N_("PORT"), N_("Read 32-bit value from PORT."),
+                         options);
   cmd_write_byte =
     grub_register_command ("outb", grub_cmd_write,
                           N_("PORT VALUE [MASK]"),
-                          N_("Write byte VALUE to PORT."));
+                          N_("Write 8-bit VALUE to PORT."));
   cmd_write_word =
     grub_register_command ("outw", grub_cmd_write,
                           N_("PORT VALUE [MASK]"),
-                          N_("Write word VALUE to PORT."));
+                          N_("Write 16-bit VALUE to PORT."));
   cmd_write_dword =
     grub_register_command ("outl", grub_cmd_write,
                           N_("ADDR VALUE [MASK]"),
-                          N_("Write dword VALUE to PORT."));
+                          N_("Write 32-bit VALUE to PORT."));
 }
 
 GRUB_MOD_FINI(memrw)
index 6c5913a54a980502d58800ee70106d6a7cea09de..10eeae3752367646652478929589cd7b24875395 100644 (file)
@@ -207,7 +207,7 @@ grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)),
     {
       const char *prefix = grub_env_get ("prefix");
       if (!prefix)
-       return grub_error (GRUB_ERR_BAD_ARGUMENT, "No prefix set");     
+       return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("variable `%s' isn't set"), "prefix");     
       filename = grub_xasprintf ("%s/layouts/%s.gkb", prefix, argv[0]);
       if (!filename)
        return grub_errno;
@@ -222,7 +222,8 @@ grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)),
   if (grub_file_read (file, magic, sizeof (magic)) != sizeof (magic))
     {
       if (!grub_errno)
-       grub_error (GRUB_ERR_BAD_ARGUMENT, "file is too short");
+       grub_error (GRUB_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
+                   filename);
       goto fail;
     }
 
@@ -236,7 +237,8 @@ grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)),
   if (grub_file_read (file, &version, sizeof (version)) != sizeof (version))
     {
       if (!grub_errno)
-       grub_error (GRUB_ERR_BAD_ARGUMENT, "file is too short");
+       grub_error (GRUB_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
+                   filename);
       goto fail;
     }
 
@@ -253,7 +255,8 @@ grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)),
   if (grub_file_read (file, newmap, sizeof (*newmap)) != sizeof (*newmap))
     {
       if (!grub_errno)
-       grub_error (GRUB_ERR_BAD_ARGUMENT, "file is too short");
+       grub_error (GRUB_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
+                   filename);
       goto fail;
     }
 
index b8effe43e525c6e44f0662c6b9e6605a15c0d630..f4939a99631942008e7d0174e612f56fd9f7bf31 100644 (file)
@@ -194,7 +194,7 @@ grub_cmd_legacy_source (struct grub_command *cmd,
   grub_err_t ret;
 
   if (argc != 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
 
   extractor = (cmd->name[0] == 'e');
   new_env = (cmd->name[extractor ? (sizeof ("extract_legacy_entries_") - 1)
@@ -299,7 +299,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
     }
 
   if (argc < 2)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "filename required");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
 
   cutargs = grub_malloc (sizeof (cutargs[0]) * (argc - 1));
   cutargc = argc - 1;
@@ -481,7 +481,7 @@ grub_cmd_legacy_initrd (struct grub_command *mycmd __attribute__ ((unused)),
     }
 
   return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                    "no kernel with module support is loaded in legacy way");
+                    "you need to load the kernel first");
 }
 
 static grub_err_t
@@ -517,7 +517,7 @@ grub_cmd_legacy_initrdnounzip (struct grub_command *mycmd __attribute__ ((unused
     }
 
   return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                    "no kernel with module support is loaded in legacy way");
+                    "you need to load the kernel first");
 }
 
 static grub_err_t
@@ -696,7 +696,7 @@ grub_cmd_legacy_password (struct grub_command *mycmd __attribute__ ((unused)),
   struct legacy_md5_password *pw = NULL;
 
   if (argc == 0)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "arguments expected");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
   if (args[0][0] != '-' || args[0][1] != '-')
     return grub_normal_set_password ("legacy", args[0]);
 
@@ -722,7 +722,7 @@ grub_cmd_legacy_check_password (struct grub_command *mycmd __attribute__ ((unuse
   char entered[GRUB_AUTH_MAX_PASSLEN];
 
   if (argc == 0)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "arguments expected");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
   grub_puts_ (N_("Enter password: "));
   if (!grub_password_get (entered, GRUB_AUTH_MAX_PASSLEN))
     return GRUB_ACCESS_DENIED;
index 1073712d5218feb40651c5787a8c71e89e526162..4dcb5d49ac4309f9e2030745c829fe7fdbedfc8d 100644 (file)
@@ -65,7 +65,7 @@ open_envblk_file (char *filename)
         }
       else
         {
-          grub_error (GRUB_ERR_FILE_NOT_FOUND, "prefix is not found");
+          grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
           return 0;
         }
     }
@@ -93,8 +93,6 @@ read_envblk_file (grub_file_t file)
       ret = grub_file_read (file, buf + offset, size);
       if (ret <= 0)
         {
-          if (grub_errno == GRUB_ERR_NONE)
-            grub_error (GRUB_ERR_FILE_READ_ERROR, "cannot read");
           grub_free (buf);
           return 0;
         }
index 4815fd174d63abd031d15bcff945d5c3bda5d5ed..260b4536d28fec1035fda14888bf7c4635d46250 100644 (file)
@@ -26,13 +26,13 @@ GRUB_MOD_LICENSE ("GPLv3+");
 
 static const char *names[] =
   {
-    [GRUB_MEMORY_AVAILABLE] = N_("available"),
-    [GRUB_MEMORY_RESERVED] = N_("reserved"),
-    [GRUB_MEMORY_ACPI] = N_("ACPI reclamaible"),
-    [GRUB_MEMORY_NVS] = N_("ACPI non-volatile storage"),
-    [GRUB_MEMORY_BADRAM] = N_("BadRAM"),
-    [GRUB_MEMORY_CODE] = N_("firmware code"),
-    [GRUB_MEMORY_HOLE] = N_("hole")
+    [GRUB_MEMORY_AVAILABLE] = N_("available RAM"),
+    [GRUB_MEMORY_RESERVED] = N_("reserved RAM"),
+    [GRUB_MEMORY_ACPI] = N_("ACPI reclaimable RAM"),
+    [GRUB_MEMORY_NVS] = N_("ACPI non-volatile storage RAM"),
+    [GRUB_MEMORY_BADRAM] = N_("faulty RAM (BadRAM)"),
+    [GRUB_MEMORY_CODE] = N_("RAM holding firmware code"),
+    [GRUB_MEMORY_HOLE] = N_("Address range not associated with RAM")
   };
 
 static grub_err_t
index 5984288ce3bfb52cffd3c4820e47b4586aa1632a..db2e435f24b56c54597e7e781e140cf93845a6cf 100644 (file)
@@ -44,7 +44,7 @@ grub_cmd_read (grub_extcmd_context_t ctxt, int argc, char **argv)
   char buf[sizeof ("XXXXXXXX")];
 
   if (argc != 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
 
   addr = grub_strtoul (argv[0], 0, 0);
   switch (ctxt->extcmd->cmd->name[sizeof ("read_") - 1])
@@ -81,7 +81,7 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
   grub_uint32_t mask = 0xffffffff;
 
   if (argc != 2 && argc != 3)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
 
   addr = grub_strtoul (argv[0], 0, 0);
   value = grub_strtoul (argv[1], 0, 0);
@@ -122,22 +122,28 @@ GRUB_MOD_INIT(memrw)
 {
   cmd_read_byte =
     grub_register_extcmd ("read_byte", grub_cmd_read, 0,
-                         N_("ADDR"), N_("Read byte from ADDR."), options);
+                         N_("ADDR"), N_("Read 8-bit value from ADDR."),
+                         options);
   cmd_read_word =
     grub_register_extcmd ("read_word", grub_cmd_read, 0,
-                         N_("ADDR"), N_("Read word from ADDR."), options);
+                         N_("ADDR"), N_("Read 16-bit value from ADDR."),
+                         options);
   cmd_read_dword =
     grub_register_extcmd ("read_dword", grub_cmd_read, 0,
-                         N_("ADDR"), N_("Read dword from ADDR."), options);
+                         N_("ADDR"), N_("Read 32-bit value from ADDR."),
+                         options);
   cmd_write_byte =
     grub_register_command ("write_byte", grub_cmd_write,
-                          N_("ADDR VALUE [MASK]"), N_("Write byte VALUE to ADDR."));
+                          N_("ADDR VALUE [MASK]"),
+                          N_("Write 8-bit VALUE to ADDR."));
   cmd_write_word =
     grub_register_command ("write_word", grub_cmd_write,
-                          N_("ADDR VALUE [MASK]"), N_("Write word VALUE to ADDR."));
+                          N_("ADDR VALUE [MASK]"),
+                          N_("Write 16-bit VALUE to ADDR."));
   cmd_write_dword =
     grub_register_command ("write_dword", grub_cmd_write,
-                          N_("ADDR VALUE [MASK]"), N_("Write dword VALUE to ADDR."));
+                          N_("ADDR VALUE [MASK]"),
+                          N_("Write 32-bit VALUE to ADDR."));
 }
 
 GRUB_MOD_FINI(memrw)
index 244a12b7a87bf9888942135fac93ec5c64f6fbcc..108062e6afc78cba9de7fcf0f7fd9a33d486567a 100644 (file)
@@ -30,11 +30,12 @@ static const struct grub_arg_option options[] =
     {"class", 1, GRUB_ARG_OPTION_REPEATABLE,
      N_("Menu entry type."), N_("STRING"), ARG_TYPE_STRING},
     {"users", 2, 0,
-     N_("Users allowed to boot this entry."), N_("USERNAME"), ARG_TYPE_STRING},
+     N_("List of users allowed to boot this entry."), N_("USERNAME[,USERNAME]"),
+     ARG_TYPE_STRING},
     {"hotkey", 3, 0,
      N_("Keyboard key to quickly boot this entry."), N_("KEYBOARD_KEY"), ARG_TYPE_STRING},
     {"source", 4, 0,
-     N_("Menu entry definition as a string."), N_("STRING"), ARG_TYPE_STRING},
+     N_("Use STRING as menu entry body."), N_("STRING"), ARG_TYPE_STRING},
     {0, 0, 0, 0, 0, 0}
   };
 
index be5cccce157002c0cdb7919b3a9fd344c41a702a..ce9a6cc27ae617836c1e6a969afb61d725a4a53c 100644 (file)
@@ -41,7 +41,7 @@ grub_mini_cmd_cat (struct grub_command *cmd __attribute__ ((unused)),
   grub_ssize_t size;
 
   if (argc < 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
 
   file = grub_file_open (argv[0]);
   if (! file)
@@ -187,7 +187,7 @@ GRUB_MOD_INIT(minicmd)
                           0, N_("Show this message."));
   cmd_dump =
     grub_register_command ("dump", grub_mini_cmd_dump,
-                          N_("ADDR [SIZE]"), N_("Dump memory."));
+                          N_("ADDR [SIZE]"), N_("Show memory contents."));
   cmd_rmmod =
     grub_register_command ("rmmod", grub_mini_cmd_rmmod,
                           N_("MODULE"), N_("Remove a module."));
index 76999368fe0c45da338d672f31ac00c1a2fd9770..002df4a2a0932247e938cf15208c2627cdb16193 100644 (file)
@@ -49,14 +49,15 @@ grub_cmd_lsspd (grub_command_t cmd __attribute__ ((unused)),
   if (err)
     return err;
 
-  grub_printf_ (N_("SMB base = 0x%x\n"), smbbase);
+  grub_printf_ (N_("System management bus controller I/O space is at 0x%x\n"),
+               smbbase);
 
   for (i = GRUB_SMB_RAM_START_ADDR;
        i < GRUB_SMB_RAM_START_ADDR + GRUB_SMB_RAM_NUM_MAX; i++)
     {
       struct grub_smbus_spd spd;
       grub_memset (&spd, 0, sizeof (spd));
-      grub_printf_ (N_("Device %d\n"), i);
+      grub_printf_ (N_("RAM slot number %d\n"), i);
       err = grub_cs5536_read_spd (smbbase, i, &spd);
       if (err)
        {
index 8821607b801d37f32092f3411237eb35981fb21e..6d42c9b02cd2e2ae6cfd81cef54c0bfb2b140f77 100644 (file)
@@ -72,7 +72,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
                   int argc, char **args)
 {
   if (argc != 2)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments expected");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
   return grub_normal_set_password (args[0], args[1]);
 }
 
index 05a627219b15a16d7f1255fcc1326be433403174..4f50b327adde03cfd4b56fede9a7a987f5f3a990 100644 (file)
@@ -90,11 +90,11 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
   struct pbkdf2_password *pass;
 
   if (argc != 2)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Two arguments expected.");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
 
   if (grub_memcmp (args[1], "grub.pbkdf2.sha512.",
                   sizeof ("grub.pbkdf2.sha512.") - 1) != 0)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "incorrect PBKDF2 password");
 
   ptr = args[1] + sizeof ("grub.pbkdf2.sha512.") - 1;
 
@@ -106,7 +106,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
   if (*ptr != '.')
     {
       grub_free (pass);
-      return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
+      return grub_error (GRUB_ERR_BAD_ARGUMENT, "incorrect PBKDF2 password");
     }
   ptr++;
 
@@ -114,7 +114,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
   if (!ptr2 || ((ptr2 - ptr) & 1) || grub_strlen (ptr2 + 1) & 1)
     {
       grub_free (pass);
-      return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
+      return grub_error (GRUB_ERR_BAD_ARGUMENT, "incorrect PBKDF2 password");
     }
 
   pass->saltlen = (ptr2 - ptr) >> 1;
@@ -137,7 +137,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
          grub_free (pass->salt);
          grub_free (pass);
          return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                            "Incorrect PBKDF2 password.");
+                            "incorrect PBKDF2 password");
        }
 
       *ptro = (hex1 << 4) | hex2;
@@ -166,7 +166,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
          grub_free (pass->salt);
          grub_free (pass);
          return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                            "Incorrect PBKDF2 password.");
+                            "incorrect PBKDF2 password");
        }
 
       *ptro = (hex1 << 4) | hex2;
index a1d68cdebaa6d7534a9048e4694ac1ff92cbb17d..8527dd5316eb50bcb0e09495c57f7c09d7845885 100644 (file)
@@ -68,7 +68,7 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, char **args)
   else
     dev = grub_device_open (args[0]);
   if (! dev)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "couldn't open device");
+    return grub_errno;
 
   if (state[1].set)
     {
@@ -96,7 +96,7 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, char **args)
     }
   fs = grub_fs_probe (dev);
   if (! fs)
-    return grub_error (GRUB_ERR_UNKNOWN_FS, "unrecognised fs");
+    return grub_errno;
   if (state[3].set)
     {
       if (state[0].set)
index 1e8a6f309791c55f998f0f2fa3697d50ee4d6723..b911ffd600d0302d3f1a57b8458e32e26fc1d49f 100644 (file)
@@ -32,7 +32,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
 static const struct grub_arg_option options[] =
   {
     { "set", 's', GRUB_ARG_OPTION_REPEATABLE,
-      N_("Variable names to update with matches."),
+      N_("Store matched component NUMBER in VARNAME."),
       N_("[NUMBER:]VARNAME"), ARG_TYPE_STRING },
     { 0, 0, 0, 0, 0, 0 }
   };
@@ -42,7 +42,6 @@ set_matches (char **varnames, char *str, grub_size_t nmatches,
             regmatch_t *matches)
 {
   int i;
-  char ch;
   char *p;
   char *q;
   grub_err_t err;
@@ -51,6 +50,7 @@ set_matches (char **varnames, char *str, grub_size_t nmatches,
   auto void setvar (char *v, regmatch_t *m);
   void setvar (char *v, regmatch_t *m)
   {
+    char ch;
     ch = str[m->rm_eo];
     str[m->rm_eo] = '\0';
     err = grub_env_set (v, str + m->rm_so);
@@ -59,7 +59,8 @@ set_matches (char **varnames, char *str, grub_size_t nmatches,
 
   for (i = 0; varnames && varnames[i]; i++)
     {
-      if (! (p = grub_strchr (varnames[i], ':')))
+      p = grub_strchr (varnames[i], ':');
+      if (! p)
        {
          /* varname w/o index defaults to 1 */
          if (nmatches < 2 || matches[1].rm_so == -1)
@@ -97,7 +98,7 @@ grub_cmd_regexp (grub_extcmd_context_t ctxt, int argc, char **args)
   regmatch_t *matches = 0;
 
   if (argc != 2)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "2 arguments expected");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
 
   ret = regcomp (&regex, args[0], REG_EXTENDED);
   if (ret)
index d5117baefdebb910abb1ff3c787e3eee94e3f1ce..5e9b7e381f1b6059d33e01f7abaf57416c5d23a3 100644 (file)
@@ -277,7 +277,7 @@ grub_cmd_do_search (grub_command_t cmd __attribute__ ((unused)), int argc,
                    char **args)
 {
   if (argc == 0)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
 
   FUNC_NAME (args[0], argc == 1 ? 0 : args[1], 0, (args + 2),
             argc > 2 ? argc - 2 : 0);
index 35c5ee3196eab178bc5199a0d6f3628a03f15e27..e055cd5c7769c5fc50ad56e6262f6dd4ea19f89a 100644 (file)
@@ -158,7 +158,7 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args)
       break;
 
   if (argc == j)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
 
   if (state[SEARCH_SET].set)
     var = state[SEARCH_SET].arg ? state[SEARCH_SET].arg : "root";
index 739d28458a879c5c9b6839e4713a47e7f4d289be..fcfec4058d41f2a879d707fc7db4d5109d27a3f4 100644 (file)
@@ -179,7 +179,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
       if (grub_errno)
        return grub_errno;
       if (*ptr != ':')
-       return grub_error (GRUB_ERR_BAD_ARGUMENT, "Colon expected.");
+       return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':');
       ptr++;
       pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff)
        << 16;
@@ -210,7 +210,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
       if (grub_errno)
        return grub_errno;
       if (*ptr != ':')
-       return grub_error (GRUB_ERR_BAD_ARGUMENT, "Colon expected.");
+       return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':');
       ptr++;
       optr = ptr;
       device = grub_strtoul (ptr, (char **) &ptr, 16);
@@ -238,11 +238,8 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
 
   write_mask = 0;
 
-  if (argc == 0)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Command expected.");
-
-  if (argc > 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Only one command is supported.");
+  if (argc != 1)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
 
   ptr = argv[0];
 
@@ -257,7 +254,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
       regsize = 0;
       regaddr = grub_strtoul (ptr, (char **) &ptr, 16);
       if (grub_errno)
-       return grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown register");
+       return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown register");
     }
   else
     {
@@ -298,7 +295,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
 
   if (!regsize)
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                      "Unknown register size.");
+                      "unknown register size");
 
   write_mask = 0;
   if (*ptr == '=')
@@ -321,7 +318,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
 
   if (write_mask && varname)
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                      "Option -v isn't valid for writes.");
+                      "option -v isn't valid for writes");
 
   grub_pci_iterate (grub_setpci_iter);
   return GRUB_ERR_NONE;
index 97e7a40a63bfadbaecbaf550f9a67efdfb55d4de..4498756ac766549a367d1064fe7358810e6ce8a7 100644 (file)
@@ -67,7 +67,7 @@ grub_cmd_sleep (grub_extcmd_context_t ctxt, int argc, char **args)
   int n;
 
   if (argc != 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "missing operand");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
 
   n = grub_strtoul (args[0], 0, 10);
 
index fe06f3d1e386125fa7d19ae30271108ce26bf2d7..ef68ad1417feca8e7e13f30edb74ed03c23bd781 100644 (file)
@@ -50,7 +50,7 @@ grub_cmd_testload (struct grub_command *cmd __attribute__ ((unused)),
     }
 
   if (argc < 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
 
   file = grub_file_open (argv[0]);
   if (! file)
index 82775e7ef7ae9731d26812ec61e973e0747dc23e..a00af143374fde9297e91e56f305a9a59070f4c2 100644 (file)
@@ -46,9 +46,13 @@ GRUB_MOD_INIT(true)
 {
   cmd_true =
     grub_register_command ("true", grub_cmd_true,
+                          /* TRANSLATORS: it's imperative, not
+                             infinitive.  */
                           0, N_("Do nothing, successfully."));
   cmd_false =
     grub_register_command ("false", grub_cmd_false,
+                          /* TRANSLATORS: it's imperative, not
+                             infinitive.  */
                           0, N_("Do nothing, unsuccessfully."));
 }
 
index 9e12ff55ef72c3a09a8f597c7aa08ea3bb6b120d..261d58613bd9e56988717fb655f3d5c4bfe61c27 100644 (file)
@@ -178,7 +178,7 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
       {
        if (adapter->init ())
          {
-           grub_puts_ (N_("  Failed"));
+           grub_puts_ (N_("  Failed to initialize video adapter"));
            grub_errno = GRUB_ERR_NONE;
            continue;
          }
index 8c4fc2bfb1daa1776a883d138a4d83bb9649308b..4ab2d18db677edb262e84fc9dbcf0c638c6ed16f 100644 (file)
@@ -543,10 +543,10 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
               (unsigned long long) parms->cmdsize);
 
   if (parms->cmdsize != 0 && parms->cmdsize != 12 && parms->cmdsize != 16)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "incorrect ATAPI command size");
+    return grub_error (GRUB_ERR_BUG, "incorrect ATAPI command size");
 
   if (parms->size > GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "too big data buffer");
+    return grub_error (GRUB_ERR_BUG, "too big data buffer");
 
   bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1));
 
@@ -626,7 +626,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
                      dev->hba->ports[dev->port].command_issue,
                      dev->hba->ports[dev->port].intstatus,
                      dev->hba->ports[dev->port].task_file_data);
-       err = grub_error (GRUB_ERR_IO, "AHCI transfer timeouted");
+       err = grub_error (GRUB_ERR_IO, "AHCI transfer timed out");
        break;
       }
 
index 198dfcfff0a6e01588ef80733ce0960e23272666..389851901477b5a3a23a9be0bbcd9175135f3d50 100644 (file)
@@ -21,6 +21,7 @@
 #include <grub/disk.h>
 #include <grub/mm.h>
 #include <grub/arc/arc.h>
+#include <grub/i18n.h>
 
 static grub_arc_fileno_t last_handle = 0;
 static char *last_path = NULL;
@@ -255,7 +256,11 @@ grub_arcdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
     {
       if (GRUB_ARC_FIRMWARE_VECTOR->read (last_handle, buf,
                                          totl, &count))
-       return grub_error (GRUB_ERR_READ_ERROR, "read failed");
+       return grub_error (GRUB_ERR_READ_ERROR,
+                          N_("failure reading sector 0x%llx "
+                                                  " from `%s'"),
+                          (unsigned long long) sector,
+                          disk->name);
       totl -= count;
       buf += count;
     }
@@ -288,7 +293,10 @@ grub_arcdisk_write (grub_disk_t disk, grub_disk_addr_t sector,
     {
       if (GRUB_ARC_FIRMWARE_VECTOR->write (last_handle, buf,
                                           totl, &count))
-       return grub_error (GRUB_ERR_WRITE_ERROR, "write failed");
+       return grub_error (GRUB_ERR_WRITE_ERROR, N_("failure writing sector 0x%llx "
+                                                  " from `%s'"),
+                          (unsigned long long) sector,
+                          disk->name);
       totl -= count;
       buf += count;
     }
index 7d63f3e4620e4358abf82135e87cd9d2b63b6cf9..dc409153c06951e100e38309029201171df7cc03 100644 (file)
@@ -41,7 +41,7 @@ static const struct grub_arg_option options[] =
   {
     {"uuid", 'u', 0, N_("Mount by UUID."), 0, 0},
     {"all", 'a', 0, N_("Mount all."), 0, 0},
-    {"boot", 'b', 0, N_("Mount all volumes marked as boot."), 0, 0},
+    {"boot", 'b', 0, N_("Mount all volumes with `boot' flag set."), 0, 0},
     {0, 0, 0, 0, 0, 0}
   };
 
@@ -501,7 +501,7 @@ grub_cryptodisk_open (const char *name, grub_disk_t disk)
       if (dev->cheat_fd == -1)
        dev->cheat_fd = open (dev->cheat, O_RDONLY);
       if (dev->cheat_fd == -1)
-       return grub_error (GRUB_ERR_IO, "couldn't open %s: %s",
+       return grub_error (GRUB_ERR_IO, N_("cannot open `%s': %s"),
                           dev->cheat, strerror (errno));
     }
 #endif
@@ -560,8 +560,8 @@ grub_cryptodisk_read (grub_disk_t disk, grub_disk_addr_t sector,
        return err;
       if (grub_util_fd_read (dev->cheat_fd, buf, size << disk->log_sector_size)
          != (ssize_t) (size << disk->log_sector_size))
-       return grub_error (GRUB_ERR_READ_ERROR, "cannot read from `%s'",
-                          dev->cheat);
+       return grub_error (GRUB_ERR_READ_ERROR, N_("cannot read `%s': %s"),
+                          dev->cheat, strerror (errno));
       return GRUB_ERR_NONE;
     }
 #endif
@@ -604,8 +604,8 @@ grub_cryptodisk_write (grub_disk_t disk, grub_disk_addr_t sector,
        return err;
       if (grub_util_fd_write (dev->cheat_fd, buf, size << disk->log_sector_size)
          != (ssize_t) (size << disk->log_sector_size))
-       return grub_error (GRUB_ERR_READ_ERROR, "cannot read from `%s'",
-                          dev->cheat);
+       return grub_error (GRUB_ERR_READ_ERROR, N_("cannot read `%s': %s"),
+                          dev->cheat, strerror (errno));
       return GRUB_ERR_NONE;
     }
 #endif
index 0354b9172e3f057edaf8f7125d3594d505ae59fe..3cfd4d9bbeb71194a4f41aa21aa017ad5bbd51fa 100644 (file)
@@ -249,8 +249,8 @@ grub_diskfilter_memberlist (grub_disk_t disk)
     for (pv = lv->vg->pvs; pv; pv = pv->next)
       {
        if (!pv->disk)
-         grub_util_error (_("Couldn't find PV %s. Check your device.map"),
-                          pv->name);
+         grub_util_error (_("Couldn't find physical volume `%s'."
+                            " Check your device.map"), pv->name);
        tmp = grub_malloc (sizeof (*tmp));
        tmp->disk = pv->disk;
        tmp->next = list;
index 1ade44cabca0d7ce4d3c1d8c99bbd0c8a385b914..c4d092da8b56d8d9994c05f5b489a84b53019040 100644 (file)
@@ -408,7 +408,7 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev)
 
   sector = grub_disk_get_size (source);
   if (sector == GRUB_DISK_SIZE_UNKNOWN || sector == 0)
-    return grub_error (GRUB_ERR_OUT_OF_RANGE, "not a geli");
+    return grub_error (GRUB_ERR_BUG, "not a geli");
 
   /* Read the GELI header.  */
   err = grub_disk_read (source, sector - 1, 0, sizeof (header), &header);
index 173e734d86a4cb89a4c05f1bc05d79fc108d3332..e989378c9aec98018c73aca8ef53ec4e017239aa 100644 (file)
@@ -472,7 +472,10 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
              break;
 
          if (i == GRUB_BIOSDISK_CDROM_RETRY_COUNT)
-           return grub_error (GRUB_ERR_READ_ERROR, "cdrom read error");
+           return grub_error (GRUB_ERR_READ_ERROR, N_("failure reading sector 0x%llx "
+                                                      " from `%s'"),
+                              (unsigned long long) sector,
+                              disk->name);
        }
       else
         if (grub_biosdisk_rw_int13_extensions (cmd + 0x42, data->drive, dap))
@@ -502,7 +505,9 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
       coff = head / data->heads;
 
       if (coff >= data->cylinders)
-       return grub_error (GRUB_ERR_OUT_OF_RANGE, "%s out of disk", disk->name);
+       return grub_error (GRUB_ERR_OUT_OF_RANGE,
+                          N_("attempt to read or write outside of disk `%s'"),
+                          disk->name);
 
       if (grub_biosdisk_rw_standard (cmd + 0x02, data->drive,
                                     coff, hoff, soff, size, segment))
@@ -510,9 +515,15 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
          switch (cmd)
            {
            case GRUB_BIOSDISK_READ:
-             return grub_error (GRUB_ERR_READ_ERROR, "%s read error", disk->name);
+             return grub_error (GRUB_ERR_READ_ERROR, N_("failure reading sector 0x%llx "
+                                                        " from `%s'"),
+                                (unsigned long long) sector,
+                                disk->name);
            case GRUB_BIOSDISK_WRITE:
-             return grub_error (GRUB_ERR_WRITE_ERROR, "%s write error", disk->name);
+             return grub_error (GRUB_ERR_WRITE_ERROR, N_("failure writing sector 0x%llx "
+                                                         " from `%s'"),
+                                (unsigned long long) sector,
+                                disk->name);
            }
        }
     }
@@ -627,7 +638,8 @@ GRUB_MOD_INIT(biosdisk)
 
   if (grub_disk_firmware_is_tainted)
     {
-      grub_puts_ (N_("Firmware is marked as tainted, refusing to initialize."));
+      grub_puts_ (N_("Native disk drivers are in use. "
+                    "Refusing to use firmware disk interface."));
       return;
     }
   grub_disk_firmware_fini = grub_disk_biosdisk_fini;
index 94d62bc4f37b7faac84de0d0c4d780e270b34fd0..1bc511eda19b6803cc3d7539c7c7fd49cc6d3756 100644 (file)
@@ -22,6 +22,7 @@
 #include <grub/mm.h>
 #include <grub/dl.h>
 #include <grub/ieee1275/ieee1275.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -177,7 +178,10 @@ grub_nand_read (grub_disk_t disk, grub_disk_addr_t sector,
       args.result = 1;
 
       if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
-        return grub_error (GRUB_ERR_READ_ERROR, "read error");
+        return grub_error (GRUB_ERR_READ_ERROR, N_("failure reading sector 0x%llx "
+                                                  " from `%s'"),
+                          (unsigned long long) sector,
+                          disk->name);
 
       ofs = 0;
       size -= len;
index 4481837de1fc55befac81b9cdadaa4b3a03a1110..9c6dc063d6cc87a3de5804d6e1a723946962dfed 100644 (file)
@@ -22,6 +22,7 @@
 #include <grub/mm.h>
 #include <grub/ieee1275/ieee1275.h>
 #include <grub/ieee1275/ofdisk.h>
+#include <grub/i18n.h>
 
 static char *last_devpath;
 static grub_ieee1275_ihandle_t last_ihandle;
@@ -273,7 +274,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
   if (grub_strcmp (prop, "block"))
     {
       grub_free (devpath);
-      return grub_error (GRUB_ERR_BAD_DEVICE, "not a block device");
+      return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a block device");
     }
 
   /* XXX: There is no property to read the number of blocks.  There
@@ -364,8 +365,10 @@ grub_ofdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
   grub_ieee1275_read (last_ihandle, buf, size  << GRUB_DISK_SECTOR_BITS,
                      &actual);
   if (actual != (grub_ssize_t) (size  << GRUB_DISK_SECTOR_BITS))
-    return grub_error (GRUB_ERR_READ_ERROR, "read error on block: %llu",
-                      (long long) sector);
+    return grub_error (GRUB_ERR_READ_ERROR, N_("failure reading sector 0x%llx "
+                                              " from `%s'"),
+                      (unsigned long long) sector,
+                      disk->name);
 
   return 0;
 }
@@ -382,8 +385,10 @@ grub_ofdisk_write (grub_disk_t disk, grub_disk_addr_t sector,
   grub_ieee1275_write (last_ihandle, buf, size  << GRUB_DISK_SECTOR_BITS,
                       &actual);
   if (actual != (grub_ssize_t) (size << GRUB_DISK_SECTOR_BITS))
-    return grub_error (GRUB_ERR_WRITE_ERROR, "write error on block: %llu",
-                      (long long) sector);
+    return grub_error (GRUB_ERR_WRITE_ERROR, N_("failure writing sector 0x%llx "
+                                               " from `%s'"),
+                      (unsigned long long) sector,
+                      disk->name);
 
   return 0;
 }
index 7a18b5e8406d2961bec2cf9d16ee4fb07a0631b7..b4b566f323627701792cd7f67344c79bb446a948 100644 (file)
@@ -23,6 +23,7 @@
 #include <grub/misc.h>
 #include <grub/diskfilter.h>
 #include <grub/gpt_partition.h>
+#include <grub/i18n.h>
 
 #ifdef GRUB_UTIL
 #include <grub/emu/misc.h>
@@ -919,10 +920,10 @@ grub_util_ldm_embed (struct grub_disk *disk, unsigned int *nsectors,
     return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
                       "LDM curently supports only PC-BIOS embedding");
   if (disk->partition)
-    return grub_error (GRUB_ERR_FILE_NOT_FOUND, "disk isn't LDM");
+    return grub_error (GRUB_ERR_BUG, "disk isn't LDM");
   pv = grub_diskfilter_get_pv_from_disk (disk, &vg);
   if (!pv)
-    return grub_error (GRUB_ERR_FILE_NOT_FOUND, "disk isn't LDM");
+    return grub_error (GRUB_ERR_BUG, "disk isn't LDM");
   for (lv = vg->lvs; lv; lv = lv->next)
     {
       struct grub_diskfilter_lv *comp;
@@ -961,8 +962,8 @@ grub_util_ldm_embed (struct grub_disk *disk, unsigned int *nsectors,
 #endif
       if (lv->size < *nsectors)
        return grub_error (GRUB_ERR_OUT_OF_RANGE,
-                          "Your LDM embed Partition is too small;"
-                          " embedding won't be possible!");
+                          N_("your LDM embed Partition is too small;"
+                             " embedding won't be possible"));
       *nsectors = lv->size;
       *sectors = grub_malloc (*nsectors * sizeof (**sectors));
       if (!*sectors)
@@ -975,8 +976,8 @@ grub_util_ldm_embed (struct grub_disk *disk, unsigned int *nsectors,
     }
 
   return grub_error (GRUB_ERR_FILE_NOT_FOUND,
-                    "This LDM no Embedding Partition;"
-                    " embedding won't be possible!");
+                    N_("this LDM has no Embedding Partition;"
+                       " embedding won't be possible"));
 }
 #endif
 
index dca83b7c674960d6a637b2aafac7a166d1d9fec4..afdcf481dcee2bdc90a75a52102019650114f30b 100644 (file)
@@ -38,7 +38,7 @@ static struct grub_loopback *loopback_list;
 
 static const struct grub_arg_option options[] =
   {
-    {"delete", 'd', 0, N_("Delete the loopback device entry."), 0, 0},
+    {"delete", 'd', 0, N_("Delete the specified loopback drive."), 0, 0},
     {0, 0, 0, 0, 0, 0}
   };
 
@@ -86,7 +86,7 @@ grub_cmd_loopback (grub_extcmd_context_t ctxt, int argc, char **args)
       return delete_loopback (args[0]);
 
   if (argc < 2)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
 
   file = grub_file_open (args[1]);
   if (! file)
@@ -224,7 +224,7 @@ GRUB_MOD_INIT(loopback)
 {
   cmd = grub_register_extcmd ("loopback", grub_cmd_loopback, 0,
                              N_("[-d] DEVICENAME FILE."),
-                             N_("Make a device of a file."), options);
+                             N_("Make a virtual drive from a file."), options);
   grub_disk_dev_register (&grub_loopback_dev);
 }
 
index 24b63ec9837925fd3618d108624779fdd3307907..05fed4b949e7c8145cd23a34e8b08057cac73d64 100644 (file)
@@ -23,6 +23,7 @@
 #include <grub/efiemu/efiemu.h>
 #include <grub/cpu/efiemu.h>
 #include <grub/elf.h>
+#include <grub/i18n.h>
 
 /* Check if EHDR is a valid ELF header.  */
 int
@@ -101,8 +102,9 @@ grub_arch_efiemu_relocate_symbols32 (grub_efiemu_segment_t segs,
                      return err;
                    break;
                  default:
-                   return grub_error (GRUB_ERR_BAD_OS,
-                                      "unrecognised relocation");
+                   return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+                                      N_("relocation 0x%x is not implemented yet"),
+                                      ELF_R_TYPE (rel->r_info));
                  }
              }
          }
index a69279077c39fd50f78d540af4dfe43587d3144c..6303019b9d8cf77f068a825a0c8a364d65153c3f 100644 (file)
@@ -23,6 +23,7 @@
 #include <grub/efiemu/efiemu.h>
 #include <grub/cpu/efiemu.h>
 #include <grub/elf.h>
+#include <grub/i18n.h>
 
 /* Check if EHDR is a valid ELF header.  */
 int
@@ -109,8 +110,9 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs,
                      return err;
                     break;
                  default:
-                   return grub_error (GRUB_ERR_BAD_OS,
-                                      "unrecognised relocation");
+                   return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+                                      N_("relocation 0x%x is not implemented yet"),
+                                      ELF_R_TYPE (rel->r_info));
                  }
              }
          }
index edadd45806c52c65d9d455d35b483fadcc33a87e..1be4a2cecfff48768053c0ca0759129bb80861dd 100644 (file)
@@ -23,6 +23,7 @@
 #include <grub/efiemu/efiemu.h>
 #include <grub/cpu/efiemu.h>
 #include <grub/elf.h>
+#include <grub/i18n.h>
 
 /* ELF symbols and their values */
 static struct grub_efiemu_elf_sym *grub_efiemu_elfsyms = 0;
@@ -193,7 +194,7 @@ grub_efiemu_count_symbols (const Elf_Ehdr *e)
       break;
 
   if (i == e->e_shnum)
-    return grub_error (GRUB_ERR_BAD_OS, "no symbol table");
+    return grub_error (GRUB_ERR_BAD_OS, N_("no symbol table"));
 
   grub_efiemu_nelfsyms = (unsigned) s->sh_size / (unsigned) s->sh_entsize;
   grub_efiemu_elfsyms = (struct grub_efiemu_elf_sym *)
@@ -230,7 +231,7 @@ grub_efiemu_resolve_symbols (grub_efiemu_segment_t segs, Elf_Ehdr *e)
       break;
 
   if (i == e->e_shnum)
-    return grub_error (GRUB_ERR_BAD_OS, "no symbol table");
+    return grub_error (GRUB_ERR_BAD_OS, N_("no symbol table"));
 
   sym = (Elf_Sym *) ((char *) e + s->sh_offset);
   size = s->sh_size;
@@ -328,7 +329,7 @@ SUFFIX (grub_efiemu_loadcore_init) (void *core, grub_size_t core_size,
   grub_err_t err;
 
   if (e->e_type != ET_REL)
-    return grub_error (GRUB_ERR_BAD_MODULE, "invalid ELF file type");
+    return grub_error (GRUB_ERR_BAD_MODULE, N_("this ELF file is not of the right type"));
 
   /* Make sure that every section is within the core.  */
   if ((grub_size_t) core_size < e->e_shoff + e->e_shentsize * e->e_shnum)
index a4db0ee9b947e613f95f47a4485fb118c3a6c021..b0a22135d97410f9f8968887c05f8c7690064e74 100644 (file)
@@ -140,8 +140,9 @@ grub_efiemu_loadcore_init (grub_file_t file)
   switch (grub_efiemu_mode)
     {
     case GRUB_EFIEMU32:
-      if ((err = grub_efiemu_loadcore_init32 (efiemu_core, efiemu_core_size,
-                                             &efiemu_segments)))
+      err = grub_efiemu_loadcore_init32 (efiemu_core, efiemu_core_size,
+                                        &efiemu_segments);
+      if (err)
        {
          grub_free (efiemu_core);
          efiemu_core = 0;
@@ -151,8 +152,9 @@ grub_efiemu_loadcore_init (grub_file_t file)
       break;
 
     case GRUB_EFIEMU64:
-      if ((err = grub_efiemu_loadcore_init64 (efiemu_core, efiemu_core_size,
-                                             &efiemu_segments)))
+      err = grub_efiemu_loadcore_init64 (efiemu_core, efiemu_core_size,
+                                        &efiemu_segments);
+      if (err)
        {
          grub_free (efiemu_core);
          efiemu_core = 0;
@@ -162,7 +164,7 @@ grub_efiemu_loadcore_init (grub_file_t file)
       break;
 
     default:
-      return grub_error (GRUB_ERR_BAD_OS, "unknown EFI runtime");
+      return grub_error (GRUB_ERR_BUG, "unknown EFI runtime");
     }
   return GRUB_ERR_NONE;
 }
@@ -184,6 +186,6 @@ grub_efiemu_loadcore_load (void)
          grub_efiemu_loadcore_unload ();
       return err;
     default:
-      return grub_error (GRUB_ERR_BAD_OS, "unknown EFI runtime");
+      return grub_error (GRUB_ERR_BUG, "unknown EFI runtime");
     }
 }
index 6e75f49d2edd4886f0f3de70e96e9f3cc635d5b7..3dc9c9744685c7f5fb1f0792acc59b6757086244 100644 (file)
@@ -121,11 +121,9 @@ grub_efiemu_register_prepare_hook (grub_err_t (*hook) (void *data),
                                   void *data)
 {
   struct grub_efiemu_prepare_hook *nhook;
-  if (! hook)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "you must supply the hook");
   nhook = (struct grub_efiemu_prepare_hook *) grub_malloc (sizeof (*nhook));
   if (! nhook)
-    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't prepare hook");
+    return grub_errno;
   nhook->hook = hook;
   nhook->unload = unload;
   nhook->data = data;
@@ -146,16 +144,13 @@ grub_efiemu_register_configuration_table (grub_efi_guid_t guid,
   struct grub_efiemu_configuration_table *tbl;
   grub_err_t err;
 
- if (! get_table && ! data)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                      "you must set at least get_table or data");
  err = grub_efiemu_unregister_configuration_table (guid);
   if (err)
     return err;
 
   tbl = (struct grub_efiemu_configuration_table *) grub_malloc (sizeof (*tbl));
   if (! tbl)
-    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't register table");
+    return grub_errno;
 
   tbl->guid = guid;
   tbl->get_table = get_table;
@@ -201,7 +196,7 @@ grub_efiemu_load_file (const char *filename)
     {
       grub_file_close (file);
       grub_efiemu_unload ();
-      return grub_error (grub_errno, "couldn't init memory management");
+      return grub_errno;
     }
 
   grub_dprintf ("efiemu", "mm initialized\n");
@@ -237,16 +232,14 @@ grub_efiemu_autocore (void)
 
   if (! prefix)
     return grub_error (GRUB_ERR_FILE_NOT_FOUND,
-                      "couldn't find efiemu core because prefix "
-                      "isn't set");
+                      N_("variable `%s' isn't set"), "prefix");
 
   suffix = grub_efiemu_get_default_core_name ();
 
   filename = grub_xasprintf ("%s/" GRUB_TARGET_CPU "-" GRUB_PLATFORM "/%s",
                             prefix, suffix);
   if (! filename)
-    return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-                      "couldn't allocate temporary space");
+    return grub_errno;
 
   err = grub_efiemu_load_file (filename);
   grub_free (filename);
@@ -297,7 +290,7 @@ grub_cmd_efiemu_load (grub_command_t cmd __attribute__ ((unused)),
   grub_efiemu_unload ();
 
   if (argc != 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "filename required");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
 
   err = grub_efiemu_load_file (args[0]);
   if (err)
index f9596f12464ee2b3b7c12fde98a5c02709261be2..10cbc68cc26b1bc990ce8f335fa850743bcd235c 100644 (file)
@@ -62,12 +62,17 @@ grub_efiemu_add_to_mmap (grub_uint64_t start, grub_uint64_t size,
   /* Extend map if necessary*/
   if (mmap_num >= mmap_reserved_size)
     {
+      void *old;
+      mmap_reserved_size = 2 * (mmap_reserved_size + 1);
+      old = efiemu_mmap;
       efiemu_mmap = (grub_efi_memory_descriptor_t *)
-       grub_realloc (efiemu_mmap, (++mmap_reserved_size)
+       grub_realloc (efiemu_mmap, mmap_reserved_size
                      * sizeof (grub_efi_memory_descriptor_t));
       if (!efiemu_mmap)
-       return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-                          "not enough space for memory map");
+       {
+         grub_free (old);
+         return grub_errno;
+       }
     }
 
   /* Fill slot*/
@@ -176,8 +181,7 @@ efiemu_alloc_requests (void)
   /* Allocate the whole memory in one block */
   resident_memory = grub_memalign (GRUB_EFIEMU_PAGESIZE, total_alloc);
   if (!resident_memory)
-    return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-                      "couldn't allocate resident memory");
+    return grub_errno;
 
   /* Split the memory into blocks by type */
   curptr = resident_memory;
@@ -540,8 +544,7 @@ grub_efiemu_mmap_sort_and_uniq (void)
     {
       grub_free (result);
       grub_free (scanline_events);
-      return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-                        "couldn't allocate space for new memory map");
+      return grub_errno;
     }
 
   /* Register scanline events */
@@ -642,12 +645,14 @@ grub_efiemu_mm_do_alloc (void)
   if (!efiemu_mmap)
     {
       grub_efiemu_unload ();
-      return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't initialize mmap");
+      return grub_errno;
     }
 
-  if ((err = efiemu_alloc_requests ()))
+  err = efiemu_alloc_requests ();
+  if (err)
     return err;
-  if ((err = grub_efiemu_mmap_fill ()))
+  err = grub_efiemu_mmap_fill ();
+  if (err)
     return err;
   return grub_efiemu_mmap_sort_and_uniq ();
 }
index e58fce84e23de3bd955bfedbe8f0487b269c67fc..28d00504480b8c4e7a55ecf62c05eac1dedc96bc 100644 (file)
@@ -171,12 +171,6 @@ nvram_set (void * data __attribute__ ((unused)))
                              (nvramsize - (nvramptr - nvram)) / 2,
                              (grub_uint8_t *) varname, len, NULL);
 
-    if (len < 0)
-      {
-       grub_error (GRUB_ERR_BAD_ARGUMENT, "broken UTF-8 in variable name");
-       return 1;
-      }
-
     nvramptr += 2 * len;
     *((grub_uint16_t *) nvramptr) = 0;
     nvramptr += 2;
index 7137fcbd9bddebde0e6036aa72f6b08914b0461e..9ea70ced9a885a7d26afdd21c16d113e754c77f4 100644 (file)
@@ -22,6 +22,7 @@
 #include <grub/misc.h>
 #include <grub/efiemu/efiemu.h>
 #include <grub/efiemu/runtime.h>
+#include <grub/i18n.h>
 
 static int ptv_written = 0;
 static int ptv_alloc = 0;
@@ -69,7 +70,7 @@ grub_efiemu_request_symbols (int num)
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
                       "symbols have already been allocated");
   if (num < 0)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT,
+    return grub_error (GRUB_ERR_BUG,
                       "can't request negative symbols");
   ptv_requested += num;
   return GRUB_ERR_NONE;
@@ -88,7 +89,7 @@ grub_efiemu_resolve_symbol (const char *name, int *handle, grub_off_t *off)
        return GRUB_ERR_NONE;
       }
   grub_dprintf ("efiemu", "%s not found\n", name);
-  return grub_error (GRUB_ERR_BAD_OS, "symbol %s isn't found", name);
+  return grub_error (GRUB_ERR_BAD_OS, N_("symbol `%s' not found"), name);
 }
 
 /* Register symbol named NAME in memory handle HANDLE at offset OFF */
@@ -99,7 +100,7 @@ grub_efiemu_register_symbol (const char *name, int handle, grub_off_t off)
   cur = (struct grub_efiemu_sym *) grub_malloc (sizeof (*cur));
   grub_dprintf ("efiemu", "registering symbol '%s'\n", name);
   if (!cur)
-    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't register symbol");
+    return grub_errno;
   cur->name = grub_strdup (name);
   cur->next = efiemu_syms;
   cur->handle = handle;
@@ -153,7 +154,7 @@ grub_efiemu_write_value (void *addr, grub_uint32_t value, int plus_handle,
        = grub_efiemu_mm_obtain_request (ptv_handle);
 
       if (ptv_needed && ptv_written >= ptv_alloc)
-       return grub_error (GRUB_ERR_OUT_OF_MEMORY,
+       return grub_error (GRUB_ERR_BUG,
                           "your module didn't declare efiemu "
                           " relocators correctly");
 
@@ -200,7 +201,7 @@ grub_efiemu_write_value (void *addr, grub_uint32_t value, int plus_handle,
       *((grub_uint8_t *) addr) = value;
       break;
     default:
-      return grub_error (GRUB_ERR_BAD_ARGUMENT, "wrong symbol size");
+      return grub_error (GRUB_ERR_BUG, "wrong symbol size");
     }
 
   return GRUB_ERR_NONE;
index b38eccd6d5defb877e29877a4efc389b4ed5bc94..b010a0c156a27f348a40322afe519823ae5a0d5a 100644 (file)
@@ -29,7 +29,7 @@ loadfont_command (grub_command_t cmd __attribute__ ((unused)),
                  char **args)
 {
   if (argc == 0)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no font specified");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
 
   while (argc--)
     if (grub_font_load (*args++) != 0)
index fe8f991c44f617f54a71abd6f2446e323fea3473..80b28745e20bb5f29ba7d5e23a2ad0b145ebf8a9 100644 (file)
@@ -28,6 +28,7 @@
 #include <grub/disk.h>
 #include <grub/dl.h>
 #include <grub/types.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -529,7 +530,7 @@ find_in_b_tree (grub_disk_t disk,
       if (err)
        return err;
       if (node.count_keys == 0)
-       return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found",
+       return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"),
                           name);
       {
        char key_data[grub_bfs_to_cpu_treehead (node.total_key_len) + 1];
@@ -600,7 +601,7 @@ find_in_b_tree (grub_disk_t disk,
            level--;
            continue;
          }
-       return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found",
+       return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"),
                           name);
       }
     }
@@ -615,7 +616,7 @@ hop_level (grub_disk_t disk,
   grub_uint64_t res;
 
   if (((grub_bfs_to_cpu32 (ino->mode) & ATTR_TYPE) != ATTR_DIR))
-    return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+    return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
 
   err = find_in_b_tree (disk, sb, ino, name, &res);
   if (err)
@@ -677,7 +678,7 @@ find_file (const char *path, grub_disk_t disk,
            {
              grub_free (alloc);
              return grub_error (GRUB_ERR_SYMLINK_LOOP,
-                                "too deep nesting of symlinks");
+                                N_("too deep nesting of symlinks"));
            }
 
 #ifndef MODE_AFS
@@ -829,7 +830,7 @@ grub_bfs_dir (grub_device_t device, const char *path,
     if (err)
       return err;
     if (((grub_bfs_to_cpu32 (ino.ino.mode) & ATTR_TYPE) != ATTR_DIR))
-      return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+      return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
     iterate_in_b_tree (device->disk, &sb, &ino.ino, hook);
   }
 
@@ -857,7 +858,7 @@ grub_bfs_open (struct grub_file *file, const char *name)
     if (err)
       return err;
     if (((grub_bfs_to_cpu32 (ino.ino.mode) & ATTR_TYPE) != ATTR_REG))
-      return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a regular file");
+      return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
 
     data = grub_zalloc (sizeof (struct grub_bfs_data)
                        + grub_bfs_to_cpu32 (sb.bsize));
index 3660b60ac4a4845d3bfa0762b40f5045654a7a6d..5dae346158c6a39f1303455dd9205456ea98e83b 100644 (file)
@@ -27,6 +27,7 @@
 #include <grub/lib/crc.h>
 #include <grub/deflate.h>
 #include <minilzo.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -1204,7 +1205,7 @@ find_path (struct grub_btrfs_data *data,
        {
          grub_free (path_alloc);
          grub_free (origpath);
-         return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+         return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
        }
 
       key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM;
@@ -1223,7 +1224,7 @@ find_path (struct grub_btrfs_data *data,
        {
          grub_free (direl);
          grub_free (path_alloc);
-         err = grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
+         err = grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), origpath);
          grub_free (origpath);
          return err;
        }
@@ -1267,7 +1268,7 @@ find_path (struct grub_btrfs_data *data,
        {
          grub_free (direl);
          grub_free (path_alloc);
-         err = grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
+         err = grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), origpath);
          grub_free (origpath);
          return err;
        }
@@ -1285,7 +1286,7 @@ find_path (struct grub_btrfs_data *data,
              grub_free (path_alloc);
              grub_free (origpath);
              return grub_error (GRUB_ERR_SYMLINK_LOOP,
-                                "too deep nesting of symlinks");
+                                N_("too deep nesting of symlinks"));
            }
 
          err = grub_btrfs_read_inode (data, &inode,
@@ -1355,7 +1356,7 @@ find_path (struct grub_btrfs_data *data,
              {
                grub_free (direl);
                grub_free (path_alloc);
-               err = grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
+               err = grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), origpath);
                grub_free (origpath);
                return err;
              }
@@ -1378,7 +1379,7 @@ find_path (struct grub_btrfs_data *data,
            {
              grub_free (direl);
              grub_free (path_alloc);
-             err = grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
+             err = grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), origpath);
              grub_free (origpath);
              return err;
            }
@@ -1430,7 +1431,7 @@ grub_btrfs_dir (grub_device_t device, const char *path,
   if (type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY)
     {
       grub_btrfs_unmount (data);
-      return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+      return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
     }
 
   err = lower_bound (data, &key_in, &key_out, tree, &elemaddr, &elemsize, &desc);
@@ -1535,7 +1536,7 @@ grub_btrfs_open (struct grub_file *file, const char *name)
   if (type != GRUB_BTRFS_DIR_ITEM_TYPE_REGULAR)
     {
       grub_btrfs_unmount (data);
-      return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a regular file");
+      return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
     }
 
   data->inode = key_in.object_id;
@@ -1628,8 +1629,8 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)),
 
   if (64 * 2 - 1 < *nsectors)
     return grub_error (GRUB_ERR_OUT_OF_RANGE,
-                      "Your core.img is unusually large.  "
-                      "It won't fit in the embedding area.");
+                      N_("your core.img is unusually large.  "
+                         "It won't fit in the embedding area"));
 
   *nsectors = 64 * 2 - 1;
   *sectors = grub_malloc (*nsectors * sizeof (**sectors));
index b7c3191ccd0958bba3b5cdc70b38d25517badb53..bfaf141011346ac7484f2ecb88304f89ce095009 100644 (file)
@@ -22,6 +22,7 @@
 #include <grub/misc.h>
 #include <grub/disk.h>
 #include <grub/dl.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -564,7 +565,7 @@ grub_cpio_dir (grub_device_t device, const char *path_in,
                  if (++symlinknest == 8)
                    {
                      grub_error (GRUB_ERR_SYMLINK_LOOP,
-                                 "too deep nesting of symlinks");
+                                 N_("too deep nesting of symlinks"));
                      goto fail;
                    }
                  ofs = 0;
@@ -622,7 +623,7 @@ grub_cpio_open (grub_file_t file, const char *name_in)
 
       if (!ofs)
        {
-         grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
+         grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), name_in);
          break;
        }
 
@@ -638,7 +639,7 @@ grub_cpio_open (grub_file_t file, const char *name_in)
          if (++symlinknest == 8)
            {
              grub_error (GRUB_ERR_SYMLINK_LOOP,
-                         "too deep nesting of symlinks");
+                         N_("too deep nesting of symlinks"));
              goto fail;
            }
          goto no_match;
index 64b07e6d8ba8386825ad6610b2804ed586033225..a6c9760c6e886ceb3ec9260b289698a352b51557 100644 (file)
@@ -27,6 +27,7 @@
 #include <grub/dl.h>
 #include <grub/charset.h>
 #include <grub/fat.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -687,7 +688,7 @@ grub_fat_iterate_dir (grub_disk_t disk, struct grub_fat_data *data,
   grub_ssize_t offset = -sizeof(dir);
 
   if (! (data->attr & GRUB_FAT_ATTR_DIRECTORY))
-    return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+    return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
 
   /* Allocate space enough to hold a long name.  */
   filename = grub_malloc (0x40 * 13 * GRUB_MAX_UTF8_PER_UTF16 + 1);
@@ -864,7 +865,7 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data,
 
   if (! (data->attr & GRUB_FAT_ATTR_DIRECTORY))
     {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
       return 0;
     }
 
@@ -896,7 +897,7 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data,
 
   grub_fat_iterate_dir (disk, data, iter_hook);
   if (grub_errno == GRUB_ERR_NONE && ! found && !call_hook)
-    grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
+    grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), origpath);
 
  fail:
   grub_free (dirname);
@@ -972,7 +973,7 @@ grub_fat_open (grub_file_t file, const char *name)
 
   if (data->attr & GRUB_FAT_ATTR_DIRECTORY)
     {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a file");
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
       goto fail;
     }
 
@@ -1086,7 +1087,7 @@ grub_fat_label (grub_device_t device, char **label)
 
   if (! (data->attr & GRUB_FAT_ATTR_DIRECTORY))
     {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
       return 0;
     }
 
index 0944cf8c35b282abc2e60a9fa322238ff76931bc..fa2c8bef5c1bb6e29c7c75947d0a157c74eaa378 100644 (file)
@@ -23,6 +23,7 @@
 #include <grub/disk.h>
 #include <grub/fshelp.h>
 #include <grub/dl.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -128,7 +129,7 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
          if (type != GRUB_FSHELP_DIR)
            {
              free_node (currnode);
-             return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+             return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
            }
 
          /* Iterate over the directory.  */
@@ -152,7 +153,7 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
                  free_node (currnode);
                  free_node (oldnode);
                  return grub_error (GRUB_ERR_SYMLINK_LOOP,
-                                     "too deep nesting of symlinks");
+                                     N_("too deep nesting of symlinks"));
                }
 
              symlink = read_symlink (currnode);
@@ -196,12 +197,12 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
          name = next;
        }
 
-      return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path);
+      return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), path);
     }
 
   if (!path || path[0] != '/')
     {
-      grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
+      grub_error (GRUB_ERR_BAD_FILENAME, N_("invalid file name `%s'"), path);
       return grub_errno;
     }
 
@@ -211,9 +212,9 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
 
   /* Check if the node that was found was of the expected type.  */
   if (expecttype == GRUB_FSHELP_REG && foundtype != expecttype)
-    return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a regular file");
+    return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
   else if (expecttype == GRUB_FSHELP_DIR && foundtype != expecttype)
-    return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+    return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
 
   return 0;
 }
index c14a884ccfbad9e0fc6abdb5b16e4b6b338286f4..7a5947b2309772bfe154dc4d7a39d873c07a4be7 100644 (file)
@@ -28,6 +28,7 @@
 #include <grub/dl.h>
 #include <grub/types.h>
 #include <grub/hfs.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -1079,7 +1080,7 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
 
   if (path[0] != '/')
     {
-      grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
+      grub_error (GRUB_ERR_BAD_FILENAME, N_("invalid file name `%s'"), path);
       return 0;
     }
 
@@ -1096,7 +1097,7 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
       grub_ssize_t slen;
       if (fdrec.frec.type != GRUB_HFS_FILETYPE_DIR)
        {
-         grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+         grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
          goto fail;
        }
 
@@ -1114,7 +1115,7 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
       slen = utf8_to_macroman (key.str, path);
       if (slen < 0)
        {
-         grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path);
+         grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), path);
          goto fail;
        }
       key.strlen = slen;
@@ -1123,7 +1124,7 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
       if (! grub_hfs_find_node (data, (char *) &key, data->cat_root,
                                0, (char *) &fdrec.frec, sizeof (fdrec.frec)))
        {
-         grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
+         grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), origpath);
          goto fail;
        }
 
@@ -1207,7 +1208,7 @@ grub_hfs_dir (grub_device_t device, const char *path,
 
   if (frec.type != GRUB_HFS_FILETYPE_DIR)
     {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
       goto fail;
     }
 
@@ -1243,7 +1244,7 @@ grub_hfs_open (struct grub_file *file, const char *name)
   if (frec.type != GRUB_HFS_FILETYPE_FILE)
     {
       grub_free (data);
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a file");
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
       grub_dl_unref (my_mod);
       return grub_errno;
     }
index d47be782a827923074bea74b2e3384c937eb9474..3676ed7193f89dd6425508e6a298f13f62440ba6 100644 (file)
@@ -25,6 +25,7 @@
 #include <grub/dl.h>
 #include <grub/types.h>
 #include <grub/charset.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -403,7 +404,7 @@ grub_jfs_opendir (struct grub_jfs_data *data, struct grub_jfs_inode *inode)
   if (!((grub_le_to_cpu32 (inode->mode)
         & GRUB_JFS_FILETYPE_MASK) == GRUB_JFS_FILETYPE_DIR))
     {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
       return 0;
     }
 
@@ -704,7 +705,7 @@ grub_jfs_find_file (struct grub_jfs_data *data, const char *path,
     }
 
   grub_jfs_closedir (diro);
-  grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path);
+  grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), path);
   return grub_errno;
 }
 
@@ -716,7 +717,7 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino)
   char symlink[size + 1];
 
   if (++data->linknest > GRUB_JFS_MAX_SYMLNK_CNT)
-    return grub_error (GRUB_ERR_SYMLINK_LOOP, "too deep nesting of symlinks");
+    return grub_error (GRUB_ERR_SYMLINK_LOOP, N_("too deep nesting of symlinks"));
 
   if (size <= sizeof (data->currinode.symlink.path))
     grub_strncpy (symlink, (char *) (data->currinode.symlink.path), size);
@@ -730,8 +731,6 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino)
     ino = 2;
 
   grub_jfs_find_file (data, symlink, ino);
-  if (grub_errno)
-    grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
 
   return grub_errno;
 }
@@ -810,7 +809,7 @@ grub_jfs_open (struct grub_file *file, const char *name)
   if (! ((grub_le_to_cpu32 (data->currinode.mode)
          & GRUB_JFS_FILETYPE_MASK) == GRUB_JFS_FILETYPE_REG))
     {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a regular file");
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
       goto fail;
     }
 
index 0128f1d8ca3f22ff78527f344e7862130ed8b5a3..ce5c4c7385807437b6b17d69518a70f72504eb30 100644 (file)
@@ -24,6 +24,7 @@
 #include <grub/disk.h>
 #include <grub/dl.h>
 #include <grub/types.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -332,7 +333,7 @@ grub_minix_lookup_symlink (struct grub_minix_data *data, int ino)
   char symlink[GRUB_MINIX_INODE_SIZE (data) + 1];
 
   if (++data->linknest > GRUB_MINIX_MAX_SYMLNK_CNT)
-    return grub_error (GRUB_ERR_SYMLINK_LOOP, "too deep nesting of symlinks");
+    return grub_error (GRUB_ERR_SYMLINK_LOOP, N_("too deep nesting of symlinks"));
 
   if (grub_minix_read_file (data, 0, 0,
                            GRUB_MINIX_INODE_SIZE (data), symlink) < 0)
@@ -349,8 +350,6 @@ grub_minix_lookup_symlink (struct grub_minix_data *data, int ino)
     return grub_errno;
 
   grub_minix_find_file (data, symlink);
-  if (grub_errno)
-    grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
 
   return grub_errno;
 }
@@ -433,7 +432,7 @@ grub_minix_find_file (struct grub_minix_data *data, const char *path)
 
          if ((GRUB_MINIX_INODE_MODE (data)
               & GRUB_MINIX_IFDIR) != GRUB_MINIX_IFDIR)
-           return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+           return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
 
          continue;
        }
@@ -441,7 +440,7 @@ grub_minix_find_file (struct grub_minix_data *data, const char *path)
       pos += sizeof (ino) + data->filename_size;
     } while (pos < GRUB_MINIX_INODE_SIZE (data));
 
-  grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path);
+  grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), path);
   return grub_errno;
 }
 
@@ -532,7 +531,7 @@ grub_minix_dir (grub_device_t device, const char *path,
 
   if ((GRUB_MINIX_INODE_MODE (data) & GRUB_MINIX_IFDIR) != GRUB_MINIX_IFDIR)
     {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
       goto fail;
     }
 
@@ -600,7 +599,7 @@ grub_minix_open (struct grub_file *file, const char *name)
 
   if (!name || name[0] != '/')
     {
-      grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
+      grub_error (GRUB_ERR_BAD_FILENAME, N_("invalid file name `%s'"), name);
       return grub_errno;
     }
 
index d6c69179474903a0e31f081ed9e56054bac1eae0..5bb529285e2e9469c829a33a1ddb0cfa197fca48 100644 (file)
@@ -38,6 +38,7 @@
 #include <grub/dl.h>
 #include <grub/types.h>
 #include <grub/fshelp.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -477,6 +478,7 @@ grub_reiserfs_get_item (struct grub_reiserfs_data *data,
   grub_uint16_t previous_level = ~0;
   struct grub_reiserfs_item_header *item_headers = 0;
 
+#if 0
   if (! data)
     {
       grub_error (GRUB_ERR_BAD_FS, "data is NULL");
@@ -494,6 +496,7 @@ grub_reiserfs_get_item (struct grub_reiserfs_data *data,
       grub_error (GRUB_ERR_BAD_FS, "item is NULL");
       goto fail;
     }
+#endif
 
   block_size = grub_le_to_cpu16 (data->superblock.block_size);
   block_number = grub_le_to_cpu32 (data->superblock.root_block);
@@ -725,8 +728,7 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item,
 
   if (item->type != GRUB_REISERFS_DIRECTORY)
     {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE,
-                  "grub_reiserfs_iterate_dir called on a non-directory item");
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
       goto fail;
     }
   block_size = grub_le_to_cpu16 (data->superblock.block_size);
@@ -754,7 +756,7 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item,
 #if 0
       if (grub_le_to_cpu16 (block_header->level) != 1)
         {
-          grub_error (GRUB_ERR_TEST_FAILURE,
+          grub_error (GRUB_ERR_BAD_FS,
                       "reiserfs: block %d is not a leaf block",
                       block_number);
           goto fail;
index cd299489572c977507e7ffe7f3cbdcb1b4659385..12c0e87153554bdd0cf061327c6c5be97ab8ae80 100644 (file)
@@ -24,6 +24,7 @@
 #include <grub/disk.h>
 #include <grub/dl.h>
 #include <grub/types.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -398,7 +399,7 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino)
   char symlink[INODE_SIZE (data) + 1];
 
   if (++data->linknest > GRUB_UFS_MAX_SYMLNK_CNT)
-    return grub_error (GRUB_ERR_SYMLINK_LOOP, "too deep nesting of symlinks");
+    return grub_error (GRUB_ERR_SYMLINK_LOOP, N_("too deep nesting of symlinks"));
 
   if (INODE_SIZE (data) <= sizeof (data->inode.symlink))
     grub_strcpy (symlink, (char *) INODE (data, symlink));
@@ -415,8 +416,6 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino)
     return grub_errno;
 
   grub_ufs_find_file (data, symlink);
-  if (grub_errno)
-    grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
 
   return grub_errno;
 }
@@ -504,7 +503,7 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path)
              }
 
            if ((INODE_MODE(data) & GRUB_UFS_ATTR_TYPE) != GRUB_UFS_ATTR_DIR)
-             return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+             return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
 
            continue;
          }
@@ -513,7 +512,7 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path)
       pos += grub_le_to_cpu16 (dirent.direntlen);
     } while (pos < INODE_SIZE (data));
 
-  grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path);
+  grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), path);
   return grub_errno;
 }
 
@@ -589,7 +588,7 @@ grub_ufs_dir (grub_device_t device, const char *path,
 
   if (!path || path[0] != '/')
     {
-      grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
+      grub_error (GRUB_ERR_BAD_FILENAME, N_("invalid file name `%s'"), path);
       return grub_errno;
     }
 
@@ -599,7 +598,7 @@ grub_ufs_dir (grub_device_t device, const char *path,
 
   if ((INODE_MODE (data) & GRUB_UFS_ATTR_TYPE) != GRUB_UFS_ATTR_DIR)
     {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
       goto fail;
     }
 
@@ -669,7 +668,7 @@ grub_ufs_open (struct grub_file *file, const char *name)
 
   if (!name || name[0] != '/')
     {
-      grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
+      grub_error (GRUB_ERR_BAD_FILENAME, N_("invalid file name `%s'"), name);
       return grub_errno;
     }
 
index 897a501656d3e85fbb0a6ac655fd6cc386a8f961..1bd350a7ad8649a112a19d14fa6be41b25762b75 100644 (file)
@@ -53,6 +53,7 @@
 #include <grub/zfs/dsl_dataset.h>
 #include <grub/deflate.h>
 #include <grub/crypto.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -1766,7 +1767,7 @@ mzap_lookup (mzap_phys_t * zapobj, grub_zfs_endian_t endian,
        }
     }
 
-  return grub_error (GRUB_ERR_FILE_NOT_FOUND, "couldn't find %s", name);
+  return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), name);
 }
 
 static int
@@ -1971,7 +1972,7 @@ zap_leaf_lookup (zap_leaf_phys_t * l, grub_zfs_endian_t endian,
        }
     }
 
-  return grub_error (GRUB_ERR_FILE_NOT_FOUND, "couldn't find %s", name);
+  return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), name);
 }
 
 
@@ -2487,7 +2488,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
       if (dnode_path->dn.dn.dn_type != DMU_OT_DIRECTORY_CONTENTS)
        {
          grub_free (path_buf);
-         return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+         return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
        }
       err = zap_lookup (&(dnode_path->dn), cname, &objnum,
                        data, subvol->case_insensitive);
@@ -3483,14 +3484,14 @@ grub_zfs_open (struct grub_file *file, const char *fsfilename)
   if (isfs)
     {
       zfs_unmount (data);
-      return grub_error (GRUB_ERR_FILE_NOT_FOUND, "Missing @ or / separator");
+      return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("missing `%c' symbol"), '@');
     }
 
   /* We found the dnode for this file. Verify if it is a plain file. */
   if (data->dnode.dn.dn_type != DMU_OT_PLAIN_FILE_CONTENTS) 
     {
       zfs_unmount (data);
-      return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a file");
+      return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file"));
     }
 
   /* get the file size and set the file position to 0 */
@@ -3882,7 +3883,7 @@ grub_zfs_dir (grub_device_t device, const char *path,
       if (data->dnode.dn.dn_type != DMU_OT_DIRECTORY_CONTENTS)
        {
          zfs_unmount (data);
-         return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+         return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
        }
       zap_iterate_u64 (&(data->dnode), iterate_zap, data);
     }
@@ -3905,8 +3906,8 @@ grub_zfs_embed (grub_device_t device __attribute__ ((unused)),
 
  if ((VDEV_BOOT_SIZE >> GRUB_DISK_SECTOR_BITS) < *nsectors)
     return grub_error (GRUB_ERR_OUT_OF_RANGE,
-                      "Your core.img is unusually large.  "
-                      "It won't fit in the embedding area.");
+                      N_("your core.img is unusually large.  "
+                         "It won't fit in the embedding area"));
 
   *nsectors = (VDEV_BOOT_SIZE >> GRUB_DISK_SECTOR_BITS);
   *sectors = grub_malloc (*nsectors * sizeof (**sectors));
index 94f2a1ac87153e89671cd2446e8c8c7cb868067f..41cb759c89e6762e58e326d6139facb0b7d2fab6 100644 (file)
@@ -45,31 +45,32 @@ print_state (char *nvlist, int tab)
   int isok = 1;
 
   print_tabs (tab);
-  grub_xputs (_("State: "));
 
   if (grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_REMOVED, &ival))
     {
-      grub_xputs (_("removed "));
+      grub_puts_ (N_("Virtual device is removed"));
       isok = 0;
     }
 
   if (grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_FAULTED, &ival))
     {
-      grub_xputs (_("faulted "));
+      grub_puts_ (N_("Virtual device is faulted"));
       isok = 0;
     }
 
   if (grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_OFFLINE, &ival))
     {
-      grub_xputs (_("offline "));
+      grub_puts_ (N_("Virtual device is offline"));
       isok = 0;
     }
 
   if (grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_FAULTED, &ival))
-    grub_xputs (_("degraded "));
+    /* TRANSLATORS: degraded doesn't mean broken but that some of
+       component are missing but virtual device as whole is still usable.  */
+    grub_puts_ (N_("Virtual device is degraded"));
 
   if (isok)
-    grub_xputs (_("online"));
+    grub_puts_ (N_("Virtual device is online"));
   grub_xputs ("\n");
 
   return GRUB_ERR_NONE;
@@ -85,7 +86,7 @@ print_vdev_info (char *nvlist, int tab)
   if (!type)
     {
       print_tabs (tab);
-      grub_puts_ (N_("Incorrect VDEV: no type available"));
+      grub_puts_ (N_("Incorrect virtual device: no type available"));
       return grub_errno;
     }
 
@@ -96,7 +97,7 @@ print_vdev_info (char *nvlist, int tab)
       char *devid = 0;
 
       print_tabs (tab);
-      grub_puts_ (N_("Leaf VDEV"));
+      grub_puts_ (N_("Leaf virtual device (file or disk)"));
 
       print_state (nvlist, tab);
 
@@ -137,10 +138,10 @@ print_vdev_info (char *nvlist, int tab)
       print_tabs (tab);
       if (nelm <= 0)
        {
-         grub_puts_ (N_("Incorrect mirror VDEV"));
+         grub_puts_ (N_("Incorrect mirror"));
          return GRUB_ERR_NONE;
        }
-      grub_printf_ (N_("Mirror VDEV with %d children\n"), nelm);
+      grub_printf_ (N_("Mirror with %d children\n"), nelm);
       print_state (nvlist, tab);
       for (i = 0; i < nelm; i++)
        {
@@ -152,11 +153,11 @@ print_vdev_info (char *nvlist, int tab)
          print_tabs (tab);
          if (!child)
            {
-             grub_printf_ (N_("Mirror VDEV element %d isn't correct\n"), i);
+             grub_printf_ (N_("Mirror element %d isn't correct\n"), i);
              continue;
            }
 
-         grub_printf_ (N_("Mirror VDEV element %d:\n"), i);
+         grub_printf_ (N_("Mirror element %d:\n"), i);
          print_vdev_info (child, tab + 1);
 
          grub_free (child);
@@ -165,7 +166,7 @@ print_vdev_info (char *nvlist, int tab)
     }
 
   print_tabs (tab);
-  grub_printf_ (N_("Unknown VDEV type: %s\n"), type);
+  grub_printf_ (N_("Unknown virtual device type: %s\n"), type);
 
   return GRUB_ERR_NONE;
 }
@@ -298,7 +299,7 @@ grub_cmd_zfsinfo (grub_command_t cmd __attribute__ ((unused)), int argc,
   nv = grub_zfs_nvlist_lookup_nvlist (nvlist, ZPOOL_CONFIG_VDEV_TREE);
 
   if (!nv)
-    grub_puts_ (N_("No vdev tree available"));
+    grub_puts_ (N_("No virtual device tree available"));
   else
     print_vdev_info (nv, 1);
 
index 2f210e02baf26b758ab6460211ca906c3099d3ca..3bd7951381148908efeb413258c06fb91c2cd729 100644 (file)
@@ -36,6 +36,7 @@
 #include <grub/gfxmenu_model.h>
 #include <grub/gfxmenu_view.h>
 #include <grub/time.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -58,7 +59,8 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
 
   theme_path = grub_env_get ("theme");
   if (! theme_path)
-    return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no theme specified");
+    return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"),
+                      "theme");
 
   instance = grub_zalloc (sizeof (*instance));
   if (!instance)
index 60e4a46de70a27c872fd94991397151eb996dd75..29784ed2d9a2bf726729a2c654e477c075e777b1 100644 (file)
@@ -151,11 +151,6 @@ rescale_image (grub_gui_image_t self)
                                    height,
                                    self->raw_bitmap,
                                    GRUB_VIDEO_BITMAP_SCALE_METHOD_BEST);
-  if (grub_errno != GRUB_ERR_NONE)
-    {
-      grub_error_push ();
-      grub_error (grub_errno, "failed to scale bitmap for image component");
-    }
   return grub_errno;
 }
 
@@ -224,7 +219,7 @@ image_set_property (void *vself, const char *name, const char *value)
 
       /* Resolve to an absolute path.  */
       if (! self->theme_dir)
-       return grub_error (GRUB_ERR_BAD_ARGUMENT, "unspecified theme_dir");
+       return grub_error (GRUB_ERR_BUG, "unspecified theme_dir");
       absvalue = grub_resolve_relative_path (self->theme_dir, value);
       if (! absvalue)
        return grub_errno;
index 6990d05d421ed893a7d6c5cc14fa03bbc64433ea..45e8f7dea129eb4b2799bf0abcf529d7dff4d5ef 100644 (file)
@@ -169,11 +169,7 @@ try_loading_icon (grub_gfxmenu_icon_manager_t mgr,
                                    GRUB_VIDEO_BITMAP_SCALE_METHOD_BEST);
   grub_video_bitmap_destroy (raw_bitmap);
   if (! scaled_bitmap)
-    {
-      grub_error_push ();
-      grub_error (grub_errno, "failed to scale icon");
-      return 0;
-    }
+    return 0;
 
   return scaled_bitmap;
 }
index 8c9131a24d15f3ecce95efe72b181065be83c193..18e2ef46963d549a42a827acc2d4b4328826d8af 100644 (file)
@@ -130,12 +130,6 @@ scale_pixmap (grub_gfxmenu_box_t self, int i, int w, int h)
       if (w != 0 && h != 0)
         grub_video_bitmap_create_scaled (scaled, w, h, raw,
                                          GRUB_VIDEO_BITMAP_SCALE_METHOD_BEST);
-      if (grub_errno != GRUB_ERR_NONE)
-        {
-          grub_error_push ();
-          grub_error (grub_errno,
-                      "failed to scale bitmap for styled box pixmap #%d", i);
-        }
     }
 
   return grub_errno;
index 0d4003cd293ee4c4cc6ca86b61fc6606658a4c3e..5dbf8bd0b10b31eb64c5364483c887ae0da9535a 100644 (file)
@@ -42,6 +42,7 @@
 #include <grub/file.h>
 #include <grub/dl.h>
 #include <grub/deflate.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -193,10 +194,7 @@ test_gzip_header (grub_file_t file)
   if (grub_file_read (gzio->file, &hdr, 10) != 10
       || ((hdr.magic != GZIP_MAGIC)
          && (hdr.magic != OLD_GZIP_MAGIC)))
-    {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "no gzip magic found");
-      return 0;
-    }
+    return 0;
 
   /*
    *  This does consistency checking on the header data.  If a
@@ -211,10 +209,7 @@ test_gzip_header (grub_file_t file)
                            grub_le_to_cpu16 (extra_len))))
       || ((hdr.flags & ORIG_NAME) && eat_field (gzio->file, -1))
       || ((hdr.flags & COMMENT) && eat_field (gzio->file, -1)))
-    {
-      grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, "unsupported gzip format");
-      return 0;
-    }
+    return 0;
 
   gzio->data_offset = grub_file_tell (gzio->file);
 
@@ -222,10 +217,7 @@ test_gzip_header (grub_file_t file)
   {
     grub_file_seek (gzio->file, grub_file_size (gzio->file) - 4);
     if (grub_file_read (gzio->file, &orig_len, 4) != 4)
-      {
-       grub_error (GRUB_ERR_BAD_FILE_TYPE, "unsupported gzip format");
-       return 0;
-      }
+      return 0;
     /* FIXME: this does not handle files whose original size is over 4GB.
        But how can we know the real original size?  */
     file->size = grub_le_to_cpu32 (orig_len);
@@ -402,7 +394,7 @@ gzio_seek (grub_gzio_t gzio, grub_off_t off)
     {
       if (off > gzio->mem_input_size)
        grub_error (GRUB_ERR_OUT_OF_RANGE,
-                   "attempt to seek outside of the file");
+                   N_("attempt to seek outside of the file"));
       else
        gzio->mem_input_off = off;
     }
@@ -1158,10 +1150,10 @@ grub_gzio_open (grub_file_t io)
 
   if (! test_gzip_header (file))
     {
+      grub_errno = GRUB_ERR_NONE;
       grub_free (gzio);
       grub_free (file);
       grub_file_seek (io, 0);
-      grub_errno = GRUB_ERR_NONE;
 
       return io;
     }
index 4996fa54614b887405f812aa64ca346c841bf237..7eb0c1b802ff1cf12013e7fb29e7ab8bae55cdd6 100644 (file)
@@ -299,31 +299,17 @@ test_header (grub_file_t file)
   grub_uint8_t *name = NULL;
 
   if (grub_file_read (lzopio->file, &header, sizeof (header)) != sizeof (header))
-    {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "no lzop magic found");
-      return 0;
-    }
+    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);
 
@@ -417,8 +403,6 @@ test_header (grub_file_t file)
   return 1;
 
 CORRUPTED:
-  grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, "lzop file corrupted");
-
   grub_free(name);
 
   return 0;
index c9f648188489b6d2062863889f7c6cbbbfc65d9c..991b7acc72bde3998e022adb9648fa77f5fe900f 100644 (file)
@@ -98,24 +98,15 @@ test_header (grub_file_t file)
                                      STREAM_HEADER_SIZE);
 
   if (xzio->buf.in_size != STREAM_HEADER_SIZE)
-    {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "no xz magic found");
-      return 0;
-    }
+    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;
 }
@@ -174,7 +165,6 @@ test_footer (grub_file_t file)
   return 1;
 
 ERROR:
-  grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, "bad footer magic");
   return 0;
 }
 
index c998d4d4b934c9f57783c7ab1dba367f280a3839..7ba09b03f6d16e650a748fdcd52bd3e73978d492 100644 (file)
@@ -25,6 +25,7 @@
 #include <grub/misc.h>
 #include <grub/env.h>
 #include <grub/partition.h>
+#include <grub/i18n.h>
 
 grub_net_t (*grub_net_open) (const char *name) = NULL;
 
@@ -39,7 +40,7 @@ grub_device_open (const char *name)
       name = grub_env_get ("root");
       if (name == NULL || *name == '\0')
        {
-         grub_error (GRUB_ERR_BAD_DEVICE, "no device is set");
+         grub_error (GRUB_ERR_BAD_DEVICE,  N_("variable `%s' isn't set"), "root");
          goto fail;
        }
     }
index df772d53114623a6da6b8b50c4a442e5fdbcfdff..9f4ca605dccfa7a66014225bd2a665c4935badde 100644 (file)
@@ -24,6 +24,7 @@
 #include <grub/misc.h>
 #include <grub/time.h>
 #include <grub/file.h>
+#include <grub/i18n.h>
 
 #define        GRUB_CACHE_TIMEOUT      2
 
@@ -263,7 +264,8 @@ grub_disk_open (const char *name)
 
   if (! dev)
     {
-      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no such disk");
+      grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' not found"),
+                 name);
       goto fail;
     }
   if (disk->log_sector_size > GRUB_DISK_CACHE_BITS + GRUB_DISK_SECTOR_BITS
@@ -360,7 +362,8 @@ grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
       if (*sector >= len
          || len - *sector < ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1)
                              >> GRUB_DISK_SECTOR_BITS))
-       return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of partition");
+       return grub_error (GRUB_ERR_OUT_OF_RANGE,
+                          N_("attempt to read or write outside of partition"));
 
       *sector += start;
     }
@@ -371,7 +374,8 @@ grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
          >> GRUB_DISK_SECTOR_BITS) > (disk->total_sectors
                                       << (disk->log_sector_size
                                           - GRUB_DISK_SECTOR_BITS)) - *sector))
-    return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk");
+    return grub_error (GRUB_ERR_OUT_OF_RANGE,
+                      N_("attempt to read or write outside of disk `%s'"), disk->name);
 
   return GRUB_ERR_NONE;
 }
index 5636dbccfa368d7d454c6cf6e35913a7fb6aaf40..6a193ec7d8ecb79fc22855541394e8e18c05918e 100644 (file)
@@ -31,6 +31,7 @@
 #include <grub/file.h>
 #include <grub/env.h>
 #include <grub/cache.h>
+#include <grub/i18n.h>
 
 /* Platforms where modules are in a readonly area of memory.  */
 #if defined(GRUB_MACHINE_QEMU)
@@ -208,20 +209,24 @@ static grub_err_t
 grub_dl_check_header (void *ehdr, grub_size_t size)
 {
   Elf_Ehdr *e = ehdr;
+  grub_err_t err;
 
   /* Check the header size.  */
   if (size < sizeof (Elf_Ehdr))
     return grub_error (GRUB_ERR_BAD_OS, "ELF header smaller than expected");
 
   /* Check the magic numbers.  */
-  if (grub_arch_dl_check_header (ehdr)
-      || e->e_ident[EI_MAG0] != ELFMAG0
+  if (e->e_ident[EI_MAG0] != ELFMAG0
       || e->e_ident[EI_MAG1] != ELFMAG1
       || e->e_ident[EI_MAG2] != ELFMAG2
       || e->e_ident[EI_MAG3] != ELFMAG3
       || e->e_ident[EI_VERSION] != EV_CURRENT
       || e->e_version != EV_CURRENT)
-    return grub_error (GRUB_ERR_BAD_OS, "invalid arch independent ELF magic");
+    return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch independent ELF magic"));
+
+  err = grub_arch_dl_check_header (ehdr);
+  if (err)
+    return err;
 
   return GRUB_ERR_NONE;
 }
@@ -345,7 +350,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
       break;
 
   if (i == e->e_shnum)
-    return grub_error (GRUB_ERR_BAD_MODULE, "no symbol table");
+    return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
 
 #ifdef GRUB_MODULES_MACHINE_READONLY
   mod->symtab = grub_malloc (s->sh_size);
@@ -378,7 +383,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
              grub_symbol_t nsym = grub_dl_resolve_symbol (name);
              if (! nsym)
                return grub_error (GRUB_ERR_BAD_MODULE,
-                                  "symbol not found: `%s'", name);
+                                  N_("symbol `%s' not found"), name);
              sym->st_value = (Elf_Addr) nsym->addr;
              if (nsym->isfunc)
                sym->st_info = ELF_ST_INFO (bind, STT_FUNC);
@@ -596,7 +601,7 @@ grub_dl_load_core (void *addr, grub_size_t size)
 
   if (e->e_type != ET_REL)
     {
-      grub_error (GRUB_ERR_BAD_MODULE, "invalid ELF file type");
+      grub_error (GRUB_ERR_BAD_MODULE, N_("this ELF file is not of the right type"));
       return 0;
     }
 
@@ -704,7 +709,7 @@ grub_dl_load (const char *name)
     return mod;
 
   if (! grub_dl_dir) {
-    grub_error (GRUB_ERR_FILE_NOT_FOUND, "\"prefix\" is not set");
+    grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
     return 0;
   }
 
index 9c7b8cec24e0fa32a2634b7f607e66b5e4e6a87e..dcf10c64e82f19bbe3ce93dd74dfadb12c105d01 100644 (file)
@@ -24,6 +24,7 @@
 #include <grub/misc.h>
 #include <grub/mm.h>
 #include <grub/dl.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -39,7 +40,7 @@ grub_elf_check_header (grub_elf_t elf)
       || e->e_ident[EI_MAG3] != ELFMAG3
       || e->e_ident[EI_VERSION] != EV_CURRENT
       || e->e_version != EV_CURRENT)
-    return grub_error (GRUB_ERR_BAD_OS, "invalid arch independent ELF magic");
+    return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch independent ELF magic"));
 
   return GRUB_ERR_NONE;
 }
@@ -59,7 +60,7 @@ grub_elf_close (grub_elf_t elf)
 }
 
 grub_elf_t
-grub_elf_file (grub_file_t file)
+grub_elf_file (grub_file_t file, const char *filename)
 {
   grub_elf_t elf;
 
@@ -75,8 +76,9 @@ grub_elf_file (grub_file_t file)
   if (grub_file_read (elf->file, &elf->ehdr, sizeof (elf->ehdr))
       != sizeof (elf->ehdr))
     {
-      grub_error_push ();
-      grub_error (GRUB_ERR_READ_ERROR, "cannot read ELF header");
+      if (!grub_errno)
+       grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+                   filename);
       goto fail;
     }
 
@@ -101,7 +103,7 @@ grub_elf_open (const char *name)
   if (! file)
     return 0;
 
-  elf = grub_elf_file (file);
+  elf = grub_elf_file (file, name);
   if (! elf)
     grub_file_close (file);
 
@@ -118,7 +120,7 @@ grub_elf_is_elf32 (grub_elf_t elf)
 }
 
 static grub_err_t
-grub_elf32_load_phdrs (grub_elf_t elf)
+grub_elf32_load_phdrs (grub_elf_t elf, const char *filename)
 {
   grub_ssize_t phdrs_size;
 
@@ -135,8 +137,10 @@ grub_elf32_load_phdrs (grub_elf_t elf)
   if ((grub_file_seek (elf->file, elf->ehdr.ehdr32.e_phoff) == (grub_off_t) -1)
       || (grub_file_read (elf->file, elf->phdrs, phdrs_size) != phdrs_size))
     {
-      grub_error_push ();
-      return grub_error (GRUB_ERR_READ_ERROR, "cannot read program headers");
+      if (!grub_errno)
+       grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+                   filename);
+      return grub_errno;
     }
 
   return GRUB_ERR_NONE;
@@ -144,6 +148,7 @@ grub_elf32_load_phdrs (grub_elf_t elf)
 
 grub_err_t
 grub_elf32_phdr_iterate (grub_elf_t elf,
+                        const char *filename,
                         int NESTED_FUNC_ATTR (*hook) (grub_elf_t, Elf32_Phdr *, void *),
                         void *hook_arg)
 {
@@ -151,7 +156,7 @@ grub_elf32_phdr_iterate (grub_elf_t elf,
   unsigned int i;
 
   if (! elf->phdrs)
-    if (grub_elf32_load_phdrs (elf))
+    if (grub_elf32_load_phdrs (elf, filename))
       return grub_errno;
   phdrs = elf->phdrs;
 
@@ -174,7 +179,8 @@ grub_elf32_phdr_iterate (grub_elf_t elf,
 
 /* Calculate the amount of memory spanned by the segments.  */
 grub_size_t
-grub_elf32_size (grub_elf_t elf, Elf32_Addr *base, grub_uint32_t *max_align)
+grub_elf32_size (grub_elf_t elf, const char *filename,
+                Elf32_Addr *base, grub_uint32_t *max_align)
 {
   Elf32_Addr segments_start = (Elf32_Addr) -1;
   Elf32_Addr segments_end = 0;
@@ -201,7 +207,7 @@ grub_elf32_size (grub_elf_t elf, Elf32_Addr *base, grub_uint32_t *max_align)
       return 0;
     }
 
-  grub_elf32_phdr_iterate (elf, calcsize, 0);
+  grub_elf32_phdr_iterate (elf, filename, calcsize, 0);
 
   if (base)
     *base = 0;
@@ -228,7 +234,8 @@ grub_elf32_size (grub_elf_t elf, Elf32_Addr *base, grub_uint32_t *max_align)
 
 /* Load every loadable segment into memory specified by `_load_hook'.  */
 grub_err_t
-grub_elf32_load (grub_elf_t _elf, grub_elf32_load_hook_t _load_hook,
+grub_elf32_load (grub_elf_t _elf, const char *filename,
+                grub_elf32_load_hook_t _load_hook,
                 grub_addr_t *base, grub_size_t *size)
 {
   grub_addr_t load_base = (grub_addr_t) -1ULL;
@@ -257,11 +264,7 @@ grub_elf32_load (grub_elf_t _elf, grub_elf32_load_hook_t _load_hook,
                  (unsigned long long) phdr->p_memsz);
 
     if (grub_file_seek (elf->file, phdr->p_offset) == (grub_off_t) -1)
-      {
-       grub_error_push ();
-       return grub_error (GRUB_ERR_BAD_OS,
-                          "invalid offset in program header");
-      }
+      return grub_errno;
 
     if (phdr->p_filesz)
       {
@@ -270,11 +273,10 @@ grub_elf32_load (grub_elf_t _elf, grub_elf32_load_hook_t _load_hook,
        if (read != (grub_ssize_t) phdr->p_filesz)
          {
            /* XXX How can we free memory from `load_hook'? */
-           grub_error_push ();
-           return grub_error (GRUB_ERR_BAD_OS,
-                              "couldn't read segment from file: "
-                              "wanted 0x%lx bytes; read 0x%lx bytes",
-                              phdr->p_filesz, read);
+           if (!grub_errno)
+             grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+                         filename);
+           return grub_errno;
          }
       }
 
@@ -287,7 +289,8 @@ grub_elf32_load (grub_elf_t _elf, grub_elf32_load_hook_t _load_hook,
     return 0;
   }
 
-  err = grub_elf32_phdr_iterate (_elf, grub_elf32_load_segment, _load_hook);
+  err = grub_elf32_phdr_iterate (_elf, filename,
+                                grub_elf32_load_segment, _load_hook);
 
   if (base)
     *base = load_base;
@@ -307,7 +310,7 @@ grub_elf_is_elf64 (grub_elf_t elf)
 }
 
 static grub_err_t
-grub_elf64_load_phdrs (grub_elf_t elf)
+grub_elf64_load_phdrs (grub_elf_t elf, const char *filename)
 {
   grub_ssize_t phdrs_size;
 
@@ -324,8 +327,10 @@ grub_elf64_load_phdrs (grub_elf_t elf)
   if ((grub_file_seek (elf->file, elf->ehdr.ehdr64.e_phoff) == (grub_off_t) -1)
       || (grub_file_read (elf->file, elf->phdrs, phdrs_size) != phdrs_size))
     {
-      grub_error_push ();
-      return grub_error (GRUB_ERR_READ_ERROR, "cannot read program headers");
+      if (!grub_errno)
+       grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+                   filename);
+      return grub_errno;
     }
 
   return GRUB_ERR_NONE;
@@ -333,6 +338,7 @@ grub_elf64_load_phdrs (grub_elf_t elf)
 
 grub_err_t
 grub_elf64_phdr_iterate (grub_elf_t elf,
+                        const char *filename,
                         int NESTED_FUNC_ATTR (*hook) (grub_elf_t, Elf64_Phdr *, void *),
                         void *hook_arg)
 {
@@ -340,7 +346,7 @@ grub_elf64_phdr_iterate (grub_elf_t elf,
   unsigned int i;
 
   if (! elf->phdrs)
-    if (grub_elf64_load_phdrs (elf))
+    if (grub_elf64_load_phdrs (elf, filename))
       return grub_errno;
   phdrs = elf->phdrs;
 
@@ -363,7 +369,8 @@ grub_elf64_phdr_iterate (grub_elf_t elf,
 
 /* Calculate the amount of memory spanned by the segments.  */
 grub_size_t
-grub_elf64_size (grub_elf_t elf, Elf64_Addr *base, grub_uint64_t *max_align)
+grub_elf64_size (grub_elf_t elf, const char *filename,
+                Elf64_Addr *base, grub_uint64_t *max_align)
 {
   Elf64_Addr segments_start = (Elf64_Addr) -1;
   Elf64_Addr segments_end = 0;
@@ -390,7 +397,7 @@ grub_elf64_size (grub_elf_t elf, Elf64_Addr *base, grub_uint64_t *max_align)
       return 0;
     }
 
-  grub_elf64_phdr_iterate (elf, calcsize, 0);
+  grub_elf64_phdr_iterate (elf, filename, calcsize, 0);
 
   if (base)
     *base = 0;
@@ -417,7 +424,8 @@ grub_elf64_size (grub_elf_t elf, Elf64_Addr *base, grub_uint64_t *max_align)
 
 /* Load every loadable segment into memory specified by `_load_hook'.  */
 grub_err_t
-grub_elf64_load (grub_elf_t _elf, grub_elf64_load_hook_t _load_hook,
+grub_elf64_load (grub_elf_t _elf, const char *filename,
+                grub_elf64_load_hook_t _load_hook,
                 grub_addr_t *base, grub_size_t *size)
 {
   grub_addr_t load_base = (grub_addr_t) -1ULL;
@@ -447,11 +455,7 @@ grub_elf64_load (grub_elf_t _elf, grub_elf64_load_hook_t _load_hook,
                  (unsigned long long) phdr->p_memsz);
 
     if (grub_file_seek (elf->file, phdr->p_offset) == (grub_off_t) -1)
-      {
-       grub_error_push ();
-       return grub_error (GRUB_ERR_BAD_OS,
-                          "invalid offset in program header");
-      }
+      return grub_errno;
 
     if (phdr->p_filesz)
       {
@@ -460,11 +464,10 @@ grub_elf64_load (grub_elf_t _elf, grub_elf64_load_hook_t _load_hook,
        if (read != (grub_ssize_t) phdr->p_filesz)
           {
            /* XXX How can we free memory from `load_hook'?  */
-           grub_error_push ();
-           return grub_error (GRUB_ERR_BAD_OS,
-                             "couldn't read segment from file: "
-                             "wanted 0x%lx bytes; read 0x%lx bytes",
-                             phdr->p_filesz, read);
+           if (!grub_errno)
+             grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
+                         filename);
+           return grub_errno;
           }
       }
 
@@ -477,7 +480,8 @@ grub_elf64_load (grub_elf_t _elf, grub_elf64_load_hook_t _load_hook,
     return 0;
   }
 
-  err = grub_elf64_phdr_iterate (_elf, grub_elf64_load_segment, _load_hook);
+  err = grub_elf64_phdr_iterate (_elf, filename,
+                                grub_elf64_load_segment, _load_hook);
 
   if (base)
     *base = load_base;
index ac30fb04c4f38f72bb268c7656dbe312c8e229b7..7d7b3d00c6e9d946b723e5c34034b7522fc4d264 100644 (file)
@@ -372,7 +372,8 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
 
     fd = open (map[drive].device, O_RDONLY);
     if (fd == -1)
-      return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot open `%s' while attempting to get disk size", map[drive].device);
+      return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("cannot open `%s': %s"),
+                        map[drive].device, strerror (errno));
 
     disk->total_sectors = grub_util_get_fd_sectors (fd, map[drive].device,
                                                    &disk->log_sector_size);
@@ -428,13 +429,19 @@ grub_util_follow_gpart_up (const char *name, grub_disk_addr_t *off_out, char **n
 
   error = geom_gettree (&mesh);
   if (error != 0)
+    /* TRANSLATORS: geom is the name of (k)FreeBSD device framework.
+       Usually left untranslated.
+     */
     grub_util_error (_("couldn't open geom"));
 
   LIST_FOREACH (class, &mesh.lg_class, lg_class)
     if (strcasecmp (class->lg_name, "part") == 0)
       break;
   if (!class)
-    grub_util_error (_("couldn't open geom part"));
+    /* TRANSLATORS: geom is the name of (k)FreeBSD device framework.
+       Usually left untranslated.
+     */
+    grub_util_error (_("couldn't find geom `part' class"));
 
   LIST_FOREACH (geom, &class->lg_geom, lg_geom)
     { 
@@ -563,12 +570,8 @@ devmapper_fail:
   fd = open (dev, O_RDONLY);
   if (fd == -1)
     {
-      grub_error (GRUB_ERR_BAD_DEVICE,
-# if !defined(HAVE_DIOCGDINFO)
-                 "cannot open `%s' while attempting to get disk geometry", dev);
-# else /* defined(HAVE_DIOCGDINFO) */
-                 "cannot open `%s' while attempting to get disk label", dev);
-# endif /* !defined(HAVE_DIOCGDINFO) */
+      grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot open `%s': %s"),
+                 dev, strerror (errno));
       return 0;
     }
 
@@ -736,9 +739,8 @@ grub_util_fd_seek (int fd, const char *name, grub_uint64_t off)
 
   offset = (loff_t) off;
   if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET))
-    {
-      return grub_error (GRUB_ERR_BAD_DEVICE, "cannot seek `%s'", name);
-    }
+    return grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot seek `%s': %s"),
+                      name, strerror (errno));
   return GRUB_ERR_NONE;
 }
 #else
@@ -748,7 +750,8 @@ grub_util_fd_seek (int fd, const char *name, grub_uint64_t off)
   off_t offset = (off_t) off;
 
   if (lseek (fd, offset, SEEK_SET) != offset)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "cannot seek `%s'", name);
+    return grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot seek `%s': %s"),
+                      name, strerror (errno));
   return 0;
 }
 #endif
@@ -842,7 +845,8 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
        fd = open (dev, flags);
        if (fd < 0)
          {
-           grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s'", dev);
+           grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot open `%s': %s"),
+                       dev, strerror (errno));
            return -1;
          }
 
@@ -922,7 +926,8 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
 
   if (fd < 0)
     {
-      grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s' in open_device()", map[disk->id].device);
+      grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot open `%s': %s"),
+                 map[disk->id].device, strerror (errno));
       return -1;
     }
 #endif /* ! __linux__ */
@@ -1030,7 +1035,8 @@ grub_util_biosdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
       if (grub_util_fd_read (fd, buf, (1 << disk->log_sector_size))
          != (1 << disk->log_sector_size))
        {
-         grub_error (GRUB_ERR_READ_ERROR, "cannot read `%s'", map[disk->id].device);
+         grub_error (GRUB_ERR_READ_ERROR, N_("cannot read `%s': %s"),
+                     map[disk->id].device, strerror (errno));
          return grub_errno;
        }
 
@@ -1041,7 +1047,8 @@ grub_util_biosdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
 
   if (grub_util_fd_read (fd, buf, size << disk->log_sector_size)
       != (ssize_t) (size << disk->log_sector_size))
-    grub_error (GRUB_ERR_READ_ERROR, "cannot read from `%s'", map[disk->id].device);
+    grub_error (GRUB_ERR_READ_ERROR, N_("cannot read `%s': %s"),
+               map[disk->id].device, strerror (errno));
 
   return grub_errno;
 }
@@ -1075,7 +1082,8 @@ grub_util_biosdisk_write (grub_disk_t disk, grub_disk_addr_t sector,
 
   if (grub_util_fd_write (fd, buf, size << disk->log_sector_size)
       != (ssize_t) (size << disk->log_sector_size))
-    grub_error (GRUB_ERR_WRITE_ERROR, "cannot write to `%s'", map[disk->id].device);
+    grub_error (GRUB_ERR_WRITE_ERROR, N_("cannot write to `%s': %s"),
+               map[disk->id].device, strerror (errno));
 
   return grub_errno;
 }
@@ -1172,7 +1180,11 @@ read_device_map (const char *dev_map)
        continue;
 
       if (*p != '(')
-       show_error (_("No open parenthesis found"));
+       {
+         char *tmp;
+         tmp = xasprintf (_("missing `%c' symbol"), '(');
+         show_error (tmp);
+       }
 
       p++;
       /* Find a free slot.  */
@@ -1183,7 +1195,11 @@ read_device_map (const char *dev_map)
       e = p;
       p = strchr (p, ')');
       if (! p)
-       show_error (_("No close parenthesis found"));
+       {
+         char *tmp;
+         tmp = xasprintf (_("missing `%c' symbol"), ')');
+         show_error (tmp);
+       }
 
       map[drive].drive = xmalloc (p - e + sizeof ('\0'));
       strncpy (map[drive].drive, e, p - e + sizeof ('\0'));
@@ -1196,7 +1212,7 @@ read_device_map (const char *dev_map)
        p++;
 
       if (*p == '\0')
-       show_error (_("No filename found"));
+       show_error (_("filename expected"));
 
       /* NUL-terminate the filename.  */
       e = p;
index 501ad466461c975e75737488b27ece418c11e82d..e2b90572de2004cec45eb68177ad353ab57cf7d2 100644 (file)
 #include <grub/file.h>
 #include <grub/disk.h>
 #include <grub/misc.h>
+#include <grub/mm.h>
 #include <grub/dl.h>
 #include <grub/util/misc.h>
+#include <grub/i18n.h>
 
 #include <dirent.h>
 #include <stdio.h>
@@ -54,6 +56,12 @@ is_dir (const char *path, const char *name)
   return S_ISDIR (st.st_mode);
 }
 
+struct grub_hostfs_data
+{
+  char *filename;
+  FILE *f;
+};
+
 static grub_err_t
 grub_hostfs_dir (grub_device_t device, const char *path,
                 int (*hook) (const char *filename,
@@ -68,7 +76,8 @@ grub_hostfs_dir (grub_device_t device, const char *path,
   dir = opendir (path);
   if (! dir)
     return grub_error (GRUB_ERR_BAD_FILENAME,
-                      "can't open the hostfs directory `%s'", path);
+                      N_("can't open `%s': %s"), path,
+                      strerror (errno));
 
   while (1)
     {
@@ -95,12 +104,30 @@ static grub_err_t
 grub_hostfs_open (struct grub_file *file, const char *name)
 {
   FILE *f;
+  struct grub_hostfs_data *data;
 
   f = fopen (name, "rb");
   if (! f)
     return grub_error (GRUB_ERR_BAD_FILENAME,
-                      "can't open `%s'", name);
-  file->data = f;
+                      N_("can't open `%s': %s"), name,
+                      strerror (errno));
+  data = grub_malloc (sizeof (*data));
+  if (!data)
+    {
+      fclose (f);
+      return grub_errno;
+    }
+  data->filename = grub_strdup (name);
+  if (!data->filename)
+    {
+      grub_free (data);
+      fclose (f);
+      return grub_errno;
+    }
+
+  data->f = f;  
+
+  file->data = data;
 
 #ifdef __MINGW32__
   file->size = grub_util_get_disk_size (name);
@@ -116,18 +143,20 @@ grub_hostfs_open (struct grub_file *file, const char *name)
 static grub_ssize_t
 grub_hostfs_read (grub_file_t file, char *buf, grub_size_t len)
 {
-  FILE *f;
+  struct grub_hostfs_data *data;
 
-  f = (FILE *) file->data;
-  if (fseeko (f, file->offset, SEEK_SET) != 0)
+  data = file->data;
+  if (fseeko (data->f, file->offset, SEEK_SET) != 0)
     {
-      grub_error (GRUB_ERR_OUT_OF_RANGE, "fseeko: %s", strerror (errno));
+      grub_error (GRUB_ERR_OUT_OF_RANGE, N_("cannot seek `%s': %s"),
+                 data->filename, strerror (errno));
       return -1;
     }
 
-  unsigned int s = fread (buf, 1, len, f);
+  unsigned int s = fread (buf, 1, len, data->f);
   if (s != len)
-    grub_error (GRUB_ERR_FILE_READ_ERROR, "fread: %s", strerror (errno));
+    grub_error (GRUB_ERR_FILE_READ_ERROR, N_("cannot read `%s': %s"),
+               data->filename, strerror (errno));
 
   return (signed) s;
 }
@@ -136,9 +165,12 @@ static grub_err_t
 grub_hostfs_close (grub_file_t file)
 {
   FILE *f;
+  struct grub_hostfs_data *data;
 
-  f = (FILE *) file->data;
-  fclose (f);
+  data = file->data;
+  fclose (data->f);
+  grub_free (data->filename);
+  grub_free (data);
 
   return GRUB_ERR_NONE;
 }
index b58ccc794835a391bd2d872e46d6c6a25db2c8fb..0461ea51c971201194af7c31642a5465af20c571 100644 (file)
@@ -23,6 +23,7 @@
 #include <grub/mm.h>
 #include <stdlib.h>
 #include <string.h>
+#include <grub/i18n.h>
 
 void *
 grub_malloc (grub_size_t size)
@@ -30,7 +31,7 @@ grub_malloc (grub_size_t size)
   void *ret;
   ret = malloc (size);
   if (!ret)
-    grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
+    grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
   return ret;
 }
 
@@ -58,7 +59,7 @@ grub_realloc (void *ptr, grub_size_t size)
   void *ret;
   ret = realloc (ptr, size);
   if (!ret)
-    grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
+    grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
   return ret;
 }
 
@@ -77,11 +78,11 @@ grub_memalign (grub_size_t align, grub_size_t size)
 #else
   (void) align;
   (void) size;
-  grub_util_error (_("grub_memalign is not supported"));
+  grub_util_error (_("grub_memalign is not supported on your system"));
 #endif
 
   if (!p)
-    grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
+    grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
 
   return p;
 }
index f69ef6fd487a6309f2968b3c28bddba6448ba077..4f1f59ff7a5130bc1f5c8c0dd680ac996d6edbc6 100644 (file)
@@ -24,6 +24,7 @@
 #include <grub/mm.h>
 #include <grub/fs.h>
 #include <grub/device.h>
+#include <grub/i18n.h>
 
 void (*EXPORT_VAR (grub_grubnet_fini)) (void);
 
@@ -41,7 +42,7 @@ grub_file_get_device_name (const char *name)
 
       if (! p)
        {
-         grub_error (GRUB_ERR_BAD_FILENAME, "missing `)'");
+         grub_error (GRUB_ERR_BAD_FILENAME, N_("missing `%c' symbol"), ')');
          return 0;
        }
 
@@ -138,7 +139,7 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len)
   if (file->offset > file->size)
     {
       grub_error (GRUB_ERR_OUT_OF_RANGE,
-                 "attempt to read past the end of file");
+                 N_("attempt to read past the end of file"));
       return -1;
     }
 
@@ -178,7 +179,7 @@ grub_file_seek (grub_file_t file, grub_off_t offset)
   if (offset > file->size)
     {
       grub_error (GRUB_ERR_OUT_OF_RANGE,
-                 "attempt to seek outside of the file");
+                 N_("attempt to seek outside of the file"));
       return -1;
     }
   
index 14d389e07b457f86ab08ee84198852868cf15544..8fe28cc5dcb5e84fb89d74900eac6d4803af9cdc 100644 (file)
@@ -26,6 +26,7 @@
 #include <grub/types.h>
 #include <grub/mm.h>
 #include <grub/term.h>
+#include <grub/i18n.h>
 
 grub_fs_t grub_fs_list = 0;
 
@@ -97,7 +98,7 @@ grub_fs_probe (grub_device_t device)
   else if (device->net && device->net->fs)
     return device->net->fs;
 
-  grub_error (GRUB_ERR_UNKNOWN_FS, "unknown filesystem");
+  grub_error (GRUB_ERR_UNKNOWN_FS, N_("unknown filesystem"));
   return 0;
 }
 
@@ -145,7 +146,7 @@ grub_fs_blocklist_open (grub_file_t file, const char *name)
          if (grub_errno != GRUB_ERR_NONE || *p != '+')
            {
              grub_error (GRUB_ERR_BAD_FILENAME,
-                         "invalid file name `%s'", name);
+                         N_("invalid file name `%s'"), name);
              goto fail;
            }
        }
@@ -157,7 +158,7 @@ grub_fs_blocklist_open (grub_file_t file, const char *name)
          || (*p && *p != ',' && ! grub_isspace (*p)))
        {
          grub_error (GRUB_ERR_BAD_FILENAME,
-                     "invalid file name `%s'", name);
+                     N_("invalid file name `%s'"), name);
          goto fail;
        }
 
index 57854964b4617509d4ee2e20a0e156ed29c55e04..73035c9ea3b1173f2bee66b99ef8a4110c2e91f4 100644 (file)
@@ -21,6 +21,7 @@
 #include <grub/elf.h>
 #include <grub/misc.h>
 #include <grub/err.h>
+#include <grub/i18n.h>
 
 /* Check if EHDR is a valid ELF header.  */
 grub_err_t
@@ -32,7 +33,7 @@ grub_arch_dl_check_header (void *ehdr)
   if (e->e_ident[EI_CLASS] != ELFCLASS32
       || e->e_ident[EI_DATA] != ELFDATA2LSB
       || e->e_machine != EM_386)
-    return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
+    return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
 
   return GRUB_ERR_NONE;
 }
@@ -54,7 +55,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
       break;
 
   if (i == e->e_shnum)
-    return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
+    return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
 
   entsize = s->sh_entsize;
 
@@ -100,6 +101,10 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
                    *addr += (sym->st_value - (Elf_Word) seg->addr
                              - rel->r_offset);
                    break;
+                 default:
+                   return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+                                      N_("relocation 0x%x is not implemented yet"),
+                                      ELF_R_TYPE (rel->r_info));
                  }
              }
          }
index 31b5f94cfd8efd1208d2ce302d5ffbbe78c8c8f1..b79ad22de6f1607ad337311da2ee17c9f683f74f 100644 (file)
@@ -22,6 +22,7 @@
 #include <grub/misc.h>
 #include <grub/err.h>
 #include <grub/mm.h>
+#include <grub/i18n.h>
 
 /* Check if EHDR is a valid ELF header.  */
 grub_err_t
@@ -33,7 +34,7 @@ grub_arch_dl_check_header (void *ehdr)
   if (e->e_ident[EI_CLASS] != ELFCLASS64
       || e->e_ident[EI_DATA] != ELFDATA2LSB
       || e->e_machine != EM_IA_64)
-    return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
+    return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
 
   return GRUB_ERR_NONE;
 }
@@ -181,7 +182,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
       break;
 
   if (i == e->e_shnum)
-    return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
+    return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
 
   entsize = s->sh_entsize;
 
@@ -265,7 +266,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
                    break;
                  default:
                    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-                                      "this relocation (0x%x) is not implemented yet",
+                                      N_("relocation 0x%x is not implemented yet"),
                                       ELF_R_TYPE (rel->r_info));
                  }
              }
index ad934068386036d0465c17df19dbc69cd5dfc618..262d9a2cac7c037202076820da3756530625319b 100644 (file)
@@ -23,6 +23,7 @@
 #include <grub/err.h>
 #include <grub/cpu/types.h>
 #include <grub/mm.h>
+#include <grub/i18n.h>
 
 /* Dummy __gnu_local_gp. Resolved by linker.  */
 static char __gnu_local_gp_dummy;
@@ -43,7 +44,7 @@ grub_arch_dl_check_header (void *ehdr)
       || e->e_ident[EI_DATA] != ELFDATA2LSB
       || e->e_machine != EM_MIPS)
 #endif
-    return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
+    return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
 
   return GRUB_ERR_NONE;
 }
@@ -69,7 +70,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
       break;
 
   if (i == e->e_shnum)
-    return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
+    return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
 
   entsize = s->sh_entsize;
 
@@ -233,7 +234,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
                    {
                      grub_free (gp);
                      return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-                                        "Unknown relocation type %d\n",
+                                        N_("relocation 0x%x is not implemented yet"),
                                         ELF_R_TYPE (rel->r_info));
                    }
                    break;
index 064bbc61fcd1f5232d38ad9036a2879e42fabaa4..5b1db338c55e80a304e013895da5847f6b949c04 100644 (file)
@@ -21,6 +21,7 @@
 #include <grub/elf.h>
 #include <grub/misc.h>
 #include <grub/err.h>
+#include <grub/i18n.h>
 
 /* Check if EHDR is a valid ELF header.  */
 grub_err_t
@@ -32,7 +33,7 @@ grub_arch_dl_check_header (void *ehdr)
   if (e->e_ident[EI_CLASS] != ELFCLASS32
       || e->e_ident[EI_DATA] != ELFDATA2MSB
       || e->e_machine != EM_PPC)
-    return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
+    return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
 
   return GRUB_ERR_NONE;
 }
@@ -112,7 +113,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
       break;
 
   if (i == e->e_shnum)
-    return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
+    return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
 
   entsize = s->sh_entsize;
 
@@ -195,7 +196,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
 
                  default:
                    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-                                      "this relocation (%d) is not implemented yet",
+                                      N_("relocation 0x%x is not implemented yet"),
                                       ELF_R_TYPE (rel->r_info));
                  }
              }
index e1be5d9ece1ed99176acccc2ba640ebfab6658de..6ea65d7e305edcca3eab43ad0ee72cdf8e6cba95 100644 (file)
@@ -21,6 +21,7 @@
 #include <grub/elf.h>
 #include <grub/misc.h>
 #include <grub/err.h>
+#include <grub/i18n.h>
 
 /* Check if EHDR is a valid ELF header.  */
 grub_err_t
@@ -32,7 +33,7 @@ grub_arch_dl_check_header (void *ehdr)
   if (e->e_ident[EI_CLASS] != ELFCLASS64
       || e->e_ident[EI_DATA] != ELFDATA2MSB
       || e->e_machine != EM_SPARCV9)
-    return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
+    return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
 
   return GRUB_ERR_NONE;
 }
@@ -55,7 +56,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
       break;
 
   if (i == e->e_shnum)
-    return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
+    return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
 
   entsize = s->sh_entsize;
 
@@ -134,7 +135,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
                    break;
                  default:
                    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-                                      "this relocation (%d) is not implemented yet",
+                                      N_("relocation 0x%x is not implemented yet"),
                                       ELF_R_TYPE (rel->r_info));
                  }
              }
index 9b63b30f830830f7296562e00f0b94c99524ec37..cf3adf9d0b4946a2d708dd58215069fef5286218 100644 (file)
@@ -21,6 +21,7 @@
 #include <grub/elf.h>
 #include <grub/misc.h>
 #include <grub/err.h>
+#include <grub/i18n.h>
 
 /* Check if EHDR is a valid ELF header.  */
 grub_err_t
@@ -32,7 +33,7 @@ grub_arch_dl_check_header (void *ehdr)
   if (e->e_ident[EI_CLASS] != ELFCLASS64
       || e->e_ident[EI_DATA] != ELFDATA2LSB
       || e->e_machine != EM_X86_64)
-    return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
+    return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch dependent ELF magic"));
 
   return GRUB_ERR_NONE;
 }
@@ -54,7 +55,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
       break;
 
   if (i == e->e_shnum)
-    return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
+    return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
 
   entsize = s->sh_entsize;
 
@@ -108,9 +109,9 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
                     *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));
                  }
              }
index e6e88c461722f198d2e56313d3b27dd92e851570..b34188528026b71d7fc344fb416302bcd3de4d6a 100644 (file)
@@ -277,8 +277,9 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
 
              if (! opt)
                {
+                 char tmp[3] = { '-', *curshort, 0 };
                  grub_error (GRUB_ERR_BAD_ARGUMENT,
-                             "unknown argument `-%c'", *curshort);
+                             N_("unknown argument `%s'"), tmp);
                  goto fail;
                }
 
@@ -344,7 +345,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
 
          if (! opt)
            {
-             grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown argument `%s'", arg);
+             grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"), arg);
              goto fail;
            }
        }
@@ -355,7 +356,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
          if (! option)
            {
              grub_error (GRUB_ERR_BAD_ARGUMENT,
-                         "missing mandatory option for `%s'", opt->longarg);
+                         N_("missing mandatory option for `%s'"), opt->longarg);
              goto fail;
            }
 
@@ -377,7 +378,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
                if (tail == 0 || tail == option || *tail != '\0' || grub_errno)
                  {
                    grub_error (GRUB_ERR_BAD_ARGUMENT,
-                               "the argument `%s' requires an integer",
+                               N_("the argument `%s' requires an integer"),
                                arg);
 
                    goto fail;
@@ -400,8 +401,8 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
          if (option)
            {
              grub_error (GRUB_ERR_BAD_ARGUMENT,
-                         "a value was assigned to the argument `%s' while it "
-                         "doesn't require an argument", arg);
+                         N_("a value was assigned to the argument `%s' while it "
+                            "doesn't require an argument"), arg);
              goto fail;
            }
 
index 48d86033505b6c8d8b1594638153e4559976fc90..f4b13ed3d8418b5ed7c5bb11f3aa39b7296b3b25 100644 (file)
@@ -22,6 +22,7 @@
 #include <grub/mm.h>
 #include <grub/term.h>
 #include <grub/dl.h>
+#include <grub/i18n.h>
 
 #ifdef GRUB_UTIL
 #include <termios.h>
index ac7d4ca4cb8b0f916e7bc1a67e07c8bea9a0fc51..74379f6f0b5b93245cef8061f702b1585faba7fc 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <grub/i386/relocator.h>
 #include <grub/relocator_private.h>
-#include <grub/cpu/relocator_private.h>
+#include <grub/i386/relocator_private.h>
 
 extern grub_uint8_t grub_relocator_forward_start;
 extern grub_uint8_t grub_relocator_forward_end;
index d6c5fe5f83fcd9881108439e0fa8e9b9337d570b..ba8370686010839d1943347409bb5dd73f02f5bd 100644 (file)
@@ -26,7 +26,7 @@
 
 #define PSEUDO_REAL_DSEG 0x20
 
-#include <grub/cpu/relocator_private.h>
+#include <grub/i386/relocator_private.h>
 
 #include "relocator_common.S"
        
index 2d9221bda768290ec21bf99f873f307f4f065a5c..07a91dad4191097f3c44e58b13c28aefb4691d5d 100644 (file)
@@ -801,7 +801,7 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
       len = grub_strlen (corig);
       if (!slash)
        {
-         grub_error (GRUB_ERR_BAD_ARGUMENT, "bad color specification %s",
+         grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid color specification `%s'",
                      args[0]);
          return NULL;
        }
index 663064655a4d22780e9613f32e2b7252be419d6c..c08fb958e89a0aa4067413ada325398348c20bb3 100644 (file)
@@ -1209,14 +1209,14 @@ grub_relocator_alloc_chunk_addr (struct grub_relocator *rel,
   grub_phys_addr_t min_addr = 0, max_addr;
 
   if (target > ~size)
-    return grub_error (GRUB_ERR_OUT_OF_RANGE, "address is out of range");
+    return grub_error (GRUB_ERR_BUG, "address is out of range");
 
   adjust_limits (rel, &min_addr, &max_addr, target, target);
 
   for (chunk = rel->chunks; chunk; chunk = chunk->next)
     if ((chunk->target <= target && target < chunk->target + chunk->size)
        || (target <= chunk->target && chunk->target < target + size))
-      return grub_error (GRUB_ERR_BAD_ARGUMENT, "overlap detected");
+      return grub_error (GRUB_ERR_BUG, "overlap detected");
 
   chunk = grub_malloc (sizeof (struct grub_relocator_chunk));
   if (!chunk)
@@ -1256,7 +1256,7 @@ grub_relocator_alloc_chunk_addr (struct grub_relocator *rel,
 
       grub_dprintf ("relocator", "not allocated\n");
       grub_free (chunk);
-      return grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
+      return grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
     }
   while (0);
 
@@ -1486,7 +1486,7 @@ grub_relocator_prepare_relocs (struct grub_relocator *rel, grub_addr_t addr,
   if (!malloc_in_range (rel, 0, ~(grub_addr_t)0 - rel->relocators_size + 1,
                        grub_relocator_align,
                        rel->relocators_size, &movers_chunk, 1, 1))
-    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
+    return grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
   movers_chunk.srcv = rels = rels0
     = grub_map_memory (movers_chunk.src, movers_chunk.size);
 
index b792b5a87c65b3ae25b5e310a264bc0cf067ece1..b734b836306eb33b2650aa93ccfb2562877eb9d9 100644 (file)
@@ -220,7 +220,7 @@ static grub_command_t cmd;
 GRUB_MOD_INIT(appleloader)
 {
   cmd = grub_register_command ("appleloader", grub_cmd_appleloader,
-                              N_("[OPTS]"), N_("Boot legacy system."));
+                              N_("[OPTS]"), N_("Boot BIOS-based system."));
   my_mod = mod;
 }
 
index 3ecdca5340d5dcc5b32be96588b23457c7b5989a..73b13c5ad1b6a0584417c8a2445b639686cd72cd 100644 (file)
@@ -88,9 +88,9 @@ grub_chainloader_boot (void)
              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)
@@ -197,7 +197,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
   char *filename;
 
   if (argc == 0)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
   filename = argv[0];
 
   grub_dl_ref (my_mod);
@@ -258,7 +258,8 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
   if (grub_file_read (file, (void *) ((grub_addr_t) address), size) != size)
     {
       if (grub_errno == GRUB_ERR_NONE)
-       grub_error (GRUB_ERR_BAD_OS, "too small");
+       grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
+                   filename);
 
       goto fail;
     }
index 835f14695f09e93851d49fe5f37431080f70ab59..5fa06c31aba0046498876b2e5872f49b060e7638 100644 (file)
@@ -107,7 +107,7 @@ static const struct grub_arg_option freebsd_opts[] =
     {"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}
@@ -131,7 +131,11 @@ static const struct grub_arg_option openbsd_opts[] =
     {"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}
   };
 
@@ -157,10 +161,14 @@ static const struct grub_arg_option netbsd_opts[] =
     {"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}
   };
 
@@ -1314,7 +1322,7 @@ grub_bsd_elf64_hook (Elf64_Phdr * phdr, grub_addr_t * addr, int *do_load)
 }
 
 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;
 
@@ -1326,7 +1334,8 @@ grub_bsd_load_elf (grub_elf_t elf)
       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,
@@ -1336,12 +1345,12 @@ grub_bsd_load_elf (grub_elf_t elf)
 
       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))
@@ -1363,7 +1372,8 @@ grub_bsd_load_elf (grub_elf_t 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;
 
@@ -1379,16 +1389,17 @@ grub_bsd_load_elf (grub_elf_t elf)
        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
@@ -1405,7 +1416,7 @@ grub_bsd_load (int argc, char *argv[])
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
       goto fail;
     }
 
@@ -1420,11 +1431,11 @@ grub_bsd_load (int argc, char *argv[])
       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
@@ -1491,9 +1502,11 @@ grub_cmd_freebsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
            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;
 
@@ -1625,9 +1638,9 @@ grub_cmd_netbsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
            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;
        }
@@ -1717,7 +1730,7 @@ grub_cmd_freebsd_loadenv (grub_command_t cmd __attribute__ ((unused)),
 
   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,
@@ -1725,7 +1738,7 @@ grub_cmd_freebsd_loadenv (grub_command_t cmd __attribute__ ((unused)),
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "no filename");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
       goto fail;
     }
 
@@ -1950,7 +1963,7 @@ grub_cmd_freebsd_module_elf (grub_command_t cmd __attribute__ ((unused)),
 
   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,
@@ -1995,7 +2008,7 @@ grub_cmd_openbsd_ramdisk (grub_command_t cmd __attribute__ ((unused)),
   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");
index 7cec7a8efecb72f2c8eb3d2b2cc8b1ee9c14537c..f28c53cc5d3d8655aa4933e9a9d9e624ba72cc79 100644 (file)
@@ -4,11 +4,12 @@
 #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;
@@ -16,14 +17,14 @@ load (grub_file_t file, void *where, grub_off_t off, grub_size_t size)
     {
       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;
@@ -32,8 +33,8 @@ read_headers (grub_file_t file, Elf_Ehdr *e, char **shdr)
     {
       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
@@ -42,10 +43,10 @@ read_headers (grub_file_t file, Elf_Ehdr *e, char **shdr)
       || 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)
@@ -59,8 +60,8 @@ read_headers (grub_file_t file, Elf_Ehdr *e, char **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;
@@ -83,7 +84,7 @@ SUFFIX (grub_freebsd_load_elfmodule_obj) (struct grub_relocator *relocator,
   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;
 
@@ -131,7 +132,7 @@ SUFFIX (grub_freebsd_load_elfmodule_obj) (struct grub_relocator *relocator,
        {
        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;
@@ -176,7 +177,7 @@ SUFFIX (grub_freebsd_load_elfmodule) (struct grub_relocator *relocator,
   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;
 
@@ -229,7 +230,8 @@ SUFFIX (grub_freebsd_load_elfmodule) (struct grub_relocator *relocator,
        {
        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)
@@ -244,16 +246,16 @@ SUFFIX (grub_freebsd_load_elfmodule) (struct grub_relocator *relocator,
        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;
@@ -263,14 +265,16 @@ SUFFIX (grub_freebsd_load_elfmodule) (struct grub_relocator *relocator,
   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;
@@ -286,7 +290,7 @@ SUFFIX (grub_freebsd_load_elf_meta) (struct grub_relocator *relocator,
   unsigned i;
   grub_size_t chunk_size;
 
-  err = read_headers (file, &e, &shdr);
+  err = read_headers (file, filename, &e, &shdr);
   if (err)
     return err;
 
@@ -303,7 +307,7 @@ SUFFIX (grub_freebsd_load_elf_meta) (struct grub_relocator *relocator,
        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;
@@ -338,7 +342,8 @@ SUFFIX (grub_freebsd_load_elf_meta) (struct grub_relocator *relocator,
   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;
@@ -351,7 +356,8 @@ SUFFIX (grub_freebsd_load_elf_meta) (struct grub_relocator *relocator,
   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;
     }
 
@@ -394,7 +400,8 @@ SUFFIX (grub_freebsd_load_elf_meta) (struct grub_relocator *relocator,
 
 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;
@@ -408,7 +415,7 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator,
   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;
 
@@ -479,7 +486,8 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator,
   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));
@@ -489,7 +497,8 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator,
   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;
     }
 
@@ -506,6 +515,7 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator,
 
 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)
@@ -518,7 +528,7 @@ SUFFIX(grub_openbsd_find_ramdisk) (grub_file_t file,
     Elf_Shdr *s;
     char *shdr = NULL;
     
-    err = read_headers (file, &e, &shdr);
+    err = read_headers (file, filename, &e, &shdr);
     if (err)
       return err;
 
@@ -560,7 +570,8 @@ SUFFIX(grub_openbsd_find_ramdisk) (grub_file_t file,
       {
        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;
       }
 
@@ -578,7 +589,8 @@ SUFFIX(grub_openbsd_find_ramdisk) (grub_file_t file,
        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;
       }
 
index 3f85aa3a96fd7286c0ce43e398a931f5e26deb30..a66033b9a0ca7561de0cbf16afced6cf4afb3a68 100644 (file)
@@ -88,7 +88,7 @@ grub_cmd_chain (grub_command_t cmd __attribute__ ((unused)),
   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 ();
 
@@ -103,7 +103,7 @@ grub_cmd_chain (grub_command_t cmd __attribute__ ((unused)),
       return grub_errno;
     }
 
-  elf = grub_elf_file (file);
+  elf = grub_elf_file (file, argv[0]);
   if (!elf)
     {
       grub_relocator_unload (relocator);
@@ -120,7 +120,7 @@ grub_cmd_chain (grub_command_t cmd __attribute__ ((unused)),
 
   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)
@@ -135,7 +135,12 @@ static grub_command_t cmd_chain;
 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)
index a5bcb24b2d173d800f5e239145a4600492cc30fe..c0fb530ff1d618e382064c1418d002ba0f8cfc76 100644 (file)
@@ -639,7 +639,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
       goto fail;
     }
 
@@ -650,7 +650,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   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;
     }
@@ -720,7 +720,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   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;
     }
@@ -913,7 +913,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   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)
@@ -953,13 +953,13 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   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;
     }
 
index abd4ae96decde49f77328ec19cb6a2aa9021a6f4..e41a4d89559f1024c83a252133dd6745ed52f6a2 100644 (file)
@@ -34,6 +34,7 @@
 #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
@@ -60,7 +61,7 @@ static void *elf_sections;
 
 
 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;
@@ -75,7 +76,10 @@ grub_multiboot_load (grub_file_t file)
   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
@@ -149,7 +153,7 @@ grub_multiboot_load (grub_file_t file)
     }
   else
     {
-      err = grub_multiboot_load_elf (file, buffer);
+      err = grub_multiboot_load_elf (file, filename, buffer);
       if (err)
        {
          grub_free (buffer);
index 30b1e8b093a602efa78e6f816252063ee806903f..c79c4fe0fc99a876b3e92f0a24f16cd636e00a0d 100644 (file)
@@ -182,8 +182,9 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags)
   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;
     }
@@ -270,9 +271,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
     }
 
   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;
 }
index 1f088e2b58103d2faa984066a49f5446846069e8..f1eed57ba10cb45c8dba63a8e4b4963dcdfc18f2 100644 (file)
@@ -83,7 +83,7 @@ grub_cmd_freedos (grub_command_t cmd __attribute__ ((unused)),
   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);
 
index 7c4a4beb6be0752dfb248d592b64e1b608392ebf..e820938e522c1a49e2fc2d175fe30dab442db621 100644 (file)
@@ -98,7 +98,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
       goto fail;
     }
 
@@ -109,7 +109,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   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;
     }
@@ -286,7 +286,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   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;
     }
@@ -326,7 +326,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   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)
@@ -366,13 +366,13 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   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;
     }
 
index 153b605edc7d303b34627e0169603a6b0c2e60ec..1b88f40d87198200e1f9f319d712f495d645928d 100644 (file)
@@ -82,7 +82,7 @@ grub_cmd_ntldr (grub_command_t cmd __attribute__ ((unused)),
   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);
 
index 169f83a43eb2bd5bde53e9b02afcb4de32b344aa..baf029f9083b0f65d5ecaa47c1757d74aa375347 100644 (file)
@@ -340,7 +340,7 @@ grub_cmd_plan9 (grub_extcmd_context_t ctxt, int argc, char *argv[])
   }
 
   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);
 
@@ -384,7 +384,12 @@ grub_cmd_plan9 (grub_extcmd_context_t ctxt, int argc, char *argv[])
     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)
@@ -462,7 +467,12 @@ grub_cmd_plan9 (grub_extcmd_context_t ctxt, int argc, char *argv[])
 
     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)
@@ -473,7 +483,12 @@ grub_cmd_plan9 (grub_extcmd_context_t ctxt, int argc, char *argv[])
 
     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);
index 30a4c24aa2b01bcc3593d0c7832343fea9aad958..4b528b6b826a75b5a1f469b19c31d509bafa95c0 100644 (file)
@@ -91,7 +91,7 @@ grub_cmd_pxechain (grub_command_t cmd __attribute__ ((unused)),
   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);
 
index 806bbacefcbc3848bd3b3629515d4c4a324ae3cf..0bbc705a05032525296220d61b27d5b5e40f5b96 100644 (file)
@@ -534,12 +534,11 @@ grub_cmd_devprop_load (grub_command_t cmd __attribute__ ((unused)),
   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)
@@ -849,7 +848,6 @@ static grub_err_t
 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;
@@ -878,9 +876,9 @@ grub_xnu_set_video (struct grub_xnu_boot_params *params)
   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)
      {
@@ -932,9 +930,9 @@ grub_xnu_set_video (struct grub_xnu_boot_params *params)
       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;
@@ -1129,7 +1127,10 @@ grub_cpu_xnu_init (void)
 {
   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
index aa01d6b1c7346d55beca21433882dfcbacce793b..64d8094004521138ca270ad37d6dc5ccd9265c6c 100644 (file)
@@ -134,18 +134,19 @@ query_fpswa (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;
     } 
 }
@@ -481,8 +482,7 @@ grub_load_elf64 (grub_file_t file, void *buffer, const char *filename)
                        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)
@@ -525,7 +525,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
     
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No kernel specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
       goto fail;
     }
 
@@ -536,7 +536,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   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;
     }
 
@@ -601,13 +603,13 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   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;
     }
 
@@ -671,14 +673,14 @@ grub_cmd_payload  (grub_command_t cmd __attribute__ ((unused)),
 
   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;
     }
 
index ecf0d8c5358103b1256edad3020b33682c134164..0a1717fbb2055a0d938e092bd6dfad48712e4e25 100644 (file)
@@ -28,6 +28,7 @@
 #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)
@@ -46,7 +47,7 @@ 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;
@@ -69,8 +70,9 @@ grub_macho_file (grub_file_t file)
   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;
     }
 
@@ -90,11 +92,12 @@ grub_macho_file (grub_file_t file)
        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;
        }
 
@@ -132,8 +135,8 @@ grub_macho_file (grub_file_t file)
       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;
 
@@ -152,7 +155,7 @@ grub_macho_open (const char *name)
   if (! file)
     return 0;
 
-  macho = grub_macho_file (file);
+  macho = grub_macho_file (file, name);
   if (! macho)
     grub_file_close (file);
 
index 918ddbb20014e2cdbee7c21589b597e94e130229..58770ddf8fdc15e72f1a506648487a39bcdba902 100644 (file)
@@ -2,6 +2,7 @@
 #include <grub/file.h>
 #include <grub/mm.h>
 #include <grub/misc.h>
+#include <grub/i18n.h>
 
 #define min(a,b) (((a) < (b)) ? (a) : (b))
 
@@ -12,7 +13,7 @@ SUFFIX (grub_macho_contains_macho) (grub_macho_t macho)
 }
 
 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;
 
@@ -25,7 +26,9 @@ SUFFIX (grub_macho_parse) (grub_macho_t macho)
       || 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;
     }
@@ -41,15 +44,14 @@ SUFFIX (grub_macho_parse) (grub_macho_t macho)
   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;
     }
 }
@@ -87,7 +89,9 @@ SUFFIX (grub_macho_filesize) (grub_macho_t macho)
 }
 
 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))
@@ -95,19 +99,16 @@ SUFFIX (grub_macho_readfile) (grub_macho_t macho, void *dest)
                       "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;
 }
@@ -162,9 +163,9 @@ SUFFIX (grub_macho_size) (grub_macho_t macho, grub_macho_addr_t *segments_start,
 
 /* 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)));
@@ -184,12 +185,7 @@ SUFFIX (grub_macho_load) (grub_macho_t macho, char *offset, int flags)
 
     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)
       {
@@ -199,11 +195,10 @@ SUFFIX (grub_macho_load) (grub_macho_t macho, char *offset, int flags)
        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;
          }
       }
@@ -216,7 +211,7 @@ SUFFIX (grub_macho_load) (grub_macho_t macho, char *offset, int flags)
 
   grub_macho_cmds_iterate (macho, do_load, 0);
 
-  return err;
+  return grub_errno;
 }
 
 grub_macho_addr_t
index 7fda817aff7ae5e1c18e0e0e652669278016e5a0..66850e2e65da2fccd5c667d40f8a27f36c9aad49 100644 (file)
@@ -132,7 +132,8 @@ grub_linux_unload (void)
 }
 
 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;
@@ -141,7 +142,7 @@ grub_linux_load32 (grub_elf_t elf, void **extra_mem, grub_size_t extra_size)
   /* 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;
@@ -183,11 +184,12 @@ grub_linux_load32 (grub_elf_t elf, void **extra_mem, grub_size_t extra_size)
       *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;
@@ -196,7 +198,7 @@ grub_linux_load64 (grub_elf_t elf, void **extra_mem, grub_size_t extra_size)
   /* 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;
@@ -237,7 +239,7 @@ grub_linux_load64 (grub_elf_t elf, void **extra_mem, grub_size_t extra_size)
       *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
@@ -259,7 +261,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 #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)
@@ -269,7 +271,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
     {
       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.  */
@@ -314,12 +316,12 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 #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);
 
@@ -445,10 +447,10 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
   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.");
index fec1b5bf6174b22d63942993a122864a93fe3fc4..9c1fd9146a11adf7fa7e17a35099cc8066d8f2d4 100644 (file)
@@ -159,14 +159,15 @@ grub_multiboot_unload (void)
 
 /* 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
@@ -222,7 +223,7 @@ grub_cmd_multiboot (grub_command_t cmd __attribute__ ((unused)),
   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)
@@ -239,7 +240,7 @@ grub_cmd_multiboot (grub_command_t cmd __attribute__ ((unused)),
   if (!grub_multiboot_relocator)
     goto fail;
 
-  err = grub_multiboot_load (file);
+  err = grub_multiboot_load (file, argv[0]);
   if (err)
     goto fail;
 
@@ -273,7 +274,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
   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)
     {
@@ -283,11 +284,11 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
     }
 
   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 ();
index c6c88f177446ca3ec635a40b87ccd80113b18548..1559aa7dbd6b6a93e0d1b9cd5b66c8e0746ed4cd 100644 (file)
@@ -49,26 +49,25 @@ CONCAT(grub_multiboot_is_elf, XX) (void *buffer)
 }
 
 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)
@@ -115,13 +114,16 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, void *buffer)
            {
              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)
@@ -159,13 +161,16 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, void *buffer)
        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++)
@@ -202,13 +207,16 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, void *buffer)
          }
 
          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,
index 9a81afe8ec5bbddf42fe24daab149042811ad4bc..7372a590cc0d175f4e1dc9c3a89468c3fdb24ce7 100644 (file)
@@ -76,7 +76,7 @@ grub_multiboot_add_elfsyms (grub_size_t num, grub_size_t entsize,
 }
 
 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;
@@ -255,7 +255,7 @@ grub_multiboot_load (grub_file_t file)
     }
   else
     {
-      err = grub_multiboot_load_elf (file, buffer);
+      err = grub_multiboot_load_elf (file, filename, buffer);
       if (err)
        {
          grub_free (buffer);
index 1ec3a4d968e7ea731480bd0fbe42521f25a8d530..4bb0ccb053b254ecb8fb426201548deca610bfa5 100644 (file)
@@ -151,7 +151,7 @@ grub_linux_unload (void)
 }
 
 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;
@@ -159,7 +159,7 @@ grub_linux_load32 (grub_elf_t elf)
   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.  */
@@ -195,11 +195,11 @@ grub_linux_load32 (grub_elf_t elf)
       *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;
@@ -207,7 +207,7 @@ grub_linux_load64 (grub_elf_t elf)
   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.  */
@@ -241,7 +241,7 @@ grub_linux_load64 (grub_elf_t elf)
       *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
@@ -255,7 +255,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
       goto out;
     }
 
@@ -266,7 +266,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   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;
     }
 
@@ -274,13 +274,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   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;
     }
 
@@ -329,13 +329,13 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   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;
     }
 
index 7b68f38b0bed673f6f6dfde4c660475c8344118b..b321f356fe46843091ca1b654f377d989e6eef62 100644 (file)
@@ -242,7 +242,7 @@ alloc_phys (grub_addr_t size)
 }
 
 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;
@@ -250,7 +250,7 @@ grub_linux_load64 (grub_elf_t elf)
   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;
 
@@ -289,7 +289,7 @@ grub_linux_load64 (grub_elf_t elf)
       *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
@@ -304,7 +304,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
       goto out;
     }
 
@@ -312,14 +312,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   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;
     }
 
@@ -327,10 +327,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   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;
     }
 
@@ -382,13 +382,13 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   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;
     }
 
index ec7c3423fbe30349a1fd1f3626810ce605a9d4d8..d01a6af6c316b2d95c7aa7074e7a2fa075afdc7a 100644 (file)
@@ -221,17 +221,17 @@ grub_xnu_writetree_toheap (grub_addr_t *target, grub_size_t *size)
 
   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, "/");
@@ -269,15 +269,11 @@ grub_xnu_create_key (struct grub_xnu_devtree_key **parent, const char *name)
     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;
@@ -303,15 +299,11 @@ grub_xnu_create_value (struct grub_xnu_devtree_key **parent, const char *name)
     }
   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;
@@ -351,7 +343,7 @@ grub_cmd_xnu_kernel (grub_command_t cmd __attribute__ ((unused)),
   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 ();
 
@@ -391,7 +383,7 @@ grub_cmd_xnu_kernel (grub_command_t cmd __attribute__ ((unused)),
     }
 
   /* 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)
     {
@@ -461,7 +453,7 @@ grub_cmd_xnu_kernel64 (grub_command_t cmd __attribute__ ((unused)),
   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 ();
 
@@ -504,7 +496,7 @@ grub_cmd_xnu_kernel64 (grub_command_t cmd __attribute__ ((unused)),
     }
 
   /* 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)
     {
@@ -573,7 +565,7 @@ grub_xnu_register_memory (const char *prefix, int *suffix,
   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)
@@ -584,24 +576,27 @@ grub_xnu_register_memory (const char *prefix, int *suffix,
 
   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;
@@ -637,7 +632,8 @@ get_name_ptr (char *name)
 
 /* 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;
@@ -662,12 +658,12 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile)
   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)
@@ -716,9 +712,9 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile)
       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);
@@ -776,10 +772,10 @@ grub_cmd_xnu_mkext (grub_command_t cmd __attribute__ ((unused)),
   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)
@@ -890,10 +886,10 @@ grub_cmd_xnu_ramdisk (grub_command_t cmd __attribute__ ((unused)),
   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)
@@ -1072,7 +1068,7 @@ grub_xnu_scan_dir_for_kexts (char *dirname, const char *osbundlerequired,
   }
 
   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);
@@ -1190,14 +1186,15 @@ grub_xnu_load_kext_from_dir (char *dirname, const char *osbundlerequired,
                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);
@@ -1220,7 +1217,7 @@ grub_cmd_xnu_kext (grub_command_t cmd __attribute__ ((unused)),
   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)
     {
@@ -1229,20 +1226,17 @@ grub_cmd_xnu_kext (grub_command_t cmd __attribute__ ((unused)),
        {
          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. */
@@ -1254,7 +1248,7 @@ grub_cmd_xnu_kextdir (grub_command_t cmd __attribute__ ((unused)),
     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],
@@ -1394,10 +1388,10 @@ grub_cmd_xnu_splash (grub_extcmd_context_t ctxt,
 {
   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,
@@ -1420,7 +1414,7 @@ grub_cmd_xnu_resume (grub_command_t cmd __attribute__ ((unused)),
                     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]);
 }
@@ -1457,11 +1451,16 @@ GRUB_MOD_INIT(xnu)
   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."),
@@ -1469,7 +1468,8 @@ GRUB_MOD_INIT(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 ();
index b34a3ba30d05e84507d9ed5c90fb77c0face83b0..7735597533e22dff94bf9a56625911eb1724a6e5 100644 (file)
@@ -212,7 +212,7 @@ grub_mmap_unregister (int handle)
          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. */
index 07a71336ba5fa4a7f8bc054cd5ba1362241bcf6b..022ad17f2166ebd2719f824425332ebc5dd4ff45 100644 (file)
@@ -139,10 +139,7 @@ grub_mmap_iterate (grub_memory_hook_t hook)
     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
@@ -237,11 +234,7 @@ grub_mmap_register (grub_uint64_t start, grub_uint64_t size, int type)
   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;
@@ -265,11 +258,12 @@ grub_mmap_unregister (int handle)
 {
   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)
@@ -279,7 +273,7 @@ grub_mmap_unregister (int handle)
        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 */
@@ -449,7 +443,7 @@ grub_cmd_cutmem (grub_command_t cmd __attribute__ ((unused)),
   }
 
   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)
@@ -471,7 +465,7 @@ GRUB_MOD_INIT(mmap)
 {
   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."));
index c9a7cb21e87426c2311d308a8b2baf4829e69117..3db852e74fc867e8d5d22f2316b6a0f17a3596ce 100644 (file)
@@ -66,7 +66,7 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
       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;
index ea8943a323f8ff515c950efa0a8169fac6a33026..f1e053cc7168feeb78b63f63e325f056de5f4d10 100644 (file)
@@ -310,7 +310,7 @@ grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
 
   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"));
index c84f12bc29b75a947aa01a5a3613b0fc2e5632f7..1d252f9840f9d468bea46c8ae545a7432b183aa1 100644 (file)
@@ -602,7 +602,7 @@ grub_cmd_nslookup (struct grub_command *cmd __attribute__ ((unused)),
   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;
@@ -643,7 +643,7 @@ grub_cmd_add_dns (struct grub_command *cmd __attribute__ ((unused)),
   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;
@@ -659,7 +659,7 @@ grub_cmd_del_dns (struct grub_command *cmd __attribute__ ((unused)),
   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;
index 2a392bc98a86c237b7ba32b341bfb0b3480e6ac2..14ab1bc2cd27fc4e31aafce0d61eef6d91344257 100644 (file)
@@ -22,6 +22,7 @@
 #include <grub/time.h>
 #include <grub/efi/api.h>
 #include <grub/efi/efi.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -39,17 +40,17 @@ send_card_buffer (const struct grub_net_card *dev,
   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"));
     }
 }
 
index 2aba28d23a992304270081456c3087f7c8a177ad..245b8780a31240805788481258d5ecda191604e1 100644 (file)
@@ -27,6 +27,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <grub/term.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -40,7 +41,7 @@ send_card_buffer (const struct grub_net_card *dev __attribute__ ((unused)),
 
   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;
 }
index 1adfa14373ecb44761ecd5e3e6daa51125990568..9895de4720f9c98f993c255810da8aa465d1383c 100644 (file)
@@ -23,6 +23,7 @@
 #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>
@@ -269,8 +270,7 @@ grub_pxe_send (const struct grub_net_card *dev __attribute__ ((unused)),
 
   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;
 }
 
index 227b88aa8b6f04885a4de51878bc0f013e179c17..a1fcf0839a1e100fe542ff94055790a6085fa871 100644 (file)
@@ -21,6 +21,7 @@
 #include <grub/dl.h>
 #include <grub/net.h>
 #include <grub/time.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -69,7 +70,7 @@ send_card_buffer (const struct grub_net_card *dev, struct grub_net_buff *pack)
                                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;
 }
 
index 9f6628cb95540430b23046e0602925afd34d0864..39f53f2325060fc598391d5e9cf29b3270090a19 100644 (file)
@@ -25,6 +25,7 @@
 #include <grub/mm.h>
 #include <grub/dl.h>
 #include <grub/file.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -400,7 +401,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
          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;
 }
index f3ec74d57ec70bb6de38109bb9635effe4dfcc0b..fe9f28176ad94e333765fe74413cabb2dbfdaea6 100644 (file)
@@ -620,7 +620,7 @@ grub_net_send_ip_packet (struct grub_net_network_level_interface *inf,
     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");
     }
 }
 
index dbb836841915db552f43817fd2ded8f1eb698a05..e63c02ab784933252c8c360bcc3b0e5a6bb5a110 100644 (file)
@@ -179,7 +179,7 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf,
     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)
@@ -563,7 +563,8 @@ grub_net_resolve_net_address (const char *name,
          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);
 }
 
@@ -1002,7 +1003,7 @@ grub_cmd_addroute (struct grub_command *cmd __attribute__ ((unused)),
   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);
   
@@ -1026,7 +1027,7 @@ grub_cmd_addroute (struct grub_command *cmd __attribute__ ((unused)),
 
       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);
     }
 }
@@ -1208,7 +1209,7 @@ grub_net_fs_dir (grub_device_t device, const char *path __attribute__ ((unused))
                            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;
 }
 
index 242b154e0198d0cc32eb970b76ec11010cdf3e08..f957cb9e55fa42c641865e476dc53102e5d910c4 100644 (file)
@@ -26,7 +26,7 @@ grub_netbuff_put (struct grub_net_buff *nb, grub_size_t len)
 {
   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;
 }
 
@@ -35,7 +35,7 @@ grub_netbuff_unput (struct grub_net_buff *nb, grub_size_t len)
 {
   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;
 }
@@ -45,7 +45,7 @@ grub_netbuff_push (struct grub_net_buff *nb, grub_size_t len)
 {
   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;
 }
@@ -55,7 +55,7 @@ grub_netbuff_pull (struct grub_net_buff *nb, grub_size_t len)
 {
   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;
 }
@@ -66,7 +66,7 @@ grub_netbuff_reserve (struct grub_net_buff *nb, grub_size_t len)
   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;
 }
index 65c6869c80d0a6701ed7c2f06d13d7e8052f9097..e830d94d36388de37f61953fd00166ea217ee819 100644 (file)
@@ -565,7 +565,7 @@ grub_net_tcp_open (char *server,
   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;
     }
  
index e374f6e9c66e6a8c046565b7a515f261e598d72e..1afe9b531514aaf90151b7eb7b6b1ca39bf5ac8f 100644 (file)
@@ -26,6 +26,7 @@
 #include <grub/dl.h>
 #include <grub/file.h>
 #include <grub/priority_queue.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -373,7 +374,7 @@ tftp_open (struct grub_file *file, const char *filename)
     }
 
   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)
index afe5de0c9ab674f518e1d070d5e112c1a350ad9b..919dca8dbd99700a1fa56c70231eff5e660f3c82 100644 (file)
@@ -76,7 +76,7 @@ grub_net_udp_open (grub_net_network_level_address_t addr,
   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;
     }
  
index 499eb6c9de117c5420e011b7d615703bf82671db..c6bd96e28ec28a6906791e8461ee8ea41387b436 100644 (file)
@@ -263,7 +263,8 @@ grub_normal_auth_init (void)
 {
   cmd = grub_register_command ("authenticate",
                               grub_cmd_authenticate,
-                              N_("[USERLIST]"), N_("Authenticate users"));
+                              N_("[USERLIST]"),
+                              N_("Check whether user is in USERLIST."));
 
 }
 
index 2b82466622df6901fbe7f0c09a5c14baad958a4e..5792cee9378f685fa65b21fdc47b70e31d4da130 100644 (file)
@@ -105,7 +105,7 @@ grub_utf8_process (grub_uint8_t c, grub_uint32_t *code, int *count)
    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)
index 1a4867e4627f14a82dd923d295354e756d2f9c8a..fcc636aec7175719764f88971482851e8414e826 100644 (file)
@@ -157,8 +157,8 @@ read_command_list (const char *prefix)
                                                   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);
index 4a7e6a3ea8382c0024196d8fab7c1cfdc636c851..360aa552d60a6e8b92f3e5eeb247cd4ccc25158e 100644 (file)
@@ -109,7 +109,7 @@ grub_normal_print_device_info (const char *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"),
index dd123aac45270c9a5be382281d1f4a234784b27f..ef89a902f175b5548403b81a7f6228b3827834d9 100644 (file)
@@ -24,6 +24,7 @@
 #include <grub/dl.h>
 #include <grub/msdos_partition.h>
 #include <grub/gpt_partition.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -173,13 +174,13 @@ gpt_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
 
   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));
index c8ab6acaba3d478c2070b37f5e7174c32a4a7536..0049fbd462156c8929fbf2ccfaa2dde1bc600432 100644 (file)
@@ -23,6 +23,7 @@
 #include <grub/mm.h>
 #include <grub/misc.h>
 #include <grub/dl.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -258,17 +259,17 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
 
   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
 
index 3377a2ccc147e9f1712bcebbe459ba6cd76d5932..8eb1f99d9ef6d58de788701f809326977f2b4316 100644 (file)
@@ -85,7 +85,7 @@ static grub_err_t grub_pcpart_boot (const grub_device_t dev,
 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}
 };
 
index 5ecd7c5b5ec4f24bc75530b7f88c928858539714..e0ddc16578cb3d0d89583ff113dfa282f86bce33 100644 (file)
@@ -1186,7 +1186,7 @@ grub_gfxterm_background_color_cmd (grub_command_t cmd __attribute__ ((unused)),
   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)
index d4f5c88c68e0c06175639fe14ecffdd649c4f899..e636ad5fcb3d2439fa1e8eeb9410e2f2ab1722b4 100644 (file)
@@ -235,7 +235,7 @@ grub_terminfo_gotoxy (struct grub_term_output *term,
 
   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;
     }
 
@@ -599,10 +599,10 @@ print_terminfo (void)
     [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;
 
@@ -623,7 +623,7 @@ static const struct grub_arg_option options[] =
   {"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}
 };
index 32e9358a34d5b92e43901871afed69c8bd2cb1ce..5210c2eb8182113b1a30630810852b62c69fae2c 100644 (file)
@@ -60,12 +60,12 @@ grub_video_bitmap_create (struct grub_video_bitmap **bitmap,
   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)
@@ -130,7 +130,7 @@ grub_video_bitmap_create (struct grub_video_bitmap **bitmap,
         grub_free (*bitmap);
         *bitmap = 0;
 
-        return grub_error (GRUB_ERR_BAD_ARGUMENT,
+        return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
                            "unsupported bitmap format");
     }
 
@@ -190,7 +190,7 @@ grub_video_bitmap_load (struct grub_video_bitmap **bitmap,
   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;
 
@@ -202,7 +202,7 @@ grub_video_bitmap_load (struct grub_video_bitmap **bitmap,
       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.  */
index 8da5697f8e90681787e8312b9e4ce0e3770dd213..73f50f61185b42591626123758026f6d3da82fa1 100644 (file)
@@ -54,22 +54,22 @@ grub_video_bitmap_create_scaled (struct grub_video_bitmap **dst,
 
   /* 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. */
@@ -90,7 +90,7 @@ grub_video_bitmap_create_scaled (struct grub_video_bitmap **dst,
       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;
     }
 
@@ -123,17 +123,19 @@ scale_nn (struct grub_video_bitmap *dst, struct grub_video_bitmap *src)
 {
   /* 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
@@ -144,12 +146,14 @@ scale_nn (struct grub_video_bitmap *dst, struct grub_video_bitmap *src)
       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;
@@ -206,17 +210,17 @@ scale_bilinear (struct grub_video_bitmap *dst, struct grub_video_bitmap *src)
 {
   /* 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
@@ -227,12 +231,12 @@ scale_bilinear (struct grub_video_bitmap *dst, struct grub_video_bitmap *src)
       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;
index 06625183e5518b592e067d34c62e9815f71a1c85..ca1d3332bfdec5671b6088e10f1c4c9ac74328d7 100644 (file)
@@ -22,6 +22,7 @@
 #include <grub/gui_string_util.h>
 #include <grub/misc.h>
 #include <grub/dl.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
index 2d9d99482381550cfb147446a9fc4be951c7c60f..2ab403db2b8cf7533f7a24b59a447aea8fdd4dff 100644 (file)
@@ -1130,7 +1130,7 @@ grub_video_fb_create_render_target (struct grub_video_fbrender_target **result,
   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.  */
@@ -1263,7 +1263,7 @@ grub_video_fb_set_active_render_target (struct grub_video_fbrender_target *targe
     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;
index 92dd7ec07e4f3467c58fee4c3f80fee4bb5172b9..51815d9628830987926cb32ea759285347d7619a 100644 (file)
@@ -434,7 +434,7 @@ grub_vbe_get_preferred_mode (unsigned int *width, unsigned int *height)
   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)
 {
index f2351dee92ab4265cc882c9fa1476510b4fcaf02..33864223ddca31a1c4b2dd48cba3534d78330d46 100644 (file)
@@ -773,7 +773,7 @@ grub_cmd_jpegtest (grub_command_t cmd __attribute__ ((unused)),
   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)
index ae9879b1642369888cef6805d8d1bdf37100dd2b..7ef7e3b4c1cceef82c66fd10898031434a2f61e5 100644 (file)
@@ -877,7 +877,7 @@ grub_cmd_pngtest (grub_command_t cmd __attribute__ ((unused)),
   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)
index 77c5206e31390bd2455b93254575e540bce4870b..ac4d3fbfcf0cfbc335dabc2c0dbd4a81d3a8c0ad 100644 (file)
@@ -21,6 +21,7 @@
 #include <grub/dl.h>
 #include <grub/misc.h>
 #include <grub/mm.h>
+#include <grub/i18n.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -440,7 +441,7 @@ parse_modespec (const char *current_mode, int *width, int *height, int *depth)
   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++;
@@ -448,7 +449,7 @@ parse_modespec (const char *current_mode, int *width, int *height, int *depth)
   *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.  */
@@ -459,7 +460,7 @@ parse_modespec (const char *current_mode, int *width, int *height, int *depth)
       *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
@@ -470,7 +471,7 @@ parse_modespec (const char *current_mode, int *width, int *height, int *depth)
       *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.  */
@@ -478,7 +479,7 @@ parse_modespec (const char *current_mode, int *width, int *height, int *depth)
       *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;
index 4f9e8099f5c8f9275ae695bdfaf84e4c42ed250f..3036d16939b2a187da712e7272275fa3f96795d2 100644 (file)
@@ -44,7 +44,7 @@
 #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);
index 9a67c5e119648ae11fef637c7fb359fd11d37932..67e0a1bf4162e21d3b96e3538d472d0e9143b17a 100644 (file)
@@ -315,7 +315,7 @@ int
 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);
 
index 579656f231e7b8f183e0e04753b8b682255bde7f..aae95f5645f7a37a5efa32697036a8548a606d14 100644 (file)
@@ -42,24 +42,32 @@ typedef grub_err_t (*grub_elf64_load_hook_t)
   (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);
 
index c9e8b7dd245d4cad3d0495216f4aa71db916f8a5..665248d038713204ca6cd04e2d67f3617f7fd438 100644 (file)
@@ -81,16 +81,20 @@ grub_err_t grub_freebsd_load_elfmodule_obj64 (struct grub_relocator *relocator,
                                              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, 
@@ -107,10 +111,12 @@ struct grub_openbsd_ramdisk_descriptor
 };
 
 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);
index 09ad7eb6451407d5952dd3f0946336249ec5784a..570bb0fa6c669f69ae811b9b1285b18a60ee62f4 100644 (file)
@@ -221,8 +221,6 @@ grub_vbe_status_t grub_vbe_bios_getset_dac_palette_width (int set, int *width);
 #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);
index 8410162fb606145779dc008b75b5927f50d012a1..9ad509b6e6c540be89d0a85f1308ce8ae459aaa5 100644 (file)
@@ -42,7 +42,7 @@ struct grub_macho_file
 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);
@@ -57,17 +57,21 @@ grub_uint64_t grub_macho_get_entry_point64 (grub_macho_t macho);
 
 /* 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 */
index 3a62d447d5c9e8286337e05d370dc47096f85b6c..2d5f8e1b270fc6c719ac374113de54e321a3883d 100644 (file)
@@ -285,7 +285,7 @@ grub_strtol (const char *str, char **end, int base)
     {
       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);
@@ -294,7 +294,7 @@ grub_strtol (const char *str, char **end, int base)
     {
       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;
index 9a0b5735957017b46bdd2f14c55ee8e730507fef..af6b0a0df1449c492e43ba8f92c249e518d35358 100644 (file)
@@ -80,10 +80,11 @@ grub_multiboot_set_console (int console_type, int accepted_consoles,
                            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;
index 0e4afffbf70290243d1a3a596688411de3ebf8fa..c4d4b303eb07338c88b8fa9dc2c5eebb44d75095 100644 (file)
 ./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
index f69af89f8bda32714abb229567b52287dd8c76fa..d3b54bad8f3682cd8d05d027b01a8c86fc81ae13 100644 (file)
@@ -910,7 +910,7 @@ grub_util_open_dm (const char *os_dev, struct dm_tree **tree,
   *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;
     }
@@ -1026,6 +1026,9 @@ grub_util_get_geom_abstraction (const char *dev)
 
   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)
@@ -1190,6 +1193,9 @@ grub_util_pull_device (const char *os_dev)
 
        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)
@@ -1228,7 +1234,8 @@ grub_util_pull_device (const char *os_dev)
                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);
@@ -1272,7 +1279,8 @@ grub_util_pull_device (const char *os_dev)
                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);
          }
@@ -1732,7 +1740,8 @@ devmapper_out:
       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.  */
@@ -1944,14 +1953,6 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
     }
 
   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)
     {
@@ -2046,13 +2047,6 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
               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
@@ -2192,6 +2186,9 @@ grub_util_get_grub_dev (const char *os_dev)
 
        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)
index 3eef7f663cf81a67d85f914dc26a6b70835df931..fe443d488f044021a29b62e58193f188f728c7cb 100644 (file)
@@ -128,7 +128,7 @@ create_envblk_file (const char *name)
           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));
@@ -160,13 +160,13 @@ open_envblk_file (const char *name)
     }
 
   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);
@@ -174,7 +174,7 @@ open_envblk_file (const char *name)
     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);
@@ -215,7 +215,7 @@ write_envblk (const char *name, grub_envblk_t envblk)
 
   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));
index 76ace544d4ccccc448a4b6cdb80cfc66760added..f98b747e61a342e27b047f8e0ce36fb3620183e8 100644 (file)
@@ -173,7 +173,7 @@ cmd_cp (char *src, char *dest)
 
     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;
       }
@@ -251,7 +251,7 @@ cmd_cmp (char *src, char *dest)
     }
 
   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);
@@ -332,7 +332,7 @@ fstest (int n, char **args)
       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);
@@ -343,7 +343,7 @@ fstest (int n, char **args)
     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);
       }
   }
 
@@ -435,7 +435,7 @@ static struct argp_option options[] = {
   {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},
@@ -443,10 +443,12 @@ static struct argp_option options[] = {
   {"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}
@@ -489,13 +491,17 @@ argp_parser (int key, char *arg, struct argp_state *state)
        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;
          }
@@ -528,6 +534,9 @@ argp_parser (int key, char *arg, struct argp_state *state)
        }
       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);
        }
index 2ceab2d663be02d894a7533fadf67c1e73c864b0..95c268c88134e1228c8adb17a146080fc04c1a0d 100644 (file)
@@ -49,7 +49,6 @@ grubdir="`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`"
 modules=
 
 install_device=
-no_floppy=
 force_lba=
 recheck=no
 debug=no
@@ -101,7 +100,6 @@ usage () {
     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")"
@@ -207,7 +205,7 @@ do
        grub_probe="`echo "$option" | sed 's/--grub-probe=//'`" ;;
 
     --no-floppy)
-       no_floppy="--no-floppy" ;;
+       ;;
     --recheck)
        recheck=yes ;;
     --removable)
@@ -535,6 +533,8 @@ if [ "x${devabstraction_module}" = "x" ] ; then
           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
              
@@ -633,7 +633,7 @@ elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${pla
        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
        }
 
@@ -668,7 +668,7 @@ elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${pla
        "$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
index 859c2e8c387535e74d2028e1708767d63b6df197..289763abb3dcfae933504e9a427ed9d2f466b91d 100644 (file)
@@ -184,7 +184,7 @@ for x in ${GRUB_TERMINAL_OUTPUT}; do
        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
index c1573379c6ace71d76d782eefd55ce32b6bda509..a32a2b2bb8234f1358d06adecdcc8c56e0f89a6b 100644 (file)
@@ -31,7 +31,7 @@ if test "x$grub_mkrelpath" = x; then
   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 () {
index 2f8189c6b2e3d04a4eadd42d584f53d3227ddfdd..352cb9126570290382b45ba1636a94e606617938 100644 (file)
@@ -591,7 +591,7 @@ add_font (struct grub_font_info *font_info, FT_Face face, int nocut)
          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)
            {
@@ -621,7 +621,8 @@ add_font (struct grub_font_info *font_info, FT_Face face, int nocut)
                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);
              }
            }
        }
@@ -692,8 +693,8 @@ print_glyphs (struct grub_font_info *font_info)
       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);
 
@@ -760,7 +761,7 @@ write_font_ascii_bitmap (struct grub_font_info *font_info, char *output_file)
   
   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;
@@ -797,7 +798,7 @@ write_font_width_spec (struct grub_font_info *font_info, char *output_file)
   
   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;
@@ -821,7 +822,7 @@ write_font_pf2 (struct grub_font_info *font_info, char *output_file)
 
   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;
@@ -961,7 +962,7 @@ static struct argp_option options[] = {
   {"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},
@@ -1128,7 +1129,7 @@ main (int argc, char *argv[])
   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)
index 3884acb0a20472fba78b1509bd098a72870cbb94..b1e2f4c7bba4cbc10f8e1725f986aea446694f0e 100644 (file)
@@ -1633,10 +1633,11 @@ generate_image (const char *dir, char *prefix, FILE *out, const char *outname,
 
 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},
index 35229107056c20e672c2ab9a5bde76b0b8991703..044896c52a20c0201a5b960fb43522d85bcce1e8 100644 (file)
@@ -389,7 +389,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
                                  *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;
                }
@@ -432,7 +432,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
                  }
 
                default:
-                 grub_util_error ("unknown relocation type %d",
+                 grub_util_error (_("relocation 0x%x is not implemented yet"),
                                   ELF_R_TYPE (info));
                  break;
                }
@@ -505,7 +505,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
                  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;
                }
@@ -730,7 +730,7 @@ SUFFIX (make_reloc_section) (Elf_Ehdr *e, void **out,
 #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;
                }
index b587590876cb504edfe11f7fc1fd54ab81e613c2..bbd8e98ce4299b061d1c6183b8f1e612a7d356fe 100644 (file)
@@ -289,7 +289,7 @@ lookup (char *code, int shift)
     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';
 }
@@ -385,7 +385,7 @@ write_keymaps (FILE *in, FILE *out)
          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)
@@ -403,7 +403,7 @@ write_keymaps (FILE *in, FILE *out)
 
   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);
     }
 
index 2f5cc920a9735ed6bba71a39d5a2d0115a664770..74ca956e0a1f2009cef5856f0751838b6d79b1c1 100644 (file)
@@ -114,7 +114,7 @@ main (int argc, char *argv[])
     .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;
@@ -243,8 +243,14 @@ main (int argc, char *argv[])
   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);
index 6b1674c39bcce27a0c69cc4d8939c835261cc177..2ed89fa00d891831228e9d44245a3d595f95be37 100644 (file)
@@ -73,7 +73,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
 
 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
 };
 
index 6cf2a78c4d64e6df4e18feeadb43862488dc781a..7bd09d6084eef1435769b4dfa2a389895d5da448 100644 (file)
@@ -52,7 +52,7 @@ xorriso=xorriso
 # 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")"
@@ -62,7 +62,7 @@ usage () {
     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
index 7b5f3f896ee1f8b7c2322b2c943a9938354037c4..02a52978c9aaa897423e352b109a3d3ebf922be3 100644 (file)
@@ -47,6 +47,8 @@ source=
 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")"
@@ -62,8 +64,6 @@ usage () {
     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
 }
 
index 0546426b7bf8521718cd0981a53285fa536808db..ddb4ce7ff43786c2ff2ede281d766244fd08199b 100644 (file)
@@ -407,7 +407,9 @@ static struct argp_option options[] = {
   {"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}
 };
@@ -449,13 +451,18 @@ argp_parser (int key, char *arg, struct argp_state *state)
          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;
            }
index 080870d167e28a71ae94f78d5eacd1a80e18ca7e..dca32ba0ed34963dfa908a6406563392eb9eaf88 100644 (file)
@@ -425,7 +425,8 @@ probe (const char *path, char **device_names, char delim)
        {
          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));
@@ -688,12 +689,11 @@ static struct argp_option options[] = {
   {"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)))
 {
index 040b454c28c41b1f28aa40e6c3cc6464f73028a7..534d6312eaf8c74b2f72c17e3f3f8625c6d8bbef 100644 (file)
@@ -431,14 +431,14 @@ setup (const char *dir,
 
     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;
       }
@@ -542,16 +542,17 @@ setup (const char *dir,
 
 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 "
@@ -740,11 +741,9 @@ static struct argp_option options[] = {
   {"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},
index 08a8c6afd6bc1df7d14fe30e4f022a79360d0b01..4d8331dda232e5ba223af864423e6c5f3e8e213e 100644 (file)
@@ -63,18 +63,18 @@ for drv in $drives ; do
 
   # 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
index a0f022a5f6ed8454561a73d743d05955ff345837..0c45d90127381b5425204cacff91fa360f882b3d 100644 (file)
@@ -114,7 +114,7 @@ grub_util_read_image (const char *path)
                     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);
@@ -138,7 +138,7 @@ grub_util_load_image (const char *path, char *buf)
                     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);
@@ -150,10 +150,10 @@ grub_util_write_image_at (const void *img, size_t size, off_t offset, FILE *out,
 {
   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));
 }
 
@@ -163,12 +163,14 @@ grub_util_write_image (const char *img, size_t size, FILE *out,
 {
   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 *
index 992bd757d591e366b54fb552a9081d105c695147..8632149b8e11d158ce1f2bd48b61448843ba7535 100644 (file)
@@ -20,33 +20,37 @@ set -e
 # 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
 }