Improve gettext support. Stylistic fixes and error handling fixes while

on it.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-08 19:26:01 +01:00
parent 215c90cb82
commit 9c4b5c13e6
184 changed files with 1175 additions and 959 deletions

View 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;
}

View 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;
}

View 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

View 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;

View 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);

View 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;

View 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;

View 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;
}

View 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

View 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);
}