merge mainline into fuse
This commit is contained in:
commit
b93f1278a3
124 changed files with 1813 additions and 991 deletions
362
ChangeLog
362
ChangeLog
|
@ -1,3 +1,365 @@
|
|||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/commands/efi/fixvideo.c: Gettextize.
|
||||
* grub-core/commands/hashsum.c: Likewise.
|
||||
* grub-core/commands/i386/cmostest.c: Likewise.
|
||||
* grub-core/commands/i386/pc/drivemap.c: Likewise.
|
||||
* grub-core/commands/i386/pc/lsapm.c: Likewise.
|
||||
* grub-core/commands/i386/pc/sendkey.c: Likewise.
|
||||
* grub-core/commands/lsmmap.c: Likewise.
|
||||
* grub-core/commands/menuentry.c: Likewise.
|
||||
* grub-core/commands/mips/loongson/lsspd.c: Likewise.
|
||||
* grub-core/commands/setpci.c: Likewise.
|
||||
* grub-core/loader/i386/bsd.c: Likewise.
|
||||
* grub-core/loader/i386/linux.c: Likewise.
|
||||
* util/getroot.c: Likewise.
|
||||
* util/grub-editenv.c: Likewise.
|
||||
* util/grub-fstest.c: Likewise.
|
||||
* util/grub-mkfont.c: Likewise.
|
||||
* util/grub-mkimage.c: Likewise.
|
||||
* util/grub-mkpasswd-pbkdf2.c: Likewise.
|
||||
* util/grub-pe2elf.c: Likewise.
|
||||
* util/grub-probe.c: Likewise.
|
||||
* util/grub-setup.c: Likewise.
|
||||
* util/ieee1275/ofpath.c: Likewise.
|
||||
* util/misc.c: Likewise.
|
||||
* util/raid.c: Likewise.
|
||||
|
||||
2011-11-11 Robert Millan <rmh@gnu.org>
|
||||
|
||||
* util/getroot.c (grub_util_get_geom_abstraction): Remove
|
||||
__attribute__((unused)) from `os_dev', which *is* being used.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* include/grub/dl.h (GRUB_ARCH_DL_TRAMP_SIZE) [__ia64__]: Add back
|
||||
forgotten define.
|
||||
(GRUB_ARCH_DL_GOT_ALIGN) [__ia64__]: Redefine in terms of
|
||||
GRUB_IA64_DL_GOT_ALIGN.
|
||||
(GRUB_ARCH_DL_TRAMP_ALIGN) [__ia64__]: Redefine in terms of
|
||||
GRUB_IA64_DL_TRAMP_ALIGN.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Replace grub_fatal with normal errors in i386 linux loader.
|
||||
|
||||
* grub-core/loader/i386/linux.c (find_efi_mmap_size): Return 0 on error.
|
||||
(allocate_pages): Check find_efi_mmap_size return value.
|
||||
(grub_e820_add_region): Return error.
|
||||
(grub_linux_boot): Check mmap return value.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/commands/acpihalt.c: Gettextized.
|
||||
* grub-core/commands/cacheinfo.c: Likewise.
|
||||
* grub-core/commands/cmp.c: Likewise.
|
||||
* grub-core/commands/efi/loadbios.c: Likewise.
|
||||
* grub-core/commands/gptsync.c: Likewise.
|
||||
* grub-core/commands/ieee1275/suspend.c: Likewise.
|
||||
* grub-core/commands/legacycfg.c: Likewise.
|
||||
* grub-core/commands/memrw.c: Likewise.
|
||||
* grub-core/commands/minicmd.c: Likewise.
|
||||
* grub-core/commands/parttool.c: Likewise.
|
||||
* grub-core/commands/time.c: Likewise.
|
||||
* grub-core/commands/videoinfo.c: Likewise.
|
||||
* grub-core/disk/geli.c: Likewise.
|
||||
* grub-core/disk/i386/pc/biosdisk.c: Likewise.
|
||||
* grub-core/disk/luks.c: Likewise.
|
||||
* grub-core/disk/lvm.c: Likewise.
|
||||
* grub-core/font/font_cmd.c: Likewise.
|
||||
* grub-core/fs/zfs/zfscrypt.c: Likewise.
|
||||
* grub-core/fs/zfs/zfsinfo.c: Likewise.
|
||||
* grub-core/gfxmenu/view.c: Likewise.
|
||||
* grub-core/kern/emu/hostdisk.c: Likewise.
|
||||
* grub-core/kern/emu/main.c: Likewise.
|
||||
* grub-core/kern/emu/misc.c: Likewise.
|
||||
* grub-core/kern/emu/mm.c: Likewise.
|
||||
* grub-core/kern/mips/arc/init.c: Likewise.
|
||||
* grub-core/kern/mips/loongson/init.c: Likewise.
|
||||
* grub-core/kern/partition.c: Likewise.
|
||||
* grub-core/lib/i386/halt.c: Likewise.
|
||||
* grub-core/lib/mips/arc/reboot.c: Likewise.
|
||||
* grub-core/lib/mips/loongson/reboot.c: Likewise.
|
||||
* grub-core/loader/i386/pc/chainloader.c: Likewise.
|
||||
* grub-core/loader/i386/xnu.c: Likewise.
|
||||
* grub-core/loader/multiboot.c: Likewise.
|
||||
* grub-core/net/bootp.c: Likewise.
|
||||
* grub-core/net/net.c: Likewise.
|
||||
* grub-core/normal/term.c: Likewise.
|
||||
* grub-core/partmap/bsdlabel.c: Likewise.
|
||||
* grub-core/parttool/msdospart.c: Likewise.
|
||||
* grub-core/term/gfxterm.c: Likewise.
|
||||
* grub-core/term/terminfo.c: Likewise.
|
||||
* grub-core/video/i386/pc/vbe.c: Likewise.
|
||||
* util/grub-menulst2cfg.c: Likewise.
|
||||
* util/grub-mkdevicemap.c: Likewise.
|
||||
* util/grub-mklayout.c: Likewise.
|
||||
* util/grub-mkrelpath.c: Likewise.
|
||||
* util/grub-script-check.c: Likewise.
|
||||
* util/ieee1275/grub-ofpathname.c: Likewise.
|
||||
* util/resolve.c: Likewise.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Support %1$d syntax.
|
||||
|
||||
* tests/printf_unit_test.c: New file.
|
||||
* Makefile.util.def (printf_test): New test.
|
||||
* grub-core/kern/misc.c (grub_vsnprintf_real): Support %1$d syntax.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/hook/datehook.c (grub_read_hook_datetime): Small stylistic
|
||||
fix.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/efiemu/mm.c (grub_efiemu_mmap_fill): Change printf into
|
||||
dprintf.
|
||||
* grub-core/font/font.c (grub_font_load): Likewise.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/grub-macho2img.c: Add comment concerning gettext.
|
||||
* grub-core/lib/legacy_parse.c: Likewise.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/misc.c (grub_vprintf): Add missing va_end.
|
||||
(grub_xvasprintf): Likewise.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Add const keyword to grub_env_get and gettextize week days.
|
||||
|
||||
* grub-core/hook/datehook.c (grub_datetime_names): Make const.
|
||||
(grub_read_hook_datetime): Return const char *.
|
||||
* grub-core/kern/env.c (grub_env_get): Return const char *. All users
|
||||
updated.
|
||||
* grub-core/normal/datetime.c (grub_weekday_names): Make const.
|
||||
Mark for gettext.
|
||||
(grub_get_weekday_name): Return const char *. Call gettext.
|
||||
* grub-core/script/argv.c (grub_script_argv_append): Receive const
|
||||
char * and len as the argument. All users updated.
|
||||
(grub_script_argv_split_append): Receive const char *.
|
||||
* include/grub/datetime.h (grub_get_weekday_name): Update proto.
|
||||
* include/grub/env.h (grub_env_get): Likewise.
|
||||
(grub_env_read_hook_t): Return const char *.
|
||||
* include/grub/script_sh.h (grub_script_argv_append): Update proto.
|
||||
(grub_script_argv_split_append): Likewise.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/normal/main.c (grub_normal_execute): Remove leftover call.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/misc.c (grub_strstr): Moved from here ...
|
||||
* include/grub/misc.h (grub_strstr): ... here. Make static and inline.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_set_property):
|
||||
Fix prototype.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Fix mips compilation.
|
||||
|
||||
* grub-core/lib/xzembed/xz_dec_stream.c (xz_dec): Restrict hash_id to
|
||||
normal decoder.
|
||||
(hashes): Use in embed decoder as well (for sizes).
|
||||
(dec_stream_header): Fix embed decompressor logic.
|
||||
(dec_stream_footer): Likewise.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Issue
|
||||
an error and not a fatal on unrecognised relocation types.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/ieee1275/openfw.c (grub_ieee1275_parse_args):
|
||||
Issue error rather than printf on unknown arguments.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/ieee1275/ieee1275.c (grub_ieee1275_set_property):
|
||||
Make buf a const.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/fs/zfs/zfscrypt.c (GRUB_MOD_INIT), (GRUB_MOD_FINI):
|
||||
Fix module name.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/fs/ntfs.c (grub_ntfs_read_symlink): Stylistic fix. Remove
|
||||
leftover debug printf.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/fs/btrfs.c (grub_btrfs_embed): Spelling fix.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/efiemu/main.c (grub_efiemu_register_configuration_table):
|
||||
A stylistic fix.
|
||||
|
||||
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/commands/probe.c (grub_cmd_probe): Fix error message.
|
||||
|
||||
2011-11-10 Shea Levy <slevy@tieronedesign.com>
|
||||
|
||||
Allow all modules to perform serial IO
|
||||
|
||||
* grub-core/term-serial.c (grub_serial_find): Remove static qualifier
|
||||
* include/grub/serial.h (grub_serial_port_configure): New inline
|
||||
function.
|
||||
(grub_serial_port_fetch): Likewise.
|
||||
(grub_serial_port_put): Likewise.
|
||||
(grub_serial_port_fini): Likewise.
|
||||
(grub_serial_find): New proto.
|
||||
|
||||
2011-11-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Put symlink at the end of the node and fix a potential
|
||||
memory corruption.
|
||||
|
||||
* grub-core/fs/iso9660.c (grub_fshelp_node): New field have_symlink.
|
||||
Make symlink into an array.
|
||||
(set_rockridge): Set have_symlink and alloc_dirents.
|
||||
(grub_iso9660_read_symlink): Use new layout.
|
||||
(grub_iso9660_iterate_dir): Fix memory corruption.
|
||||
Use new layout.
|
||||
(grub_iso9660_dir): Set have_symlink.
|
||||
(grub_iso9660_open): Likewise.
|
||||
|
||||
2011-11-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Remove local keyword.
|
||||
|
||||
* util/grub-mkconfig_lib.in (version_test_numeric): Remove local.
|
||||
(version_test_gt): Likewise.
|
||||
(version_find_latest): Likewise.
|
||||
(gettext_printf): Likewise.
|
||||
* util/grub.d/10_windows.in (get_os_name_from_boot_ini): Likewise.
|
||||
|
||||
2011-11-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/fs/zfs/zfs.c (zfs_mount): Fix spurious warning.
|
||||
|
||||
2011-11-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Fix ZFS memory and resource leaks.
|
||||
|
||||
* grub-core/fs/zfs/zfs.c (fill_vdev_info_real): New paramter inserted.
|
||||
All users updated.
|
||||
Free type on exit.
|
||||
(fill_vdev_info): New parameter inserted. All users updated.
|
||||
(check_pool_label): Likewise.
|
||||
(scan_disk): Likewise.
|
||||
(scan_devices): Close non-inserted disks.
|
||||
(fzap_iterate): Free l.
|
||||
(unmount_device): Free children descripto memory.
|
||||
|
||||
2011-11-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Fix grub_strncat
|
||||
argument (access out of bounds).
|
||||
|
||||
2011-11-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/fs/btrfs.c (grub_btrfs_read_logical): Fix RAID10 logic for
|
||||
>= 6 drives.
|
||||
|
||||
2011-11-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* include/grub/i386/netbsd_bootinfo.h (grub_netbsd_btinfo_bootwedge):
|
||||
Fix declaration.
|
||||
|
||||
2011-11-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Fix several memory leaks.
|
||||
|
||||
* grub-core/fs/btrfs.c (grub_btrfs_dir): Fix memory leak.
|
||||
* grub-core/fs/cpio.c (grub_cpio_find_file): Likewise.
|
||||
(grub_cpio_dir): Likewise.
|
||||
* grub-core/fs/fat.c (grub_fat_label): Likewise.
|
||||
* grub-core/fs/jfs.c (grub_jfs_label): Likewise.
|
||||
* grub-core/fs/romfs.c (grub_romfs_close): Likewise.
|
||||
(grub_romfs_label): Likewise.
|
||||
* grub-core/fs/squash4.c (squash_mount): Use zalloc for safety.
|
||||
(squash_unmount): New function.
|
||||
(grub_squash_dir): Fix memory leak.
|
||||
(grub_squash_open): Likewise.
|
||||
(grub_squash_read): Likewise.
|
||||
(grub_squash_mtime): Likewise.
|
||||
* grub-core/fs/xfs.c (grub_xfs_open): Likewise.
|
||||
* grub-core/fs/zfs/zfs.c (check_pool_label): Likewise.
|
||||
* util/grub-fstest.c (fstest): Likewise.
|
||||
|
||||
2011-11-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* include/grub/misc.h (grub_strncat): Fix the order of conditionals to
|
||||
avoid accessing beyond the array.
|
||||
|
||||
2011-11-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* configure.ac: Add missing -mXX to TARGET_CPPFLAGS.
|
||||
|
||||
2011-11-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Several AFFS fixes.
|
||||
|
||||
* grub-core/fs/affs.c (grub_affs_bblock): Replace flags with version.
|
||||
(GRUB_AFFS_FLAG_FFS): Removed.
|
||||
(GRUB_AFFS_SYMLINK_SIZE): Likewise.
|
||||
(GRUB_AFFS_FILETYPE_DIR): Make positive and unsigned.
|
||||
(GRUB_AFFS_FILETYPE_DIR), (GRUB_AFFS_FILETYPE_REG): Fix a mix-up.
|
||||
(grub_fshelp_node): Make block 32-bit.
|
||||
Add block_cache and last_block_cache.
|
||||
(grub_affs_read_block): Fill and use block cache.
|
||||
(grub_affs_read_file): Removed.
|
||||
(grub_affs_mount): Zero-fill node. Fix version check. Don't reread
|
||||
boot block.
|
||||
(grub_affs_read_symlink): Fix symlink size. Add a \0 at the end for
|
||||
safety.
|
||||
(grub_affs_iterate_dir): Use more appropriate types. Zero-fill allocated
|
||||
space.
|
||||
(grub_affs_close): Free block cache.
|
||||
(grub_affs_read): Use grub_fshelp_read_file directly.
|
||||
|
||||
2011-11-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/fs/zfs/zfs.c (read_dva): Issue an error if read failed
|
||||
with no error set.
|
||||
|
||||
2011-11-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/lib/LzmaEnc.c (LzmaEnc_CodeOneBlock): Remove set but not
|
||||
used variable.
|
||||
* grub-core/kern/ia64/dl_helper.c (grub_ia64_dl_get_tramp_got_size):
|
||||
Likewise.
|
||||
|
||||
2011-11-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Fix potential problem with calling zfs_to_cpu and cpu_to_be in a row.
|
||||
|
||||
* grub-core/fs/zfs/zfscrypt.c (grub_zfs_decrypt_real): Use explicit
|
||||
byteswap when needed.
|
||||
|
||||
2011-11-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Fix FreeBSD compilation.
|
||||
|
||||
* grub-core/disk/geli.c (GRUB_MD_SHA256) [GRUB_UTIL]: Redefine in a way
|
||||
to avoid circular dependency.
|
||||
(GRUB_MD_SHA512) [GRUB_UTIL]: Likewise.
|
||||
* util/getroot.c (grub_util_follow_gpart_up): Move from here...
|
||||
* grub-core/kern/emu/hostdisk.c (+grub_util_follow_gpart_up): ... here.
|
||||
|
||||
2011-11-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Fix ZFS crypto error types.
|
||||
|
|
|
@ -675,6 +675,21 @@ program = {
|
|||
ldadd = '$(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
program = {
|
||||
testcase;
|
||||
name = printf_test;
|
||||
common = tests/printf_unit_test.c;
|
||||
common = tests/lib/unit_test.c;
|
||||
common = grub-core/kern/list.c;
|
||||
common = grub-core/kern/misc.c;
|
||||
common = grub-core/tests/lib/test.c;
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
program = {
|
||||
name = grub-menulst2cfg;
|
||||
mansection = 1;
|
||||
|
|
|
@ -464,6 +464,7 @@ if test "x$target_m32" = x1; then
|
|||
# Force 32-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
||||
TARGET_MODULE_FORMAT="elf32"
|
||||
fi
|
||||
|
@ -472,6 +473,7 @@ if test "x$target_m64" = x1; then
|
|||
# Force 64-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
||||
TARGET_MODULE_FORMAT="elf64"
|
||||
fi
|
||||
|
|
|
@ -33,6 +33,7 @@ typedef uint8_t grub_uint8_t;
|
|||
#endif
|
||||
|
||||
#include <grub/acpi.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
#include <grub/misc.h>
|
||||
|
@ -327,6 +328,6 @@ grub_acpi_halt (void)
|
|||
|
||||
grub_millisleep (1500);
|
||||
|
||||
grub_printf ("ACPI shutdown failed\n");
|
||||
grub_puts_ (N_("ACPI shutdown failed"));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -31,14 +31,14 @@ grub_rescue_cmd_info (struct grub_command *cmd __attribute__ ((unused)),
|
|||
unsigned long hits, misses;
|
||||
|
||||
grub_disk_cache_get_performance (&hits, &misses);
|
||||
grub_printf ("Disk cache: hits = %lu, misses = %lu ", 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);
|
||||
}
|
||||
else
|
||||
grub_printf ("(N/A)\n");
|
||||
grub_puts_ (N_("(N/A)"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (argc != 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
|
||||
|
||||
grub_printf ("Compare file `%s' with `%s':\n", args[0],
|
||||
args[1]);
|
||||
grub_printf_ (N_("Compare file `%s' with `%s':\n"), args[0],
|
||||
args[1]);
|
||||
|
||||
file1 = grub_file_open (args[0]);
|
||||
file2 = grub_file_open (args[1]);
|
||||
|
@ -51,9 +51,9 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto cleanup;
|
||||
|
||||
if (grub_file_size (file1) != grub_file_size (file2))
|
||||
grub_printf ("Files differ in size: %llu [%s], %llu [%s]\n",
|
||||
(unsigned long long) grub_file_size (file1), args[0],
|
||||
(unsigned long long) grub_file_size (file2), args[1]);
|
||||
grub_printf_ (N_("Files differ in size: %llu [%s], %llu [%s]\n"),
|
||||
(unsigned long long) grub_file_size (file1), args[0],
|
||||
(unsigned long long) grub_file_size (file2), args[1]);
|
||||
else
|
||||
{
|
||||
pos = 0;
|
||||
|
@ -78,9 +78,9 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
|||
{
|
||||
if (buf1[i] != buf2[i])
|
||||
{
|
||||
grub_printf ("Files differ at the offset %llu: 0x%x [%s], 0x%x [%s]\n",
|
||||
(unsigned long long) (i + pos), buf1[i], args[0],
|
||||
buf2[i], args[1]);
|
||||
grub_printf_ (N_("Files differ at the offset %llu: 0x%x [%s], 0x%x [%s]\n"),
|
||||
(unsigned long long) (i + pos), buf1[i],
|
||||
args[0], buf2[i], args[1]);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,8 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
|||
}
|
||||
while (rd2);
|
||||
|
||||
grub_printf ("The files are identical.\n");
|
||||
/* TRANSLATORS: it's always exactly 2 files. */
|
||||
grub_printf_ (N_("The files are identical.\n"));
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
|
|
@ -56,24 +56,24 @@ scan_card (grub_pci_device_t dev, grub_pci_id_t pciid)
|
|||
{
|
||||
grub_target_addr_t base;
|
||||
|
||||
grub_printf ("Found graphic card: %s\n", p->name);
|
||||
grub_dprintf ("fixvideo", "Found graphic card: %s\n", p->name);
|
||||
addr += 8 + p->mmio_bar * 4;
|
||||
base = grub_pci_read (addr);
|
||||
if ((! base) || (base & GRUB_PCI_ADDR_SPACE_IO) ||
|
||||
(base & GRUB_PCI_ADDR_MEM_PREFETCH))
|
||||
grub_printf ("Invalid MMIO bar %d\n", p->mmio_bar);
|
||||
grub_dprintf ("fixvideo", "Invalid MMIO bar %d\n", p->mmio_bar);
|
||||
else
|
||||
{
|
||||
base &= GRUB_PCI_ADDR_MEM_MASK;
|
||||
base += p->mmio_reg;
|
||||
|
||||
if (*((volatile grub_uint32_t *) base) != p->mmio_old)
|
||||
grub_printf ("Old value don't match\n");
|
||||
grub_dprintf ("fixvideo", "Old value doesn't match\n");
|
||||
else
|
||||
{
|
||||
*((volatile grub_uint32_t *) base) = 0;
|
||||
if (*((volatile grub_uint32_t *) base))
|
||||
grub_printf ("Set MMIO fails\n");
|
||||
grub_dprintf ("fixvideo", "Setting MMIO fails\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ scan_card (grub_pci_device_t dev, grub_pci_id_t pciid)
|
|||
p++;
|
||||
}
|
||||
|
||||
grub_printf ("Unknown graphic card: %x\n", pciid);
|
||||
grub_dprintf ("fixvideo", "Unknown graphic card: %x\n", pciid);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -49,7 +49,7 @@ enable_rom_area (void)
|
|||
rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
|
||||
if (*rom_ptr != BLANK_MEM)
|
||||
{
|
||||
grub_printf ("ROM image is present.\n");
|
||||
grub_puts_ (N_("ROM image is present."));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ enable_rom_area (void)
|
|||
*rom_ptr = 0;
|
||||
if (*rom_ptr != 0)
|
||||
{
|
||||
grub_printf ("Can\'t enable ROM area.\n");
|
||||
grub_puts_ (N_("Can\'t enable ROM area."));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ GRUB_MOD_INIT(loadbios)
|
|||
0, N_("Fake BIOS."));
|
||||
|
||||
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
|
||||
"BIOS_DUMP [INT10_DUMP]",
|
||||
N_("BIOS_DUMP [INT10_DUMP]"),
|
||||
N_("Load BIOS dump."));
|
||||
}
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
grub_printf ("New MBR is written to '%s'\n", args[0]);
|
||||
grub_printf_ (N_("New MBR is written to '%s'\n"), args[0]);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
|||
grub_file_close (file);
|
||||
if (err)
|
||||
{
|
||||
grub_printf ("%s: READ ERROR\n", p);
|
||||
grub_printf_ (N_("%s: READ ERROR\n"), p);
|
||||
if (!keep)
|
||||
{
|
||||
grub_file_close (hashlist);
|
||||
|
@ -155,7 +155,7 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
|||
}
|
||||
if (grub_crypto_memcmp (expected, actual, hash->mdlen) != 0)
|
||||
{
|
||||
grub_printf ("%s: HASH MISMATCH\n", p);
|
||||
grub_printf_ (N_("%s: HASH MISMATCH\n"), p);
|
||||
if (!keep)
|
||||
{
|
||||
grub_file_close (hashlist);
|
||||
|
@ -166,7 +166,7 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
|||
mismatch++;
|
||||
continue;
|
||||
}
|
||||
grub_printf ("%s: OK\n", p);
|
||||
grub_printf_ (N_("%s: OK\n"), p);
|
||||
}
|
||||
if (mismatch || unread)
|
||||
return grub_error (GRUB_ERR_TEST_FAILURE,
|
||||
|
@ -257,8 +257,8 @@ static grub_extcmd_t cmd, cmd_md5, cmd_sha1, cmd_sha256, cmd_sha512, cmd_crc;
|
|||
GRUB_MOD_INIT(hashsum)
|
||||
{
|
||||
cmd = grub_register_extcmd ("hashsum", grub_cmd_hashsum, 0,
|
||||
"hashsum -h HASH [-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]",
|
||||
N_("-h HASH [-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]"),
|
||||
N_("Compute or check hash checksum."),
|
||||
options);
|
||||
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum, 0,
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/cmos.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -86,11 +87,11 @@ static grub_command_t cmd, cmd_clean;
|
|||
GRUB_MOD_INIT(cmostest)
|
||||
{
|
||||
cmd = grub_register_command ("cmostest", grub_cmd_cmostest,
|
||||
"cmostest BYTE:BIT",
|
||||
"Test bit at BYTE:BIT in CMOS.");
|
||||
N_("BYTE:BIT"),
|
||||
N_("Test bit at BYTE:BIT in CMOS."));
|
||||
cmd_clean = grub_register_command ("cmosclean", grub_cmd_cmosclean,
|
||||
"cmosclean BYTE:BIT",
|
||||
"Clean bit at BYTE:BIT in CMOS.");
|
||||
N_("BYTE:BIT"),
|
||||
N_("Clean bit at BYTE:BIT in CMOS."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(cmostest)
|
||||
|
|
|
@ -178,11 +178,11 @@ list_mappings (void)
|
|||
/* Show: list mappings. */
|
||||
if (! map_head)
|
||||
{
|
||||
grub_printf ("No drives have been remapped\n");
|
||||
grub_puts_ (N_("No drives have been remapped"));
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_printf ("OS disk #num ------> GRUB/BIOS device\n");
|
||||
grub_puts_ (N_("OS disk #num ------> GRUB/BIOS device"));
|
||||
drivemap_node_t *curnode = map_head;
|
||||
while (curnode)
|
||||
{
|
||||
|
@ -363,7 +363,7 @@ uninstall_int13_handler (void)
|
|||
static int
|
||||
grub_get_root_biosnumber_drivemap (void)
|
||||
{
|
||||
char *biosnum;
|
||||
const char *biosnum;
|
||||
int ret = -1;
|
||||
grub_device_t dev;
|
||||
|
||||
|
|
|
@ -74,27 +74,27 @@ 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 ("Vesion %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",
|
||||
info.version >> 8, info.version & 0xff,
|
||||
info.cseg, info.cseg_len, info.offset,
|
||||
info.cseg_16, info.cseg_16_len,
|
||||
info.dseg, info.dseg_len);
|
||||
grub_printf_ (N_("Vesion %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"),
|
||||
info.version >> 8, info.version & 0xff,
|
||||
info.cseg, info.cseg_len, info.offset,
|
||||
info.cseg_16, info.cseg_16_len,
|
||||
info.dseg, info.dseg_len);
|
||||
grub_xputs (info.flags & GRUB_APM_FLAGS_16BITPROTECTED_SUPPORTED
|
||||
? "16-bit protected interface supported\n"
|
||||
: "16-bit protected interface unsupported\n");
|
||||
? _("16-bit protected interface supported\n")
|
||||
: _("16-bit protected interface unsupported\n"));
|
||||
grub_xputs (info.flags & GRUB_APM_FLAGS_32BITPROTECTED_SUPPORTED
|
||||
? "32-bit protected interface supported\n"
|
||||
: "32-bit protected interface unsupported\n");
|
||||
? _("32-bit protected interface supported\n")
|
||||
: _("32-bit protected interface unsupported\n"));
|
||||
grub_xputs (info.flags & GRUB_APM_FLAGS_CPUIDLE_SLOWS_DOWN
|
||||
? "CPU Idle slows down processor\n"
|
||||
: "CPU Idle doesn't slow down processor\n");
|
||||
? _("CPU Idle slows down processor\n")
|
||||
: _("CPU Idle doesn't slow down processor\n"));
|
||||
grub_xputs (info.flags & GRUB_APM_FLAGS_DISABLED
|
||||
? "APM disabled\n" : "APM enabled\n");
|
||||
? _("APM disabled\n") : _("APM enabled\n"));
|
||||
grub_xputs (info.flags & GRUB_APM_FLAGS_DISENGAGED
|
||||
? "APM disengaged\n" : "APM engaged\n");
|
||||
? _("APM disengaged\n") : _("APM engaged\n"));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/loader.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv2+");
|
||||
|
||||
|
@ -35,23 +36,23 @@ static int keylen = 0;
|
|||
static int noled = 0;
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"num", 'n', 0, "set numlock mode", "[on|off]", ARG_TYPE_STRING},
|
||||
{"caps", 'c', 0, "set capslock mode", "[on|off]", ARG_TYPE_STRING},
|
||||
{"scroll", 's', 0, "set scrolllock mode", "[on|off]", ARG_TYPE_STRING},
|
||||
{"insert", 0, 0, "set insert mode", "[on|off]", ARG_TYPE_STRING},
|
||||
{"pause", 0, 0, "set pause mode", "[on|off]", ARG_TYPE_STRING},
|
||||
{"left-shift", 0, 0, "press left shift", "[on|off]", ARG_TYPE_STRING},
|
||||
{"right-shift", 0, 0, "press right shift", "[on|off]", ARG_TYPE_STRING},
|
||||
{"sysrq", 0, 0, "press SysRq", "[on|off]", ARG_TYPE_STRING},
|
||||
{"numkey", 0, 0, "press NumLock key", "[on|off]", ARG_TYPE_STRING},
|
||||
{"capskey", 0, 0, "press CapsLock key", "[on|off]", ARG_TYPE_STRING},
|
||||
{"scrollkey", 0, 0, "press ScrollLock key", "[on|off]", ARG_TYPE_STRING},
|
||||
{"insertkey", 0, 0, "press Insert key", "[on|off]", ARG_TYPE_STRING},
|
||||
{"left-alt", 0, 0, "press left alt", "[on|off]", ARG_TYPE_STRING},
|
||||
{"right-alt", 0, 0, "press right alt", "[on|off]", ARG_TYPE_STRING},
|
||||
{"left-ctrl", 0, 0, "press left ctrl", "[on|off]", ARG_TYPE_STRING},
|
||||
{"right-ctrl", 0, 0, "press right ctrl", "[on|off]", ARG_TYPE_STRING},
|
||||
{"no-led", 0, 0, "don't update LED state", 0, 0},
|
||||
{"num", 'n', 0, N_("set numlock mode"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"caps", 'c', 0, N_("set capslock mode"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"scroll", 's', 0, N_("set scrolllock mode"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"insert", 0, 0, N_("set insert mode"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"pause", 0, 0, N_("set pause mode"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"left-shift", 0, 0, N_("press left shift"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"right-shift", 0, 0, N_("press right shift"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"sysrq", 0, 0, N_("press SysRq"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"numkey", 0, 0, N_("press NumLock key"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"capskey", 0, 0, N_("press CapsLock key"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"scrollkey", 0, 0, N_("press ScrollLock key"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"insertkey", 0, 0, N_("press Insert key"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"left-alt", 0, 0, N_("press left alt"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"right-alt", 0, 0, N_("press right alt"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"left-ctrl", 0, 0, N_("press left ctrl"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"right-ctrl", 0, 0, N_("press right ctrl"), "[on|off]", ARG_TYPE_STRING},
|
||||
{"no-led", 0, 0, N_("don't update LED state"), 0, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
static int simple_flag_offsets[]
|
||||
|
@ -369,8 +370,8 @@ static void *preboot_hook;
|
|||
GRUB_MOD_INIT (sendkey)
|
||||
{
|
||||
cmd = grub_register_extcmd ("sendkey", grub_cmd_sendkey, 0,
|
||||
"sendkey [KEYSTROKE1] [KEYSTROKE2] ...",
|
||||
"Emulate a keystroke", options);
|
||||
N_("[KEYSTROKE1] [KEYSTROKE2] ..."),
|
||||
N_("Emulate a keystroke"), options);
|
||||
|
||||
preboot_hook
|
||||
= grub_loader_register_preboot_hook (grub_sendkey_preboot,
|
||||
|
|
|
@ -31,7 +31,7 @@ grub_cmd_suspend (grub_command_t cmd __attribute__ ((unused)),
|
|||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
grub_printf ("Run 'go' to resume GRUB.\n");
|
||||
grub_puts_ (N_("Run 'go' to resume GRUB."));
|
||||
grub_ieee1275_enter ();
|
||||
grub_cls ();
|
||||
return 0;
|
||||
|
|
|
@ -344,7 +344,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||
int bsd_part = -1;
|
||||
{
|
||||
grub_device_t dev;
|
||||
char *hdbiasstr;
|
||||
const char *hdbiasstr;
|
||||
int hdbias = 0;
|
||||
hdbiasstr = grub_env_get ("legacy_hdbias");
|
||||
if (hdbiasstr)
|
||||
|
@ -723,7 +723,7 @@ grub_cmd_legacy_check_password (struct grub_command *mycmd __attribute__ ((unuse
|
|||
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "arguments expected");
|
||||
grub_printf ("Enter password:");
|
||||
grub_puts_ (N_("Enter password: "));
|
||||
if (!grub_password_get (entered, GRUB_AUTH_MAX_PASSLEN))
|
||||
return GRUB_ACCESS_DENIED;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ open_envblk_file (char *filename)
|
|||
|
||||
if (! filename)
|
||||
{
|
||||
char *prefix;
|
||||
const char *prefix;
|
||||
|
||||
prefix = grub_env_get ("prefix");
|
||||
if (prefix)
|
||||
|
@ -346,7 +346,7 @@ grub_cmd_save_env (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
|
||||
while (argc)
|
||||
{
|
||||
char *value;
|
||||
const char *value;
|
||||
|
||||
value = grub_env_get (args[0]);
|
||||
if (value)
|
||||
|
|
|
@ -26,13 +26,13 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||
|
||||
static const char *names[] =
|
||||
{
|
||||
[GRUB_MEMORY_AVAILABLE] = "available",
|
||||
[GRUB_MEMORY_RESERVED] = "reserved",
|
||||
[GRUB_MEMORY_ACPI] = "ACPI reclamaible",
|
||||
[GRUB_MEMORY_NVS] = "NVS",
|
||||
[GRUB_MEMORY_BADRAM] = "BadRAM",
|
||||
[GRUB_MEMORY_CODE] = "firmware code",
|
||||
[GRUB_MEMORY_HOLE] = "hole"
|
||||
[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")
|
||||
};
|
||||
|
||||
static grub_err_t
|
||||
|
@ -46,11 +46,11 @@ grub_cmd_lsmmap (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_memory_type_t type)
|
||||
{
|
||||
if (type < ARRAY_SIZE (names) && names[type])
|
||||
grub_printf ("base_addr = 0x%llx, length = 0x%llx, %s\n",
|
||||
(long long) addr, (long long) size, names[type]);
|
||||
grub_printf_ (N_("base_addr = 0x%llx, length = 0x%llx, %s\n"),
|
||||
(long long) addr, (long long) size, _(names[type]));
|
||||
else
|
||||
grub_printf ("base_addr = 0x%llx, length = 0x%llx, type = 0x%x\n",
|
||||
(long long) addr, (long long) size, type);
|
||||
grub_printf_ (N_("base_addr = 0x%llx, length = 0x%llx, type = 0x%x\n"),
|
||||
(long long) addr, (long long) size, type);
|
||||
return 0;
|
||||
}
|
||||
#ifndef GRUB_MACHINE_EMU
|
||||
|
|
|
@ -31,7 +31,7 @@ static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
|
|||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{0, 'v', 0, N_("Save read value into variable VARNAME."),
|
||||
"VARNAME", ARG_TYPE_STRING},
|
||||
N_("VARNAME"), ARG_TYPE_STRING},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"class", 1, GRUB_ARG_OPTION_REPEATABLE,
|
||||
N_("Menu entry type."), "STRING", ARG_TYPE_STRING},
|
||||
N_("Menu entry type."), N_("STRING"), ARG_TYPE_STRING},
|
||||
{"users", 2, 0,
|
||||
N_("Users allowed to boot this entry."), "USERNAME", ARG_TYPE_STRING},
|
||||
N_("Users allowed to boot this entry."), N_("USERNAME"), ARG_TYPE_STRING},
|
||||
{"hotkey", 3, 0,
|
||||
N_("Keyboard key for this entry."), "KEY", ARG_TYPE_STRING},
|
||||
N_("Keyboard key for this entry."), N_("KEY"), ARG_TYPE_STRING},
|
||||
{"source", 4, 0,
|
||||
N_("Menu entry definition as a string."), "STRING", ARG_TYPE_STRING},
|
||||
N_("Menu entry definition as a string."), N_("STRING"), ARG_TYPE_STRING},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)),
|
|||
{
|
||||
grub_dl_t mod;
|
||||
|
||||
grub_printf ("Name\tRef Count\tDependencies\n");
|
||||
grub_printf_ (N_("Name\tRef Count\tDependencies\n"));
|
||||
FOR_DL_MODULES (mod)
|
||||
{
|
||||
grub_dl_dep_t dep;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/cs5536.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -38,43 +39,44 @@ grub_cmd_lsspd (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
if (!grub_cs5536_find (&dev))
|
||||
{
|
||||
grub_printf ("No CS5536 found\n");
|
||||
grub_puts_ (N_("No CS5536 found"));
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
grub_printf ("CS5536 at %d:%d.%d\n", grub_pci_get_bus (dev),
|
||||
grub_pci_get_device (dev), grub_pci_get_function (dev));
|
||||
grub_printf_ (N_("CS5536 at %d:%d.%d\n"), grub_pci_get_bus (dev),
|
||||
grub_pci_get_device (dev), grub_pci_get_function (dev));
|
||||
|
||||
err = grub_cs5536_init_smbus (dev, 0x7fff, &smbbase);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
grub_printf ("SMB base = 0x%x\n", smbbase);
|
||||
grub_printf_ (N_("SMB base = 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 ("Device %d\n", i);
|
||||
grub_printf_ (N_("Device %d\n"), i);
|
||||
err = grub_cs5536_read_spd (smbbase, i, &spd);
|
||||
if (err)
|
||||
{
|
||||
grub_print_error ();
|
||||
continue;
|
||||
}
|
||||
grub_printf ("Written SPD bytes: %d B.\n", spd.written_size);
|
||||
grub_printf ("Total flash size: %d B.\n", 1 << spd.log_total_flash_size);
|
||||
grub_printf_ (N_("Written SPD bytes: %d B.\n"), spd.written_size);
|
||||
grub_printf_ (N_("Total flash size: %d B.\n"),
|
||||
1 << spd.log_total_flash_size);
|
||||
if (spd.memory_type == GRUB_SMBUS_SPD_MEMORY_TYPE_DDR2)
|
||||
{
|
||||
char str[sizeof (spd.ddr2.part_number) + 1];
|
||||
grub_printf ("Memory type: DDR2.\n");
|
||||
grub_puts_ (N_("Memory type: DDR2."));
|
||||
grub_memcpy (str, spd.ddr2.part_number,
|
||||
sizeof (spd.ddr2.part_number));
|
||||
str[sizeof (spd.ddr2.part_number)] = 0;
|
||||
grub_printf ("Part no: %s.\n", str);
|
||||
grub_printf_ (N_("Part no: %s.\n"), str);
|
||||
}
|
||||
else
|
||||
grub_printf ("Memory type: Unknown.\n");
|
||||
grub_puts_ (N_("Memory type: Unknown."));
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
|
@ -85,7 +87,7 @@ static grub_command_t cmd;
|
|||
GRUB_MOD_INIT(lsspd)
|
||||
{
|
||||
cmd = grub_register_command ("lsspd", grub_cmd_lsspd, 0,
|
||||
"Print Memory information.");
|
||||
N_("Print Memory information."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(lsspd)
|
||||
|
|
|
@ -37,9 +37,9 @@ static struct grub_parttool *parts = 0;
|
|||
static int curhandle = 0;
|
||||
static grub_dl_t mymod;
|
||||
static char helpmsg[] =
|
||||
"Perform COMMANDS on partition.\n"
|
||||
"Use \"parttool PARTITION help\" for the list "
|
||||
"of available commands.";
|
||||
N_("Perform COMMANDS on partition.\n"
|
||||
"Use \"parttool PARTITION help\" for the list "
|
||||
"of available commands.");
|
||||
|
||||
int
|
||||
grub_parttool_register(const char *part_name,
|
||||
|
@ -128,7 +128,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
|||
break;
|
||||
|
||||
case GRUB_PARTTOOL_ARG_VAL:
|
||||
grub_printf ("=VAL");
|
||||
grub_xputs (_("=VAL"));
|
||||
spacing -= 4;
|
||||
break;
|
||||
|
||||
|
@ -137,18 +137,18 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
|||
}
|
||||
while (spacing-- > 0)
|
||||
grub_printf (" ");
|
||||
grub_printf ("%s\n", curarg->desc);
|
||||
grub_puts_ (curarg->desc);
|
||||
}
|
||||
}
|
||||
if (! found)
|
||||
grub_printf ("Sorry no parttool is available for %s\n",
|
||||
grub_printf_ (N_("Sorry no parttool is available for %s\n"),
|
||||
dev->disk->partition->partmap->name);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
if (argc < 1)
|
||||
{
|
||||
grub_printf ("%s\n", helpmsg);
|
||||
grub_puts_ (helpmsg);
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "too few arguments");
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
return err;
|
||||
if (! label)
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"uuid for this FS isn't supported yet");
|
||||
"label for this FS isn't supported yet");
|
||||
|
||||
if (state[0].set)
|
||||
grub_env_set (state[0].arg, label);
|
||||
|
|
|
@ -66,12 +66,12 @@ static struct pci_register pci_registers[] =
|
|||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{0, 'd', 0, "Select device by vendor and device IDs.",
|
||||
"[vendor]:[device]", ARG_TYPE_STRING},
|
||||
{0, 's', 0, "Select device by its position on the bus.",
|
||||
"[bus]:[slot][.func]", ARG_TYPE_STRING},
|
||||
{0, 'v', 0, "Save read value into variable VARNAME.",
|
||||
"VARNAME", ARG_TYPE_STRING},
|
||||
{0, 'd', 0, N_("Select device by vendor and device IDs."),
|
||||
N_("[vendor]:[device]"), ARG_TYPE_STRING},
|
||||
{0, 's', 0, N_("Select device by its position on the bus."),
|
||||
N_("[bus]:[slot][.func]"), ARG_TYPE_STRING},
|
||||
{0, 'v', 0, N_("Save read value into variable VARNAME."),
|
||||
N_("VARNAME"), ARG_TYPE_STRING},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -128,7 +128,7 @@ grub_setpci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
|
|||
|
||||
if (!write_mask)
|
||||
{
|
||||
grub_printf ("Register %x of %d:%d.%d is %x\n", regaddr,
|
||||
grub_printf (N_("Register %x of %d:%d.%d is %x\n"), regaddr,
|
||||
grub_pci_get_bus (dev),
|
||||
grub_pci_get_device (dev),
|
||||
grub_pci_get_function (dev),
|
||||
|
|
|
@ -47,8 +47,8 @@ grub_cmd_time (grub_command_t ctxt __attribute__ ((unused)),
|
|||
(cmd->func) (cmd, argc - 1, &args[1]);
|
||||
end = grub_get_time_ms ();
|
||||
|
||||
grub_printf ("Elapsed time: %d.%03d seconds \n", (end - start) / 1000,
|
||||
(end - start) % 1000);
|
||||
grub_printf_ (N_("Elapsed time: %d.%03d seconds \n"), (end - start) / 1000,
|
||||
(end - start) % 1000);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
|
|
@ -52,36 +52,36 @@ hook (const struct grub_video_mode_info *info)
|
|||
grub_printf ("%4d x %4d x %2d ", info->width, info->height, info->bpp);
|
||||
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_PURE_TEXT)
|
||||
grub_printf ("Text-only ");
|
||||
grub_xputs (_("Text-only "));
|
||||
/* Show mask and position details for direct color modes. */
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_RGB)
|
||||
grub_printf ("Direct, mask: %d/%d/%d/%d pos: %d/%d/%d/%d",
|
||||
info->red_mask_size,
|
||||
info->green_mask_size,
|
||||
info->blue_mask_size,
|
||||
info->reserved_mask_size,
|
||||
info->red_field_pos,
|
||||
info->green_field_pos,
|
||||
info->blue_field_pos,
|
||||
info->reserved_field_pos);
|
||||
grub_printf_ (N_("Direct, mask: %d/%d/%d/%d pos: %d/%d/%d/%d"),
|
||||
info->red_mask_size,
|
||||
info->green_mask_size,
|
||||
info->blue_mask_size,
|
||||
info->reserved_mask_size,
|
||||
info->red_field_pos,
|
||||
info->green_field_pos,
|
||||
info->blue_field_pos,
|
||||
info->reserved_field_pos);
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_INDEX_COLOR)
|
||||
grub_printf ("Packed ");
|
||||
grub_xputs (_("Packed "));
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_YUV)
|
||||
grub_printf ("YUV ");
|
||||
grub_xputs (_("YUV "));
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_PLANAR)
|
||||
grub_printf ("Planar ");
|
||||
grub_xputs (_("Planar "));
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_HERCULES)
|
||||
grub_printf ("Hercules ");
|
||||
grub_xputs (_("Hercules "));
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_CGA)
|
||||
grub_printf ("CGA ");
|
||||
grub_xputs (_("CGA "));
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_NONCHAIN4)
|
||||
grub_printf ("Non-chain 4 ");
|
||||
grub_xputs (_("Non-chain 4 "));
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP)
|
||||
grub_printf ("Monochrome ");
|
||||
grub_xputs (_("Monochrome "));
|
||||
if (info->mode_type & GRUB_VIDEO_MODE_TYPE_UNKNOWN)
|
||||
grub_printf ("Unknown ");
|
||||
grub_xputs (_("Unknown "));
|
||||
|
||||
grub_printf ("\n");
|
||||
grub_xputs ("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -93,19 +93,19 @@ print_edid (struct grub_video_edid_info *edid_info)
|
|||
|
||||
if (grub_video_edid_checksum (edid_info))
|
||||
{
|
||||
grub_printf (" EDID checksum invalid\n");
|
||||
grub_puts_ (N_(" EDID checksum invalid"));
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
grub_printf (" EDID version: %u.%u\n",
|
||||
edid_info->version, edid_info->revision);
|
||||
grub_printf_ (N_(" EDID version: %u.%u\n"),
|
||||
edid_info->version, edid_info->revision);
|
||||
if (grub_video_edid_preferred_mode (edid_info, &edid_width, &edid_height)
|
||||
== GRUB_ERR_NONE)
|
||||
grub_printf (" Preferred mode: %ux%u\n", edid_width, edid_height);
|
||||
grub_printf_ (N_(" Preferred mode: %ux%u\n"), edid_width, edid_height);
|
||||
else
|
||||
{
|
||||
grub_printf (" No preferred mode available\n");
|
||||
grub_printf_ (N_(" No preferred mode available\n"));
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
}
|
||||
|
@ -147,20 +147,20 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
id = grub_video_get_driver_id ();
|
||||
|
||||
grub_printf ("List of supported video modes:\n");
|
||||
grub_printf ("Legend: P=Packed pixel, D=Direct color, "
|
||||
"mask/pos=R/G/B/reserved\n");
|
||||
grub_puts_ (N_("List of supported video modes:"));
|
||||
grub_puts_ (N_("Legend: P=Packed pixel, D=Direct color, "
|
||||
"mask/pos=R/G/B/reserved"));
|
||||
|
||||
FOR_VIDEO_ADAPTERS (adapter)
|
||||
{
|
||||
struct grub_video_mode_info info;
|
||||
struct grub_video_edid_info edid_info;
|
||||
|
||||
grub_printf ("Adapter '%s':\n", adapter->name);
|
||||
grub_printf_ (N_("Adapter '%s':\n"), adapter->name);
|
||||
|
||||
if (!adapter->iterate)
|
||||
{
|
||||
grub_printf (" No info available\n");
|
||||
grub_puts_ (N_(" No info available"));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
|
|||
{
|
||||
if (adapter->init ())
|
||||
{
|
||||
grub_printf (" Failed\n");
|
||||
grub_puts_ (N_(" Failed"));
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
continue;
|
||||
}
|
||||
|
@ -215,12 +215,13 @@ static grub_command_t cmd_vbe;
|
|||
|
||||
GRUB_MOD_INIT(videoinfo)
|
||||
{
|
||||
cmd = grub_register_command ("videoinfo", grub_cmd_videoinfo, "[WxH[xD]]",
|
||||
cmd = grub_register_command ("videoinfo", grub_cmd_videoinfo, N_("[WxH[xD]]"),
|
||||
N_("List available video modes. If "
|
||||
"resolution is given show only modes"
|
||||
" matching it."));
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
cmd_vbe = grub_register_command ("vbeinfo", grub_cmd_videoinfo, "[WxH[xD]]",
|
||||
cmd_vbe = grub_register_command ("vbeinfo", grub_cmd_videoinfo,
|
||||
N_("[WxH[xD]]"),
|
||||
N_("List available video modes. If "
|
||||
"resolution is given show only modes"
|
||||
" matching it."));
|
||||
|
|
|
@ -436,7 +436,7 @@ wildcard_expand (const char *s, char ***strs)
|
|||
|
||||
else if (*start == '/') /* no device part */
|
||||
{
|
||||
char *root;
|
||||
const char *root;
|
||||
char *prefix;
|
||||
|
||||
root = grub_env_get ("root");
|
||||
|
|
|
@ -58,6 +58,38 @@
|
|||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* Dirty trick to solve circular dependency. */
|
||||
#ifdef GRUB_UTIL
|
||||
|
||||
#include <grub/util/misc.h>
|
||||
|
||||
#undef GRUB_MD_SHA256
|
||||
#undef GRUB_MD_SHA512
|
||||
|
||||
static const gcry_md_spec_t *
|
||||
grub_md_sha256_real (void)
|
||||
{
|
||||
const gcry_md_spec_t *ret;
|
||||
ret = grub_crypto_lookup_md_by_name ("sha256");
|
||||
if (!ret)
|
||||
grub_util_error ("Coulnd't load sha256");
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const gcry_md_spec_t *
|
||||
grub_md_sha512_real (void)
|
||||
{
|
||||
const gcry_md_spec_t *ret;
|
||||
ret = grub_crypto_lookup_md_by_name ("sha512");
|
||||
if (!ret)
|
||||
grub_util_error ("Coulnd't load sha512");
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define GRUB_MD_SHA256 grub_md_sha256_real()
|
||||
#define GRUB_MD_SHA512 grub_md_sha512_real()
|
||||
#endif
|
||||
|
||||
struct grub_geli_key
|
||||
{
|
||||
grub_uint8_t iv_key[64];
|
||||
|
@ -194,7 +226,7 @@ grub_util_get_geli_uuid (const char *dev)
|
|||
|
||||
uuid = xmalloc (GRUB_MD_SHA256->mdlen * 2 + 1);
|
||||
if (grub_util_fd_read (fd, (void *) &hdr, 512) < 0)
|
||||
grub_util_error ("couldn't read ELI metadata");
|
||||
grub_util_error (_("couldn't read ELI metadata"));
|
||||
|
||||
COMPILE_TIME_ASSERT (sizeof (header) <= 512);
|
||||
header = (void *) &hdr;
|
||||
|
@ -203,7 +235,7 @@ grub_util_get_geli_uuid (const char *dev)
|
|||
if (grub_memcmp (header->magic, GELI_MAGIC, sizeof (GELI_MAGIC))
|
||||
|| grub_le_to_cpu32 (header->version) > 5
|
||||
|| grub_le_to_cpu32 (header->version) < 1)
|
||||
grub_util_error ("wrong ELI magic or version");
|
||||
grub_util_error (_("wrong ELI magic or version"));
|
||||
|
||||
err = make_uuid ((void *) &hdr, uuid);
|
||||
if (err)
|
||||
|
@ -386,15 +418,15 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
|||
keysize = grub_le_to_cpu16 (header.keylen) / 8;
|
||||
grub_memset (zero, 0, sizeof (zero));
|
||||
|
||||
grub_printf ("Attempting to decrypt master key...\n");
|
||||
grub_puts_ (N_("Attempting to decrypt master key..."));
|
||||
|
||||
/* Get the passphrase from the user. */
|
||||
tmp = NULL;
|
||||
if (source->partition)
|
||||
tmp = grub_partition_get_name (source->partition);
|
||||
grub_printf ("Enter passphrase for %s%s%s (%s): ", source->name,
|
||||
source->partition ? "," : "", tmp ? : "",
|
||||
dev->uuid);
|
||||
grub_printf_ (N_("Enter passphrase for %s%s%s (%s): "), source->name,
|
||||
source->partition ? "," : "", tmp ? : "",
|
||||
dev->uuid);
|
||||
grub_free (tmp);
|
||||
if (!grub_password_get (passphrase, MAX_PASSPHRASE))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Passphrase not supplied");
|
||||
|
@ -481,7 +513,7 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
|||
|
||||
if (grub_memcmp (candidate_key.hmac, key_hmac, dev->hash->mdlen) != 0)
|
||||
continue;
|
||||
grub_printf ("Slot %d opened\n", i);
|
||||
grub_printf_ (N_("Slot %d opened\n"), i);
|
||||
|
||||
/* Set the master key. */
|
||||
if (!dev->rekey)
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -625,7 +626,7 @@ GRUB_MOD_INIT(biosdisk)
|
|||
|
||||
if (grub_disk_firmware_is_tainted)
|
||||
{
|
||||
grub_printf ("Firmware is marked as tainted, refusing to initialize.\n");
|
||||
grub_puts_ (N_("Firmware is marked as tainted, refusing to initialize."));
|
||||
return;
|
||||
}
|
||||
grub_disk_firmware_fini = grub_disk_biosdisk_fini;
|
||||
|
|
|
@ -316,7 +316,7 @@ luks_recover_key (grub_disk_t source,
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
grub_printf ("Attempting to decrypt master key...\n");
|
||||
grub_puts_ (N_("Attempting to decrypt master key..."));
|
||||
keysize = grub_be_to_cpu32 (header.keyBytes);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE (header.keyblock); i++)
|
||||
|
@ -332,7 +332,7 @@ luks_recover_key (grub_disk_t source,
|
|||
tmp = NULL;
|
||||
if (source->partition)
|
||||
tmp = grub_partition_get_name (source->partition);
|
||||
grub_printf ("Enter passphrase for %s%s%s (%s): ", source->name,
|
||||
grub_printf_ (N_("Enter passphrase for %s%s%s (%s): "), source->name,
|
||||
source->partition ? "," : "", tmp ? : "",
|
||||
dev->uuid);
|
||||
grub_free (tmp);
|
||||
|
@ -434,7 +434,7 @@ luks_recover_key (grub_disk_t source,
|
|||
continue;
|
||||
}
|
||||
|
||||
grub_printf ("Slot %d opened\n", i);
|
||||
grub_printf_ (N_("Slot %d opened\n"), i);
|
||||
|
||||
/* Set the master key. */
|
||||
gcry_err = grub_cryptodisk_setkey (dev, candidate_key, keysize);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/lvm.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
#include <grub/emu/misc.h>
|
||||
|
@ -775,7 +776,7 @@ grub_lvm_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",
|
||||
grub_util_error (_("Couldn't find PV %s. Check your device.map"),
|
||||
pv->name);
|
||||
tmp = grub_malloc (sizeof (*tmp));
|
||||
tmp->disk = pv->disk;
|
||||
|
|
|
@ -149,7 +149,8 @@ grub_efiemu_register_configuration_table (grub_efi_guid_t guid,
|
|||
if (! get_table && ! data)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"you must set at least get_table or data");
|
||||
if ((err = grub_efiemu_unregister_configuration_table (guid)))
|
||||
err = grub_efiemu_unregister_configuration_table (guid);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
tbl = (struct grub_efiemu_configuration_table *) grub_malloc (sizeof (*tbl));
|
||||
|
|
|
@ -404,7 +404,8 @@ grub_efiemu_mmap_fill (void)
|
|||
GRUB_EFI_ACPI_MEMORY_NVS);
|
||||
|
||||
default:
|
||||
grub_printf ("Unknown memory type %d. Assuming unusable\n", type);
|
||||
grub_dprintf ("efiemu",
|
||||
"Unknown memory type %d. Assuming unusable\n", type);
|
||||
case GRUB_MEMORY_RESERVED:
|
||||
return grub_efiemu_add_to_mmap (addr, size,
|
||||
GRUB_EFI_UNUSABLE_MEMORY);
|
||||
|
|
|
@ -608,7 +608,7 @@ grub_font_load (const char *filename)
|
|||
|
||||
if (!font->name)
|
||||
{
|
||||
grub_printf ("Note: Font has no name.\n");
|
||||
grub_dprintf ("font", "Font has no name.\n");
|
||||
font->name = grub_strdup ("Unknown");
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ lsfonts_command (grub_command_t cmd __attribute__ ((unused)),
|
|||
{
|
||||
struct grub_font_node *node;
|
||||
|
||||
grub_printf ("Loaded fonts:\n");
|
||||
grub_puts_ (N_("Loaded fonts:"));
|
||||
for (node = grub_font_list; node; node = node->next)
|
||||
{
|
||||
grub_font_t font = node->value;
|
||||
|
|
|
@ -32,15 +32,11 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||
struct grub_affs_bblock
|
||||
{
|
||||
grub_uint8_t type[3];
|
||||
grub_uint8_t flags;
|
||||
grub_uint8_t version;
|
||||
grub_uint32_t checksum;
|
||||
grub_uint32_t rootblock;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Set if the filesystem is a AFFS filesystem. Otherwise this is an
|
||||
OFS filesystem. */
|
||||
#define GRUB_AFFS_FLAG_FFS 1
|
||||
|
||||
/* The affs rootblock. */
|
||||
struct grub_affs_rblock
|
||||
{
|
||||
|
@ -85,19 +81,19 @@ struct grub_affs_file
|
|||
#define GRUB_AFFS_BLOCKPTR_OFFSET 24
|
||||
#define GRUB_AFFS_SYMLINK_OFFSET 24
|
||||
|
||||
#define GRUB_AFFS_SYMLINK_SIZE(blocksize) ((blocksize) - 225)
|
||||
|
||||
#define GRUB_AFFS_FILETYPE_DIR -3
|
||||
#define GRUB_AFFS_FILETYPE_REG 2
|
||||
#define GRUB_AFFS_FILETYPE_REG 0xfffffffd
|
||||
#define GRUB_AFFS_FILETYPE_DIR 2
|
||||
#define GRUB_AFFS_FILETYPE_SYMLINK 3
|
||||
|
||||
|
||||
struct grub_fshelp_node
|
||||
{
|
||||
struct grub_affs_data *data;
|
||||
grub_disk_addr_t block;
|
||||
grub_uint32_t block;
|
||||
struct grub_fshelp_node *parent;
|
||||
struct grub_affs_file di;
|
||||
grub_uint32_t *block_cache;
|
||||
grub_uint32_t last_block_cache;
|
||||
};
|
||||
|
||||
/* Information about a "mounted" affs filesystem. */
|
||||
|
@ -120,32 +116,46 @@ static grub_dl_t my_mod;
|
|||
static grub_disk_addr_t
|
||||
grub_affs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
||||
{
|
||||
int links;
|
||||
grub_uint32_t target, curblock;
|
||||
grub_uint32_t pos;
|
||||
int block = node->block;
|
||||
struct grub_affs_file file;
|
||||
struct grub_affs_data *data = node->data;
|
||||
grub_uint64_t mod;
|
||||
|
||||
if (!node->block_cache)
|
||||
{
|
||||
node->block_cache = grub_malloc ((((grub_be_to_cpu32 (node->di.size)
|
||||
+ 511) >> 9) / data->htsize + 1)
|
||||
* sizeof (node->block_cache[0]));
|
||||
if (!node->block_cache)
|
||||
return -1;
|
||||
node->last_block_cache = 0;
|
||||
node->block_cache[0] = node->block;
|
||||
}
|
||||
|
||||
/* Files are at most 2G on AFFS, so no need for 64-bit division. */
|
||||
target = (grub_uint32_t) fileblock / data->htsize;
|
||||
mod = (grub_uint32_t) fileblock % data->htsize;
|
||||
/* Find the block that points to the fileblock we are looking up by
|
||||
following the chain until the right table is reached. */
|
||||
for (links = grub_divmod64 (fileblock, data->htsize, &mod); links; links--)
|
||||
for (curblock = node->last_block_cache + 1; curblock <= target; curblock++)
|
||||
{
|
||||
grub_disk_read (data->disk, block + data->blocksize - 1,
|
||||
grub_disk_read (data->disk,
|
||||
node->block_cache[curblock - 1] + data->blocksize - 1,
|
||||
data->blocksize * (GRUB_DISK_SECTOR_SIZE
|
||||
- GRUB_AFFS_FILE_LOCATION),
|
||||
sizeof (file), &file);
|
||||
if (grub_errno)
|
||||
return 0;
|
||||
|
||||
block = grub_be_to_cpu32 (file.extension);
|
||||
node->block_cache[curblock] = grub_be_to_cpu32 (file.extension);
|
||||
node->last_block_cache = curblock;
|
||||
}
|
||||
|
||||
/* Translate the fileblock to the block within the right table. */
|
||||
fileblock = mod;
|
||||
grub_disk_read (data->disk, block,
|
||||
grub_disk_read (data->disk, node->block_cache[target],
|
||||
GRUB_AFFS_BLOCKPTR_OFFSET
|
||||
+ (data->htsize - fileblock - 1) * sizeof (pos),
|
||||
+ (data->htsize - mod - 1) * sizeof (pos),
|
||||
sizeof (pos), &pos);
|
||||
if (grub_errno)
|
||||
return 0;
|
||||
|
@ -153,21 +163,6 @@ grub_affs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
|||
return grub_be_to_cpu32 (pos);
|
||||
}
|
||||
|
||||
|
||||
/* Read LEN bytes from the file described by DATA starting with byte
|
||||
POS. Return the amount of read bytes in READ. */
|
||||
static grub_ssize_t
|
||||
grub_affs_read_file (grub_fshelp_node_t node,
|
||||
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
|
||||
unsigned offset, unsigned length),
|
||||
grub_off_t pos, grub_size_t len, char *buf)
|
||||
{
|
||||
return grub_fshelp_read_file (node->data->disk, node, read_hook,
|
||||
pos, len, buf, grub_affs_read_block,
|
||||
grub_be_to_cpu32 (node->di.size), 0);
|
||||
}
|
||||
|
||||
|
||||
static struct grub_affs_data *
|
||||
grub_affs_mount (grub_disk_t disk)
|
||||
{
|
||||
|
@ -178,7 +173,7 @@ grub_affs_mount (grub_disk_t disk)
|
|||
int checksum = 0;
|
||||
int blocksize = 0;
|
||||
|
||||
data = grub_malloc (sizeof (struct grub_affs_data));
|
||||
data = grub_zalloc (sizeof (struct grub_affs_data));
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
|
@ -196,18 +191,12 @@ grub_affs_mount (grub_disk_t disk)
|
|||
}
|
||||
|
||||
/* Test if the filesystem is a OFS filesystem. */
|
||||
if (! (data->bblock.flags & GRUB_AFFS_FLAG_FFS))
|
||||
if (data->bblock.version < 1)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS, "OFS not yet supported");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Read the bootblock. */
|
||||
grub_disk_read (disk, 0, 0, sizeof (struct grub_affs_bblock),
|
||||
&data->bblock);
|
||||
if (grub_errno)
|
||||
goto fail;
|
||||
|
||||
/* No sane person uses more than 8KB for a block. At least I hope
|
||||
for that person because in that case this won't work. */
|
||||
rootblock = grub_malloc (GRUB_DISK_SECTOR_SIZE * 16);
|
||||
|
@ -270,18 +259,21 @@ grub_affs_read_symlink (grub_fshelp_node_t node)
|
|||
{
|
||||
struct grub_affs_data *data = node->data;
|
||||
char *symlink;
|
||||
const grub_size_t symlink_size = (data->blocksize * GRUB_DISK_SECTOR_SIZE
|
||||
- 225);
|
||||
|
||||
symlink = grub_malloc (GRUB_AFFS_SYMLINK_SIZE (data->blocksize));
|
||||
symlink = grub_malloc (symlink_size + 1);
|
||||
if (!symlink)
|
||||
return 0;
|
||||
|
||||
grub_disk_read (data->disk, node->block, GRUB_AFFS_SYMLINK_OFFSET,
|
||||
GRUB_AFFS_SYMLINK_SIZE (data->blocksize), symlink);
|
||||
symlink_size, symlink);
|
||||
if (grub_errno)
|
||||
{
|
||||
grub_free (symlink);
|
||||
return 0;
|
||||
}
|
||||
symlink[symlink_size] = 1;
|
||||
grub_dprintf ("affs", "Symlink: `%s'\n", symlink);
|
||||
return symlink;
|
||||
}
|
||||
|
@ -301,24 +293,24 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
|||
grub_uint32_t *hashtable;
|
||||
|
||||
auto int NESTED_FUNC_ATTR grub_affs_create_node (const char *name,
|
||||
grub_disk_addr_t block,
|
||||
grub_uint32_t block,
|
||||
const struct grub_affs_file *fil);
|
||||
|
||||
int NESTED_FUNC_ATTR grub_affs_create_node (const char *name,
|
||||
grub_disk_addr_t block,
|
||||
grub_uint32_t block,
|
||||
const struct grub_affs_file *fil)
|
||||
{
|
||||
int type;
|
||||
node = grub_malloc (sizeof (*node));
|
||||
node = grub_zalloc (sizeof (*node));
|
||||
if (!node)
|
||||
{
|
||||
grub_free (hashtable);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((int) grub_be_to_cpu32 (fil->type) == GRUB_AFFS_FILETYPE_DIR)
|
||||
if (grub_be_to_cpu32 (fil->type) == GRUB_AFFS_FILETYPE_REG)
|
||||
type = GRUB_FSHELP_REG;
|
||||
else if (grub_be_to_cpu32 (fil->type) == GRUB_AFFS_FILETYPE_REG)
|
||||
else if (grub_be_to_cpu32 (fil->type) == GRUB_AFFS_FILETYPE_DIR)
|
||||
type = GRUB_FSHELP_DIR;
|
||||
else if (grub_be_to_cpu32 (fil->type) == GRUB_AFFS_FILETYPE_SYMLINK)
|
||||
type = GRUB_FSHELP_SYMLINK;
|
||||
|
@ -339,7 +331,7 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
|||
}
|
||||
|
||||
/* Create the directory entries for `.' and `..'. */
|
||||
node = grub_malloc (sizeof (*node));
|
||||
node = grub_zalloc (sizeof (*node));
|
||||
if (!node)
|
||||
return 1;
|
||||
|
||||
|
@ -348,7 +340,7 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
|||
return 1;
|
||||
if (dir->parent)
|
||||
{
|
||||
node = grub_malloc (sizeof (*node));
|
||||
node = grub_zalloc (sizeof (*node));
|
||||
if (!node)
|
||||
return 1;
|
||||
*node = *dir->parent;
|
||||
|
@ -356,7 +348,7 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
|||
return 1;
|
||||
}
|
||||
|
||||
hashtable = grub_malloc (data->htsize * sizeof (*hashtable));
|
||||
hashtable = grub_zalloc (data->htsize * sizeof (*hashtable));
|
||||
if (!hashtable)
|
||||
return 1;
|
||||
|
||||
|
@ -367,7 +359,7 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
|||
|
||||
for (i = 0; i < data->htsize; i++)
|
||||
{
|
||||
grub_uint64_t next;
|
||||
grub_uint32_t next;
|
||||
|
||||
if (!hashtable[i])
|
||||
continue;
|
||||
|
@ -441,10 +433,13 @@ grub_affs_open (struct grub_file *file, const char *name)
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_affs_close (grub_file_t file)
|
||||
{
|
||||
struct grub_affs_data *data =
|
||||
(struct grub_affs_data *) file->data;
|
||||
|
||||
grub_free (data->diropen.block_cache);
|
||||
grub_free (file->data);
|
||||
|
||||
grub_dl_unref (my_mod);
|
||||
|
@ -452,7 +447,6 @@ grub_affs_close (grub_file_t file)
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
||||
/* Read LEN bytes data from FILE into BUF. */
|
||||
static grub_ssize_t
|
||||
grub_affs_read (grub_file_t file, char *buf, grub_size_t len)
|
||||
|
@ -460,13 +454,12 @@ grub_affs_read (grub_file_t file, char *buf, grub_size_t len)
|
|||
struct grub_affs_data *data =
|
||||
(struct grub_affs_data *) file->data;
|
||||
|
||||
int size = grub_affs_read_file (&data->diropen, file->read_hook,
|
||||
file->offset, len, buf);
|
||||
|
||||
return size;
|
||||
return grub_fshelp_read_file (data->diropen.data->disk, &data->diropen,
|
||||
file->read_hook,
|
||||
file->offset, len, buf, grub_affs_read_block,
|
||||
grub_be_to_cpu32 (data->diropen.di.size), 0);
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_affs_dir (grub_device_t device, const char *path,
|
||||
int (*hook) (const char *filename,
|
||||
|
|
|
@ -734,12 +734,11 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
|||
&low);
|
||||
|
||||
high = grub_divmod64 (middle,
|
||||
grub_le_to_cpu16 (chunk->nsubstripes),
|
||||
grub_le_to_cpu16 (chunk->nstripes)
|
||||
/ grub_le_to_cpu16 (chunk->nsubstripes),
|
||||
&stripen);
|
||||
stripen *= grub_le_to_cpu16 (chunk->nstripes)
|
||||
/ grub_le_to_cpu16 (chunk->nsubstripes);
|
||||
redundancy = grub_le_to_cpu16 (chunk->nstripes)
|
||||
/ grub_le_to_cpu16 (chunk->nsubstripes);
|
||||
stripen *= grub_le_to_cpu16 (chunk->nsubstripes);
|
||||
redundancy = grub_le_to_cpu16 (chunk->nsubstripes);
|
||||
stripe_offset = low + grub_le_to_cpu64 (chunk->stripe_length)
|
||||
* high;
|
||||
csize = grub_le_to_cpu64 (chunk->stripe_length) - low;
|
||||
|
@ -1415,22 +1414,28 @@ grub_btrfs_dir (grub_device_t device, const char *path,
|
|||
|
||||
err = find_path (data, path, &key_in, &tree, &type);
|
||||
if (err)
|
||||
return err;
|
||||
{
|
||||
grub_btrfs_unmount (data);
|
||||
return err;
|
||||
}
|
||||
if (type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY)
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
{
|
||||
grub_btrfs_unmount (data);
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
}
|
||||
|
||||
err = lower_bound (data, &key_in, &key_out, tree, &elemaddr, &elemsize, &desc);
|
||||
if (err)
|
||||
return err;
|
||||
{
|
||||
grub_btrfs_unmount (data);
|
||||
return err;
|
||||
}
|
||||
if (key_out.type != GRUB_BTRFS_ITEM_TYPE_DIR_ITEM
|
||||
|| key_out.object_id != key_in.object_id)
|
||||
{
|
||||
r = next (data, &desc, &elemaddr, &elemsize, &key_out);
|
||||
if (r <= 0)
|
||||
{
|
||||
free_iterator (&desc);
|
||||
return -r;
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
do
|
||||
{
|
||||
|
@ -1448,14 +1453,17 @@ grub_btrfs_dir (grub_device_t device, const char *path,
|
|||
direl = grub_malloc (allocated + 1);
|
||||
if (!direl)
|
||||
{
|
||||
free_iterator (&desc);
|
||||
return grub_errno;
|
||||
r = -grub_errno;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
err = grub_btrfs_read_logical (data, elemaddr, direl, elemsize);
|
||||
if (err)
|
||||
return err;
|
||||
{
|
||||
r = -err;
|
||||
break;
|
||||
}
|
||||
|
||||
for (cdirel = direl;
|
||||
(grub_uint8_t *) cdirel - (grub_uint8_t *) direl
|
||||
|
@ -1607,7 +1615,7 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)),
|
|||
|
||||
if (embed_type != GRUB_EMBED_PCBIOS)
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"BtrFS curently supports only PC-BIOS embedding");
|
||||
"BtrFS currently supports only PC-BIOS embedding");
|
||||
|
||||
if (64 * 2 - 1 < *nsectors)
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
|
|
|
@ -147,6 +147,7 @@ grub_cpio_find_file (struct grub_cpio_data *data, char **name,
|
|||
&& grub_memcmp(*name, "TRAILER!!!", 11) == 0)
|
||||
{
|
||||
*ofs = 0;
|
||||
grub_free (*name);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
@ -481,6 +482,8 @@ grub_cpio_dir (grub_device_t device, const char *path_in,
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
grub_free (name);
|
||||
data->hofs = ofs;
|
||||
}
|
||||
|
||||
|
|
|
@ -1048,7 +1048,10 @@ grub_fat_label (grub_device_t device, char **label)
|
|||
grub_size_t chc;
|
||||
*label = grub_malloc (11 * 4 + 1);
|
||||
if (!*label)
|
||||
return grub_errno;
|
||||
{
|
||||
grub_free (data);
|
||||
return grub_errno;
|
||||
}
|
||||
chc = dir.type_specific.volume_label.character_count;
|
||||
if (chc > ARRAY_SIZE (dir.type_specific.volume_label.str))
|
||||
chc = ARRAY_SIZE (dir.type_specific.volume_label.str);
|
||||
|
@ -1057,6 +1060,7 @@ grub_fat_label (grub_device_t device, char **label)
|
|||
}
|
||||
}
|
||||
|
||||
grub_free (data);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
|
|
@ -159,8 +159,9 @@ struct grub_fshelp_node
|
|||
{
|
||||
struct grub_iso9660_data *data;
|
||||
grub_size_t have_dirents, alloc_dirents;
|
||||
char *symlink;
|
||||
int have_symlink;
|
||||
struct grub_iso9660_dir dirents[8];
|
||||
char symlink[0];
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -408,9 +409,9 @@ set_rockridge (struct grub_iso9660_data *data)
|
|||
struct grub_fshelp_node rootnode;
|
||||
|
||||
rootnode.data = data;
|
||||
rootnode.alloc_dirents = 0;
|
||||
rootnode.alloc_dirents = ARRAY_SIZE (rootnode.dirents);
|
||||
rootnode.have_dirents = 1;
|
||||
rootnode.symlink = 0;
|
||||
rootnode.have_symlink = 0;
|
||||
rootnode.dirents[0] = data->voldesc.rootdir;
|
||||
|
||||
/* The 2nd data byte stored how many bytes are skipped every time
|
||||
|
@ -500,7 +501,10 @@ grub_iso9660_mount (grub_disk_t disk)
|
|||
static char *
|
||||
grub_iso9660_read_symlink (grub_fshelp_node_t node)
|
||||
{
|
||||
return node->symlink ? grub_strdup (node->symlink) : grub_strdup ("");
|
||||
return node->have_symlink
|
||||
? grub_strdup (node->symlink
|
||||
+ (node->have_dirents) * sizeof (node->dirents[0])
|
||||
- sizeof (node->dirents)) : grub_strdup ("");
|
||||
}
|
||||
|
||||
static grub_off_t
|
||||
|
@ -559,9 +563,9 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir,
|
|||
filename = "..";
|
||||
else if (entry->len >= 5)
|
||||
{
|
||||
int size = 1;
|
||||
grub_size_t size = 1, csize = 1;
|
||||
char *old;
|
||||
size = entry->len - 5;
|
||||
csize = size = entry->len - 5;
|
||||
old = filename;
|
||||
if (filename_alloc)
|
||||
{
|
||||
|
@ -580,7 +584,7 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir,
|
|||
return grub_errno;
|
||||
}
|
||||
filename_alloc = 1;
|
||||
grub_strncat (filename, (char *) &entry->data[1], size);
|
||||
grub_strncat (filename, (char *) &entry->data[1], csize);
|
||||
filename[size] = '\0';
|
||||
}
|
||||
}
|
||||
|
@ -703,7 +707,7 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir,
|
|||
|
||||
/* Setup a new node. */
|
||||
node->data = dir->data;
|
||||
node->symlink = symlink;
|
||||
node->have_symlink = 0;
|
||||
|
||||
/* If the filetype was not stored using rockridge, use
|
||||
whatever is stored in the iso9660 filesystem. */
|
||||
|
@ -767,10 +771,11 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir,
|
|||
{
|
||||
struct grub_fshelp_node *new_node;
|
||||
node->alloc_dirents *= 2;
|
||||
new_node = grub_malloc (sizeof (struct grub_fshelp_node)
|
||||
+ ((node->alloc_dirents
|
||||
- ARRAY_SIZE (node->dirents))
|
||||
* sizeof (node->dirents[0])));
|
||||
new_node = grub_realloc (node,
|
||||
sizeof (struct grub_fshelp_node)
|
||||
+ ((node->alloc_dirents
|
||||
- ARRAY_SIZE (node->dirents))
|
||||
* sizeof (node->dirents[0])));
|
||||
if (!new_node)
|
||||
{
|
||||
if (filename_alloc)
|
||||
|
@ -778,9 +783,37 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir,
|
|||
grub_free (node);
|
||||
return 0;
|
||||
}
|
||||
node = new_node;
|
||||
}
|
||||
node->dirents[node->have_dirents++] = dirent;
|
||||
}
|
||||
if (symlink)
|
||||
{
|
||||
if ((node->alloc_dirents - node->have_dirents)
|
||||
* sizeof (node->dirents[0]) < grub_strlen (symlink) + 1)
|
||||
{
|
||||
struct grub_fshelp_node *new_node;
|
||||
new_node = grub_realloc (node,
|
||||
sizeof (struct grub_fshelp_node)
|
||||
+ ((node->alloc_dirents
|
||||
- ARRAY_SIZE (node->dirents))
|
||||
* sizeof (node->dirents[0]))
|
||||
+ grub_strlen (symlink) + 1);
|
||||
if (!new_node)
|
||||
{
|
||||
if (filename_alloc)
|
||||
grub_free (filename);
|
||||
grub_free (node);
|
||||
return 0;
|
||||
}
|
||||
node = new_node;
|
||||
}
|
||||
node->have_symlink = 1;
|
||||
grub_strcpy (node->symlink
|
||||
+ node->have_dirents * sizeof (node->dirents[0])
|
||||
- sizeof (node->dirents), symlink);
|
||||
grub_free (symlink);
|
||||
}
|
||||
if (hook (filename, type, node))
|
||||
{
|
||||
if (filename_alloc)
|
||||
|
@ -832,7 +865,7 @@ grub_iso9660_dir (grub_device_t device, const char *path,
|
|||
rootnode.data = data;
|
||||
rootnode.alloc_dirents = 0;
|
||||
rootnode.have_dirents = 1;
|
||||
rootnode.symlink = 0;
|
||||
rootnode.have_symlink = 0;
|
||||
rootnode.dirents[0] = data->voldesc.rootdir;
|
||||
|
||||
/* Use the fshelp function to traverse the path. */
|
||||
|
@ -875,7 +908,7 @@ grub_iso9660_open (struct grub_file *file, const char *name)
|
|||
rootnode.data = data;
|
||||
rootnode.alloc_dirents = 0;
|
||||
rootnode.have_dirents = 1;
|
||||
rootnode.symlink = 0;
|
||||
rootnode.have_symlink = 0;
|
||||
rootnode.dirents[0] = data->voldesc.rootdir;
|
||||
|
||||
/* Use the fshelp function to traverse the path. */
|
||||
|
|
|
@ -891,6 +891,8 @@ grub_jfs_label (grub_device_t device, char **label)
|
|||
else
|
||||
*label = 0;
|
||||
|
||||
grub_free (data);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
|
|
@ -705,17 +705,18 @@ grub_ntfs_read_symlink (grub_fshelp_node_t node)
|
|||
switch (grub_cpu_to_le32 (symdesc.type))
|
||||
{
|
||||
case 0xa000000c:
|
||||
off = sizeof (struct symlink_descriptor) + 4 + grub_cpu_to_le32 (symdesc.off1);
|
||||
off = (sizeof (struct symlink_descriptor) + 4
|
||||
+ grub_cpu_to_le32 (symdesc.off1));
|
||||
len = grub_cpu_to_le32 (symdesc.len1);
|
||||
break;
|
||||
case 0xa0000003:
|
||||
off = sizeof (struct symlink_descriptor) + grub_cpu_to_le32 (symdesc.off1);
|
||||
off = (sizeof (struct symlink_descriptor)
|
||||
+ grub_cpu_to_le32 (symdesc.off1));
|
||||
len = grub_cpu_to_le32 (symdesc.len1);
|
||||
break;
|
||||
default:
|
||||
grub_error (GRUB_ERR_BAD_FS, "symlink type invalid (%x)",
|
||||
grub_cpu_to_le32 (symdesc.type));
|
||||
grub_printf ("%d\n", __LINE__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -397,7 +397,10 @@ grub_romfs_read (grub_file_t file, char *buf, grub_size_t len)
|
|||
static grub_err_t
|
||||
grub_romfs_close (grub_file_t file)
|
||||
{
|
||||
grub_free (file->data);
|
||||
struct grub_fshelp_node *data = file->data;
|
||||
|
||||
grub_free (data->data);
|
||||
grub_free (data);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -432,6 +435,7 @@ grub_romfs_label (grub_device_t device, char **label)
|
|||
return err;
|
||||
}
|
||||
(*label)[data->first_file - sizeof (struct grub_romfs_superblock)] = 0;
|
||||
grub_free (data);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ squash_mount (grub_disk_t disk)
|
|||
if (err)
|
||||
return NULL;
|
||||
|
||||
data = grub_malloc (sizeof (*data));
|
||||
data = grub_zalloc (sizeof (*data));
|
||||
if (!data)
|
||||
return NULL;
|
||||
data->sb = sb;
|
||||
|
@ -418,6 +418,15 @@ make_root_node (struct grub_squash_data *data, struct grub_fshelp_node *root)
|
|||
grub_cpu_to_le16 (data->sb.root_ino_offset));
|
||||
}
|
||||
|
||||
static void
|
||||
squash_unmount (struct grub_squash_data *data)
|
||||
{
|
||||
grub_free (data->ino.cumulated_block_sizes);
|
||||
grub_free (data->ino.block_sizes);
|
||||
grub_free (data);
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_squash_dir (grub_device_t device, const char *path,
|
||||
int (*hook) (const char *filename,
|
||||
|
@ -436,6 +445,7 @@ grub_squash_dir (grub_device_t device, const char *path,
|
|||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
info.mtimeset = 1;
|
||||
info.mtime = grub_le_to_cpu32 (node->ino.mtime);
|
||||
grub_free (node);
|
||||
return hook (filename, &info);
|
||||
}
|
||||
|
||||
|
@ -457,7 +467,7 @@ grub_squash_dir (grub_device_t device, const char *path,
|
|||
if (!grub_errno)
|
||||
grub_squash_iterate_dir (fdiro, iterate);
|
||||
|
||||
grub_free (data);
|
||||
squash_unmount (data);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
@ -482,7 +492,7 @@ grub_squash_open (struct grub_file *file, const char *name)
|
|||
grub_squash_read_symlink, GRUB_FSHELP_REG);
|
||||
if (grub_errno)
|
||||
{
|
||||
grub_free (data);
|
||||
squash_unmount (data);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
@ -499,6 +509,8 @@ grub_squash_open (struct grub_file *file, const char *name)
|
|||
else
|
||||
file->size = grub_le_to_cpu32 (fdiro->ino.file.size);
|
||||
|
||||
grub_free (fdiro);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
@ -664,7 +676,7 @@ grub_squash_read (grub_file_t file, char *buf, grub_size_t len)
|
|||
static grub_err_t
|
||||
grub_squash_close (grub_file_t file)
|
||||
{
|
||||
grub_free (file->data);
|
||||
squash_unmount (file->data);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
@ -677,7 +689,7 @@ grub_squash_mtime (grub_device_t dev, grub_int32_t *tm)
|
|||
if (! data)
|
||||
return grub_errno;
|
||||
*tm = grub_le_to_cpu32 (data->sb.creation_time);
|
||||
grub_free (data);
|
||||
squash_unmount (data);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
|
|
@ -771,10 +771,13 @@ grub_xfs_open (struct grub_file *file, const char *name)
|
|||
}
|
||||
|
||||
if (fdiro != &data->diropen)
|
||||
grub_memcpy (&data->diropen, fdiro,
|
||||
sizeof (struct grub_fshelp_node)
|
||||
- sizeof (struct grub_xfs_inode)
|
||||
+ (1 << data->sblock.log2_inode));
|
||||
{
|
||||
grub_memcpy (&data->diropen, fdiro,
|
||||
sizeof (struct grub_fshelp_node)
|
||||
- sizeof (struct grub_xfs_inode)
|
||||
+ (1 << data->sblock.log2_inode));
|
||||
grub_free (fdiro);
|
||||
}
|
||||
|
||||
file->size = grub_be_to_cpu64 (data->diropen.inode.size);
|
||||
file->data = data;
|
||||
|
|
|
@ -535,7 +535,8 @@ static grub_err_t
|
|||
fill_vdev_info_real (struct grub_zfs_data *data,
|
||||
const char *nvlist,
|
||||
struct grub_zfs_device_desc *fill,
|
||||
struct grub_zfs_device_desc *insert)
|
||||
struct grub_zfs_device_desc *insert,
|
||||
int *inserted)
|
||||
{
|
||||
char *type;
|
||||
|
||||
|
@ -545,10 +546,16 @@ fill_vdev_info_real (struct grub_zfs_data *data,
|
|||
return grub_errno;
|
||||
|
||||
if (!grub_zfs_nvlist_lookup_uint64 (nvlist, "id", &(fill->id)))
|
||||
return grub_error (GRUB_ERR_BAD_FS, "couldn't find vdev id");
|
||||
{
|
||||
grub_free (type);
|
||||
return grub_error (GRUB_ERR_BAD_FS, "couldn't find vdev id");
|
||||
}
|
||||
|
||||
if (!grub_zfs_nvlist_lookup_uint64 (nvlist, "guid", &(fill->guid)))
|
||||
return grub_error (GRUB_ERR_BAD_FS, "couldn't find vdev id");
|
||||
{
|
||||
grub_free (type);
|
||||
return grub_error (GRUB_ERR_BAD_FS, "couldn't find vdev id");
|
||||
}
|
||||
|
||||
if (grub_strcmp (type, VDEV_TYPE_DISK) == 0
|
||||
|| grub_strcmp (type, VDEV_TYPE_FILE) == 0)
|
||||
|
@ -563,8 +570,11 @@ fill_vdev_info_real (struct grub_zfs_data *data,
|
|||
fill->original = insert->original;
|
||||
if (!data->device_original)
|
||||
data->device_original = fill;
|
||||
*inserted = 1;
|
||||
}
|
||||
|
||||
grub_free (type);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
@ -580,17 +590,27 @@ fill_vdev_info_real (struct grub_zfs_data *data,
|
|||
grub_uint64_t par;
|
||||
fill->type = DEVICE_RAIDZ;
|
||||
if (!grub_zfs_nvlist_lookup_uint64 (nvlist, "nparity", &par))
|
||||
return grub_error (GRUB_ERR_BAD_FS, "couldn't find raidz parity");
|
||||
{
|
||||
grub_free (type);
|
||||
return grub_error (GRUB_ERR_BAD_FS, "couldn't find raidz parity");
|
||||
}
|
||||
fill->nparity = par;
|
||||
if (!grub_zfs_nvlist_lookup_uint64 (nvlist, "ashift", &par))
|
||||
return grub_error (GRUB_ERR_BAD_FS, "couldn't find raidz ashift");
|
||||
{
|
||||
grub_free (type);
|
||||
return grub_error (GRUB_ERR_BAD_FS, "couldn't find raidz ashift");
|
||||
}
|
||||
fill->ashift = par;
|
||||
}
|
||||
|
||||
nelm = grub_zfs_nvlist_lookup_nvlist_array_get_nelm (nvlist, ZPOOL_CONFIG_CHILDREN);
|
||||
nelm = grub_zfs_nvlist_lookup_nvlist_array_get_nelm (nvlist,
|
||||
ZPOOL_CONFIG_CHILDREN);
|
||||
|
||||
if (nelm <= 0)
|
||||
return grub_error (GRUB_ERR_BAD_FS, "incorrect mirror VDEV");
|
||||
{
|
||||
grub_free (type);
|
||||
return grub_error (GRUB_ERR_BAD_FS, "incorrect mirror VDEV");
|
||||
}
|
||||
|
||||
if (!fill->children)
|
||||
{
|
||||
|
@ -608,34 +628,43 @@ fill_vdev_info_real (struct grub_zfs_data *data,
|
|||
child = grub_zfs_nvlist_lookup_nvlist_array
|
||||
(nvlist, ZPOOL_CONFIG_CHILDREN, i);
|
||||
|
||||
err = fill_vdev_info_real (data, child, &fill->children[i], insert);
|
||||
err = fill_vdev_info_real (data, child, &fill->children[i], insert,
|
||||
inserted);
|
||||
|
||||
grub_free (child);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
{
|
||||
grub_free (type);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
grub_free (type);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "vdev %s isn't supported",
|
||||
type);
|
||||
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "vdev %s isn't supported", type);
|
||||
grub_free (type);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
fill_vdev_info (struct grub_zfs_data *data,
|
||||
char *nvlist, struct grub_zfs_device_desc *diskdesc)
|
||||
char *nvlist, struct grub_zfs_device_desc *diskdesc,
|
||||
int *inserted)
|
||||
{
|
||||
grub_uint64_t id;
|
||||
unsigned i;
|
||||
|
||||
*inserted = 0;
|
||||
|
||||
if (!grub_zfs_nvlist_lookup_uint64 (nvlist, "id", &id))
|
||||
return grub_error (GRUB_ERR_BAD_FS, "couldn't find vdev id");
|
||||
|
||||
for (i = 0; i < data->n_devices_attached; i++)
|
||||
if (data->devices_attached[i].id == id)
|
||||
return fill_vdev_info_real (data, nvlist, &data->devices_attached[i],
|
||||
diskdesc);
|
||||
diskdesc, inserted);
|
||||
|
||||
data->n_devices_attached++;
|
||||
if (data->n_devices_attached > data->n_devices_allocated)
|
||||
|
@ -658,7 +687,7 @@ fill_vdev_info (struct grub_zfs_data *data,
|
|||
|
||||
return fill_vdev_info_real (data, nvlist,
|
||||
&data->devices_attached[data->n_devices_attached - 1],
|
||||
diskdesc);
|
||||
diskdesc, inserted);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -667,7 +696,8 @@ fill_vdev_info (struct grub_zfs_data *data,
|
|||
*/
|
||||
static grub_err_t
|
||||
check_pool_label (struct grub_zfs_data *data,
|
||||
struct grub_zfs_device_desc *diskdesc)
|
||||
struct grub_zfs_device_desc *diskdesc,
|
||||
int *inserted)
|
||||
{
|
||||
grub_uint64_t pool_state, txg = 0;
|
||||
char *nvlist;
|
||||
|
@ -679,6 +709,8 @@ check_pool_label (struct grub_zfs_data *data,
|
|||
int found;
|
||||
grub_err_t err;
|
||||
|
||||
*inserted = 0;
|
||||
|
||||
err = zfs_fetch_nvlist (diskdesc, &nvlist);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -778,12 +810,14 @@ check_pool_label (struct grub_zfs_data *data,
|
|||
grub_free (nvlist);
|
||||
return grub_error (GRUB_ERR_BAD_FS, "couldn't find vdev tree");
|
||||
}
|
||||
err = fill_vdev_info (data, nv, diskdesc);
|
||||
err = fill_vdev_info (data, nv, diskdesc, inserted);
|
||||
if (err)
|
||||
{
|
||||
grub_free (nv);
|
||||
grub_free (nvlist);
|
||||
return err;
|
||||
}
|
||||
grub_free (nv);
|
||||
}
|
||||
grub_dprintf ("zfs", "check 10 passed\n");
|
||||
|
||||
|
@ -794,7 +828,7 @@ check_pool_label (struct grub_zfs_data *data,
|
|||
|
||||
static grub_err_t
|
||||
scan_disk (grub_device_t dev, struct grub_zfs_data *data,
|
||||
int original)
|
||||
int original, int *inserted)
|
||||
{
|
||||
int label = 0;
|
||||
uberblock_phys_t *ub_array, *ubbest = NULL;
|
||||
|
@ -856,7 +890,7 @@ scan_disk (grub_device_t dev, struct grub_zfs_data *data,
|
|||
grub_memmove (&(data->current_uberblock),
|
||||
&ubbest->ubp_uberblock, sizeof (uberblock_t));
|
||||
|
||||
err = check_pool_label (data, &desc);
|
||||
err = check_pool_label (data, &desc, inserted);
|
||||
if (err)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
@ -887,6 +921,7 @@ scan_devices (struct grub_zfs_data *data)
|
|||
{
|
||||
grub_device_t dev;
|
||||
grub_err_t err;
|
||||
int inserted;
|
||||
dev = grub_device_open (name);
|
||||
if (!dev)
|
||||
return 0;
|
||||
|
@ -895,7 +930,7 @@ scan_devices (struct grub_zfs_data *data)
|
|||
grub_device_close (dev);
|
||||
return 0;
|
||||
}
|
||||
err = scan_disk (dev, data, 0);
|
||||
err = scan_disk (dev, data, 0, &inserted);
|
||||
if (err == GRUB_ERR_BAD_FS)
|
||||
{
|
||||
grub_device_close (dev);
|
||||
|
@ -909,6 +944,9 @@ scan_devices (struct grub_zfs_data *data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!inserted)
|
||||
grub_device_close (dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
grub_device_iterate (hook);
|
||||
|
@ -1324,7 +1362,7 @@ read_dva (const dva_t *dva,
|
|||
{
|
||||
grub_uint64_t offset;
|
||||
unsigned i;
|
||||
grub_err_t err;
|
||||
grub_err_t err = 0;
|
||||
int try = 0;
|
||||
offset = dva_get_offset (dva, endian);
|
||||
|
||||
|
@ -1344,6 +1382,9 @@ read_dva (const dva_t *dva,
|
|||
if (err)
|
||||
return err;
|
||||
}
|
||||
if (!err)
|
||||
return grub_error (GRUB_ERR_BAD_FS, "unknown device %d",
|
||||
(int) DVA_GET_VDEV (dva));
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -2037,10 +2078,14 @@ fzap_iterate (dnode_end_t * zap_dnode, zap_phys_t * zap,
|
|||
|
||||
if (hook (buf, le->le_name_length,
|
||||
val, le->le_value_length, le->le_int_size))
|
||||
return 1;
|
||||
{
|
||||
grub_free (l);
|
||||
return 1;
|
||||
}
|
||||
grub_free (buf);
|
||||
grub_free (val);
|
||||
}
|
||||
grub_free (l);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -3151,6 +3196,7 @@ unmount_device (struct grub_zfs_device_desc *desc)
|
|||
case DEVICE_MIRROR:
|
||||
for (i = 0; i < desc->n_children; i++)
|
||||
unmount_device (&desc->children[i]);
|
||||
grub_free (desc->children);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -3181,10 +3227,11 @@ zfs_mount (grub_device_t dev)
|
|||
{
|
||||
struct grub_zfs_data *data = 0;
|
||||
grub_err_t err;
|
||||
objset_phys_t *osp = 0;
|
||||
void *osp = 0;
|
||||
grub_size_t ospsize;
|
||||
grub_zfs_endian_t ub_endian = GRUB_ZFS_UNKNOWN_ENDIAN;
|
||||
uberblock_t *ub;
|
||||
int inserted;
|
||||
|
||||
if (! dev->disk)
|
||||
{
|
||||
|
@ -3205,7 +3252,7 @@ zfs_mount (grub_device_t dev)
|
|||
data->devices_attached = grub_malloc (sizeof (data->devices_attached[0])
|
||||
* data->n_devices_allocated);
|
||||
data->n_devices_attached = 0;
|
||||
err = scan_disk (dev, data, 1);
|
||||
err = scan_disk (dev, data, 1, &inserted);
|
||||
if (err)
|
||||
{
|
||||
zfs_unmount (data);
|
||||
|
@ -3218,7 +3265,7 @@ zfs_mount (grub_device_t dev)
|
|||
? GRUB_ZFS_LITTLE_ENDIAN : GRUB_ZFS_BIG_ENDIAN);
|
||||
|
||||
err = zio_read (&ub->ub_rootbp, ub_endian,
|
||||
(void **) &osp, &ospsize, data);
|
||||
&osp, &ospsize, data);
|
||||
if (err)
|
||||
{
|
||||
zfs_unmount (data);
|
||||
|
@ -3234,7 +3281,8 @@ zfs_mount (grub_device_t dev)
|
|||
}
|
||||
|
||||
/* Got the MOS. Save it at the memory addr MOS. */
|
||||
grub_memmove (&(data->mos.dn), &osp->os_meta_dnode, DNODE_SIZE);
|
||||
grub_memmove (&(data->mos.dn), &((objset_phys_t *) osp)->os_meta_dnode,
|
||||
DNODE_SIZE);
|
||||
data->mos.endian = (grub_zfs_to_cpu64 (ub->ub_rootbp.blk_prop,
|
||||
ub_endian) >> 63) & 1;
|
||||
grub_free (osp);
|
||||
|
|
|
@ -277,8 +277,9 @@ grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher,
|
|||
grub_err_t err;
|
||||
|
||||
grub_memcpy (sw, nonce, 16);
|
||||
for (i = 0; i < 4; i++)
|
||||
sw[i] = grub_cpu_to_be32 (grub_zfs_to_cpu32 (sw[i], endian));
|
||||
if (endian != GRUB_ZFS_BIG_ENDIAN)
|
||||
for (i = 0; i < 4; i++)
|
||||
sw[i] = grub_swap_bytes32 (sw[i]);
|
||||
|
||||
if (!cipher)
|
||||
return grub_error (GRUB_ERR_ACCESS_DENIED,
|
||||
|
@ -420,7 +421,7 @@ grub_cmd_zfs_key (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
}
|
||||
else
|
||||
{
|
||||
grub_printf ("Enter ZFS password: ");
|
||||
grub_xputs (_("Enter ZFS password: "));
|
||||
if (!grub_password_get ((char *) buf, 1023))
|
||||
return grub_errno;
|
||||
real_size = grub_strlen ((char *) buf);
|
||||
|
@ -454,17 +455,17 @@ grub_cmd_zfs_key (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
|
||||
static grub_extcmd_t cmd_key;
|
||||
|
||||
GRUB_MOD_INIT(zfscrypto)
|
||||
GRUB_MOD_INIT(zfscrypt)
|
||||
{
|
||||
grub_zfs_decrypt = grub_zfs_decrypt_real;
|
||||
grub_zfs_load_key = grub_zfs_load_key_real;
|
||||
cmd_key = grub_register_extcmd ("zfskey", grub_cmd_zfs_key, 0,
|
||||
"zfskey [-h|-p|-r] [FILE]",
|
||||
"Import ZFS wrapping key stored in FILE.",
|
||||
N_("[-h|-p|-r] [FILE]"),
|
||||
N_("Import ZFS wrapping key stored in FILE."),
|
||||
options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(zfscrypto)
|
||||
GRUB_MOD_FINI(zfscrypt)
|
||||
{
|
||||
grub_zfs_decrypt = 0;
|
||||
grub_zfs_load_key = 0;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -44,32 +45,32 @@ print_state (char *nvlist, int tab)
|
|||
int isok = 1;
|
||||
|
||||
print_tabs (tab);
|
||||
grub_printf ("State: ");
|
||||
grub_xputs (_("State: "));
|
||||
|
||||
if (grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_REMOVED, &ival))
|
||||
{
|
||||
grub_printf ("removed ");
|
||||
grub_xputs (_("removed "));
|
||||
isok = 0;
|
||||
}
|
||||
|
||||
if (grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_FAULTED, &ival))
|
||||
{
|
||||
grub_printf ("faulted ");
|
||||
grub_xputs (_("faulted "));
|
||||
isok = 0;
|
||||
}
|
||||
|
||||
if (grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_OFFLINE, &ival))
|
||||
{
|
||||
grub_printf ("offline ");
|
||||
grub_xputs (_("offline "));
|
||||
isok = 0;
|
||||
}
|
||||
|
||||
if (grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_FAULTED, &ival))
|
||||
grub_printf ("degraded ");
|
||||
grub_xputs (_("degraded "));
|
||||
|
||||
if (isok)
|
||||
grub_printf ("online");
|
||||
grub_printf ("\n");
|
||||
grub_xputs (_("online"));
|
||||
grub_xputs ("\n");
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -84,7 +85,7 @@ print_vdev_info (char *nvlist, int tab)
|
|||
if (!type)
|
||||
{
|
||||
print_tabs (tab);
|
||||
grub_printf ("Incorrect VDEV: no type available\n");
|
||||
grub_puts_ (N_("Incorrect VDEV: no type available"));
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
@ -95,7 +96,7 @@ print_vdev_info (char *nvlist, int tab)
|
|||
char *devid = 0;
|
||||
|
||||
print_tabs (tab);
|
||||
grub_printf ("Leaf VDEV\n");
|
||||
grub_puts_ (N_("Leaf VDEV"));
|
||||
|
||||
print_state (nvlist, tab);
|
||||
|
||||
|
@ -103,23 +104,23 @@ print_vdev_info (char *nvlist, int tab)
|
|||
grub_zfs_nvlist_lookup_string (nvlist, ZPOOL_CONFIG_PHYS_PATH);
|
||||
print_tabs (tab);
|
||||
if (!bootpath)
|
||||
grub_printf ("Bootpath: unavailable\n");
|
||||
grub_puts_ (N_("Bootpath: unavailable\n"));
|
||||
else
|
||||
grub_printf ("Bootpath: %s\n", bootpath);
|
||||
grub_printf_ (N_("Bootpath: %s\n"), bootpath);
|
||||
|
||||
path = grub_zfs_nvlist_lookup_string (nvlist, "path");
|
||||
print_tabs (tab);
|
||||
if (!path)
|
||||
grub_printf ("Path: unavailable\n");
|
||||
grub_puts_ (N_("Path: unavailable"));
|
||||
else
|
||||
grub_printf ("Path: %s\n", path);
|
||||
grub_printf_ (N_("Path: %s\n"), path);
|
||||
|
||||
devid = grub_zfs_nvlist_lookup_string (nvlist, ZPOOL_CONFIG_DEVID);
|
||||
print_tabs (tab);
|
||||
if (!devid)
|
||||
grub_printf ("Devid: unavailable\n");
|
||||
grub_puts_ (N_("Devid: unavailable"));
|
||||
else
|
||||
grub_printf ("Devid: %s\n", devid);
|
||||
grub_printf_ (N_("Devid: %s\n"), devid);
|
||||
grub_free (bootpath);
|
||||
grub_free (devid);
|
||||
grub_free (path);
|
||||
|
@ -136,10 +137,10 @@ print_vdev_info (char *nvlist, int tab)
|
|||
print_tabs (tab);
|
||||
if (nelm <= 0)
|
||||
{
|
||||
grub_printf ("Incorrect mirror VDEV\n");
|
||||
grub_puts_ (N_("Incorrect mirror VDEV"));
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
grub_printf ("Mirror VDEV with %d children\n", nelm);
|
||||
grub_printf_ (N_("Mirror VDEV with %d children\n"), nelm);
|
||||
print_state (nvlist, tab);
|
||||
for (i = 0; i < nelm; i++)
|
||||
{
|
||||
|
@ -151,11 +152,11 @@ print_vdev_info (char *nvlist, int tab)
|
|||
print_tabs (tab);
|
||||
if (!child)
|
||||
{
|
||||
grub_printf ("Mirror VDEV element %d isn't correct\n", i);
|
||||
grub_printf_ (N_("Mirror VDEV element %d isn't correct\n"), i);
|
||||
continue;
|
||||
}
|
||||
|
||||
grub_printf ("Mirror VDEV element %d:\n", i);
|
||||
grub_printf_ (N_("Mirror VDEV element %d:\n"), i);
|
||||
print_vdev_info (child, tab + 1);
|
||||
|
||||
grub_free (child);
|
||||
|
@ -164,7 +165,7 @@ print_vdev_info (char *nvlist, int tab)
|
|||
}
|
||||
|
||||
print_tabs (tab);
|
||||
grub_printf ("Unknown VDEV type: %s\n", type);
|
||||
grub_printf_ (N_("Unknown VDEV type: %s\n"), type);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -221,15 +222,15 @@ get_bootpath (char *nvlist, char **bootpath, char **devid)
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static char *poolstates[] = {
|
||||
[POOL_STATE_ACTIVE] = "active",
|
||||
[POOL_STATE_EXPORTED] = "exported",
|
||||
[POOL_STATE_DESTROYED] = "destroyed",
|
||||
[POOL_STATE_SPARE] = "reserved for hot spare",
|
||||
[POOL_STATE_L2CACHE] = "level 2 ARC device",
|
||||
[POOL_STATE_UNINITIALIZED] = "uninitialized",
|
||||
[POOL_STATE_UNAVAIL] = "unavailable",
|
||||
[POOL_STATE_POTENTIALLY_ACTIVE] = "potentially active"
|
||||
static const char *poolstates[] = {
|
||||
[POOL_STATE_ACTIVE] = N_("Pool state: active"),
|
||||
[POOL_STATE_EXPORTED] = N_("Pool state: exported"),
|
||||
[POOL_STATE_DESTROYED] = N_("Pool state: destroyed"),
|
||||
[POOL_STATE_SPARE] = N_("Pool state: reserved for hot spare"),
|
||||
[POOL_STATE_L2CACHE] = N_("Pool state: level 2 ARC device"),
|
||||
[POOL_STATE_UNINITIALIZED] = N_("Pool state: uninitialized"),
|
||||
[POOL_STATE_UNAVAIL] = N_("Pool state: unavailable"),
|
||||
[POOL_STATE_POTENTIALLY_ACTIVE] = N_("Pool state: potentially active")
|
||||
};
|
||||
|
||||
static grub_err_t
|
||||
|
@ -274,30 +275,30 @@ grub_cmd_zfsinfo (grub_command_t cmd __attribute__ ((unused)), int argc,
|
|||
|
||||
poolname = grub_zfs_nvlist_lookup_string (nvlist, ZPOOL_CONFIG_POOL_NAME);
|
||||
if (!poolname)
|
||||
grub_printf ("Pool name: unavailable\n");
|
||||
grub_puts_ (N_("Pool name: unavailable"));
|
||||
else
|
||||
grub_printf ("Pool name: %s\n", poolname);
|
||||
grub_printf_ (N_("Pool name: %s\n"), poolname);
|
||||
|
||||
found =
|
||||
grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_POOL_GUID, &guid);
|
||||
if (!found)
|
||||
grub_printf ("Pool GUID: unavailable\n");
|
||||
grub_puts_ (N_("Pool GUID: unavailable"));
|
||||
else
|
||||
grub_printf ("Pool GUID: %016llx\n", (long long unsigned) guid);
|
||||
grub_printf_ (N_("Pool GUID: %016llx\n"), (long long unsigned) guid);
|
||||
|
||||
found = grub_zfs_nvlist_lookup_uint64 (nvlist, ZPOOL_CONFIG_POOL_STATE,
|
||||
&pool_state);
|
||||
if (!found)
|
||||
grub_printf ("Unable to retrieve pool state\n");
|
||||
grub_puts_ (N_("Unable to retrieve pool state"));
|
||||
else if (pool_state >= ARRAY_SIZE (poolstates))
|
||||
grub_printf ("Unrecognized pool state\n");
|
||||
grub_puts_ (N_("Unrecognized pool state"));
|
||||
else
|
||||
grub_printf ("Pool state: %s\n", poolstates[pool_state]);
|
||||
grub_puts_ (poolstates[pool_state]);
|
||||
|
||||
nv = grub_zfs_nvlist_lookup_nvlist (nvlist, ZPOOL_CONFIG_VDEV_TREE);
|
||||
|
||||
if (!nv)
|
||||
grub_printf ("No vdev tree available\n");
|
||||
grub_puts_ (N_("No vdev tree available"));
|
||||
else
|
||||
print_vdev_info (nv, 1);
|
||||
|
||||
|
@ -395,11 +396,11 @@ static grub_command_t cmd_info, cmd_bootfs;
|
|||
GRUB_MOD_INIT (zfsinfo)
|
||||
{
|
||||
cmd_info = grub_register_command ("zfsinfo", grub_cmd_zfsinfo,
|
||||
"zfsinfo DEVICE",
|
||||
"Print ZFS info about DEVICE.");
|
||||
N_("DEVICE"),
|
||||
N_("Print ZFS info about DEVICE."));
|
||||
cmd_bootfs = grub_register_command ("zfs-bootfs", grub_cmd_zfs_bootfs,
|
||||
"zfs-bootfs FILESYSTEM [VARIABLE]",
|
||||
"Print ZFS-BOOTFSOBJ or set it to VARIABLE");
|
||||
N_("FILESYSTEM [VARIABLE]"),
|
||||
N_("Print ZFS-BOOTFSOBJ or set it to VARIABLE"));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI (zfsinfo)
|
||||
|
|
|
@ -294,7 +294,7 @@ grub_mofile_open_lang (const char *locale_dir, const char *locale)
|
|||
static void
|
||||
grub_gettext_init_ext (const char *locale)
|
||||
{
|
||||
char *locale_dir;
|
||||
const char *locale_dir;
|
||||
|
||||
if (!locale)
|
||||
return;
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <grub/gfxmenu_view.h>
|
||||
#include <grub/gui_string_util.h>
|
||||
#include <grub/icon_manager.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static void
|
||||
init_terminal (grub_gfxmenu_view_t view);
|
||||
|
@ -77,7 +78,7 @@ grub_gfxmenu_view_new (const char *theme_path,
|
|||
view->desktop_image = 0;
|
||||
view->desktop_color = default_bg_color;
|
||||
view->terminal_box = grub_gfxmenu_create_box (0, 0);
|
||||
view->title_text = grub_strdup ("GRUB Boot Menu");
|
||||
view->title_text = grub_strdup (_("GRUB Boot Menu"));
|
||||
view->progress_message_text = 0;
|
||||
view->theme_path = 0;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static char *grub_datetime_names[] =
|
||||
static const char *grub_datetime_names[] =
|
||||
{
|
||||
"YEAR",
|
||||
"MONTH",
|
||||
|
@ -37,7 +37,7 @@ static char *grub_datetime_names[] =
|
|||
"WEEKDAY",
|
||||
};
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
grub_read_hook_datetime (struct grub_env_var *var,
|
||||
const char *val __attribute__ ((unused)))
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ grub_read_hook_datetime (struct grub_env_var *var,
|
|||
int i;
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
if (! grub_strcmp (var->name, grub_datetime_names[i]))
|
||||
if (grub_strcmp (var->name, grub_datetime_names[i]) == 0)
|
||||
{
|
||||
int n;
|
||||
|
||||
|
|
|
@ -697,7 +697,7 @@ grub_dl_load (const char *name)
|
|||
{
|
||||
char *filename;
|
||||
grub_dl_t mod;
|
||||
char *grub_dl_dir = grub_env_get ("prefix");
|
||||
const char *grub_dl_dir = grub_env_get ("prefix");
|
||||
|
||||
mod = grub_dl_get (name);
|
||||
if (mod)
|
||||
|
|
|
@ -94,6 +94,8 @@ struct hd_geometry
|
|||
# include <sys/disk.h> /* DIOCGMEDIASIZE */
|
||||
# include <sys/param.h>
|
||||
# include <sys/sysctl.h>
|
||||
# include <sys/mount.h>
|
||||
#include <libgeom.h>
|
||||
# define MAJOR(dev) major(dev)
|
||||
# define FLOPPY_MAJOR 2
|
||||
#endif
|
||||
|
@ -267,7 +269,7 @@ grub_util_get_fd_sectors (int fd, unsigned *log_secsize)
|
|||
struct stat st;
|
||||
|
||||
if (fstat (fd, &st) < 0)
|
||||
grub_util_error ("fstat failed");
|
||||
grub_util_error (_("fstat failed"));
|
||||
|
||||
#if defined(__linux__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__NetBSD__) \
|
||||
|
@ -322,7 +324,7 @@ grub_util_get_fd_sectors (int fd, unsigned *log_secsize)
|
|||
return minfo.dki_capacity;
|
||||
# else
|
||||
if (nr & ((1 << log_sector_size) - 1))
|
||||
grub_util_error ("unaligned device size");
|
||||
grub_util_error (_("unaligned device size"));
|
||||
|
||||
return (nr >> log_sector_size);
|
||||
# endif
|
||||
|
@ -371,7 +373,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
|
|||
size = grub_util_get_disk_size (map[drive].device);
|
||||
|
||||
if (size % 512)
|
||||
grub_util_error ("unaligned device size");
|
||||
grub_util_error (_("unaligned device size"));
|
||||
|
||||
disk->total_sectors = size >> 9;
|
||||
|
||||
|
@ -423,8 +425,59 @@ grub_util_device_is_mapped (const char *dev)
|
|||
#endif /* HAVE_DEVICE_MAPPER */
|
||||
}
|
||||
|
||||
|
||||
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
|
||||
/* FIXME: geom actually gives us the whole container hierarchy.
|
||||
It can be used more efficiently than this. */
|
||||
void
|
||||
grub_util_follow_gpart_up (const char *name, grub_disk_addr_t *off_out, char **name_out)
|
||||
{
|
||||
struct gmesh mesh;
|
||||
struct gclass *class;
|
||||
int error;
|
||||
struct ggeom *geom;
|
||||
|
||||
grub_util_info ("following geom '%s'", name);
|
||||
|
||||
error = geom_gettree (&mesh);
|
||||
if (error != 0)
|
||||
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"));
|
||||
|
||||
LIST_FOREACH (geom, &class->lg_geom, lg_geom)
|
||||
{
|
||||
struct gprovider *provider;
|
||||
LIST_FOREACH (provider, &geom->lg_provider, lg_provider)
|
||||
if (strcmp (provider->lg_name, name) == 0)
|
||||
{
|
||||
char *name_tmp = xstrdup (geom->lg_name);
|
||||
grub_disk_addr_t off = 0;
|
||||
struct gconfig *config;
|
||||
grub_util_info ("geom '%s' has parent '%s'", name, geom->lg_name);
|
||||
|
||||
grub_util_follow_gpart_up (name_tmp, &off, name_out);
|
||||
free (name_tmp);
|
||||
LIST_FOREACH (config, &provider->lg_config, lg_config)
|
||||
if (strcasecmp (config->lg_name, "start") == 0)
|
||||
off += strtoull (config->lg_val, 0, 10);
|
||||
if (off_out)
|
||||
*off_out = off;
|
||||
return;
|
||||
}
|
||||
}
|
||||
grub_util_info ("geom '%s' has no parent", name);
|
||||
if (name_out)
|
||||
*name_out = xstrdup (name);
|
||||
if (off_out)
|
||||
*off_out = 0;
|
||||
}
|
||||
|
||||
static grub_disk_addr_t
|
||||
find_partition_start (const char *dev)
|
||||
{
|
||||
|
@ -1091,18 +1144,18 @@ read_device_map (const char *dev_map)
|
|||
continue;
|
||||
|
||||
if (*p != '(')
|
||||
show_error ("No open parenthesis found");
|
||||
show_error (_("No open parenthesis found"));
|
||||
|
||||
p++;
|
||||
/* Find a free slot. */
|
||||
drive = find_free_slot ();
|
||||
if (drive < 0)
|
||||
show_error ("Map table size exceeded");
|
||||
show_error (_("Map table size exceeded"));
|
||||
|
||||
e = p;
|
||||
p = strchr (p, ')');
|
||||
if (! p)
|
||||
show_error ("No close parenthesis found");
|
||||
show_error (_("No close parenthesis found"));
|
||||
|
||||
map[drive].drive = xmalloc (p - e + sizeof ('\0'));
|
||||
strncpy (map[drive].drive, e, p - e + sizeof ('\0'));
|
||||
|
@ -1114,7 +1167,7 @@ read_device_map (const char *dev_map)
|
|||
p++;
|
||||
|
||||
if (*p == '\0')
|
||||
show_error ("No filename found");
|
||||
show_error (_("No filename found"));
|
||||
|
||||
/* NUL-terminate the filename. */
|
||||
e = p;
|
||||
|
@ -1143,7 +1196,7 @@ read_device_map (const char *dev_map)
|
|||
{
|
||||
map[drive].device = xmalloc (PATH_MAX);
|
||||
if (! realpath (p, map[drive].device))
|
||||
grub_util_error ("cannot get the real path of `%s'", p);
|
||||
grub_util_error (_("cannot get the real path of `%s'"), p);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
|
|
@ -98,10 +98,10 @@ usage (int status)
|
|||
{
|
||||
if (status)
|
||||
fprintf (stderr,
|
||||
"Try `%s --help' for more information.\n", program_name);
|
||||
_("Try `%s --help' for more information.\n"), program_name);
|
||||
else
|
||||
printf (
|
||||
"Usage: %s [OPTION]...\n"
|
||||
_("Usage: %s [OPTION]...\n"
|
||||
"\n"
|
||||
"GRUB emulator.\n"
|
||||
"\n"
|
||||
|
@ -113,7 +113,7 @@ usage (int status)
|
|||
" -h, --help display this message and exit\n"
|
||||
" -V, --version print version information and exit\n"
|
||||
"\n"
|
||||
"Report bugs to <%s>.\n", program_name, DEFAULT_DEVICE_MAP, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT);
|
||||
"Report bugs to <%s>.\n"), program_name, DEFAULT_DEVICE_MAP, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -166,13 +166,13 @@ main (int argc, char *argv[])
|
|||
|
||||
if (optind < argc)
|
||||
{
|
||||
fprintf (stderr, "Unknown extra argument `%s'.\n", argv[optind]);
|
||||
fprintf (stderr, _("Unknown extra argument `%s'.\n"), argv[optind]);
|
||||
return usage (1);
|
||||
}
|
||||
|
||||
/* Wait until the ARGS.HOLD variable is cleared by an attached debugger. */
|
||||
if (hold && verbosity > 0)
|
||||
printf ("Run \"gdb %s %d\", and set ARGS.HOLD to zero.\n",
|
||||
printf (_("Run \"gdb %s %d\", and set ARGS.HOLD to zero.\n"),
|
||||
program_name, (int) getpid ());
|
||||
while (hold)
|
||||
{
|
||||
|
|
|
@ -117,7 +117,7 @@ xmalloc (grub_size_t size)
|
|||
|
||||
p = malloc (size);
|
||||
if (! p)
|
||||
grub_util_error ("out of memory");
|
||||
grub_util_error (_("out of memory"));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ xrealloc (void *ptr, grub_size_t size)
|
|||
{
|
||||
ptr = realloc (ptr, size);
|
||||
if (! ptr)
|
||||
grub_util_error ("out of memory");
|
||||
grub_util_error (_("out of memory"));
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ xasprintf (const char *fmt, ...)
|
|||
if (vasprintf (&result, fmt, ap) < 0)
|
||||
{
|
||||
if (errno == ENOMEM)
|
||||
grub_util_error ("out of memory");
|
||||
grub_util_error (_("out of memory"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ 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"));
|
||||
#endif
|
||||
|
||||
if (!p)
|
||||
|
|
|
@ -132,7 +132,7 @@ grub_env_set (const char *name, const char *val)
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
grub_env_get (const char *name)
|
||||
{
|
||||
struct grub_env_var *var;
|
||||
|
|
|
@ -30,7 +30,6 @@ grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
|||
const Elf64_Ehdr *e = ehdr;
|
||||
grub_size_t cntt = 0, cntg = 0;;
|
||||
const Elf64_Shdr *s;
|
||||
Elf64_Word entsize;
|
||||
unsigned i;
|
||||
|
||||
/* Find a symbol table. */
|
||||
|
@ -43,8 +42,6 @@ grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
|||
if (i == grub_le_to_cpu16 (e->e_shnum))
|
||||
return;
|
||||
|
||||
entsize = s->sh_entsize;
|
||||
|
||||
for (i = 0, s = (Elf64_Shdr *) ((char *) e + grub_le_to_cpu32 (e->e_shoff));
|
||||
i < grub_le_to_cpu16 (e->e_shnum);
|
||||
i++, s = (Elf64_Shdr *) ((char *) s + grub_le_to_cpu16 (e->e_shentsize)))
|
||||
|
|
|
@ -532,7 +532,7 @@ grub_ieee1275_release (grub_addr_t addr, grub_size_t size)
|
|||
|
||||
int
|
||||
grub_ieee1275_set_property (grub_ieee1275_phandle_t phandle,
|
||||
const char *propname, void *buf,
|
||||
const char *propname, const void *buf,
|
||||
grub_size_t size, grub_ssize_t *actual)
|
||||
{
|
||||
struct set_property_args
|
||||
|
|
|
@ -403,7 +403,8 @@ grub_ieee1275_parse_args (const char *path, enum grub_ieee1275_parse_type ptype)
|
|||
break;
|
||||
default:
|
||||
unknown:
|
||||
grub_printf ("Unsupported type %s for device %s\n", type, device);
|
||||
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"unsupported type %s for device %s", type, device);
|
||||
}
|
||||
|
||||
fail:
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <grub/term.h>
|
||||
#include <grub/arc/arc.h>
|
||||
#include <grub/offsets.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
const char *type_names[] = {
|
||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||
|
@ -178,7 +179,7 @@ grub_halt (void)
|
|||
|
||||
grub_millisleep (1500);
|
||||
|
||||
grub_printf ("Shutdown failed\n");
|
||||
grub_puts_ (N_("Shutdown failed"));
|
||||
grub_refresh ();
|
||||
while (1);
|
||||
}
|
||||
|
@ -190,7 +191,7 @@ grub_exit (void)
|
|||
|
||||
grub_millisleep (1500);
|
||||
|
||||
grub_printf ("Exit failed\n");
|
||||
grub_puts_ (N_("Exit failed"));
|
||||
grub_refresh ();
|
||||
while (1);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <grub/cs5536.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/cpu/memory.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
extern void grub_video_sm712_init (void);
|
||||
extern void grub_video_sis315pro_init (void);
|
||||
|
@ -254,7 +255,7 @@ grub_halt (void)
|
|||
break;
|
||||
}
|
||||
|
||||
grub_printf ("Shutdown failed\n");
|
||||
grub_puts_ (N_("Shutdown failed"));
|
||||
grub_refresh ();
|
||||
while (1);
|
||||
}
|
||||
|
|
|
@ -216,6 +216,8 @@ grub_vprintf (const char *fmt, va_list args)
|
|||
s = grub_vsnprintf_real (curbuf, s, fmt, ap2);
|
||||
}
|
||||
|
||||
va_end (ap2);
|
||||
|
||||
grub_xputs (curbuf);
|
||||
|
||||
if (curbuf != buf)
|
||||
|
@ -312,52 +314,6 @@ grub_strrchr (const char *s, int c)
|
|||
return p;
|
||||
}
|
||||
|
||||
/* Copied from gnulib.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2005. */
|
||||
char *
|
||||
grub_strstr (const char *haystack, const char *needle)
|
||||
{
|
||||
/* Be careful not to look at the entire extent of haystack or needle
|
||||
until needed. This is useful because of these two cases:
|
||||
- haystack may be very long, and a match of needle found early,
|
||||
- needle may be very long, and not even a short initial segment of
|
||||
needle may be found in haystack. */
|
||||
if (*needle != '\0')
|
||||
{
|
||||
/* Speed up the following searches of needle by caching its first
|
||||
character. */
|
||||
char b = *needle++;
|
||||
|
||||
for (;; haystack++)
|
||||
{
|
||||
if (*haystack == '\0')
|
||||
/* No match. */
|
||||
return NULL;
|
||||
if (*haystack == b)
|
||||
/* The first character matches. */
|
||||
{
|
||||
const char *rhaystack = haystack + 1;
|
||||
const char *rneedle = needle;
|
||||
|
||||
for (;; rhaystack++, rneedle++)
|
||||
{
|
||||
if (*rneedle == '\0')
|
||||
/* Found a match. */
|
||||
return (char *) haystack;
|
||||
if (*rhaystack == '\0')
|
||||
/* No match. */
|
||||
return NULL;
|
||||
if (*rhaystack != *rneedle)
|
||||
/* Nothing in this round. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return (char *) haystack;
|
||||
}
|
||||
|
||||
int
|
||||
grub_strword (const char *haystack, const char *needle)
|
||||
{
|
||||
|
@ -681,10 +637,13 @@ grub_lltoa (char *str, int c, unsigned long long n)
|
|||
}
|
||||
|
||||
static int
|
||||
grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt, va_list args)
|
||||
grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list args_in)
|
||||
{
|
||||
char c;
|
||||
grub_size_t n = 0;
|
||||
grub_size_t count = 0;
|
||||
grub_size_t count_args = 0;
|
||||
const char *fmt;
|
||||
auto void write_char (unsigned char ch);
|
||||
auto void write_str (const char *s);
|
||||
auto void write_fill (const char ch, int n);
|
||||
|
@ -703,209 +662,362 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt, va_list ar
|
|||
write_char (*s++);
|
||||
}
|
||||
|
||||
void write_fill (const char ch, int n)
|
||||
void write_fill (const char ch, int count_fill)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
for (i = 0; i < count_fill; i++)
|
||||
write_char (ch);
|
||||
}
|
||||
|
||||
fmt = fmt0;
|
||||
while ((c = *fmt++) != 0)
|
||||
{
|
||||
if (c != '%')
|
||||
write_char (c);
|
||||
else
|
||||
continue;
|
||||
|
||||
if (*fmt && *fmt =='-')
|
||||
fmt++;
|
||||
|
||||
while (*fmt && grub_isdigit (*fmt))
|
||||
fmt++;
|
||||
|
||||
if (*fmt && *fmt == '$')
|
||||
fmt++;
|
||||
|
||||
if (*fmt && *fmt =='-')
|
||||
fmt++;
|
||||
|
||||
while (*fmt && grub_isdigit (*fmt))
|
||||
fmt++;
|
||||
|
||||
if (*fmt && *fmt =='.')
|
||||
fmt++;
|
||||
|
||||
while (*fmt && grub_isdigit (*fmt))
|
||||
fmt++;
|
||||
|
||||
c = *fmt++;
|
||||
if (c == 'l')
|
||||
{
|
||||
char tmp[32];
|
||||
char *p;
|
||||
unsigned int format1 = 0;
|
||||
unsigned int format2 = ~ 0U;
|
||||
char zerofill = ' ';
|
||||
int rightfill = 0;
|
||||
int n;
|
||||
int longfmt = 0;
|
||||
int longlongfmt = 0;
|
||||
int unsig = 0;
|
||||
c = *fmt++;
|
||||
if (c == 'l')
|
||||
c = *fmt++;
|
||||
}
|
||||
switch (c)
|
||||
{
|
||||
case 'p':
|
||||
case 'x':
|
||||
case 'u':
|
||||
case 'd':
|
||||
case 'c':
|
||||
case 'C':
|
||||
case 's':
|
||||
count_args++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (*fmt && *fmt =='-')
|
||||
enum { INT, WCHAR, LONG, LONGLONG, POINTER } types[count_args];
|
||||
union
|
||||
{
|
||||
int i;
|
||||
grub_uint32_t w;
|
||||
long l;
|
||||
long long ll;
|
||||
void *p;
|
||||
} args[count_args];
|
||||
|
||||
grub_memset (types, 0, sizeof (types));
|
||||
|
||||
fmt = fmt0;
|
||||
n = 0;
|
||||
while ((c = *fmt++) != 0)
|
||||
{
|
||||
int longfmt = 0;
|
||||
int longlongfmt = 0;
|
||||
grub_size_t curn;
|
||||
const char *p;
|
||||
|
||||
if (c != '%')
|
||||
continue;
|
||||
|
||||
curn = n++;
|
||||
|
||||
if (*fmt && *fmt =='-')
|
||||
fmt++;
|
||||
|
||||
while (*fmt && grub_isdigit (*fmt))
|
||||
fmt++;
|
||||
|
||||
p = fmt;
|
||||
|
||||
if (*fmt && *fmt == '$')
|
||||
{
|
||||
curn = grub_strtoull (p, 0, 10) - 1;
|
||||
fmt++;
|
||||
}
|
||||
|
||||
while (*fmt && grub_isdigit (*fmt))
|
||||
fmt++;
|
||||
|
||||
c = *fmt++;
|
||||
if (c == 'l')
|
||||
{
|
||||
c = *fmt++;
|
||||
longfmt = 1;
|
||||
if (c == 'l')
|
||||
{
|
||||
rightfill = 1;
|
||||
fmt++;
|
||||
c = *fmt++;
|
||||
longlongfmt = 1;
|
||||
}
|
||||
}
|
||||
if (curn >= count_args)
|
||||
continue;
|
||||
switch (c)
|
||||
{
|
||||
case 'x':
|
||||
case 'u':
|
||||
case 'd':
|
||||
if (longlongfmt)
|
||||
types[curn] = LONGLONG;
|
||||
else if (longfmt)
|
||||
types[curn] = LONG;
|
||||
else
|
||||
types[curn] = INT;
|
||||
break;
|
||||
case 'p':
|
||||
case 's':
|
||||
types[curn] = POINTER;
|
||||
break;
|
||||
case 'c':
|
||||
types[curn] = INT;
|
||||
break;
|
||||
case 'C':
|
||||
types[curn] = WCHAR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
p = (char *) fmt;
|
||||
/* Read formatting parameters. */
|
||||
for (n = 0; n < count_args; n++)
|
||||
switch (types[n])
|
||||
{
|
||||
case WCHAR:
|
||||
args[n].w = va_arg (args_in, grub_uint32_t);
|
||||
break;
|
||||
case POINTER:
|
||||
args[n].p = va_arg (args_in, void *);
|
||||
break;
|
||||
case INT:
|
||||
args[n].i = va_arg (args_in, int);
|
||||
break;
|
||||
case LONG:
|
||||
args[n].l = va_arg (args_in, long);
|
||||
break;
|
||||
case LONGLONG:
|
||||
args[n].ll = va_arg (args_in, long long);
|
||||
break;
|
||||
}
|
||||
|
||||
fmt = fmt0;
|
||||
|
||||
n = 0;
|
||||
while ((c = *fmt++) != 0)
|
||||
{
|
||||
char tmp[32];
|
||||
char *p;
|
||||
unsigned int format1 = 0;
|
||||
unsigned int format2 = ~ 0U;
|
||||
char zerofill = ' ';
|
||||
int rightfill = 0;
|
||||
int longfmt = 0;
|
||||
int longlongfmt = 0;
|
||||
int unsig = 0;
|
||||
grub_size_t curn;
|
||||
|
||||
if (c != '%')
|
||||
{
|
||||
write_char (c);
|
||||
continue;
|
||||
}
|
||||
|
||||
curn = n++;
|
||||
|
||||
rescan:;
|
||||
|
||||
if (*fmt && *fmt =='-')
|
||||
{
|
||||
rightfill = 1;
|
||||
fmt++;
|
||||
}
|
||||
|
||||
p = (char *) fmt;
|
||||
/* Read formatting parameters. */
|
||||
while (*p && grub_isdigit (*p))
|
||||
p++;
|
||||
|
||||
if (p > fmt)
|
||||
{
|
||||
char s[p - fmt + 1];
|
||||
grub_strncpy (s, fmt, p - fmt);
|
||||
s[p - fmt] = 0;
|
||||
if (s[0] == '0')
|
||||
zerofill = '0';
|
||||
format1 = grub_strtoul (s, 0, 10);
|
||||
fmt = p;
|
||||
}
|
||||
|
||||
if (*p && *p == '.')
|
||||
{
|
||||
p++;
|
||||
fmt++;
|
||||
while (*p && grub_isdigit (*p))
|
||||
p++;
|
||||
|
||||
if (p > fmt)
|
||||
{
|
||||
char s[p - fmt + 1];
|
||||
grub_strncpy (s, fmt, p - fmt);
|
||||
s[p - fmt] = 0;
|
||||
if (s[0] == '0')
|
||||
zerofill = '0';
|
||||
format1 = grub_strtoul (s, 0, 10);
|
||||
char fstr[p - fmt + 1];
|
||||
grub_strncpy (fstr, fmt, p - fmt);
|
||||
fstr[p - fmt] = 0;
|
||||
format2 = grub_strtoul (fstr, 0, 10);
|
||||
fmt = p;
|
||||
}
|
||||
}
|
||||
if (*fmt == '$')
|
||||
{
|
||||
curn = format1 - 1;
|
||||
fmt++;
|
||||
format1 = 0;
|
||||
format2 = ~ 0U;
|
||||
zerofill = ' ';
|
||||
rightfill = 0;
|
||||
|
||||
if (*p && *p == '.')
|
||||
{
|
||||
p++;
|
||||
fmt++;
|
||||
while (*p && grub_isdigit (*p))
|
||||
p++;
|
||||
|
||||
if (p > fmt)
|
||||
{
|
||||
char fstr[p - fmt + 1];
|
||||
grub_strncpy (fstr, fmt, p - fmt);
|
||||
fstr[p - fmt] = 0;
|
||||
format2 = grub_strtoul (fstr, 0, 10);
|
||||
fmt = p;
|
||||
}
|
||||
}
|
||||
goto rescan;
|
||||
}
|
||||
|
||||
c = *fmt++;
|
||||
if (c == 'l')
|
||||
{
|
||||
longfmt = 1;
|
||||
c = *fmt++;
|
||||
if (c == 'l')
|
||||
{
|
||||
longfmt = 1;
|
||||
longlongfmt = 1;
|
||||
c = *fmt++;
|
||||
if (c == 'l')
|
||||
{
|
||||
longlongfmt = 1;
|
||||
c = *fmt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 'p':
|
||||
write_str ("0x");
|
||||
c = 'x';
|
||||
longlongfmt |= (sizeof (void *) == sizeof (long long));
|
||||
/* Fall through. */
|
||||
case 'x':
|
||||
case 'u':
|
||||
unsig = 1;
|
||||
/* Fall through. */
|
||||
case 'd':
|
||||
if (longlongfmt)
|
||||
{
|
||||
long long ll;
|
||||
if (curn >= count_args)
|
||||
continue;
|
||||
|
||||
ll = va_arg (args, long long);
|
||||
grub_lltoa (tmp, c, ll);
|
||||
}
|
||||
else if (longfmt && unsig)
|
||||
{
|
||||
unsigned long l = va_arg (args, unsigned long);
|
||||
grub_lltoa (tmp, c, l);
|
||||
}
|
||||
else if (longfmt)
|
||||
{
|
||||
long l = va_arg (args, long);
|
||||
grub_lltoa (tmp, c, l);
|
||||
}
|
||||
else if (unsig)
|
||||
{
|
||||
unsigned u = va_arg (args, unsigned);
|
||||
grub_lltoa (tmp, c, u);
|
||||
}
|
||||
else
|
||||
{
|
||||
n = va_arg (args, int);
|
||||
grub_lltoa (tmp, c, n);
|
||||
}
|
||||
if (! rightfill && grub_strlen (tmp) < format1)
|
||||
write_fill (zerofill, format1 - grub_strlen (tmp));
|
||||
write_str (tmp);
|
||||
if (rightfill && grub_strlen (tmp) < format1)
|
||||
write_fill (zerofill, format1 - grub_strlen (tmp));
|
||||
break;
|
||||
switch (c)
|
||||
{
|
||||
case 'p':
|
||||
write_str ("0x");
|
||||
c = 'x';
|
||||
longlongfmt |= (sizeof (void *) == sizeof (long long));
|
||||
/* Fall through. */
|
||||
case 'x':
|
||||
case 'u':
|
||||
unsig = 1;
|
||||
/* Fall through. */
|
||||
case 'd':
|
||||
if (longlongfmt)
|
||||
grub_lltoa (tmp, c, args[curn].ll);
|
||||
else if (longfmt && unsig)
|
||||
grub_lltoa (tmp, c, (unsigned long) args[curn].l);
|
||||
else if (longfmt)
|
||||
grub_lltoa (tmp, c, args[curn].l);
|
||||
else if (unsig)
|
||||
grub_lltoa (tmp, c, (unsigned) args[curn].i);
|
||||
else
|
||||
grub_lltoa (tmp, c, args[curn].i);
|
||||
if (! rightfill && grub_strlen (tmp) < format1)
|
||||
write_fill (zerofill, format1 - grub_strlen (tmp));
|
||||
write_str (tmp);
|
||||
if (rightfill && grub_strlen (tmp) < format1)
|
||||
write_fill (zerofill, format1 - grub_strlen (tmp));
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
n = va_arg (args, int);
|
||||
write_char (n & 0xff);
|
||||
break;
|
||||
case 'c':
|
||||
write_char (args[curn].i & 0xff);
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
case 'C':
|
||||
{
|
||||
grub_uint32_t code = args[curn].w;
|
||||
int shift;
|
||||
unsigned mask;
|
||||
|
||||
if (code <= 0x7f)
|
||||
{
|
||||
grub_uint32_t code = va_arg (args, grub_uint32_t);
|
||||
int shift;
|
||||
unsigned mask;
|
||||
|
||||
if (code <= 0x7f)
|
||||
{
|
||||
shift = 0;
|
||||
mask = 0;
|
||||
}
|
||||
else if (code <= 0x7ff)
|
||||
{
|
||||
shift = 6;
|
||||
mask = 0xc0;
|
||||
}
|
||||
else if (code <= 0xffff)
|
||||
{
|
||||
shift = 12;
|
||||
mask = 0xe0;
|
||||
}
|
||||
else if (code <= 0x1fffff)
|
||||
{
|
||||
shift = 18;
|
||||
mask = 0xf0;
|
||||
}
|
||||
else if (code <= 0x3ffffff)
|
||||
{
|
||||
shift = 24;
|
||||
mask = 0xf8;
|
||||
}
|
||||
else if (code <= 0x7fffffff)
|
||||
{
|
||||
shift = 30;
|
||||
mask = 0xfc;
|
||||
}
|
||||
else
|
||||
{
|
||||
code = '?';
|
||||
shift = 0;
|
||||
mask = 0;
|
||||
}
|
||||
|
||||
write_char (mask | (code >> shift));
|
||||
|
||||
for (shift -= 6; shift >= 0; shift -= 6)
|
||||
write_char (0x80 | (0x3f & (code >> shift)));
|
||||
shift = 0;
|
||||
mask = 0;
|
||||
}
|
||||
else if (code <= 0x7ff)
|
||||
{
|
||||
shift = 6;
|
||||
mask = 0xc0;
|
||||
}
|
||||
else if (code <= 0xffff)
|
||||
{
|
||||
shift = 12;
|
||||
mask = 0xe0;
|
||||
}
|
||||
else if (code <= 0x1fffff)
|
||||
{
|
||||
shift = 18;
|
||||
mask = 0xf0;
|
||||
}
|
||||
else if (code <= 0x3ffffff)
|
||||
{
|
||||
shift = 24;
|
||||
mask = 0xf8;
|
||||
}
|
||||
else if (code <= 0x7fffffff)
|
||||
{
|
||||
shift = 30;
|
||||
mask = 0xfc;
|
||||
}
|
||||
else
|
||||
{
|
||||
code = '?';
|
||||
shift = 0;
|
||||
mask = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 's':
|
||||
p = va_arg (args, char *);
|
||||
if (p)
|
||||
{
|
||||
grub_size_t len = 0;
|
||||
while (len < format2 && p[len])
|
||||
len++;
|
||||
write_char (mask | (code >> shift));
|
||||
|
||||
if (!rightfill && len < format1)
|
||||
write_fill (zerofill, format1 - len);
|
||||
for (shift -= 6; shift >= 0; shift -= 6)
|
||||
write_char (0x80 | (0x3f & (code >> shift)));
|
||||
}
|
||||
break;
|
||||
|
||||
grub_size_t i;
|
||||
for (i = 0; i < len; i++)
|
||||
write_char (*p++);
|
||||
case 's':
|
||||
p = args[curn].p;
|
||||
if (p)
|
||||
{
|
||||
grub_size_t len = 0;
|
||||
while (len < format2 && p[len])
|
||||
len++;
|
||||
|
||||
if (rightfill && len < format1)
|
||||
write_fill (zerofill, format1 - len);
|
||||
}
|
||||
else
|
||||
write_str ("(null)");
|
||||
if (!rightfill && len < format1)
|
||||
write_fill (zerofill, format1 - len);
|
||||
|
||||
break;
|
||||
grub_size_t i;
|
||||
for (i = 0; i < len; i++)
|
||||
write_char (*p++);
|
||||
|
||||
default:
|
||||
write_char (c);
|
||||
break;
|
||||
if (rightfill && len < format1)
|
||||
write_fill (zerofill, format1 - len);
|
||||
}
|
||||
else
|
||||
write_str ("(null)");
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
write_char (c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -957,6 +1069,9 @@ grub_xvasprintf (const char *fmt, va_list ap)
|
|||
return NULL;
|
||||
|
||||
s = grub_vsnprintf_real (ret, as, fmt, ap2);
|
||||
|
||||
va_end (ap2);
|
||||
|
||||
if (s <= as)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
|
|||
|
||||
void add_var (grub_parser_state_t newstate)
|
||||
{
|
||||
char *val;
|
||||
const char *val;
|
||||
|
||||
/* Check if a variable was being read in and the end of the name
|
||||
was reached. */
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
#include <grub/util/misc.h>
|
||||
|
@ -47,7 +48,7 @@ grub_partition_check_containment (const grub_disk_t disk,
|
|||
grub_dprintf ("partition", "sub-partition %s%d of (%s,%s) ends after parent.\n",
|
||||
part->partmap->name, part->number + 1, disk->name, partname);
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_warn ("Discarding improperly nested partition (%s,%s,%s%d)",
|
||||
grub_util_warn (_("Discarding improperly nested partition (%s,%s,%s%d)"),
|
||||
disk->name, partname, part->partmap->name, part->number + 1);
|
||||
#endif
|
||||
grub_free (partname);
|
||||
|
|
|
@ -109,7 +109,9 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
break;
|
||||
|
||||
default:
|
||||
grub_fatal ("Unrecognized relocation: %d\n", ELF_R_TYPE (rel->r_info));
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"this relocation (%d) is not implemented yet",
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1994,13 +1994,15 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize
|
|||
static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
|
||||
{
|
||||
UInt32 beforeSize = kNumOpts;
|
||||
#ifdef COMPRESS_MF_MT
|
||||
Bool btMode;
|
||||
#endif
|
||||
if (!RangeEnc_Alloc(&p->rc, alloc))
|
||||
return SZ_ERROR_MEM;
|
||||
#ifdef COMPRESS_MF_MT
|
||||
btMode = (p->matchFinderBase.btMode != 0);
|
||||
#ifdef COMPRESS_MF_MT
|
||||
p->mtMode = (p->multiThread && !p->fastMode && btMode);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
{
|
||||
unsigned lclp = p->lc + p->lp;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <grub/cpu/io.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/acpi.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
const char bochs_shutdown[] = "Shutdown";
|
||||
|
||||
|
@ -52,7 +53,7 @@ grub_halt (void)
|
|||
for (i = 0; i < sizeof (bochs_shutdown) - 1; i++)
|
||||
grub_outb (bochs_shutdown[i], 0x8900);
|
||||
|
||||
grub_printf ("GRUB doesn't know how to halt this machine yet!\n");
|
||||
grub_puts_ (N_("GRUB doesn't know how to halt this machine yet!"));
|
||||
|
||||
/* In order to return we'd have to check what the previous status of IF
|
||||
flag was. But user most likely doesn't want to return anyway ... */
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
static int
|
||||
grub_get_root_biosnumber_default (void)
|
||||
{
|
||||
char *biosnum;
|
||||
const char *biosnum;
|
||||
int ret = -1;
|
||||
grub_device_t dev;
|
||||
|
||||
|
|
|
@ -58,6 +58,9 @@ struct legacy_command
|
|||
const char *longdesc;
|
||||
};
|
||||
|
||||
/* Help texts are kept here mostly for reference. They are never shown. So
|
||||
no need to gettextize.
|
||||
*/
|
||||
static struct legacy_command legacy_commands[] =
|
||||
{
|
||||
{"blocklist", "blocklist '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILE",
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
void
|
||||
grub_reboot (void)
|
||||
|
@ -28,7 +29,7 @@ grub_reboot (void)
|
|||
|
||||
grub_millisleep (1500);
|
||||
|
||||
grub_printf ("Reboot failed\n");
|
||||
grub_puts_ (N_("Reboot failed"));
|
||||
grub_refresh ();
|
||||
while (1);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/cs5536.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
void
|
||||
grub_reboot (void)
|
||||
|
@ -51,7 +52,7 @@ grub_reboot (void)
|
|||
}
|
||||
grub_millisleep (1500);
|
||||
|
||||
grub_printf ("Reboot failed\n");
|
||||
grub_puts_ (N_("Reboot failed"));
|
||||
grub_refresh ();
|
||||
while (1);
|
||||
}
|
||||
|
|
|
@ -78,9 +78,9 @@ struct xz_dec {
|
|||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
const gcry_md_spec_t *hash;
|
||||
const gcry_md_spec_t *crc32;
|
||||
grub_uint8_t hash_id;
|
||||
#endif
|
||||
grub_size_t hash_size;
|
||||
grub_uint8_t hash_id;
|
||||
|
||||
/* True if we are operating in single-call mode. */
|
||||
bool single_call;
|
||||
|
@ -428,8 +428,7 @@ static enum xz_ret hash_validate(struct xz_dec *s, struct xz_buf *b,
|
|||
return XZ_STREAM_END;
|
||||
}
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
static struct
|
||||
static const struct
|
||||
{
|
||||
const char *name;
|
||||
grub_size_t size;
|
||||
|
@ -438,7 +437,6 @@ static struct
|
|||
[0x04] = { "CRC64", 8},
|
||||
[0x0A] = { "SHA256", 32},
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Decode the Stream Header field (the first 12 bytes of the .xz Stream). */
|
||||
static enum xz_ret dec_stream_header(struct xz_dec *s)
|
||||
|
@ -470,9 +468,9 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
/*
|
||||
* Decode the Stream Flags field. Of integrity checks, we support
|
||||
* only none (Check ID = 0) and CRC32 (Check ID = 1).
|
||||
* Decode the Stream Flags field.
|
||||
*/
|
||||
if (s->temp.buf[HEADER_MAGIC_SIZE] != 0
|
||||
|| s->temp.buf[HEADER_MAGIC_SIZE + 1] >= ARRAY_SIZE (hashes)
|
||||
|
@ -482,7 +480,6 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)
|
|||
|
||||
s->hash_id = s->temp.buf[HEADER_MAGIC_SIZE + 1];
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
if (s->crc32)
|
||||
{
|
||||
s->crc32_context = kmalloc(s->crc32->contextsize, GFP_KERNEL);
|
||||
|
@ -530,17 +527,15 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)
|
|||
s->hash->init(s->index.hash.hash_context);
|
||||
s->hash->init(s->block.hash.hash_context);
|
||||
}
|
||||
#else
|
||||
s->hash = 0;
|
||||
#endif
|
||||
#if 1
|
||||
if (!s->hash)
|
||||
return XZ_OPTIONS_ERROR;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
s->hash = 0;
|
||||
#endif
|
||||
s->hash_size = 0;
|
||||
}
|
||||
|
||||
|
@ -589,8 +584,10 @@ static enum xz_ret dec_stream_footer(struct xz_dec *s)
|
|||
if ((s->index.size >> 2) != get_le32(s->temp.buf + 4))
|
||||
return XZ_DATA_ERROR;
|
||||
|
||||
#ifndef GRUB_EMBED_DECOMPRESSOR
|
||||
if (s->temp.buf[8] != 0 || s->temp.buf[9] != s->hash_id)
|
||||
return XZ_DATA_ERROR;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use XZ_STREAM_END instead of XZ_OK to be more convenient
|
||||
|
|
|
@ -450,7 +450,8 @@ grub_freebsd_list_modules (void)
|
|||
{
|
||||
struct bsd_tag *tag;
|
||||
|
||||
grub_printf (" %-18s %-18s%14s%14s\n", "name", "type", "addr", "size");
|
||||
grub_printf (" %-18s %-18s%14s%14s\n", _("name"), _("type"), _("addr"),
|
||||
_("size"));
|
||||
|
||||
for (tag = tags; tag; tag = tag->next)
|
||||
{
|
||||
|
@ -515,7 +516,8 @@ grub_netbsd_list_modules (void)
|
|||
{
|
||||
struct netbsd_module *mod;
|
||||
|
||||
grub_printf (" %-18s%14s%14s%14s\n", "name", "type", "addr", "size");
|
||||
grub_printf (" %-18s%14s%14s%14s\n", _("name"), _("type"), _("addr"),
|
||||
_("size"));
|
||||
|
||||
for (mod = netbsd_mods; mod; mod = mod->next)
|
||||
grub_printf (" %-18s 0x%08x 0x%08x 0x%08x", mod->mod.name,
|
||||
|
@ -1050,7 +1052,7 @@ grub_netbsd_boot (void)
|
|||
if (err)
|
||||
{
|
||||
grub_print_error ();
|
||||
grub_printf ("Booting however\n");
|
||||
grub_puts_ (N_("Booting in blind mode"));
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
@ -2061,7 +2063,7 @@ GRUB_MOD_INIT (bsd)
|
|||
|
||||
cmd_openbsd_ramdisk = grub_register_command ("kopenbsd_ramdisk",
|
||||
grub_cmd_openbsd_ramdisk, 0,
|
||||
"Load kOpenBSD ramdisk. ");
|
||||
N_("Load kOpenBSD ramdisk."));
|
||||
|
||||
my_mod = mod;
|
||||
}
|
||||
|
|
|
@ -130,7 +130,10 @@ find_efi_mmap_size (void)
|
|||
grub_free (mmap);
|
||||
|
||||
if (ret < 0)
|
||||
grub_fatal ("cannot get memory map");
|
||||
{
|
||||
grub_error (GRUB_ERR_IO, "cannot get memory map");
|
||||
return 0;
|
||||
}
|
||||
else if (ret > 0)
|
||||
break;
|
||||
|
||||
|
@ -198,6 +201,8 @@ allocate_pages (grub_size_t prot_size)
|
|||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
efi_mmap_size = find_efi_mmap_size ();
|
||||
if (efi_mmap_size == 0)
|
||||
return grub_errno;
|
||||
#endif
|
||||
|
||||
grub_dprintf ("linux", "real_size = %x, prot_size = %x, mmap_size = %x\n",
|
||||
|
@ -291,7 +296,7 @@ allocate_pages (grub_size_t prot_size)
|
|||
return err;
|
||||
}
|
||||
|
||||
static void
|
||||
static grub_err_t
|
||||
grub_e820_add_region (struct grub_e820_mmap *e820_map, int *e820_num,
|
||||
grub_uint64_t start, grub_uint64_t size,
|
||||
grub_uint32_t type)
|
||||
|
@ -299,7 +304,10 @@ grub_e820_add_region (struct grub_e820_mmap *e820_map, int *e820_num,
|
|||
int n = *e820_num;
|
||||
|
||||
if (n >= GRUB_E820_MAX_ENTRY)
|
||||
grub_fatal ("Too many e820 memory map entries");
|
||||
{
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"Too many e820 memory map entries");
|
||||
}
|
||||
|
||||
if ((n > 0) && (e820_map[n - 1].addr + e820_map[n - 1].size == start) &&
|
||||
(e820_map[n - 1].type == type))
|
||||
|
@ -311,6 +319,7 @@ grub_e820_add_region (struct grub_e820_mmap *e820_map, int *e820_num,
|
|||
e820_map[n].type = type;
|
||||
(*e820_num)++;
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
|
@ -320,7 +329,7 @@ grub_linux_setup_video (struct linux_kernel_params *params)
|
|||
void *framebuffer;
|
||||
grub_err_t err;
|
||||
grub_video_driver_id_t driver_id;
|
||||
char *gfxlfbvar = grub_env_get ("gfxpayloadforcelfb");
|
||||
const char *gfxlfbvar = grub_env_get ("gfxpayloadforcelfb");
|
||||
|
||||
driver_id = grub_video_get_driver_id ();
|
||||
|
||||
|
@ -418,14 +427,15 @@ grub_linux_boot (void)
|
|||
struct linux_kernel_params *params;
|
||||
int e820_num;
|
||||
grub_err_t err = 0;
|
||||
char *modevar, *tmp;
|
||||
const char *modevar;
|
||||
char *tmp;
|
||||
struct grub_relocator32_state state;
|
||||
|
||||
params = real_mode_mem;
|
||||
|
||||
#ifdef GRUB_MACHINE_IEEE1275
|
||||
{
|
||||
char *bootpath;
|
||||
const char *bootpath;
|
||||
grub_ssize_t len;
|
||||
|
||||
bootpath = grub_env_get ("root");
|
||||
|
@ -445,37 +455,38 @@ grub_linux_boot (void)
|
|||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size,
|
||||
grub_memory_type_t type)
|
||||
{
|
||||
grub_uint32_t e820_type;
|
||||
switch (type)
|
||||
{
|
||||
case GRUB_MEMORY_AVAILABLE:
|
||||
grub_e820_add_region (params->e820_map, &e820_num,
|
||||
addr, size, GRUB_E820_RAM);
|
||||
e820_type = GRUB_E820_RAM;
|
||||
break;
|
||||
|
||||
case GRUB_MEMORY_ACPI:
|
||||
grub_e820_add_region (params->e820_map, &e820_num,
|
||||
addr, size, GRUB_E820_ACPI);
|
||||
e820_type = GRUB_E820_ACPI;
|
||||
break;
|
||||
|
||||
case GRUB_MEMORY_NVS:
|
||||
grub_e820_add_region (params->e820_map, &e820_num,
|
||||
addr, size, GRUB_E820_NVS);
|
||||
e820_type = GRUB_E820_NVS;
|
||||
break;
|
||||
|
||||
case GRUB_MEMORY_BADRAM:
|
||||
grub_e820_add_region (params->e820_map, &e820_num,
|
||||
addr, size, GRUB_E820_BADRAM);
|
||||
e820_type = GRUB_E820_BADRAM;
|
||||
break;
|
||||
|
||||
default:
|
||||
grub_e820_add_region (params->e820_map, &e820_num,
|
||||
addr, size, GRUB_E820_RESERVED);
|
||||
e820_type = GRUB_E820_RESERVED;
|
||||
}
|
||||
if (grub_e820_add_region (params->e820_map, &e820_num,
|
||||
addr, size, e820_type))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
e820_num = 0;
|
||||
grub_mmap_iterate (hook);
|
||||
if (grub_mmap_iterate (hook))
|
||||
return grub_errno;
|
||||
params->mmap_size = e820_num;
|
||||
|
||||
modevar = grub_env_get ("gfxpayload");
|
||||
|
@ -506,7 +517,7 @@ grub_linux_boot (void)
|
|||
if (err)
|
||||
{
|
||||
grub_print_error ();
|
||||
grub_printf ("Booting however\n");
|
||||
grub_puts_ (N_("Booting in blind mode"));
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
@ -782,7 +793,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
vid_mode = GRUB_LINUX_VID_MODE_EXTENDED;
|
||||
else if (grub_strcmp (val, "ask") == 0)
|
||||
{
|
||||
grub_printf ("Legacy `ask' parameter no longer supported.\n");
|
||||
grub_puts_ (N_("Legacy `ask' parameter no longer supported."));
|
||||
|
||||
/* We usually would never do this in a loader, but "vga=ask" means user
|
||||
requested interaction, so it can't hurt to request keyboard input. */
|
||||
|
@ -798,9 +809,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
case 0:
|
||||
case GRUB_LINUX_VID_MODE_NORMAL:
|
||||
grub_env_set ("gfxpayload", "text");
|
||||
grub_printf ("%s is deprecated. "
|
||||
"Use set gfxpayload=text before "
|
||||
"linux command instead.\n",
|
||||
grub_printf_ (N_("%s is deprecated. "
|
||||
"Use set gfxpayload=text before "
|
||||
"linux command instead.\n"),
|
||||
argv[i]);
|
||||
break;
|
||||
|
||||
|
@ -808,9 +819,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
case GRUB_LINUX_VID_MODE_EXTENDED:
|
||||
/* FIXME: support 80x50 text. */
|
||||
grub_env_set ("gfxpayload", "text");
|
||||
grub_printf ("%s is deprecated. "
|
||||
"Use set gfxpayload=text before "
|
||||
"linux command instead.\n",
|
||||
grub_printf_ (N_("%s is deprecated. "
|
||||
"Use set gfxpayload=text before "
|
||||
"linux command instead.\n"),
|
||||
argv[i]);
|
||||
break;
|
||||
default:
|
||||
|
@ -819,9 +830,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
vid_mode > GRUB_VESA_MODE_TABLE_END)
|
||||
{
|
||||
grub_env_set ("gfxpayload", "text");
|
||||
grub_printf ("%s is deprecated. Mode %d isn't recognized. "
|
||||
"Use set gfxpayload=WIDTHxHEIGHT[xDEPTH] before "
|
||||
"linux command instead.\n",
|
||||
grub_printf_ (N_("%s is deprecated. Mode %d isn't recognized. "
|
||||
"Use set gfxpayload=WIDTHxHEIGHT[xDEPTH] "
|
||||
"before linux command instead.\n"),
|
||||
argv[i], vid_mode);
|
||||
break;
|
||||
}
|
||||
|
@ -836,9 +847,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (! buf)
|
||||
goto fail;
|
||||
|
||||
grub_printf ("%s is deprecated. "
|
||||
"Use set gfxpayload=%s before "
|
||||
"linux command instead.\n",
|
||||
grub_printf_ (N_("%s is deprecated. "
|
||||
"Use set gfxpayload=%s before "
|
||||
"linux command instead.\n"),
|
||||
argv[i], buf);
|
||||
err = grub_env_set ("gfxpayload", buf);
|
||||
grub_free (buf);
|
||||
|
|
|
@ -247,7 +247,7 @@ static grub_command_t cmd;
|
|||
GRUB_MOD_INIT(chainloader)
|
||||
{
|
||||
cmd = grub_register_command ("chainloader", grub_cmd_chainloader,
|
||||
"[--force|--bpb] FILE",
|
||||
N_("[--force|--bpb] FILE"),
|
||||
N_("Load another boot loader."));
|
||||
my_mod = mod;
|
||||
}
|
||||
|
|
|
@ -700,7 +700,7 @@ grub_cpu_xnu_fill_devicetree (void)
|
|||
return grub_errno;
|
||||
|
||||
/* First see if user supplies the value. */
|
||||
char *fsbvar = grub_env_get ("fsb");
|
||||
const char *fsbvar = grub_env_get ("fsb");
|
||||
if (! fsbvar)
|
||||
*((grub_uint64_t *) curval->data) = 0;
|
||||
else
|
||||
|
@ -1018,7 +1018,7 @@ grub_xnu_boot (void)
|
|||
{
|
||||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
grub_printf ("Booting in blind mode\n");
|
||||
grub_puts_ (N_("Booting in blind mode"));
|
||||
|
||||
bootparams->lfb_mode = 0;
|
||||
bootparams->lfb_width = 0;
|
||||
|
|
|
@ -182,7 +182,7 @@ grub_multiboot_set_console (int console_type, int accepted_consoles,
|
|||
if (console_required)
|
||||
return grub_error (GRUB_ERR_BAD_OS,
|
||||
"OS requires a console but none is available");
|
||||
grub_printf ("WARNING: no console will be available to OS");
|
||||
grub_puts_ (N_("WARNING: no console will be available to OS"));
|
||||
accepts_video = 0;
|
||||
accepts_ega_text = 0;
|
||||
return GRUB_ERR_NONE;
|
||||
|
|
|
@ -520,10 +520,10 @@ void
|
|||
grub_bootp_init (void)
|
||||
{
|
||||
cmd_bootp = grub_register_command ("net_bootp", grub_cmd_bootp,
|
||||
"[CARD]",
|
||||
N_("[CARD]"),
|
||||
N_("perform a bootp autoconfiguration"));
|
||||
cmd_dhcp = grub_register_command ("net_dhcp", grub_cmd_bootp,
|
||||
"[CARD]",
|
||||
N_("[CARD]"),
|
||||
N_("perform a bootp autoconfiguration"));
|
||||
cmd_getdhcp = grub_register_command ("net_get_dhcp_option", grub_cmd_dhcpopt,
|
||||
N_("VAR INTERFACE NUMBER DESCRIPTION"),
|
||||
|
|
|
@ -946,16 +946,16 @@ static grub_command_t cmd_lsaddr;
|
|||
GRUB_MOD_INIT(net)
|
||||
{
|
||||
cmd_addaddr = grub_register_command ("net_add_addr", grub_cmd_addaddr,
|
||||
"SHORTNAME CARD ADDRESS [HWADDRESS]",
|
||||
N_("SHORTNAME CARD ADDRESS [HWADDRESS]"),
|
||||
N_("Add a network address."));
|
||||
cmd_deladdr = grub_register_command ("net_del_addr", grub_cmd_deladdr,
|
||||
"SHORTNAME",
|
||||
N_("SHORTNAME"),
|
||||
N_("Delete a network address."));
|
||||
cmd_addroute = grub_register_command ("net_add_route", grub_cmd_addroute,
|
||||
"SHORTNAME NET [INTERFACE| gw GATEWAY]",
|
||||
N_("SHORTNAME NET [INTERFACE| gw GATEWAY]"),
|
||||
N_("Add a network route."));
|
||||
cmd_delroute = grub_register_command ("net_del_route", grub_cmd_delroute,
|
||||
"SHORTNAME",
|
||||
N_("SHORTNAME"),
|
||||
N_("Delete a network route."));
|
||||
cmd_lsroutes = grub_register_command ("net_ls_routes", grub_cmd_listroutes,
|
||||
"", N_("list network routes"));
|
||||
|
|
|
@ -18,16 +18,17 @@
|
|||
*/
|
||||
|
||||
#include <grub/datetime.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static char *grub_weekday_names[] =
|
||||
static const char *grub_weekday_names[] =
|
||||
{
|
||||
"Sunday",
|
||||
"Monday",
|
||||
"Tuesday",
|
||||
"Wednesday",
|
||||
"Thursday",
|
||||
"Friday",
|
||||
"Saturday",
|
||||
N_("Sunday"),
|
||||
N_("Monday"),
|
||||
N_("Tuesday"),
|
||||
N_("Wednesday"),
|
||||
N_("Thursday"),
|
||||
N_("Friday"),
|
||||
N_("Saturday"),
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -42,10 +43,10 @@ grub_get_weekday (struct grub_datetime *datetime)
|
|||
return (datetime->day + y + y / 4 - y / 100 + y / 400 + (31 * m / 12)) % 7;
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
grub_get_weekday_name (struct grub_datetime *datetime)
|
||||
{
|
||||
return grub_weekday_names[grub_get_weekday (datetime)];
|
||||
return _ (grub_weekday_names[grub_get_weekday (datetime)]);
|
||||
}
|
||||
|
||||
#define SECPERMIN 60
|
||||
|
|
|
@ -274,7 +274,6 @@ grub_normal_execute (const char *config, int nested, int batch)
|
|||
prefix = grub_env_get ("prefix");
|
||||
read_lists (prefix);
|
||||
grub_register_variable_hook ("prefix", NULL, read_lists_hook);
|
||||
grub_command_execute ("parser.grub", 0, 0);
|
||||
}
|
||||
|
||||
if (config)
|
||||
|
|
|
@ -79,7 +79,7 @@ grub_menu_get_entry (grub_menu_t menu, int no)
|
|||
int
|
||||
grub_menu_get_timeout (void)
|
||||
{
|
||||
char *val;
|
||||
const char *val;
|
||||
int timeout;
|
||||
|
||||
val = grub_env_get ("timeout");
|
||||
|
@ -124,7 +124,7 @@ grub_menu_set_timeout (int timeout)
|
|||
static int
|
||||
get_and_remove_first_entry_number (const char *name)
|
||||
{
|
||||
char *val;
|
||||
const char *val;
|
||||
char *tail;
|
||||
int entry;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/env.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/charset.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
struct term_state
|
||||
{
|
||||
|
@ -63,7 +64,9 @@ print_more (void)
|
|||
|
||||
pos = grub_term_save_pos ();
|
||||
|
||||
grub_utf8_to_ucs4_alloc ("--MORE--", &unicode_str,
|
||||
/* TRANSLATORS: This has to fit on one line. It's ok to include few
|
||||
words but don't write poems. */
|
||||
grub_utf8_to_ucs4_alloc (_("--MORE--"), &unicode_str,
|
||||
&unicode_last_position);
|
||||
|
||||
if (!unicode_str)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/msdos_partition.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -105,7 +106,7 @@ iterate_real (grub_disk_t disk, grub_disk_addr_t sector, int freebsd,
|
|||
/* disk->partition != NULL as 0 < delta */
|
||||
partname = disk->partition ? grub_partition_get_name (disk->partition)
|
||||
: "";
|
||||
grub_util_warn ("Discarding improperly nested partition (%s,%s,%s%d)",
|
||||
grub_util_warn (_("Discarding improperly nested partition (%s,%s,%s%d)"),
|
||||
disk->name, partname, p.partmap->name, p.number + 1);
|
||||
grub_free (partname);
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/parttool.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv2+");
|
||||
|
||||
|
@ -35,7 +36,7 @@ static int type_table_handle = -1;
|
|||
|
||||
static struct grub_parttool_argdesc grub_pcpart_bootargs[] =
|
||||
{
|
||||
{"boot", "Make partition active", GRUB_PARTTOOL_ARG_BOOL},
|
||||
{"boot", N_("Make partition active"), GRUB_PARTTOOL_ARG_BOOL},
|
||||
{0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -65,12 +66,12 @@ static grub_err_t grub_pcpart_boot (const grub_device_t dev,
|
|||
for (i = 0; i < 4; i++)
|
||||
mbr.entries[i].flag = 0x0;
|
||||
mbr.entries[index].flag = 0x80;
|
||||
grub_printf ("Partition %d is active now. \n", index);
|
||||
grub_printf_ (N_("Partition %d is active now. \n"), index);
|
||||
}
|
||||
else
|
||||
{
|
||||
mbr.entries[index].flag = 0x0;
|
||||
grub_printf ("Cleared active flag on %d. \n", index);
|
||||
grub_printf (N_("Cleared active flag on %d. \n"), index);
|
||||
}
|
||||
|
||||
/* Write the MBR. */
|
||||
|
@ -83,8 +84,8 @@ static grub_err_t grub_pcpart_boot (const grub_device_t dev,
|
|||
|
||||
static struct grub_parttool_argdesc grub_pcpart_typeargs[] =
|
||||
{
|
||||
{"type", "Change partition type", GRUB_PARTTOOL_ARG_VAL},
|
||||
{"hidden", "Make partition hidden", GRUB_PARTTOOL_ARG_BOOL},
|
||||
{"type", N_("Change partition type"), GRUB_PARTTOOL_ARG_VAL},
|
||||
{"hidden", N_("Make partition hidden"), GRUB_PARTTOOL_ARG_BOOL},
|
||||
{0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -129,7 +130,7 @@ static grub_err_t grub_pcpart_type (const grub_device_t dev,
|
|||
}
|
||||
|
||||
mbr.entries[index].type = type;
|
||||
grub_printf ("Setting partition type to 0x%x\n", type);
|
||||
grub_printf_ (N_("Setting partition type to 0x%x\n"), type);
|
||||
|
||||
/* Write the parttable. */
|
||||
grub_disk_write (dev->disk, part->offset, 0,
|
||||
|
|
|
@ -66,7 +66,8 @@ grub_script_argv_make (struct grub_script_argv *argv, int argc, char **args)
|
|||
struct grub_script_argv r = { 0, 0, 0 };
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
if (grub_script_argv_next (&r) || grub_script_argv_append (&r, args[i]))
|
||||
if (grub_script_argv_next (&r)
|
||||
|| grub_script_argv_append (&r, args[i], grub_strlen (args[i])))
|
||||
{
|
||||
grub_script_argv_free (&r);
|
||||
return 1;
|
||||
|
@ -99,23 +100,23 @@ grub_script_argv_next (struct grub_script_argv *argv)
|
|||
|
||||
/* Append `s' to the last argument. */
|
||||
int
|
||||
grub_script_argv_append (struct grub_script_argv *argv, const char *s)
|
||||
grub_script_argv_append (struct grub_script_argv *argv, const char *s,
|
||||
grub_size_t slen)
|
||||
{
|
||||
int a;
|
||||
int b;
|
||||
grub_size_t a;
|
||||
char *p = argv->args[argv->argc - 1];
|
||||
|
||||
if (! s)
|
||||
return 0;
|
||||
|
||||
a = p ? grub_strlen (p) : 0;
|
||||
b = grub_strlen (s);
|
||||
|
||||
p = grub_realloc (p, round_up_exp ((a + b + 1) * sizeof (char)));
|
||||
p = grub_realloc (p, round_up_exp ((a + slen + 1) * sizeof (char)));
|
||||
if (! p)
|
||||
return 1;
|
||||
|
||||
grub_strcpy (p + a, s);
|
||||
grub_memcpy (p + a, s, slen);
|
||||
p[a+slen] = 0;
|
||||
argv->args[argv->argc - 1] = p;
|
||||
|
||||
return 0;
|
||||
|
@ -123,10 +124,9 @@ grub_script_argv_append (struct grub_script_argv *argv, const char *s)
|
|||
|
||||
/* Split `s' and append words as multiple arguments. */
|
||||
int
|
||||
grub_script_argv_split_append (struct grub_script_argv *argv, char *s)
|
||||
grub_script_argv_split_append (struct grub_script_argv *argv, const char *s)
|
||||
{
|
||||
char ch;
|
||||
char *p;
|
||||
const char *p;
|
||||
int errors = 0;
|
||||
|
||||
if (! s)
|
||||
|
@ -138,10 +138,7 @@ grub_script_argv_split_append (struct grub_script_argv *argv, char *s)
|
|||
while (*s && ! grub_isspace (*s))
|
||||
s++;
|
||||
|
||||
ch = *s;
|
||||
*s = '\0';
|
||||
errors += grub_script_argv_append (argv, p);
|
||||
*s = ch;
|
||||
errors += grub_script_argv_append (argv, p, s - p);
|
||||
|
||||
while (*s && grub_isspace (*s))
|
||||
s++;
|
||||
|
|
|
@ -193,7 +193,7 @@ grub_script_env_get (const char *name, grub_script_arg_type_t type)
|
|||
|
||||
if (! grub_env_special (name))
|
||||
{
|
||||
char *v = grub_env_get (name);
|
||||
const char *v = grub_env_get (name);
|
||||
if (v && v[0])
|
||||
{
|
||||
if (type == GRUB_SCRIPT_ARG_TYPE_VAR)
|
||||
|
@ -202,20 +202,20 @@ grub_script_env_get (const char *name, grub_script_arg_type_t type)
|
|||
goto fail;
|
||||
}
|
||||
else
|
||||
if (grub_script_argv_append (&result, v))
|
||||
if (grub_script_argv_append (&result, v, grub_strlen (v)))
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
else if (! scope)
|
||||
{
|
||||
if (grub_script_argv_append (&result, 0))
|
||||
if (grub_script_argv_append (&result, 0, 0))
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_strcmp (name, "#") == 0)
|
||||
{
|
||||
char buffer[ERRNO_DIGITS_MAX + 1];
|
||||
grub_snprintf (buffer, sizeof (buffer), "%u", scope->argv.argc);
|
||||
if (grub_script_argv_append (&result, buffer))
|
||||
if (grub_script_argv_append (&result, buffer, grub_strlen (buffer)))
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_strcmp (name, "*") == 0)
|
||||
|
@ -231,10 +231,11 @@ grub_script_env_get (const char *name, grub_script_arg_type_t type)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (i != 0 && grub_script_argv_append (&result, " "))
|
||||
if (i != 0 && grub_script_argv_append (&result, " ", 1))
|
||||
goto fail;
|
||||
|
||||
if (grub_script_argv_append (&result, scope->argv.args[i]))
|
||||
if (grub_script_argv_append (&result, scope->argv.args[i],
|
||||
grub_strlen (scope->argv.args[i])))
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +252,8 @@ grub_script_env_get (const char *name, grub_script_arg_type_t type)
|
|||
goto fail;
|
||||
}
|
||||
else
|
||||
if (grub_script_argv_append (&result, scope->argv.args[i]))
|
||||
if (grub_script_argv_append (&result, scope->argv.args[i],
|
||||
grub_strlen (scope->argv.args[i])))
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -270,7 +272,9 @@ grub_script_env_get (const char *name, grub_script_arg_type_t type)
|
|||
goto fail;
|
||||
}
|
||||
else
|
||||
if (grub_script_argv_append (&result, scope->argv.args[num - 1]))
|
||||
if (grub_script_argv_append (&result, scope->argv.args[num - 1],
|
||||
grub_strlen (scope->argv.args[num - 1])
|
||||
))
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +313,7 @@ grub_script_arglist_to_argv (struct grub_script_arglist *arglist,
|
|||
char *p = 0;
|
||||
|
||||
if (! grub_wildcard_translator || escape_type == 0)
|
||||
return grub_script_argv_append (&result, s);
|
||||
return grub_script_argv_append (&result, s, grub_strlen (s));
|
||||
|
||||
if (escape_type > 0)
|
||||
p = grub_wildcard_translator->escape (s);
|
||||
|
@ -319,7 +323,7 @@ grub_script_arglist_to_argv (struct grub_script_arglist *arglist,
|
|||
if (! p)
|
||||
return 1;
|
||||
|
||||
r = grub_script_argv_append (&result, p);
|
||||
r = grub_script_argv_append (&result, p, grub_strlen (p));
|
||||
grub_free (p);
|
||||
return r;
|
||||
}
|
||||
|
@ -344,7 +348,8 @@ grub_script_arglist_to_argv (struct grub_script_arglist *arglist,
|
|||
|
||||
if (arg->type == GRUB_SCRIPT_ARG_TYPE_VAR)
|
||||
{
|
||||
if (grub_script_argv_append (&result, values[i]))
|
||||
if (grub_script_argv_append (&result, values[i],
|
||||
grub_strlen (values[i])))
|
||||
goto fail;
|
||||
}
|
||||
else
|
||||
|
@ -359,16 +364,18 @@ grub_script_arglist_to_argv (struct grub_script_arglist *arglist,
|
|||
break;
|
||||
|
||||
case GRUB_SCRIPT_ARG_TYPE_BLOCK:
|
||||
if (grub_script_argv_append (&result, "{") ||
|
||||
grub_script_argv_append (&result, arg->str) ||
|
||||
grub_script_argv_append (&result, "}"))
|
||||
if (grub_script_argv_append (&result, "{", 1)
|
||||
|| grub_script_argv_append (&result, arg->str,
|
||||
grub_strlen (arg->str))
|
||||
|| grub_script_argv_append (&result, "}", 1))
|
||||
goto fail;
|
||||
result.script = arg->script;
|
||||
break;
|
||||
|
||||
case GRUB_SCRIPT_ARG_TYPE_TEXT:
|
||||
if (grub_strlen (arg->str) &&
|
||||
grub_script_argv_append (&result, arg->str))
|
||||
grub_script_argv_append (&result, arg->str,
|
||||
grub_strlen (arg->str)))
|
||||
goto fail;
|
||||
break;
|
||||
|
||||
|
@ -680,7 +687,7 @@ grub_err_t
|
|||
grub_script_execute_cmdif (struct grub_script_cmd *cmd)
|
||||
{
|
||||
int ret;
|
||||
char *result;
|
||||
const char *result;
|
||||
struct grub_script_cmdif *cmdif = (struct grub_script_cmdif *) cmd;
|
||||
|
||||
/* Check if the commands results in a true or a false. The value is
|
||||
|
|
|
@ -1111,7 +1111,10 @@ grub_gfxterm_set_repaint_callback (grub_gfxterm_repaint_callback_t func)
|
|||
|
||||
static const struct grub_arg_option background_image_cmd_options[] =
|
||||
{
|
||||
{"mode", 'm', 0, "Background image mode.", "stretch|normal",
|
||||
/* TRANSLATORS: note that GRUB will accept only original keywords stretch
|
||||
and normal, not the translated ones. So please put both in translation
|
||||
e.g. stretch=(%STRETCH%)|normal(=%NORMAL). */
|
||||
{"mode", 'm', 0, N_("Background image mode."), N_("stretch|normal"),
|
||||
ARG_TYPE_STRING},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
|
|
@ -125,7 +125,7 @@ static struct grub_term_output grub_serial_term_output =
|
|||
|
||||
|
||||
|
||||
static struct grub_serial_port *
|
||||
struct grub_serial_port *
|
||||
grub_serial_find (char *name)
|
||||
{
|
||||
struct grub_serial_port *port;
|
||||
|
|
|
@ -606,7 +606,7 @@ print_terminfo (void)
|
|||
};
|
||||
struct grub_term_output *cur;
|
||||
|
||||
grub_printf ("Current terminfo types: \n");
|
||||
grub_puts_ (N_("Current terminfo types:"));
|
||||
for (cur = terminfo_outputs; cur;
|
||||
cur = ((struct grub_terminfo_output_state *) cur->data)->next)
|
||||
grub_printf ("%s: %s\t%s\n", cur->name,
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/i386/pc/int.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -993,15 +994,15 @@ grub_video_vbe_get_info_and_fini (struct grub_video_mode_info *mode_info,
|
|||
static void
|
||||
grub_video_vbe_print_adapter_specific_info (void)
|
||||
{
|
||||
grub_printf (" VBE info: version: %d.%d OEM software rev: %d.%d\n",
|
||||
controller_info.version >> 8,
|
||||
controller_info.version & 0xFF,
|
||||
controller_info.oem_software_rev >> 8,
|
||||
controller_info.oem_software_rev & 0xFF);
|
||||
grub_printf_ (N_(" VBE info: version: %d.%d OEM software rev: %d.%d\n"),
|
||||
controller_info.version >> 8,
|
||||
controller_info.version & 0xFF,
|
||||
controller_info.oem_software_rev >> 8,
|
||||
controller_info.oem_software_rev & 0xFF);
|
||||
|
||||
/* The total_memory field is in 64 KiB units. */
|
||||
grub_printf (" total memory: %d KiB\n",
|
||||
(controller_info.total_memory << 16) / 1024);
|
||||
grub_printf_ (N_(" total memory: %d KiB\n"),
|
||||
(controller_info.total_memory << 16) / 1024);
|
||||
}
|
||||
|
||||
static struct grub_video_adapter grub_video_vbe_adapter =
|
||||
|
|
|
@ -46,7 +46,7 @@ grub_err_t grub_set_datetime (struct grub_datetime *datetime);
|
|||
#endif
|
||||
|
||||
int grub_get_weekday (struct grub_datetime *datetime);
|
||||
char *grub_get_weekday_name (struct grub_datetime *datetime);
|
||||
const char *grub_get_weekday_name (struct grub_datetime *datetime);
|
||||
|
||||
void grub_unixtime2datetime (grub_int32_t nix,
|
||||
struct grub_datetime *datetime);
|
||||
|
|
|
@ -178,8 +178,9 @@ grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
|||
grub_size_t *got);
|
||||
|
||||
#if defined (__ia64__)
|
||||
#define GRUB_ARCH_DL_TRAMP_ALIGN 16
|
||||
#define GRUB_ARCH_DL_GOT_ALIGN 16
|
||||
#define GRUB_ARCH_DL_TRAMP_ALIGN GRUB_IA64_DL_TRAMP_ALIGN
|
||||
#define GRUB_ARCH_DL_GOT_ALIGN GRUB_IA64_DL_GOT_ALIGN
|
||||
#define GRUB_ARCH_DL_TRAMP_SIZE GRUB_IA64_DL_TRAMP_SIZE
|
||||
#define grub_arch_dl_get_tramp_got_size grub_ia64_dl_get_tramp_got_size
|
||||
#else
|
||||
void
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
struct grub_env_var;
|
||||
|
||||
typedef char *(*grub_env_read_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
typedef const char *(*grub_env_read_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
typedef char *(*grub_env_write_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
|
||||
|
@ -43,7 +43,7 @@ struct grub_env_var
|
|||
};
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_env_set) (const char *name, const char *val);
|
||||
char *EXPORT_FUNC(grub_env_get) (const char *name);
|
||||
const char *EXPORT_FUNC(grub_env_get) (const char *name);
|
||||
void EXPORT_FUNC(grub_env_unset) (const char *name);
|
||||
void EXPORT_FUNC(grub_env_iterate) (int (*func) (struct grub_env_var *var));
|
||||
struct grub_env_var *EXPORT_FUNC(grub_env_find) (const char *name);
|
||||
|
|
|
@ -92,7 +92,7 @@ struct grub_netbsd_btinfo_bootwedge {
|
|||
grub_disk_addr_t matchblk;
|
||||
grub_uint64_t matchnblks;
|
||||
grub_uint8_t matchhash[16]; /* MD5 hash */
|
||||
} __packed;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_netbsd_btinfo_symtab
|
||||
{
|
||||
|
|
|
@ -173,7 +173,8 @@ int EXPORT_FUNC(grub_ieee1275_claim) (grub_addr_t addr, grub_size_t size,
|
|||
unsigned int align, grub_addr_t *result);
|
||||
int EXPORT_FUNC(grub_ieee1275_release) (grub_addr_t addr, grub_size_t size);
|
||||
int EXPORT_FUNC(grub_ieee1275_set_property) (grub_ieee1275_phandle_t phandle,
|
||||
const char *propname, void *buf,
|
||||
const char *propname,
|
||||
const void *buf,
|
||||
grub_size_t size,
|
||||
grub_ssize_t *actual);
|
||||
int EXPORT_FUNC(grub_ieee1275_set_color) (grub_ieee1275_ihandle_t ihandle,
|
||||
|
|
|
@ -87,7 +87,7 @@ grub_strncat (char *dest, const char *src, int c)
|
|||
while (*p)
|
||||
p++;
|
||||
|
||||
while ((*p = *src) != '\0' && c--)
|
||||
while (c-- && (*p = *src) != '\0')
|
||||
{
|
||||
p++;
|
||||
src++;
|
||||
|
@ -113,7 +113,53 @@ int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n);
|
|||
char *EXPORT_FUNC(grub_strchr) (const char *s, int c);
|
||||
char *EXPORT_FUNC(grub_strrchr) (const char *s, int c);
|
||||
int EXPORT_FUNC(grub_strword) (const char *s, const char *w);
|
||||
char *EXPORT_FUNC(grub_strstr) (const char *haystack, const char *needle);
|
||||
|
||||
/* Copied from gnulib.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2005. */
|
||||
static inline char *
|
||||
grub_strstr (const char *haystack, const char *needle)
|
||||
{
|
||||
/* Be careful not to look at the entire extent of haystack or needle
|
||||
until needed. This is useful because of these two cases:
|
||||
- haystack may be very long, and a match of needle found early,
|
||||
- needle may be very long, and not even a short initial segment of
|
||||
needle may be found in haystack. */
|
||||
if (*needle != '\0')
|
||||
{
|
||||
/* Speed up the following searches of needle by caching its first
|
||||
character. */
|
||||
char b = *needle++;
|
||||
|
||||
for (;; haystack++)
|
||||
{
|
||||
if (*haystack == '\0')
|
||||
/* No match. */
|
||||
return 0;
|
||||
if (*haystack == b)
|
||||
/* The first character matches. */
|
||||
{
|
||||
const char *rhaystack = haystack + 1;
|
||||
const char *rneedle = needle;
|
||||
|
||||
for (;; rhaystack++, rneedle++)
|
||||
{
|
||||
if (*rneedle == '\0')
|
||||
/* Found a match. */
|
||||
return (char *) haystack;
|
||||
if (*rhaystack == '\0')
|
||||
/* No match. */
|
||||
return 0;
|
||||
if (*rhaystack != *rneedle)
|
||||
/* Nothing in this round. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return (char *) haystack;
|
||||
}
|
||||
|
||||
int EXPORT_FUNC(grub_isspace) (int c);
|
||||
int EXPORT_FUNC(grub_isprint) (int c);
|
||||
|
||||
|
|
|
@ -245,8 +245,9 @@ void grub_script_mem_free (struct grub_script_mem *mem);
|
|||
void grub_script_argv_free (struct grub_script_argv *argv);
|
||||
int grub_script_argv_make (struct grub_script_argv *argv, int argc, char **args);
|
||||
int grub_script_argv_next (struct grub_script_argv *argv);
|
||||
int grub_script_argv_append (struct grub_script_argv *argv, const char *s);
|
||||
int grub_script_argv_split_append (struct grub_script_argv *argv, char *s);
|
||||
int grub_script_argv_append (struct grub_script_argv *argv, const char *s,
|
||||
grub_size_t slen);
|
||||
int grub_script_argv_split_append (struct grub_script_argv *argv, const char *s);
|
||||
|
||||
struct grub_script_arglist *
|
||||
grub_script_create_arglist (struct grub_parser_param *state);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue