Improve and unify messages.

* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors): Add argument
	name. All users updated.
	Print filename in error.
	(read_device_map): Print filename in error.
	* util/getroot.c (grub_guess_root_devices): Print filename in error.
	(grub_util_get_os_disk): Likewise.
	(grub_util_biosdisk_get_grub_dev): Likewise.
	(grub_util_check_block_device): Likewise.
	(grub_util_check_char_device): Likewise.
	(grub_make_system_path_relative_to_its_root): Likewise.
	* util/grub-editenv.c (create_envblk_file): Likewise.
	(open_envblk_file): Likewise.
	(write_envblk): Likewise.
	* util/grub-fstest.c (cmd_cp): Likewise.
	(cmd_cat): Likewise.
	(cmd_cmp): Likewise.
	* util/grub-menulst2cfg.c (main): Likewise.
	* util/grub-mkfont.c (write_font_ascii_bitmap): Likewise.
	(write_font_width_spec): Likewise.
	(write_font_pf2): Likewise.
	* util/grub-mkimage.c (generate_image): New argument outname.
	All users updated.
	Remove unreacheable message.
	(options): Unify messages.
	(help_filter): Likewise.
	* util/grub-mklayout.c (usage): Removed (unused).
	(main): Print filename in error.
	* util/grub-mkrescue.in: Fix wrong quoting.
	* util/grub-setup.c (setup): Print filename in error.
	* util/ieee1275/ofpath.c (vendor_is_ATA): Likewise.
	(check_sas): Likewise.
	* util/misc.c (grub_util_get_fp_size): Removed.
	(grub_util_get_image_size): Print filename in error.
	(grub_util_read_at): Removed.
	(grub_util_read_image): Print filename in error.
	(grub_util_load_image): Likewise.
	(grub_util_write_image_at): New argument filename. All users updated.
	Print filename in error.
	(grub_util_write_image): New argument filename. All users updated.
	Print filename in error.
	* util/raid.c (grub_util_raid_getmembers): Print filename in error.
	* util/resolve.c (grub_util_resolve_dependencies): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-05 11:07:33 +01:00
parent 0a96117de7
commit 0ae70393ba
19 changed files with 222 additions and 166 deletions

View file

@ -123,7 +123,7 @@ insert_string (const char *name)
}
static int *
write_section_data (FILE* fp, char *image,
write_section_data (FILE* fp, const char *name, char *image,
struct grub_pe32_coff_header *pe_chdr,
struct grub_pe32_section_table *pe_shdr)
{
@ -192,7 +192,8 @@ write_section_data (FILE* fp, char *image,
{
shdr[idx].sh_offset = offset;
grub_util_write_image_at (image + pe_shdr->raw_data_offset,
pe_shdr->raw_data_size, offset, fp);
pe_shdr->raw_data_size, offset, fp,
name);
offset += pe_shdr->raw_data_size;
}
@ -222,7 +223,7 @@ write_section_data (FILE* fp, char *image,
}
static void
write_reloc_section (FILE* fp, char *image,
write_reloc_section (FILE* fp, const char *name, char *image,
struct grub_pe32_coff_header *pe_chdr,
struct grub_pe32_section_table *pe_shdr,
Elf32_Sym *symtab,
@ -296,7 +297,7 @@ write_reloc_section (FILE* fp, char *image,
grub_util_write_image_at (image + pe_sec->raw_data_offset,
shdr[shdr[i].sh_info].sh_size,
shdr[shdr[i].sh_info].sh_offset,
fp);
fp, name);
shdr[i].sh_type = SHT_REL;
shdr[i].sh_offset = offset;
@ -305,14 +306,14 @@ write_reloc_section (FILE* fp, char *image,
shdr[i].sh_entsize = sizeof (Elf32_Rel);
shdr[i].sh_size = num_rels * sizeof (Elf32_Rel);
grub_util_write_image_at (rel, shdr[i].sh_size, offset, fp);
grub_util_write_image_at (rel, shdr[i].sh_size, offset, fp, name);
offset += shdr[i].sh_size;
free (rel);
}
}
static void
write_symbol_table (FILE* fp, char *image,
write_symbol_table (FILE* fp, const char *name, char *image,
struct grub_pe32_coff_header *pe_chdr,
struct grub_pe32_section_table *pe_shdr,
int *section_map)
@ -403,7 +404,7 @@ write_symbol_table (FILE* fp, char *image,
shdr[SYMTAB_SECTION].sh_addralign = 4;
grub_util_write_image_at (symtab, shdr[SYMTAB_SECTION].sh_size,
offset, fp);
offset, fp, name);
offset += shdr[SYMTAB_SECTION].sh_size;
free (symtab);
@ -411,21 +412,22 @@ write_symbol_table (FILE* fp, char *image,
}
static void
write_string_table (FILE* fp)
write_string_table (FILE *fp, const char *name)
{
shdr[STRTAB_SECTION].sh_name = insert_string (".strtab");
shdr[STRTAB_SECTION].sh_type = SHT_STRTAB;
shdr[STRTAB_SECTION].sh_offset = offset;
shdr[STRTAB_SECTION].sh_size = strtab_len;
shdr[STRTAB_SECTION].sh_addralign = 1;
grub_util_write_image_at (strtab, strtab_len, offset, fp);
grub_util_write_image_at (strtab, strtab_len, offset, fp,
name);
offset += strtab_len;
free (strtab);
}
static void
write_section_header (FILE* fp)
write_section_header (FILE *fp, const char *name)
{
ehdr.e_ident[EI_MAG0] = ELFMAG0;
ehdr.e_ident[EI_MAG1] = ELFMAG1;
@ -446,13 +448,13 @@ write_section_header (FILE* fp)
ehdr.e_shoff = offset;
ehdr.e_shnum = num_sections;
grub_util_write_image_at (&shdr, sizeof (Elf32_Shdr) * num_sections,
offset, fp);
offset, fp, name);
grub_util_write_image_at (&ehdr, sizeof (Elf32_Ehdr), 0, fp);
grub_util_write_image_at (&ehdr, sizeof (Elf32_Ehdr), 0, fp, name);
}
static void
convert_pe (FILE* fp, char *image)
convert_pe (FILE* fp, const char *name, char *image)
{
struct grub_pe32_coff_header *pe_chdr;
struct grub_pe32_section_table *pe_shdr;
@ -471,14 +473,14 @@ convert_pe (FILE* fp, char *image)
pe_shdr = (struct grub_pe32_section_table *) (pe_chdr + 1);
num_sections = REL_SECTION;
section_map = write_section_data (fp, image, pe_chdr, pe_shdr);
section_map = write_section_data (fp, name, image, pe_chdr, pe_shdr);
write_symbol_table (fp, image, pe_chdr, pe_shdr, section_map);
write_symbol_table (fp, name, image, pe_chdr, pe_shdr, section_map);
free (section_map);
write_string_table (fp);
write_string_table (fp, name);
write_section_header (fp);
write_section_header (fp, name);
}
int
@ -533,7 +535,7 @@ main (int argc, char *argv[])
if (! fp)
grub_util_error ("cannot open %s", argv[optind]);
convert_pe (fp, image);
convert_pe (fp, argv[optind], image);
fclose (fp);