Merge trunk

This commit is contained in:
Felix Zielcke 2009-12-29 16:58:30 +01:00
commit a9eff6b400
157 changed files with 1652 additions and 1335 deletions

451
ChangeLog
View file

@ -1,4 +1,427 @@
2009-12-23 Felix Zielcke <fzielcke@z-51.de>
2009-12-29 Robert Millan <rmh.grub@aybabtu.com>
* configure.ac: Check for TARGET_CFLAGS initialization before we
initialize it ourselves (sigh).
Move a few modifications to TARGET_CFLAGS to be unconditional
(extra warning flags, loop alignment, i386 CPU extensions, GCC 4.4
eh_frame)
* gettext/gettext.c (grub_gettext_delete_list): Add `void' argument.
* term/i386/pc/at_keyboard.c
(keyboard_controller_wait_untill_ready): Likewise.
(keyboard_controller_led): Rename `led_status' paramter to avoid
name conflict.
2009-12-28 Carles Pina i Estany <carles@pina.cat>
* normal/misc.c (grub_normal_print_device_info): Add spaces and double
quotes.
2009-12-27 Vladimir Serbinenko <phcoder@gmail.com>
* kern/parser.c (grub_parser_split_cmdline): Don't dereference NULL.
2009-12-27 Vladimir Serbinenko <phcoder@gmail.com>
* normal/menu_text.c (grub_print_message_indented): Prevent
past-the-end-of-array dereference.
2009-12-27 Vladimir Serbinenko <phcoder@gmail.com>
* video/readers/jpeg.c (GRUB_MOD_FINI (grub_cmd_jpegtest)): Rename to ..
(GRUB_MOD_FINI (video_reader_jpeg)): ...this
2009-12-27 Carles Pina i Estany <carles@pina.cat>
* normal/cmdline.c (grub_cmdline_get): Print a space after prompt.
* normal/main.c (grub_normal_read_line): Remove a space from the
default prompt.
2009-12-27 Carles Pina i Estany <carles@pina.cat>
* loader/i386/efi/linux.c (GRUB_MOD_INIT): Improve command summary.
* loader/i386/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
* loader/i386/linux.c (GRUB_MOD_INIT): Likewise.
* loader/i386/pc/linux.c (GRUB_MOD_INIT): Likewise.
* loader/powerpc/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
* loader/sparc64/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
* loader/xnu.c (GRUB_MOD_INIT): Likewise.
2009-12-26 Carles Pina i Estany <carles@pina.cat>
* video/readers/jpeg.c (cmd): Declare.
(grub_cmd_jpegtest): Use `grub_command_t' type.
(GRUB_MOD_INIT): Fix arguments passed to `grub_register_command'.
Assign to `cmd'.
(GRUB_MOD_FINI): Use `cmd' to unregister.
* video/readers/png.c (cmd): Declare.
(grub_cmd_pngtest): Use `grub_command_t' type.
(GRUB_MOD_INIT): Fix arguments passed to `grub_register_command'.
Assign to `cmd'.
(GRUB_MOD_FINI): Use `cmd' to unregister.
* video/readers/tga.c (cmd): Declare.
(grub_cmd_tgatest): Use `grub_command_t' type.
(GRUB_MOD_INIT): Fix arguments passed to `grub_register_command'.
Assign to `cmd'.
(GRUB_MOD_FINI): Use `cmd' to unregister.
2009-12-26 Carles Pina i Estany <carles@pina.cat>
* efiemu/main.c (GRUB_MOD_INIT): Fix capitalizations and/or full
stops.
* kern/corecmd.c (grub_register_core_commands): Likewise.
* loader/efi/chainloader.c (GRUB_MOD_INIT): Likewise.
* loader/i386/bsd.c (GRUB_MOD_INIT): Likewise.
* loader/i386/efi/linux.c (GRUB_MOD_INIT): Likewise.
* loader/i386/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
* loader/i386/linux.c (GRUB_MOD_INIT): Likewise.
* loader/i386/pc/chainloader.c (GRUB_MOD_INIT): Likewise.
* loader/i386/pc/linux.c (GRUB_MOD_INIT): Likewise.
* loader/multiboot_loader.c (GRUB_MOD_INIT): Likewise.
* loader/powerpc/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
* loader/sparc64/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
* loader/xnu.c (GRUB_MOD_INIT): Likewise.
* mmap/mmap.c (GRUB_MOD_INIT): Likewise.
* normal/handler.c (insert_handler): Likewise.
* normal/main.c (GRUB_MOD_INIT): Likewise.
* term/gfxterm.c (GRUB_MOD_INIT): Likewise.
2009-12-26 Carles Pina i Estany <carles@pina.cat>
* commands/help.c (grub_cmd_help): Print the command name before the
summary.
(GRUB_MOD_INIT): Remove command name from the summary.
* kern/command.c (GRUB_MOD_INIT): If summary is null assign an empty
string as summary.
* lib/arg.c (find_long): Print the command name before the summary.
* commands/acpi.c (GRUB_MOD_INIT): Remove command name from the
summary.
* commands/blocklist.c (GRUB_MOD_INIT): Likewise.
* commands/cat.c (GRUB_MOD_INIT): Likewise.
* commands/cmp.c (GRUB_MOD_INIT): Likewise.
* commands/configfile.c (GRUB_MOD_INIT): Likewise.
* commands/crc.c (GRUB_MOD_INIT): Likewise.
* commands/date.c (GRUB_MOD_INIT): Likewise.
* commands/echo.c (GRUB_MOD_INIT): Likewise.
* commands/efi/loadbios.c (GRUB_MOD_INIT): Likewise.
* commands/gptsync.c (GRUB_MOD_INIT): Likewise.
* commands/handler.c (GRUB_MOD_INIT): Likewise.
* commands/hdparm.c (GRUB_MOD_INIT): Likewise.
* commands/hexdump.c (GRUB_MOD_INIT): Likewise.
* commands/i386/cpuid.c (GRUB_MOD_INIT): Likewise.
* commands/i386/pc/halt.c (GRUB_MOD_INIT): Likewise.
* commands/i386/pc/play.c (GRUB_MOD_INIT): Likewise.
* commands/i386/pc/pxecmd.c (GRUB_MOD_INIT): Likewise.
* commands/keystatus.c (GRUB_MOD_INIT): Likewise.
* commands/loadenv.c (GRUB_MOD_INIT): Likewise.
* commands/ls.c (GRUB_MOD_INIT): Likewise.
* commands/lspci.c (GRUB_MOD_INIT): Likewise.
* commands/memrw.c (GRUB_MOD_INIT): Likewise.
* commands/minicmd.c (GRUB_MOD_INIT): Likewise.
* commands/parttool.c (GRUB_MOD_INIT): Likewise.
* commands/password.c (GRUB_MOD_INIT): Likewise.
* commands/probe.c (GRUB_MOD_INIT): Likewise.
* commands/read.c (GRUB_MOD_INIT): Likewise.
* commands/search.c (GRUB_MOD_INIT): Likewise.
* commands/sleep.c (GRUB_MOD_INIT): Likewise.
* commands/test.c (GRUB_MOD_INIT): Likewise.
* commands/xnu_uuid.c (GRUB_MOD_INIT): Likewise.
* efiemu/main.c (GRUB_MOD_INIT): Likewise.
* font/font_cmd.c (GRUB_MOD_INIT): Likewise.
* gettext/gettext.c (GRUB_MOD_INIT): Likewise.
* kern/corecmd.c (GRUB_MOD_INIT): Likewise.
* lib/arg.c (GRUB_MOD_INIT): Likewise.
* loader/efi/appleloader.c (GRUB_MOD_INIT): Likewise.
* loader/i386/bsd.c (GRUB_MOD_INIT): Likewise.
* loader/xnu.c (GRUB_MOD_INIT): Likewise.
* mmap/mmap.c (GRUB_MOD_INIT): Likewise.
* term/terminfo.c (GRUB_MOD_INIT): Likewise.
* video/readers/jpeg.c (GRUB_MOD_INIT): Likewise.
* video/readers/png.c (GRUB_MOD_INIT): Likewise.
* video/readers/tga.c (GRUB_MOD_INIT): Likewise.
2009-12-25 Vladimir Serbinenko <phcoder@gmail.com>
Use search command for preliminar UUID search.
* commands/search.c: Split into ...
* commands/search_wrap.c: ...this
* commands/search.c: ...and this.
* commands/search_file.c: New file.
* commands/search_label.c: New file.
* commands/search_uuid.c: New file.
* conf/any-emu.rmk (grub_emu_SOURCES): Remove commands/search.c.
Add commands/search_wrap.c, commands/search_file.c,
commands/search_label.c and commands/search_uuid.c.
* conf/common.rmk (pkglib_MODULES): Remove fs_uuid.mod and fs_file.mod.
(search_mod_SOURCES): Set to commands/search_wrap.c.
(pkglib_MODULES): Add search_fs_file.mod, search_fs_uuid.mod and
search_label.mod.
(search_fs_file_mod_SOURCES): New variable.
(search_fs_file_mod_CFLAGS): Likewise.
(search_fs_file_mod_LDFLAGS): Likewise.
(search_label_mod_SOURCES): Likewise.
(search_label_mod_CFLAGS): Likewise.
(search_label_mod_LDFLAGS): Likewise.
(search_fs_uuid_mod_SOURCES): New variable.
(search_fs_uuid_mod_CFLAGS): Likewise.
(search_fs_uuid_mod_LDFLAGS): Likewise.
(fs_file_mod_SOURCES): Removed.
(fs_file_mod_CFLAGS): Likewise.
(fs_file_mod_LDFLAGS): Likewise.
(fs_uuid_mod_SOURCES): Removed.
(fs_uuid_mod_CFLAGS): Likewise.
(fs_uuid_mod_LDFLAGS): Likewise.
* conf/sparc64-ieee1275.rmk (grub_install_SOURCES):
Set to util/grub-install.in.
* disk/fs_file.c: Removed.
* disk/fs_uuid.c: Likewise.
* include/grub/search.h: New file.
* util/grub-install.in: Handle sparc64.
Create and use load.cfg.
* util/sparc64/ieee1275/grub-install.in: Removed.
2009-12-25 Vladimir Serbinenko <phcoder@gmail.com>
* kern/i386/pc/startup.S (grub_biosdisk_get_diskinfo_int13_extensions):
Ignore return status if CF is cleared.
(grub_biosdisk_get_diskinfo_standard): Likewise.
2009-12-25 Robert Millan <rmh.grub@aybabtu.com>
* term/i386/pc/at_keyboard.c
(keyboard_controller_wait_untill_ready): New function.
(grub_keyboard_controller_write, grub_keyboard_controller_read)
(keyboard_controller_led): Use keyboard_controller_wait_untill_ready()
for keyboard polling, rather than duplicate the same loop. This
saves a few bytes in code size.
2009-12-25 Vladimir Serbinenko <phcoder@gmail.com>
Support for (pxe[:server[:gateway]]) syntax and
use environment variable for PXE.
* commands/i386/pc/pxecmd.c (options): Removed.
(print_ip): Removed.
(grub_cmd_pxe): Removed
(grub_cmd_pxe_unload): New function.
* fs/i386/pc/pxe.c (grub_pxe_disk_data): New structure.
(grub_pxe_your_ip): Made static.
(grub_pxe_default_server_ip): Likewise.
(grub_pxe_default_gateway_ip): Likewise.
(grub_pxe_blksize): Likewise.
(parse_ip): New function.
(grub_pxe_open): Support server and gateway specification.
(grub_pxe_close): Free disk->data.
(grub_pxefs_open): Use disk->data.
(grub_pxefs_read): Likewise.
(grub_env_write_readonly): New function.
(set_mac_env): Likewise.
(set_env_limn_ro): Likewise.
(parse_dhcp_vendor): Likewise.
(grub_pxe_detect): Set the environment variables.
(set_ip_env): New function.
(write_ip_env): Likewise.
(grub_env_write_pxe_default_server): Likewise.
(grub_env_write_pxe_default_gateway): Likewise.
(grub_env_write_pxe_blocksize): Likewise.
(GRUB_MOD_INIT(pxe)): Set environment variables.
* include/grub/i386/pc/pxe.h (grub_pxe_mac_addr): Rename to ...
(grub_pxe_mac_addr_t): ... this. All users updated.
(grub_pxe_your_ip): Removed.
(grub_pxe_server_ip): Likewise.
(grub_pxe_gateway_ip): Likewise.
(grub_pxe_blksize): Likewise.
2009-12-25 Carles Pina i Estany <carles@pina.cat>
* commands/help.c: Include `<grub/i18n.h>'.
(grub_cmd_help): Gettextizze.
(GRUB_MOD_INIT): Likewise.
* commands/i386/pc/play.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* commands/search.c: Include `<grub/i18n.h>'.
(options): Gettextizze.
(GRUB_MOD_INIT): Gettextizze.
* lib/arg.c: Include `<grub/i18n.h>'.
(help_options): Gettextizze.
(find_long): Likewise.
(grub_arg_show_help): Likewise.
* normal/dyncmd.c: Include `<grub/i18n.h>'.
(read_command_list): Gettextizze.
* po/POTFILES: Add `commands/i386/pc/play.c', `commands/search.c',
`commands/help.c', `lib/arg.c' and `normal/dyncmd.c'.
2009-12-25 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/i386/at_keyboard.h (NUM_LOCK, SCROLL_LOCK): New macros.
* term/i386/pc/at_keyboard.c (KEYBOARD_STATUS_NUM_LOCK)
(KEYBOARD_LED_SCROLL, KEYBOARD_LED_NUM, KEYBOARD_LED_CAPS): New macros.
(led_status): New variable.
(keyboard_controller_led): New function.
(grub_at_keyboard_getkey_noblock): Handle num lock and scroll lock,
update led status for caps lock, num lock and scroll lock.
2009-12-25 Felix Zielcke <fzielcke@z-51.de>
* util/hostdisk.c (open_device): Fix a comment.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-install.in (host_os): New variable.
* util/i386/efi/grub-install.in (host_os): Likewise.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
* util/mkisofs/write.c (padblock_write): Abort when given an
excedingly large embed image, instead of silently truncating it.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
* include/multiboot.h: Indentation fixes.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
* include/multiboot.h (struct multiboot_aout_symbol_table)
(struct multiboot_elf_section_header_table): New structure
declarations (stolen from GRUB Legacy).
(struct multiboot_info): Replace opaque `syms' with a.out and ELF
table information.
(multiboot_aout_symbol_table_t, multiboot_elf_section_header_table_t)
(multiboot_info_t, multiboot_memory_map_t, multiboot_module_t): New
type aliases.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
* include/multiboot.h: Make comments src2texi-friendly.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
For consistency with [multiboot]/docs/boot.S.
* include/multiboot.h (MULTIBOOT_MAGIC): Rename from this ...
(MULTIBOOT_HEADER_MAGIC): ... to this. Update all users.
(MULTIBOOT_MAGIC2): Rename from this ...
(MULTIBOOT_BOOTLOADER_MAGIC): ... to this. Update all users.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
* include/multiboot.h: Remove `<grub/types.h>'.
(multiboot_uint16_t, multiboot_uint32_t, multiboot_uint64_t): New
types. Update all users.
2009-12-25 Carles Pina i Estany <carles@pina.cat>
* commands/efi/loadbios.c: Capitalize acronyms, replace `could not' by
`couldn't' and `can not' by `cannot'.
* commands/i386/pc/drivemap.c: Likewise.
* disk/ata.c: Likewise.
* disk/ieee1275/nand.c: Likewise.
* fs/affs.c: Likewise.
* fs/fat.c: Likewise.
* fs/hfs.c: Likewise.
* fs/hfsplus.c: Likewise.
* fs/iso9660.c: Likewise.
* fs/jfs.c: Likewise.
* fs/minix.c: Likewise.
* fs/reiserfs.c: Likewise.
* fs/sfs.c: Likewise.
* fs/udf.c: Likewise.
* fs/ufs.c: Likewise.
* fs/xfs.c: Likewise.
* loader/powerpc/ieee1275/linux.c: Likewise.
* loader/sparc64/ieee1275/linux.c: Likewise.
* util/grub-probe.c: Likewise.
* util/misc.c: Likewise.
2009-12-24 Carles Pina i Estany <carles@pina.cat>
* bus/usb/usbhub.c: Fix capitalization, fullstop and newlines in
grub_errno calls.
* commands/acpi.c: Likewise.
* commands/blocklist.c: Likewise.
* commands/efi/loadbios.c: Likewise.
* commands/i386/pc/drivemap.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/memrw.c: Likewise.
* commands/password.c: Likewise.
* commands/videotest.c: Likewise.
* disk/ata.c: Likewise.
* disk/ata_pthru.c: Likewise.
* disk/dmraid_nvidia.c: Likewise.
* disk/ieee1275/nand.c: Likewise.
* disk/ieee1275/ofdisk.c: Likewise.
* disk/loopback.c: Likewise.
* disk/lvm.c: Likewise.
* disk/mdraid_linux.c: Likewise.
* disk/raid.c: Likewise.
* disk/raid6_recover.c: Likewise.
* disk/scsi.c: Likewise.
* efiemu/main.c: Likewise.
* efiemu/mm.c: Likewise.
* efiemu/pnvram.c: Likewise.
* efiemu/symbols.c: Likewise.
* font/font.c: Likewise.
* fs/cpio.c: Likewise.
* fs/hfsplus.c: Likewise.
* fs/iso9660.c: Likewise.
* fs/jfs.c: Likewise.
* fs/minix.c: Likewise.
* fs/ntfs.c: Likewise.
* fs/ntfscomp.c: Likewise.
* fs/reiserfs.c: Likewise.
* fs/ufs.c: Likewise.
* fs/xfs.c: Likewise.
* gettext/gettext.c: Likewise.
* include/grub/auth.h: Likewise.
* kern/elf.c: Likewise.
* kern/file.c: Likewise.
* kern/ieee1275/init.c: Likewise.
* kern/ieee1275/mmap.c: Likewise.
* kern/ieee1275/openfw.c: Likewise.
* kern/powerpc/dl.c: Likewise.
* kern/sparc64/dl.c: Likewise.
* lib/arg.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/bsdXX.c: Likewise.
* loader/i386/efi/linux.c: Likewise.
* loader/i386/efi/xnu.c: Likewise.
* loader/i386/ieee1275/linux.c: Likewise.
* loader/i386/linux.c: Likewise.
* loader/i386/multiboot.c: Likewise.
* loader/i386/pc/linux.c: Likewise.
* loader/i386/pc/multiboot2.c: Likewise.
* loader/i386/xnu.c: Likewise.
* loader/ieee1275/multiboot2.c: Likewise.
* loader/macho.c: Likewise.
* loader/machoXX.c: Likewise.
* loader/multiboot2.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* loader/powerpc/ieee1275/linux.c: Likewise.
* loader/sparc64/ieee1275/linux.c: Likewise.
* loader/xnu.c: Likewise.
* loader/xnu_resume.c: Likewise.
* mmap/i386/pc/mmap.c: Likewise.
* normal/menu_viewer.c: Likewise.
* partmap/acorn.c: Likewise.
* partmap/amiga.c: Likewise.
* partmap/apple.c: Likewise.
* script/lexer.c: Likewise.
* term/gfxterm.c: Likewise.
* term/i386/pc/serial.c: Likewise.
* term/i386/pc/vga.c: Likewise.
* term/ieee1275/ofconsole.c: Likewise.
* term/terminfo.c: Likewise.
* video/bitmap.c: Likewise.
* video/efi_gop.c: Likewise.
* video/efi_uga.c: Likewise.
* video/fb/video_fb.c: Likewise.
* video/i386/pc/vbe.c: Likewise.
* video/readers/tga.c: Likewise.
* video/video.c: Likewise.
2009-12-23 Felix Zielcke <fzielcke@z-51.de>
* commands/i386/pc/drivemap.c: Remove all trailing whitespace.
* commands/lspci.c: Likewise.
@ -51,7 +474,7 @@
* video/efi_gop.c (grub_video_gop_get_bitmask): Fix off-by-one in mask
size counting.
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* util/grub-mkrescue.in (pkglib_DATA): Set to @pkglib_DATA@.
* genmk.rb (class SCRIPT): Modify the target file instead of source.
@ -69,11 +492,11 @@
(grub_cmd_read): Restructure for readability. Support "-v" option.
(grub_cmd_write): Restructure for readability.
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* genmk.rb (class SCRIPT): Prepend #{src} path with $(srcdir).
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* genmk.rb (class SCRIPT): Use sed to substitute @pkglib_DATA@
with the actual contents of the correspondending make variable.
@ -81,7 +504,7 @@
(process_input_dir): Copy all $pkglib_DATA files instead of explicitly
specifying `*.lst' and `efiemu??.o'
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* util/grub.d/30_os-prober.in (osx_entry): Add round brackets
after function name.
@ -97,7 +520,7 @@
(GRUB_MOD_INIT(lspci)): Use extcmd.
(GRUB_MOD_FINI(lspci)): Likewise.
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* util/grub.d/30_os-prober.in (osx_entry): Remove non POSIX compliant
`function' keyword.
@ -157,7 +580,7 @@
`$(XGETTEXT)'.
* po/POTFILES: Add `commands/loadenv.c'.
2009-12-21 Felix Zielcke <fzielcke@z-51.de>
2009-12-21 Felix Zielcke <fzielcke@z-51.de>
* util/grub-mkrescue.in (process_input_dir): Copy `*.lst' files
instead of specifying them explicit.
@ -470,7 +893,7 @@
(grub_vbe_get_video_mode): Use 'last_set_mode' if get_mode fails.
(grub_video_vbe_setup): Don't check for reserved flag.
2009-12-17 Felix Zielcke <fzielcke@z-51.de>
2009-12-17 Felix Zielcke <fzielcke@z-51.de>
* gendistlist.sh: Use POSIX compliant `!' instead of `-not' in
the `find' command.
@ -483,7 +906,7 @@
(grub_hfs_fs): New value .uuid.
* include/grub/hfs.h (grub_hfs_sblock): New field 'num_serial'.
2009-12-14 Felix Zielcke <fzielcke@z-51.de>
2009-12-14 Felix Zielcke <fzielcke@z-51.de>
Fix a segfault with parsing unknown long options.
@ -493,7 +916,7 @@
* include/grub/misc.h (grub_puts): New declaration.
(grub_puts_): Likewise.
* kern/mis.c (grub_puts): New definition.
* kern/misc.c (grub_puts): New definition.
(grub_puts_): Likewise.
2009-12-13 Robert Millan <rmh.grub@aybabtu.com>
@ -632,11 +1055,11 @@
* include/grub/pciutils.h: New file.
* util/pci.c: Likewise.
2009-12-11 Felix Zielcke <fzielcke@z-51.de>
2009-12-11 Felix Zielcke <fzielcke@z-51.de>
* util/misc.c: Don't include <errno.h> twice.
2009-12-10 Felix Zielcke <fzielcke@z-51.de>
2009-12-10 Felix Zielcke <fzielcke@z-51.de>
* disk/i386/pc/biosdisk.c (grub_biosdisk_open): Show the disk
name in an error message.
@ -732,7 +1155,7 @@
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Recognize
anything even prefixed with 'cdrom' as a cdrom.
2009-12-06 Felix Zielcke <fzielcke@z-51.de>
2009-12-06 Felix Zielcke <fzielcke@z-51.de>
* util/misc.c (make_system_path_relative_to_its_root): Correctly cope with
mount points.
@ -948,7 +1371,7 @@
($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po)): Rewrite as ...
(po/%.po): ... this.
2009-11-26 Felix Zielcke <fzielcke@z-51.de>
2009-11-26 Felix Zielcke <fzielcke@z-51.de>
* util/i386/efi/grub-mkimage.c: Include "progname.h".
(main): Use `program_name' instead of nonexistent `progname'.

View file

@ -185,7 +185,7 @@ real_code_2:
call LOCAL(move_memory)
/* Check for multiboot signature. */
cmpl $MULTIBOOT_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_DATA_END)
cmpl $MULTIBOOT_HEADER_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_DATA_END)
jz 1f
movl (ramdisk_image - start), %esi

View file

@ -50,7 +50,7 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
}
if (i == 128)
{
grub_error (GRUB_ERR_IO, "Can't assign address to USB device");
grub_error (GRUB_ERR_IO, "can't assign address to USB device");
return NULL;
}

View file

@ -277,7 +277,7 @@ grub_acpi_create_ebda (void)
{
grub_mmap_unregister (mmapregion);
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't find suitable spot in EBDA");
"couldn't find suitable spot in EBDA");
}
/* Remove any other RSDT. */
@ -551,7 +551,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
grub_free (exclude);
grub_free (load_only);
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't allocate table");
"couldn't allocate table");
}
grub_memcpy (table_dsdt, dsdt, dsdt->length);
}
@ -578,7 +578,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
grub_free (exclude);
grub_free (load_only);
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't allocate table structure");
"couldn't allocate table structure");
}
table->size = curtable->length;
table->addr = grub_malloc (table->size);
@ -587,7 +587,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
{
free_tables ();
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't allocate table");
"couldn't allocate table");
}
table->next = acpi_tables;
acpi_tables = table;
@ -674,7 +674,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
{
free_tables ();
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't allocate table structure");
"couldn't allocate table structure");
}
table->size = size;
@ -709,7 +709,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
{
free_tables ();
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't allocate space for ACPI tables");
"couldn't allocate space for ACPI tables");
}
setup_common_tables ();
@ -759,7 +759,7 @@ GRUB_MOD_INIT(acpi)
{
cmd = grub_register_extcmd ("acpi", grub_cmd_acpi,
GRUB_COMMAND_FLAG_BOTH,
"acpi [-1|-2] [--exclude=table1,table2|"
"[-1|-2] [--exclude=table1,table2|"
"--load-only=table1,table2] filename1 "
" [filename2] [...]",
"Load host acpi tables and tables "

View file

@ -87,7 +87,7 @@ grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
if (! file->device->disk)
return grub_error (GRUB_ERR_BAD_DEVICE,
"this command is available only for disk devices.");
"this command is available only for disk devices");
if (file->device->disk->partition)
part_start = grub_partition_get_start (file->device->disk->partition);
@ -110,7 +110,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(blocklist)
{
cmd = grub_register_command ("blocklist", grub_cmd_blocklist,
"blocklist FILE", "Print a block list.");
"FILE", "Print a block list.");
}
GRUB_MOD_FINI(blocklist)

View file

@ -78,7 +78,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(cat)
{
cmd = grub_register_command_p1 ("cat", grub_cmd_cat,
"cat FILE", "Show the contents of a file.");
"FILE", "Show the contents of a file.");
}
GRUB_MOD_FINI(cat)

View file

@ -109,7 +109,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(cmp)
{
cmd = grub_register_command ("cmp", grub_cmd_cmp,
"cmp FILE1 FILE2", "Compare two files.");
"FILE1 FILE2", "Compare two files.");
}
GRUB_MOD_FINI(cmp)

View file

@ -53,15 +53,15 @@ GRUB_MOD_INIT(configfile)
{
cmd_configfile =
grub_register_command ("configfile", grub_cmd_source,
"configfile FILE", "Load another config file.");
"FILE", "Load another config file.");
cmd_source =
grub_register_command ("source", grub_cmd_source,
"source FILE",
"FILE",
"Load another config file without changing context."
);
cmd_dot =
grub_register_command (".", grub_cmd_source,
". FILE",
"FILE",
"Load another config file without changing context."
);
}

View file

@ -57,7 +57,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(crc)
{
cmd = grub_register_command ("crc", grub_cmd_crc,
"crc FILE",
"FILE",
"Calculate the crc32 checksum of a file.");
}

View file

@ -135,7 +135,7 @@ GRUB_MOD_INIT(date)
{
cmd =
grub_register_command ("date", grub_cmd_date,
"date [[year-]month-day] [hour:minute[:second]]",
"[[year-]month-day] [hour:minute[:second]]",
"Command to display/set current datetime.");
}

View file

@ -113,7 +113,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(echo)
{
cmd = grub_register_extcmd ("echo", grub_cmd_echo, GRUB_COMMAND_FLAG_BOTH,
"echo [-e|-n] STRING", "Display a line of text.",
"[-e|-n] STRING", "Display a line of text.",
options);
}

View file

@ -160,7 +160,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
int size;
if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "No rom image specified");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no ROM image specified");
if (argc > 1)
{
@ -169,7 +169,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
return grub_errno;
if (file->size != 4)
grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid int10 dump size");
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid int10 dump size");
else
grub_file_read (file, (void *) 0x40, 4);
@ -184,7 +184,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
size = file->size;
if ((size < 0x10000) || (size > 0x40000))
grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid bios dump size");
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid bios dump size");
else if (enable_rom_area ())
{
grub_file_read (file, (void *) VBIOS_ADDR, size);
@ -204,7 +204,7 @@ GRUB_MOD_INIT(loadbios)
0, "Fake bios.");
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
"loadbios BIOS_DUMP [INT10_DUMP]",
"BIOS_DUMP [INT10_DUMP]",
"Load bios dump.");
}

View file

@ -240,7 +240,7 @@ GRUB_MOD_INIT(gptsync)
{
(void) mod; /* To stop warning. */
cmd = grub_register_command ("gptsync", grub_cmd_gptsync,
"gptsync DEVICE [PARTITION[+/-[TYPE]]] ...",
"DEVICE [PARTITION[+/-[TYPE]]] ...",
"Fill hybrid MBR of GPT drive DEVICE. "
"specified partitions will be a part "
"of hybrid mbr. Up to 3 partitions are "

View file

@ -95,15 +95,15 @@ GRUB_MOD_INIT(handler)
{
cmd_handler =
grub_register_command ("handler", grub_cmd_handler,
"handler [class [handler]]",
"[class [handler]]",
"List or select a handler.");
cmd_terminal_input =
grub_register_command ("terminal_input", grub_cmd_handler,
"terminal_input [handler]",
"[handler]",
"List or select an input terminal.");
cmd_terminal_output =
grub_register_command ("terminal_output", grub_cmd_handler,
"terminal_output [handler]",
"[handler]",
"List or select an output terminal.");
}

View file

@ -410,7 +410,7 @@ GRUB_MOD_INIT(hdparm)
{
cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm,
GRUB_COMMAND_FLAG_BOTH,
"hdparm [OPTIONS] DISK",
"[OPTIONS] DISK",
"Get/set ATA disk parameters.", options);
}

View file

@ -21,6 +21,7 @@
#include <grub/misc.h>
#include <grub/term.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
static grub_err_t
grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
@ -38,13 +39,14 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
{
char description[GRUB_TERM_WIDTH / 2];
int desclen = grub_strlen (cmd->summary);
const char* summary_translated = _(cmd->summary);
int desclen = grub_strlen (summary_translated);
/* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled
with the description followed by spaces. */
grub_memset (description, ' ', GRUB_TERM_WIDTH / 2 - 1);
description[GRUB_TERM_WIDTH / 2 - 1] = '\0';
grub_memcpy (description, cmd->summary,
grub_memcpy (description, summary_translated,
(desclen < GRUB_TERM_WIDTH / 2 - 1
? desclen : GRUB_TERM_WIDTH / 2 - 1));
@ -65,8 +67,8 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
grub_arg_show_help ((grub_extcmd_t) cmd->data);
else
grub_printf ("Usage: %s\n%s\b", cmd->summary,
cmd->description);
grub_printf ("%s %s %s\n%s\b", _("Usage:"), cmd->name, _(cmd->summary),
_(cmd->description));
}
}
return 0;
@ -94,8 +96,8 @@ GRUB_MOD_INIT(help)
{
cmd = grub_register_extcmd ("help", grub_cmd_help,
GRUB_COMMAND_FLAG_CMDLINE,
"help [PATTERN ...]",
"Show a help message.", 0);
N_("[PATTERN ...]"),
N_("Show a help message."), 0);
}
GRUB_MOD_FINI(help)

View file

@ -121,7 +121,7 @@ GRUB_MOD_INIT (hexdump)
{
cmd = grub_register_extcmd ("hexdump", grub_cmd_hexdump,
GRUB_COMMAND_FLAG_BOTH,
"hexdump [OPTIONS] FILE_OR_DEVICE",
"[OPTIONS] FILE_OR_DEVICE",
"Dump the contents of a file or memory.",
options);
}

View file

@ -88,7 +88,7 @@ done:
#endif
cmd = grub_register_extcmd ("cpuid", grub_cmd_cpuid, GRUB_COMMAND_FLAG_BOTH,
"cpuid [-l]", "Check for CPU features.", options);
"[-l]", "Check for CPU features.", options);
}
GRUB_MOD_FINI(cpuid)

View file

@ -308,7 +308,7 @@ install_int13_handler (int noret __attribute__ ((unused)))
GRUB_MACHINE_MEMORY_RESERVED,
GRUB_MMAP_MALLOC_LOW);
if (! handler_base)
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Could not reserve "
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't reserve "
"memory for the int13h handler");
/* Copy int13h handler bundle to reserved area. */

View file

@ -46,7 +46,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(halt)
{
cmd = grub_register_extcmd ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
"halt [-n]",
"[-n]",
"Halt the system, if possible using APM.",
options);
}

View file

@ -27,6 +27,7 @@
#include <grub/machine/time.h>
#include <grub/cpu/io.h>
#include <grub/command.h>
#include <grub/i18n.h>
#define BASE_TEMPO 120
@ -207,7 +208,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(play)
{
cmd = grub_register_command ("play", grub_cmd_play,
"play FILE", "Play a tune.");
N_("FILE"), N_("Play a tune."));
}
GRUB_MOD_FINI(play)

View file

@ -1,7 +1,7 @@
/* pxe.c - command to control the pxe driver */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,79 +21,31 @@
#include <grub/err.h>
#include <grub/misc.h>
#include <grub/machine/pxe.h>
#include <grub/extcmd.h>
static const struct grub_arg_option options[] =
{
{"info", 'i', 0, "Show PXE information.", 0, 0},
{"bsize", 'b', 0, "Set PXE block size.", 0, ARG_TYPE_INT},
{"unload", 'u', 0, "Unload PXE stack.", 0, 0},
{0, 0, 0, 0, 0, 0}
};
static void
print_ip (grub_uint32_t ip)
{
int i;
for (i = 0; i < 3; i++)
{
grub_printf ("%d.", ip & 0xFF);
ip >>= 8;
}
grub_printf ("%d", ip);
}
#include <grub/command.h>
static grub_err_t
grub_cmd_pxe (grub_extcmd_t cmd, int argc __attribute__ ((unused)),
char **args __attribute__ ((unused)))
grub_cmd_pxe_unload (grub_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),
char **args __attribute__ ((unused)))
{
struct grub_arg_list *state = cmd->state;
if (! grub_pxe_pxenv)
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no pxe environment");
if (state[1].set)
{
int size;
size = grub_strtoul (state[1].arg, 0, 0);
if (size < GRUB_PXE_MIN_BLKSIZE)
size = GRUB_PXE_MIN_BLKSIZE;
else if (size > GRUB_PXE_MAX_BLKSIZE)
size = GRUB_PXE_MAX_BLKSIZE;
grub_pxe_blksize = size;
}
if (state[0].set)
{
grub_printf ("blksize : %d\n", grub_pxe_blksize);
grub_printf ("client ip : ");
print_ip (grub_pxe_your_ip);
grub_printf ("\nserver ip : ");
print_ip (grub_pxe_server_ip);
grub_printf ("\ngateway ip : ");
print_ip (grub_pxe_gateway_ip);
grub_printf ("\n");
}
if (state[2].set)
grub_pxe_unload ();
grub_pxe_unload ();
return 0;
}
static grub_extcmd_t cmd;
static grub_command_t cmd;
GRUB_MOD_INIT(pxecmd)
{
cmd = grub_register_extcmd ("pxe", grub_cmd_pxe, GRUB_COMMAND_FLAG_BOTH,
"pxe [-i|-b|-u]",
"Command to control the PXE device.", options);
cmd = grub_register_command ("pxe_unload", grub_cmd_pxe_unload,
0,
"Unload PXE environment.");
}
GRUB_MOD_FINI(pxecmd)
{
grub_unregister_extcmd (cmd);
grub_unregister_command (cmd);
}

View file

@ -70,7 +70,7 @@ GRUB_MOD_INIT(keystatus)
{
cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus,
GRUB_COMMAND_FLAG_BOTH,
"keystatus [--shift] [--ctrl] [--alt]",
"[--shift] [--ctrl] [--alt]",
"Check key modifier status.",
options);
}

View file

@ -328,7 +328,7 @@ grub_cmd_save_env (grub_extcmd_t cmd, int argc, char **args)
}
if (! argc)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "No variable is specified");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no variable is specified");
file = open_envblk_file ((state[0].set) ? state[0].arg : 0);
if (! file)
@ -396,7 +396,7 @@ GRUB_MOD_INIT(loadenv)
cmd_save =
grub_register_extcmd ("save_env", grub_cmd_save_env,
GRUB_COMMAND_FLAG_BOTH,
"save_env [-f FILE] variable_name [...]",
"[-f FILE] variable_name [...]",
"Save variables to environment block file.",
options);
}

View file

@ -260,7 +260,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(ls)
{
cmd = grub_register_extcmd ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
"ls [-l|-h|-a] [FILE]",
"[-l|-h|-a] [FILE]",
"List devices and files.", options);
}

View file

@ -218,7 +218,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(lspci)
{
cmd = grub_register_extcmd ("lspci", grub_cmd_lspci, GRUB_COMMAND_FLAG_BOTH,
"lspci [-i]", "List PCI devices.", options);
"[-i]", "List PCI devices.", options);
}
GRUB_MOD_FINI(lspci)

View file

@ -41,7 +41,7 @@ grub_cmd_read (grub_extcmd_t cmd, int argc, char **argv)
char buf[sizeof ("XXXXXXXX")];
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
addr = grub_strtoul (argv[0], 0, 0);
switch (cmd->cmd->name[sizeof ("read_") - 1])
@ -78,7 +78,7 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
grub_uint32_t mask = 0xffffffff;
if (argc != 2 && argc != 3)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
addr = grub_strtoul (argv[0], 0, 0);
value = grub_strtoul (argv[1], 0, 0);
@ -119,22 +119,22 @@ GRUB_MOD_INIT(memrw)
{
cmd_read_byte =
grub_register_extcmd ("read_byte", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
"read_byte ADDR", "Read byte from ADDR.", options);
"ADDR", "Read byte from ADDR.", options);
cmd_read_word =
grub_register_extcmd ("read_word", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
"read_word ADDR", "Read word from ADDR.", options);
"ADDR", "Read word from ADDR.", options);
cmd_read_dword =
grub_register_extcmd ("read_dword", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
"read_dword ADDR", "Read dword from ADDR.", options);
"ADDR", "Read dword from ADDR.", options);
cmd_write_byte =
grub_register_command ("write_byte", grub_cmd_write,
"write_byte ADDR VALUE [MASK]", "Write byte VALUE to ADDR.");
"ADDR VALUE [MASK]", "Write byte VALUE to ADDR.");
cmd_write_word =
grub_register_command ("write_word", grub_cmd_write,
"write_word ADDR VALUE [MASK]", "Write word VALUE to ADDR.");
"ADDR VALUE [MASK]", "Write word VALUE to ADDR.");
cmd_write_dword =
grub_register_command ("write_dword", grub_cmd_write,
"write_dword ADDR VALUE [MASK]", "Write dword VALUE to ADDR.");
"ADDR VALUE [MASK]", "Write dword VALUE to ADDR.");
}
GRUB_MOD_FINI(memrw)

View file

@ -354,19 +354,19 @@ GRUB_MOD_INIT(minicmd)
{
cmd_cat =
grub_register_command ("cat", grub_mini_cmd_cat,
"cat FILE", "Show the contents of a file.");
"FILE", "Show the contents of a file.");
cmd_help =
grub_register_command ("help", grub_mini_cmd_help,
0, "Show this message.");
cmd_root =
grub_register_command ("root", grub_mini_cmd_root,
"root [DEVICE]", "Set the root device.");
"[DEVICE]", "Set the root device.");
cmd_dump =
grub_register_command ("dump", grub_mini_cmd_dump,
"dump ADDR", "Dump memory.");
"ADDR", "Dump memory.");
cmd_rmmod =
grub_register_command ("rmmod", grub_mini_cmd_rmmod,
"rmmod MODULE", "Remove a module.");
"MODULE", "Remove a module.");
cmd_lsmod =
grub_register_command ("lsmod", grub_mini_cmd_lsmod,
0, "Show loaded modules.");

View file

@ -322,7 +322,7 @@ GRUB_MOD_INIT(parttool)
{
mymod = mod;
cmd = grub_register_command ("parttool", grub_cmd_parttool,
"parttool PARTITION COMMANDS",
"PARTITION COMMANDS",
helpmsg);
}

View file

@ -53,7 +53,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
char *pass;
if (argc != 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Two arguments expected.");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments expected");
pass = grub_strdup (args[1]);
if (!pass)
@ -75,7 +75,7 @@ GRUB_MOD_INIT(password)
{
my_mod = mod;
cmd = grub_register_command ("password", grub_cmd_password,
"password USER PASSWORD",
"USER PASSWORD",
"Set user password (plaintext). "
"Unrecommended and insecure.");
}

View file

@ -150,7 +150,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT (probe)
{
cmd = grub_register_extcmd ("probe", grub_cmd_probe, GRUB_COMMAND_FLAG_BOTH,
"probe [DEVICE]",
"[DEVICE]",
"Retrieve device info.", options);
}

View file

@ -79,7 +79,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(read)
{
cmd = grub_register_command ("read", grub_cmd_read,
"read [ENVVAR]",
"[ENVVAR]",
"Set variable with user input.");
}

View file

@ -25,29 +25,12 @@
#include <grub/device.h>
#include <grub/file.h>
#include <grub/env.h>
#include <grub/extcmd.h>
#include <grub/command.h>
#include <grub/search.h>
#include <grub/i18n.h>
static const struct grub_arg_option options[] =
{
{"file", 'f', 0, "Search devices by a file.", 0, 0},
{"label", 'l', 0, "Search devices by a filesystem label.", 0, 0},
{"fs-uuid", 'u', 0, "Search devices by a filesystem UUID.", 0, 0},
{"set", 's', GRUB_ARG_OPTION_OPTIONAL, "Set a variable to the first device found.", "VAR", ARG_TYPE_STRING},
{"no-floppy", 'n', 0, "Do not probe any floppy drive.", 0, 0},
{0, 0, 0, 0, 0, 0}
};
enum options
{
SEARCH_FILE,
SEARCH_LABEL,
SEARCH_FS_UUID,
SEARCH_SET,
SEARCH_NO_FLOPPY,
};
static void
search_fs (const char *key, const char *var, int no_floppy, enum options type)
void
FUNC_NAME (const char *key, const char *var, int no_floppy)
{
int count = 0;
char *buf = NULL;
@ -63,7 +46,7 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
name[0] == 'f' && name[1] == 'd' && name[2] >= '0' && name[2] <= '9')
return 0;
if (type == SEARCH_FILE)
#ifdef DO_SEARCH_FILE
{
grub_size_t len;
char *p;
@ -84,27 +67,29 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
grub_file_close (file);
}
}
else
#else
{
/* type is SEARCH_FS_UUID or SEARCH_LABEL */
/* SEARCH_FS_UUID or SEARCH_LABEL */
grub_device_t dev;
grub_fs_t fs;
int (*compare_fn) (const char *, const char *);
char *quid;
dev = grub_device_open (name);
if (dev)
{
fs = grub_fs_probe (dev);
compare_fn =
(type == SEARCH_FS_UUID) ? grub_strcasecmp : grub_strcmp;
if (fs && ((type == SEARCH_FS_UUID) ? fs->uuid : fs->label))
#ifdef DO_SEARCH_FS_UUID
#define compare_fn grub_strcasecmp
#define read_fn uuid
#else
#define compare_fn grub_strcmp
#define read_fn label
#endif
if (fs && fs->read_fn)
{
if (type == SEARCH_FS_UUID)
fs->uuid (dev, &quid);
else
fs->label (dev, &quid);
fs->read_fn (dev, &quid);
if (grub_errno == GRUB_ERR_NONE && quid)
{
@ -118,6 +103,7 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
grub_device_close (dev);
}
}
#endif
if (found)
{
@ -156,45 +142,42 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
}
static grub_err_t
grub_cmd_search (grub_extcmd_t cmd, int argc, char **args)
grub_cmd_do_search (grub_command_t cmd __attribute__ ((unused)), int argc,
char **args)
{
struct grub_arg_list *state = cmd->state;
const char *var = 0;
if (argc == 0)
return grub_error (GRUB_ERR_INVALID_COMMAND, "no argument specified");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
if (state[SEARCH_SET].set)
var = state[SEARCH_SET].arg ? state[SEARCH_SET].arg : "root";
if (state[SEARCH_LABEL].set)
search_fs (args[0], var, state[SEARCH_NO_FLOPPY].set, SEARCH_LABEL);
else if (state[SEARCH_FS_UUID].set)
search_fs (args[0], var, state[SEARCH_NO_FLOPPY].set, SEARCH_FS_UUID);
else if (state[SEARCH_FILE].set)
search_fs (args[0], var, state[SEARCH_NO_FLOPPY].set, SEARCH_FILE);
else
return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
FUNC_NAME (args[0], argc == 1 ? 0 : args[1], 0);
return grub_errno;
}
static grub_extcmd_t cmd;
static grub_command_t cmd;
GRUB_MOD_INIT(search)
#ifdef DO_SEARCH_FILE
GRUB_MOD_INIT(search_file)
#elif defined (DO_SEARCH_FS_UUID)
GRUB_MOD_INIT(search_fs_uuid)
#else
GRUB_MOD_INIT(search_fs_label)
#endif
{
cmd =
grub_register_extcmd ("search", grub_cmd_search,
GRUB_COMMAND_FLAG_BOTH,
"search [-f|-l|-u|-s|-n] NAME",
"Search devices by file, filesystem label or filesystem UUID."
" If --set is specified, the first device found is"
" set to a variable. If no variable name is"
" specified, \"root\" is used.",
options);
grub_register_command (COMMAND_NAME, grub_cmd_do_search,
"NAME [VARIABLE]",
"Search devices by " SEARCH_TARGET "."
" If VARIABLE is specified, "
"the first device found is set to a variable.");
}
GRUB_MOD_FINI(search)
#ifdef DO_SEARCH_FILE
GRUB_MOD_FINI(search_file)
#elif defined (DO_SEARCH_FS_UUID)
GRUB_MOD_FINI(search_fs_uuid)
#else
GRUB_MOD_FINI(search_fs_label)
#endif
{
grub_unregister_extcmd (cmd);
grub_unregister_command (cmd);
}

5
commands/search_file.c Normal file
View file

@ -0,0 +1,5 @@
#define DO_SEARCH_FILE 1
#define FUNC_NAME grub_search_fs_file
#define COMMAND_NAME "search.file"
#define SEARCH_TARGET "file"
#include "search.c"

5
commands/search_label.c Normal file
View file

@ -0,0 +1,5 @@
#define DO_SEARCH_FS_LABEL 1
#define FUNC_NAME grub_search_label
#define COMMAND_NAME "search.fs_label"
#define SEARCH_TARGET "filesystem label"
#include "search.c"

5
commands/search_uuid.c Normal file
View file

@ -0,0 +1,5 @@
#define DO_SEARCH_FS_UUID 1
#define FUNC_NAME grub_search_fs_uuid
#define COMMAND_NAME "search.fs_uuid"
#define SEARCH_TARGET "filesystem UUID"
#include "search.c"

95
commands/search_wrap.c Normal file
View file

@ -0,0 +1,95 @@
/* search.c - search devices based on a file or a filesystem label */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/types.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/err.h>
#include <grub/dl.h>
#include <grub/env.h>
#include <grub/extcmd.h>
#include <grub/search.h>
#include <grub/i18n.h>
static const struct grub_arg_option options[] =
{
{"file", 'f', 0, N_("Search devices by a file."), 0, 0},
{"label", 'l', 0, N_("Search devices by a filesystem label."),
0, 0},
{"fs-uuid", 'u', 0, N_("Search devices by a filesystem UUID."),
0, 0},
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
N_("Set a variable to the first device found."), "VAR", ARG_TYPE_STRING},
{"no-floppy", 'n', 0, N_("Do not probe any floppy drive."), 0, 0},
{0, 0, 0, 0, 0, 0}
};
enum options
{
SEARCH_FILE,
SEARCH_LABEL,
SEARCH_FS_UUID,
SEARCH_SET,
SEARCH_NO_FLOPPY,
};
static grub_err_t
grub_cmd_search (grub_extcmd_t cmd, int argc, char **args)
{
struct grub_arg_list *state = cmd->state;
const char *var = 0;
if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
if (state[SEARCH_SET].set)
var = state[SEARCH_SET].arg ? state[SEARCH_SET].arg : "root";
if (state[SEARCH_LABEL].set)
grub_search_label (args[0], var, state[SEARCH_NO_FLOPPY].set);
else if (state[SEARCH_FS_UUID].set)
grub_search_fs_uuid (args[0], var, state[SEARCH_NO_FLOPPY].set);
else if (state[SEARCH_FILE].set)
grub_search_fs_file (args[0], var, state[SEARCH_NO_FLOPPY].set);
else
return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
return grub_errno;
}
static grub_extcmd_t cmd;
GRUB_MOD_INIT(search)
{
cmd =
grub_register_extcmd ("search", grub_cmd_search,
GRUB_COMMAND_FLAG_BOTH,
N_("search [-f|-l|-u|-s|-n] NAME"),
N_("Search devices by file, filesystem label"
" or filesystem UUID."
" If --set is specified, the first device found is"
" set to a variable. If no variable name is"
" specified, \"root\" is used."),
options);
}
GRUB_MOD_FINI(search)
{
grub_unregister_extcmd (cmd);
}

View file

@ -105,7 +105,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(sleep)
{
cmd = grub_register_extcmd ("sleep", grub_cmd_sleep, GRUB_COMMAND_FLAG_BOTH,
"sleep NUMBER_OF_SECONDS",
"NUMBER_OF_SECONDS",
"Wait for a specified number of seconds.",
options);
}

View file

@ -420,9 +420,9 @@ static grub_command_t cmd_1, cmd_2;
GRUB_MOD_INIT(test)
{
cmd_1 = grub_register_command ("[", grub_cmd_test,
"[ EXPRESSION ]", "Evaluate an expression.");
"EXPRESSION ]", "Evaluate an expression.");
cmd_2 = grub_register_command ("test", grub_cmd_test,
"test EXPRESSION", "Evaluate an expression.");
"EXPRESSION", "Evaluate an expression.");
}
GRUB_MOD_FINI(test)

View file

@ -71,7 +71,7 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
sanssmall = grub_font_get ("Helvetica 8");
fixed = grub_font_get ("Fixed 20");
if (! sansbig || ! sans || ! sanssmall || ! fixed)
return grub_error (GRUB_ERR_BAD_FONT, "No font loaded.");
return grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
glyph = grub_font_get_glyph (fixed, '*');
grub_font_draw_glyph (glyph, color, 200 ,0);

View file

@ -377,7 +377,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT (xnu_uuid)
{
cmd = grub_register_command ("xnu_uuid", grub_cmd_xnu_uuid,
"xnu_uuid GRUBUUID [VARNAME]",
"GRUBUUID [VARNAME]",
"Transform 64-bit UUID to format "
"suitable for xnu.");
}

View file

@ -8,7 +8,9 @@ util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/echo.c commands/help.c \
commands/handler.c commands/ls.c commands/test.c \
commands/search.c commands/blocklist.c commands/hexdump.c \
commands/search_wrap.c commands/search_file.c \
commands/search_label.c commands/search_uuid.c \
commands/blocklist.c commands/hexdump.c \
lib/hexdump.c commands/halt.c commands/reboot.c \
lib/envblk.c commands/loadenv.c \
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \

View file

@ -381,7 +381,7 @@ scsi_mod_LDFLAGS = $(COMMON_LDFLAGS)
# Commands.
pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod \
ls.mod cmp.mod cat.mod help.mod search.mod loopback.mod \
fs_file.mod fs_uuid.mod configfile.mod echo.mod \
configfile.mod echo.mod \
terminfo.mod test.mod blocklist.mod hexdump.mod \
read.mod sleep.mod loadenv.mod crc.mod parttool.mod \
msdospart.mod memrw.mod normal.mod sh.mod \
@ -454,10 +454,27 @@ help_mod_CFLAGS = $(COMMON_CFLAGS)
help_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For search.mod.
search_mod_SOURCES = commands/search.c
search_mod_SOURCES = commands/search_wrap.c
search_mod_CFLAGS = $(COMMON_CFLAGS)
search_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += search_fs_file.mod search_fs_uuid.mod search_label.mod
# For search.mod.
search_fs_file_mod_SOURCES = commands/search_file.c
search_fs_file_mod_CFLAGS = $(COMMON_CFLAGS)
search_fs_file_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For search.mod.
search_label_mod_SOURCES = commands/search_label.c
search_label_mod_CFLAGS = $(COMMON_CFLAGS)
search_label_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For search.mod.
search_fs_uuid_mod_SOURCES = commands/search_uuid.c
search_fs_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
search_fs_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For test.mod.
test_mod_SOURCES = commands/test.c
test_mod_CFLAGS = $(COMMON_CFLAGS)
@ -468,16 +485,6 @@ loopback_mod_SOURCES = disk/loopback.c
loopback_mod_CFLAGS = $(COMMON_CFLAGS)
loopback_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For fs_file.mod
fs_file_mod_SOURCES = disk/fs_file.c
fs_file_mod_CFLAGS = $(COMMON_CFLAGS)
fs_file_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For fs_uuid.mod
fs_uuid_mod_SOURCES = disk/fs_uuid.c
fs_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
fs_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For configfile.mod
configfile_mod_SOURCES = commands/configfile.c
configfile_mod_CFLAGS = $(COMMON_CFLAGS)

View file

@ -93,7 +93,7 @@ grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
sbin_SCRIPTS = grub-install
# For grub-install.
grub_install_SOURCES = util/sparc64/ieee1275/grub-install.in
grub_install_SOURCES = util/grub-install.in
# Modules.
pkglib_MODULES = halt.mod \

View file

@ -44,6 +44,11 @@ AC_CANONICAL_TARGET
# Program name transformations
AC_ARG_PROGRAM
# Optimization flag. Allow user to override.
if test "x$TARGET_CFLAGS" = x; then
TARGET_CFLAGS="$TARGET_CFLAGS -Os"
fi
case "$target_cpu" in
i[[3456]]86) target_cpu=i386 ;;
sparc) target_cpu=sparc64 ;;
@ -242,60 +247,45 @@ CPPFLAGS="$TARGET_CPPFLAGS"
LDFLAGS="$TARGET_LDFLAGS"
LIBS=""
if test "x$TARGET_CFLAGS" = x; then
# debug flags.
TARGET_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
-Wundef -Wstrict-prototypes -g"
# debug flags.
TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
-Wundef -Wstrict-prototypes -g"
# optimization flags.
AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [
CFLAGS=-Os
# Force no alignment to save space on i386.
if test "x$target_cpu" = xi386; then
AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
CFLAGS="$CFLAGS -falign-loops=1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_Os=yes],
[grub_cv_cc_Os=no])
[grub_cv_cc_falign_loop=yes],
[grub_cv_cc_falign_loop=no])
])
if test "x$grub_cv_cc_Os" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -Os"
if test "x$grub_cv_cc_falign_loop" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
else
TARGET_CFLAGS="$TARGET_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
fi
# Force no alignment to save space on i386.
if test "x$target_cpu" = xi386; then
AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
CFLAGS="$CFLAGS -falign-loops=1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_falign_loop=yes],
[grub_cv_cc_falign_loop=no])
])
# Some toolchains enable these features by default, but they need
# registers that aren't set up properly in GRUB.
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
fi
if test "x$grub_cv_cc_falign_loop" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
else
TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
fi
# By default, GCC 4.4 generates .eh_frame sections containing unwind
# information in some cases where it previously did not. GRUB doesn't need
# these and they just use up vital space. Restore the old compiler
# behaviour.
AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_fno_dwarf2_cfi_asm=yes],
[grub_cv_cc_fno_dwarf2_cfi_asm=no])
CFLAGS="$SAVE_CFLAGS"
])
# Some toolchains enable these features by default, but they need
# registers that aren't set up properly in GRUB.
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
fi
# By default, GCC 4.4 generates .eh_frame sections containing unwind
# information in some cases where it previously did not. GRUB doesn't need
# these and they just use up vital space. Restore the old compiler
# behaviour.
AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_fno_dwarf2_cfi_asm=yes],
[grub_cv_cc_fno_dwarf2_cfi_asm=no])
CFLAGS="$SAVE_CFLAGS"
])
if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
fi
if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
fi
grub_apple_target_cc

View file

@ -281,7 +281,7 @@ grub_ata_identify (struct grub_ata_device *dev)
else
/* Other Error. */
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"device can not be identified");
"device cannot be identified");
}
grub_ata_pio_read (dev, info, GRUB_DISK_SECTOR_SIZE);
@ -520,7 +520,7 @@ grub_ata_setaddress (struct grub_ata_device *dev,
|| cylinder > dev->cylinders
|| head > dev->heads)
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"sector %d can not be addressed "
"sector %d cannot be addressed "
"using CHS addressing", sector);
grub_ata_regset (dev, GRUB_ATA_REG_DISK, (dev->device << 4) | head);
@ -675,7 +675,7 @@ grub_ata_open (const char *name, grub_disk_t disk)
}
if (! dev)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
if (dev->atapi)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not an ATA harddisk");
@ -775,7 +775,7 @@ grub_atapi_read (struct grub_scsi *scsi,
/* Count of last transfer may be uneven. */
if (! (0 < cnt && cnt <= size - nread && (! (cnt & 1) || cnt == size - nread)))
return grub_error (GRUB_ERR_READ_ERROR, "Invalid ATAPI transfer count");
return grub_error (GRUB_ERR_READ_ERROR, "invalid ATAPI transfer count");
/* Read the data. */
grub_ata_pio_read (dev, buf + nread, cnt);
@ -821,7 +821,7 @@ grub_atapi_open (const char *name, struct grub_scsi *scsi)
grub_dprintf ("ata", "opening ATAPI dev `%s'\n", name);
if (! devfnd)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "No such ATAPI device");
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no such ATAPI device");
scsi->data = devfnd;

View file

@ -30,7 +30,7 @@ grub_ata_pass_through (grub_disk_t disk,
{
if (disk->dev->id != GRUB_DISK_DEVICE_ATA_ID)
return grub_error (GRUB_ERR_BAD_DEVICE,
"Device not accessed via ata.mod");
"device not accessed via ata.mod");
struct grub_ata_device *dev = (struct grub_ata_device *) disk->data;

View file

@ -107,7 +107,7 @@ grub_dmraid_nv_detect (grub_disk_t disk, struct grub_raid_array *array)
if (sb.version != NV_VERSION)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unknown version: %d.%d", sb.version);
"unknown version: %d.%d", sb.version);
switch (sb.array.raid_level)
{
@ -129,7 +129,7 @@ grub_dmraid_nv_detect (grub_disk_t disk, struct grub_raid_array *array)
default:
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unsupported RAID level: %d", sb.array.raid_level);
"unsupported RAID level: %d", sb.array.raid_level);
}
array->name = NULL;

View file

@ -1,136 +0,0 @@
/* fs_file.c - Access partition by a file it contains. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/disk.h>
#include <grub/dl.h>
#include <grub/file.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/partition.h>
static grub_device_t
search_fs_file (const char *key, unsigned long *count)
{
char *filename = NULL;
grub_device_t ret = NULL;
*count = 0;
auto int iterate_device (const char *name);
int iterate_device (const char *name)
{
int len;
grub_file_t file;
(*count)++;
len = grub_strlen (name) + 2 + grub_strlen (key) + 1;
filename = grub_realloc (filename, len);
if (! filename)
return 1;
grub_sprintf (filename, "(%s)%s", name, key);
file = grub_file_open (filename);
if (file)
{
grub_file_close (file);
ret = grub_device_open (name);
return 1;
}
grub_errno = GRUB_ERR_NONE;
return 0;
}
grub_device_iterate (iterate_device);
grub_free (filename);
return ret;
}
static grub_err_t
grub_fs_file_open (const char *name, grub_disk_t disk)
{
grub_device_t dev;
if (grub_strncmp (name, "FILE=", sizeof ("FILE=") - 1))
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a FILE virtual volume");
dev = search_fs_file (name + sizeof ("FILE=") - 1, &disk->id);
if (! dev)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching file found");
disk->total_sectors = dev->disk->total_sectors;
disk->has_partitions = 0;
if (dev->disk->partition)
{
disk->partition = grub_malloc (sizeof (*disk->partition));
if (disk->partition)
grub_memcpy (disk->partition, dev->disk->partition,
sizeof (*disk->partition));
}
else
disk->partition = NULL;
disk->data = dev;
return GRUB_ERR_NONE;
}
static void
grub_fs_file_close (grub_disk_t disk)
{
grub_device_t parent = disk->data;
grub_device_close (parent);
}
static grub_err_t
grub_fs_file_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, char *buf)
{
grub_device_t parent = disk->data;
return parent->disk->dev->read (parent->disk, sector, size, buf);
}
static grub_err_t
grub_fs_file_write (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, const char *buf)
{
grub_device_t parent = disk->data;
return parent->disk->dev->write (parent->disk, sector, size, buf);
}
static struct grub_disk_dev grub_fs_file_dev = {
.name = "fs_file",
.id = GRUB_DISK_DEVICE_FILE_ID,
.open = grub_fs_file_open,
.close = grub_fs_file_close,
.read = grub_fs_file_read,
.write = grub_fs_file_write,
.next = 0
};
GRUB_MOD_INIT (fs_file)
{
grub_disk_dev_register (&grub_fs_file_dev);
}
GRUB_MOD_FINI (fs_file)
{
grub_disk_dev_unregister (&grub_fs_file_dev);
}

View file

@ -1,149 +0,0 @@
/* fs_uuid.c - Access disks by their filesystem UUID. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/disk.h>
#include <grub/dl.h>
#include <grub/kernel.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/types.h>
#include <grub/fs.h>
#include <grub/partition.h>
static grub_device_t
search_fs_uuid (const char *key, unsigned long *count)
{
*count = 0;
grub_device_t ret = NULL;
auto int iterate_device (const char *name);
int iterate_device (const char *name)
{
grub_device_t dev;
dev = grub_device_open (name);
if (dev)
{
grub_fs_t fs;
fs = grub_fs_probe (dev);
if (fs && fs->uuid)
{
char *uuid;
(fs->uuid) (dev, &uuid);
if (grub_errno == GRUB_ERR_NONE && uuid)
{
(*count)++;
if (grub_strcasecmp (uuid, key) == 0)
{
ret = dev;
grub_free (uuid);
return 1;
}
grub_free (uuid);
}
}
grub_device_close (dev);
}
grub_errno = GRUB_ERR_NONE;
return 0;
}
grub_device_iterate (iterate_device);
return ret;
}
static grub_err_t
grub_fs_uuid_open (const char *name, grub_disk_t disk)
{
grub_device_t dev;
if (grub_strncmp (name, "UUID=", sizeof ("UUID=")-1))
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a UUID virtual volume");
dev = search_fs_uuid (name + sizeof ("UUID=") - 1, &disk->id);
if (! dev)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching UUID found");
disk->total_sectors = dev->disk->total_sectors;
disk->has_partitions = 0;
if (dev->disk->partition)
{
disk->partition = grub_malloc (sizeof (*disk->partition));
if (disk->partition)
grub_memcpy (disk->partition, dev->disk->partition,
sizeof (*disk->partition));
}
else
disk->partition = NULL;
disk->data = dev;
return GRUB_ERR_NONE;
}
static void
grub_fs_uuid_close (grub_disk_t disk __attribute((unused)))
{
grub_device_t parent = disk->data;
grub_device_close (parent);
}
static grub_err_t
grub_fs_uuid_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, char *buf)
{
grub_device_t parent = disk->data;
return parent->disk->dev->read (parent->disk, sector, size, buf);
}
static grub_err_t
grub_fs_uuid_write (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, const char *buf)
{
grub_device_t parent = disk->data;
return parent->disk->dev->write (parent->disk, sector, size, buf);
}
static struct grub_disk_dev grub_fs_uuid_dev =
{
.name = "fs_uuid",
.id = GRUB_DISK_DEVICE_UUID_ID,
.open = grub_fs_uuid_open,
.close = grub_fs_uuid_close,
.read = grub_fs_uuid_read,
.write = grub_fs_uuid_write,
.next = 0
};
GRUB_MOD_INIT(fs_uuid)
{
grub_disk_dev_register (&grub_fs_uuid_dev);
}
GRUB_MOD_FINI(fs_uuid)
{
grub_disk_dev_unregister (&grub_fs_uuid_dev);
}

View file

@ -67,7 +67,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
} args;
if (! grub_strstr (name, "nand"))
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Not a nand device");
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a NAND device");
data = grub_malloc (sizeof (*data));
if (! data)
@ -76,7 +76,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
grub_ieee1275_open (name, &dev_ihandle);
if (! dev_ihandle)
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
goto fail;
}
@ -89,7 +89,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't get block size");
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't get block size");
goto fail;
}
@ -102,7 +102,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't get disk size");
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't get disk size");
goto fail;
}
@ -172,7 +172,7 @@ grub_nand_read (grub_disk_t disk, grub_disk_addr_t sector,
args.result = 1;
if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
return grub_error (GRUB_ERR_READ_ERROR, "Read error");
return grub_error (GRUB_ERR_READ_ERROR, "read error");
ofs = 0;
size -= len;

View file

@ -175,7 +175,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
grub_ieee1275_open (op->devpath, &dev_ihandle);
if (! dev_ihandle)
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
goto fail;
}
@ -184,20 +184,20 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
if (grub_ieee1275_finddevice (op->devpath, &dev))
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't read device properties");
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't read device properties");
goto fail;
}
if (grub_ieee1275_get_property (dev, "device_type", prop, sizeof (prop),
&actual))
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't read the device type");
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't read the device type");
goto fail;
}
if (grub_strcmp (prop, "block"))
{
grub_error (GRUB_ERR_BAD_DEVICE, "Not a block device");
grub_error (GRUB_ERR_BAD_DEVICE, "not a block device");
goto fail;
}
@ -244,12 +244,12 @@ grub_ofdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
(int) (pos >> 32), (int) pos & 0xFFFFFFFFUL, &status);
if (status < 0)
return grub_error (GRUB_ERR_READ_ERROR,
"Seek error, can't seek block %llu",
"seek error, can't seek block %llu",
(long long) sector);
grub_ieee1275_read ((grub_ieee1275_ihandle_t) (unsigned long) disk->data,
buf, size * 512UL, &actual);
if (actual != actual)
return grub_error (GRUB_ERR_READ_ERROR, "Read error on block: %llu",
return grub_error (GRUB_ERR_READ_ERROR, "read error on block: %llu",
(long long) sector);
return 0;

View file

@ -56,7 +56,7 @@ delete_loopback (const char *name)
break;
if (! dev)
return grub_error (GRUB_ERR_BAD_DEVICE, "Device not found");
return grub_error (GRUB_ERR_BAD_DEVICE, "device not found");
/* Remove the device from the list. */
*prev = dev->next;
@ -167,7 +167,7 @@ grub_loopback_open (const char *name, grub_disk_t disk)
break;
if (! dev)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
file = grub_file_open (dev->filename);
if (! file)

View file

@ -95,7 +95,7 @@ grub_lvm_open (const char *name, grub_disk_t disk)
}
if (! lv)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Unknown LVM device %s", name);
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown LVM device %s", name);
disk->has_partitions = 0;
disk->id = lv->number;
@ -188,7 +188,7 @@ grub_lvm_read (grub_disk_t disk, grub_disk_addr_t sector,
size << GRUB_DISK_SECTOR_BITS, buf);
else
err = grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"Physical volume %s not found", pv->name);
"physical volume %s not found", pv->name);
return err;
}
@ -263,7 +263,7 @@ grub_lvm_scan_device (const char *name)
if (dlocn->offset)
{
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"We don't support multiple LVM data areas");
"we don't support multiple LVM data areas");
goto fail;
}
@ -290,7 +290,7 @@ grub_lvm_scan_device (const char *name)
|| (grub_le_to_cpu32 (mdah->version) != GRUB_LVM_FMTT_VERSION))
{
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unknown LVM metadata header");
"unknown LVM metadata header");
goto fail2;
}

View file

@ -295,7 +295,7 @@ superblock_0_90:
if (sb.major_version != 0 || sb.minor_version != 90)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unsupported RAID version: %d.%d",
"unsupported RAID version: %d.%d",
sb.major_version, sb.minor_version);
/* FIXME: Check the checksum. */
@ -307,7 +307,7 @@ superblock_0_90:
if (sb.level != 0 && sb.level != 1 && sb.level != 4 &&
sb.level != 5 && sb.level != 6 && sb.level != 10)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unsupported RAID level: %d", sb.level);
"unsupported RAID level: %d", sb.level);
array->name = NULL;
array->number = sb.md_minor;

View file

@ -123,7 +123,7 @@ grub_raid_open (const char *name, grub_disk_t disk)
}
if (!array)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Unknown RAID device %s",
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown RAID device %s",
name);
disk->has_partitions = 1;
@ -265,7 +265,7 @@ grub_raid_read (grub_disk_t disk, grub_disk_addr_t sector,
}
else
err = grub_error (GRUB_ERR_READ_ERROR,
"disk missing.");
"disk missing");
k++;
if (k == array->total_devs)

View file

@ -157,7 +157,7 @@ grub_raid6_recover (struct grub_raid_array *array, int disknr, int p,
if (! array->device[q])
{
grub_error (GRUB_ERR_READ_ERROR, "Not enough disk to restore");
grub_error (GRUB_ERR_READ_ERROR, "not enough disk to restore");
goto quit;
}
@ -176,7 +176,7 @@ grub_raid6_recover (struct grub_raid_array *array, int disknr, int p,
if ((! array->device[p]) || (! array->device[q]))
{
grub_error (GRUB_ERR_READ_ERROR, "Not enough disk to restore");
grub_error (GRUB_ERR_READ_ERROR, "not enough disk to restore");
goto quit;
}

View file

@ -337,14 +337,14 @@ grub_scsi_read (grub_disk_t disk, grub_disk_addr_t sector,
unsigned spb = scsi->blocksize >> GRUB_DISK_SECTOR_BITS;
if (! (spb != 0 && (scsi->blocksize & GRUB_DISK_SECTOR_SIZE) == 0))
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unsupported SCSI block size");
"unsupported SCSI block size");
grub_uint32_t sector_mod = 0;
sector = grub_divmod64 (sector, spb, &sector_mod);
if (! (sector_mod == 0 && size % spb == 0))
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unaligned SCSI read not supported");
"unaligned SCSI read not supported");
size /= spb;
}

View file

@ -214,7 +214,7 @@ grub_efiemu_load_file (const char *filename)
{
grub_file_close (file);
grub_efiemu_unload ();
return grub_error (grub_errno, "Couldn't init memory management");
return grub_error (grub_errno, "couldn't init memory management");
}
grub_dprintf ("efiemu", "mm initialized\n");
@ -328,15 +328,15 @@ GRUB_MOD_INIT(efiemu)
{
cmd_loadcore = grub_register_command ("efiemu_loadcore",
grub_cmd_efiemu_load,
"efiemu_loadcore FILE",
"Load and initialize EFI emulator");
"FILE",
"Load and initialize EFI emulator.");
cmd_prepare = grub_register_command ("efiemu_prepare",
grub_cmd_efiemu_prepare,
"efiemu_prepare",
"Finalize loading of EFI emulator");
0,
"Finalize loading of EFI emulator.");
cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload,
"efiemu_unload",
"Unload EFI emulator");
0,
"Unload EFI emulator.");
}
GRUB_MOD_FINI(efiemu)

View file

@ -67,7 +67,7 @@ grub_efiemu_add_to_mmap (grub_uint64_t start, grub_uint64_t size,
* sizeof (grub_efi_memory_descriptor_t));
if (!efiemu_mmap)
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Not enough space for memory map");
"not enough space for memory map");
}
/* Fill slot*/
@ -622,7 +622,7 @@ grub_efiemu_mm_do_alloc (void)
if (!efiemu_mmap)
{
grub_efiemu_unload ();
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Couldn't initialize mmap");
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't initialize mmap");
}
if ((err = efiemu_alloc_requests ()))

View file

@ -78,8 +78,8 @@ unescape (char *in, char *out, char *outmax, int *len)
}
if (dptr == outmax)
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Too many NVRAM variables for reserved variable space."
" Try increasing EfiEmu.pnvram.size.");
"too many NVRAM variables for reserved variable space."
" Try increasing EfiEmu.pnvram.size");
*len = dptr - out;
return 0;
}
@ -132,8 +132,8 @@ nvram_set (void * data __attribute__ ((unused)))
if (nvramptr - nvram + sizeof (struct efi_variable) > nvramsize)
{
grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Too many NVRAM variables for reserved variable space."
" Try increasing EfiEmu.pnvram.size.");
"too many NVRAM variables for reserved variable space."
" Try increasing EfiEmu.pnvram.size");
return 1;
}
@ -173,7 +173,7 @@ nvram_set (void * data __attribute__ ((unused)))
if (len < 0)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, "Broken UTF-8 in variable name\n");
grub_error (GRUB_ERR_BAD_ARGUMENT, "broken UTF-8 in variable name");
return 1;
}

View file

@ -222,7 +222,7 @@ grub_efiemu_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
/* Ensure that we are called only once */
if (*ptv_relocated)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "EfiEmu is already relocated.");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "EfiEmu is already relocated");
*ptv_relocated = 1;
/* Correct addresses using information supplied by grub */

View file

@ -210,7 +210,7 @@ open_section (grub_file_t file, struct font_file_section *section)
else if (retval < 0)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font format error: can't read section name");
"font format error: can't read section name");
return 1;
}
@ -225,7 +225,7 @@ open_section (grub_file_t file, struct font_file_section *section)
else if (retval < 0)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font format error: can't read section length");
"font format error: can't read section length");
return 1;
}
@ -259,7 +259,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
if ((sect_length % FONT_CHAR_INDEX_ENTRY_SIZE) != 0)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font file format error: character index length %d "
"font file format error: character index length %d "
"is not a multiple of the entry size %d",
sect_length, FONT_CHAR_INDEX_ENTRY_SIZE);
return 1;
@ -294,7 +294,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
if (i != 0 && entry->code <= last_code)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font characters not in ascending order: %u <= %u",
"font characters not in ascending order: %u <= %u",
entry->code, last_code);
return 1;
}
@ -357,7 +357,7 @@ read_section_as_short (struct font_file_section *section, grub_int16_t *value)
if (section->length != 2)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font file format error: section %c%c%c%c length "
"font file format error: section %c%c%c%c length "
"is %d but should be 2",
section->name[0], section->name[1],
section->name[2], section->name[3],
@ -403,7 +403,7 @@ grub_font_load (const char *filename)
if (grub_memcmp (section.name, section_names_file, 4) != 0)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font file format error: 1st section must be FILE");
"font file format error: 1st section must be FILE");
goto fail;
}
@ -413,7 +413,7 @@ grub_font_load (const char *filename)
if (section.length != 4)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font file format error (file type ID length is %d "
"font file format error (file type ID length is %d "
"but should be 4)", section.length);
goto fail;
}
@ -431,7 +431,7 @@ grub_font_load (const char *filename)
if (grub_memcmp (magic, pff2_magic, 4) != 0)
{
grub_error (GRUB_ERR_BAD_FONT, "Invalid font magic %x %x %x %x",
grub_error (GRUB_ERR_BAD_FONT, "invalid font magic %x %x %x %x",
magic[0], magic[1], magic[2], magic[3]);
goto fail;
}
@ -558,7 +558,7 @@ grub_font_load (const char *filename)
|| font->descent == 0)
{
grub_error (GRUB_ERR_BAD_FONT,
"Invalid font file: missing some required data.");
"invalid font file: missing some required data");
goto fail;
}

View file

@ -62,7 +62,7 @@ GRUB_MOD_INIT(font_manager)
cmd_loadfont =
grub_register_command ("loadfont", loadfont_command,
"loadfont FILE...",
"FILE...",
"Specify one or more font files to load.");
cmd_lsfonts =
grub_register_command ("lsfonts", lsfonts_command,

View file

@ -182,14 +182,14 @@ grub_affs_mount (grub_disk_t disk)
/* Make sure this is an affs filesystem. */
if (grub_strncmp ((char *) (data->bblock.type), "DOS", 3))
{
grub_error (GRUB_ERR_BAD_FS, "not an affs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an AFFS filesystem");
goto fail;
}
/* Test if the filesystem is a OFS filesystem. */
if (! (data->bblock.flags & GRUB_AFFS_FLAG_FFS))
{
grub_error (GRUB_ERR_BAD_FS, "ofs not yet supported");
grub_error (GRUB_ERR_BAD_FS, "OFS not yet supported");
goto fail;
}
@ -231,7 +231,7 @@ grub_affs_mount (grub_disk_t disk)
}
if (-checksum != checksumr)
{
grub_error (GRUB_ERR_BAD_FS, "affs blocksize could not be determined");
grub_error (GRUB_ERR_BAD_FS, "AFFS blocksize couldn't be determined");
goto fail;
}
blocksize++;
@ -248,7 +248,7 @@ grub_affs_mount (grub_disk_t disk)
fail:
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not an affs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an AFFS filesystem");
grub_free (data);
grub_free (rootblock);

View file

@ -88,7 +88,7 @@ grub_cpio_find_file (struct grub_cpio_data *data, char **name,
return grub_errno;
if (hd.magic != MAGIC_BCPIO)
return grub_error (GRUB_ERR_BAD_FS, "Invalid cpio archive");
return grub_error (GRUB_ERR_BAD_FS, "invalid cpio archive");
data->size = (((grub_uint32_t) hd.filesize_1) << 16) + hd.filesize_2;
@ -130,7 +130,7 @@ grub_cpio_find_file (struct grub_cpio_data *data, char **name,
}
if (grub_memcmp (hd.magic, MAGIC_USTAR, sizeof (MAGIC_USTAR) - 1))
return grub_error (GRUB_ERR_BAD_FS, "Invalid tar archive");
return grub_error (GRUB_ERR_BAD_FS, "invalid tar archive");
if ((*name = grub_strdup (hd.name)) == NULL)
return grub_errno;

View file

@ -338,7 +338,7 @@ grub_fat_mount (grub_disk_t disk)
fail:
grub_free (data);
grub_error (GRUB_ERR_BAD_FS, "not a fat filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a FAT filesystem");
return 0;
}

View file

@ -365,7 +365,7 @@ grub_hfs_mount (grub_disk_t disk)
if (grub_hfs_find_node (data, (char *) &key, data->cat_root,
0, (char *) &dir, sizeof (dir)) == 0)
{
grub_error (GRUB_ERR_BAD_FS, "can not find the hfs root directory");
grub_error (GRUB_ERR_BAD_FS, "cannot find the HFS root directory");
goto fail;
}
@ -379,7 +379,7 @@ grub_hfs_mount (grub_disk_t disk)
grub_free (data);
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not a hfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a HFS filesystem");
return 0;
}

View file

@ -502,7 +502,7 @@ grub_hfsplus_mount (grub_disk_t disk)
fail:
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not a hfsplus filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a HFS+ filesystem");
grub_free (data);
return 0;
@ -653,7 +653,7 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree,
btree->nodesize, (char *) node) <= 0)
{
grub_free (node);
return grub_error (GRUB_ERR_BAD_FS, "Couldn't read i-node.");
return grub_error (GRUB_ERR_BAD_FS, "couldn't read i-node");
}
nodedesc = (struct grub_hfsplus_btnode *) node;

View file

@ -1,7 +1,7 @@
/* pxe.c - Driver to provide access to the pxe filesystem */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,6 +24,7 @@
#include <grub/file.h>
#include <grub/misc.h>
#include <grub/bufio.h>
#include <grub/env.h>
#include <grub/machine/pxe.h>
#include <grub/machine/memory.h>
@ -33,11 +34,17 @@
#define SEGOFS(x) ((SEGMENT(x) << 16) + OFFSET(x))
#define LINEAR(x) (void *) (((x >> 16) <<4) + (x & 0xFFFF))
struct grub_pxe_disk_data
{
grub_uint32_t server_ip;
grub_uint32_t gateway_ip;
};
struct grub_pxenv *grub_pxe_pxenv;
grub_uint32_t grub_pxe_your_ip;
grub_uint32_t grub_pxe_server_ip;
grub_uint32_t grub_pxe_gateway_ip;
int grub_pxe_blksize = GRUB_PXE_MIN_BLKSIZE;
static grub_uint32_t grub_pxe_your_ip;
static grub_uint32_t grub_pxe_default_server_ip;
static grub_uint32_t grub_pxe_default_gateway_ip;
static unsigned grub_pxe_blksize = GRUB_PXE_MIN_BLKSIZE;
static grub_file_t curr_file = 0;
@ -56,24 +63,83 @@ grub_pxe_iterate (int (*hook) (const char *name))
return 0;
}
static grub_err_t
parse_ip (const char *val, grub_uint32_t *ip, const char **rest)
{
grub_uint32_t newip = 0;
unsigned long t;
int i;
const char *ptr = val;
for (i = 0; i < 4; i++)
{
t = grub_strtoul (ptr, (char **) &ptr, 0);
if (grub_errno)
return grub_errno;
if (t & ~0xff)
return grub_error (GRUB_ERR_OUT_OF_RANGE, "Invalid IP.");
newip >>= 8;
newip |= (t << 24);
if (i != 3 && *ptr != '.')
return grub_error (GRUB_ERR_OUT_OF_RANGE, "Invalid IP.");
ptr++;
}
*ip = newip;
if (rest)
*rest = ptr - 1;
return 0;
}
static grub_err_t
grub_pxe_open (const char *name, grub_disk_t disk)
{
if (grub_strcmp (name, "pxe"))
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a pxe disk");
struct grub_pxe_disk_data *data;
if (grub_strcmp (name, "pxe") != 0
&& grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) != 0)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a pxe disk");
data = grub_malloc (sizeof (*data));
if (!data)
return grub_errno;
if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0)
{
const char *ptr;
grub_err_t err;
ptr = name + sizeof ("pxe:") - 1;
err = parse_ip (ptr, &(data->server_ip), &ptr);
if (err)
return err;
if (*ptr == ':')
{
err = parse_ip (ptr + 1, &(data->server_ip), 0);
if (err)
return err;
}
else
data->gateway_ip = grub_pxe_default_gateway_ip;
}
else
{
data->server_ip = grub_pxe_default_server_ip;
data->gateway_ip = grub_pxe_default_gateway_ip;
}
disk->total_sectors = 0;
disk->id = (unsigned long) "pxe";
disk->id = (unsigned long) data;
disk->has_partitions = 0;
disk->data = 0;
disk->data = data;
return GRUB_ERR_NONE;
}
static void
grub_pxe_close (grub_disk_t disk __attribute((unused)))
grub_pxe_close (grub_disk_t disk)
{
grub_free (disk->data);
}
static grub_err_t
@ -125,6 +191,7 @@ grub_pxefs_open (struct grub_file *file, const char *name)
struct grub_pxenv_tftp_open c2;
} c;
struct grub_pxe_data *data;
struct grub_pxe_disk_data *disk_data = file->device->disk->data;
grub_file_t file_int, bufio;
if (curr_file != 0)
@ -133,8 +200,8 @@ grub_pxefs_open (struct grub_file *file, const char *name)
curr_file = 0;
}
c.c1.server_ip = grub_pxe_server_ip;
c.c1.gateway_ip = grub_pxe_gateway_ip;
c.c1.server_ip = disk_data->server_ip;
c.c1.gateway_ip = disk_data->gateway_ip;
grub_strcpy ((char *)&c.c1.filename[0], name);
grub_pxe_call (GRUB_PXENV_TFTP_GET_FSIZE, &c.c1);
if (c.c1.status)
@ -184,6 +251,7 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
{
struct grub_pxenv_tftp_read c;
struct grub_pxe_data *data;
struct grub_pxe_disk_data *disk_data = file->device->disk->data;
grub_uint32_t pn, r;
data = file->data;
@ -203,8 +271,8 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
if (curr_file != 0)
grub_pxe_call (GRUB_PXENV_TFTP_CLOSE, &o);
o.server_ip = grub_pxe_server_ip;
o.gateway_ip = grub_pxe_gateway_ip;
o.server_ip = disk_data->server_ip;
o.gateway_ip = disk_data->gateway_ip;
grub_strcpy ((char *)&o.filename[0], data->filename);
o.tftp_port = grub_cpu_to_be16 (GRUB_PXE_TFTP_PORT);
o.packet_size = grub_pxe_blksize;
@ -272,6 +340,99 @@ static struct grub_fs grub_pxefs_fs =
.next = 0
};
static char *
grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)),
const char *val __attribute__ ((unused)))
{
return NULL;
}
static void
set_mac_env (grub_uint8_t *mac_addr, grub_size_t mac_len)
{
char buf[(sizeof ("XX:") - 1) * mac_len + 1];
char *ptr = buf;
unsigned i;
for (i = 0; i < mac_len; i++)
{
grub_sprintf (ptr, "%02x:", mac_addr[i] & 0xff);
ptr += (sizeof ("XX:") - 1);
}
if (mac_len)
*(ptr - 1) = 0;
else
buf[0] = 0;
grub_env_set ("net_pxe_mac", buf);
/* XXX: Is it possible to change MAC in PXE? */
grub_register_variable_hook ("net_pxe_mac", 0, grub_env_write_readonly);
}
static void
set_env_limn_ro (const char *varname, char *value, grub_size_t len)
{
char c;
c = value[len];
value[len] = 0;
grub_env_set (varname, value);
value[len] = c;
grub_register_variable_hook (varname, 0, grub_env_write_readonly);
}
static void
parse_dhcp_vendor (void *vend, int limit)
{
grub_uint8_t *ptr, *ptr0;
ptr = ptr0 = vend;
if (grub_be_to_cpu32 (*(grub_uint32_t *) ptr) != 0x63825363)
return;
ptr = ptr + sizeof (grub_uint32_t);
while (ptr - ptr0 < limit)
{
grub_uint8_t tagtype;
grub_uint8_t taglength;
tagtype = *ptr++;
/* Pad tag. */
if (tagtype == 0)
continue;
/* End tag. */
if (tagtype == 0xff)
return;
taglength = *ptr++;
switch (tagtype)
{
case 12:
set_env_limn_ro ("net_pxe_hostname", (char *) ptr, taglength);
break;
case 15:
set_env_limn_ro ("net_pxe_domain", (char *) ptr, taglength);
break;
case 17:
set_env_limn_ro ("net_pxe_rootpath", (char *) ptr, taglength);
break;
case 18:
set_env_limn_ro ("net_pxe_extensionspath", (char *) ptr, taglength);
break;
/* If you need any other options please contact GRUB
developpement team. */
}
ptr += taglength;
}
}
static void
grub_pxe_detect (void)
{
@ -293,9 +454,15 @@ grub_pxe_detect (void)
bp = LINEAR (ci.buffer);
grub_pxe_your_ip = bp->your_ip;
grub_pxe_server_ip = bp->server_ip;
grub_pxe_gateway_ip = bp->gateway_ip;
grub_pxe_default_server_ip = bp->server_ip;
grub_pxe_default_gateway_ip = bp->gateway_ip;
set_mac_env (bp->mac_addr, bp->hw_len < sizeof (bp->mac_addr) ? bp->hw_len
: sizeof (bp->mac_addr));
set_env_limn_ro ("net_pxe_boot_file", (char *) bp->boot_file,
sizeof (bp->boot_file));
set_env_limn_ro ("net_pxe_dhcp_server_name", (char *) bp->server_name,
sizeof (bp->server_name));
parse_dhcp_vendor (&bp->vendor, sizeof (bp->vendor));
grub_pxe_pxenv = pxenv;
}
@ -311,11 +478,110 @@ grub_pxe_unload (void)
}
}
static void
set_ip_env (char *varname, grub_uint32_t ip)
{
char buf[sizeof ("XXX.XXX.XXX.XXX")];
grub_sprintf (buf, "%d.%d.%d.%d", (ip & 0xff),
(ip >> 8) & 0xff, (ip >> 16) & 0xff, (ip >> 24) & 0xff);
grub_env_set (varname, buf);
}
static char *
write_ip_env (grub_uint32_t *ip, const char *val)
{
char *buf;
grub_err_t err;
grub_uint32_t newip;
err = parse_ip (val, &newip, 0);
if (err)
return 0;
/* Normalize the IP. */
buf = grub_malloc (sizeof ("XXX.XXX.XXX.XXX"));
if (!buf)
return 0;
*ip = newip;
grub_sprintf (buf, "%d.%d.%d.%d", (newip & 0xff), (newip >> 8) & 0xff,
(newip >> 16) & 0xff, (newip >> 24) & 0xff);
return buf;
}
static char *
grub_env_write_pxe_default_server (struct grub_env_var *var
__attribute__ ((unused)),
const char *val)
{
return write_ip_env (&grub_pxe_default_server_ip, val);
}
static char *
grub_env_write_pxe_default_gateway (struct grub_env_var *var
__attribute__ ((unused)),
const char *val)
{
return write_ip_env (&grub_pxe_default_gateway_ip, val);
}
static char *
grub_env_write_pxe_blocksize (struct grub_env_var *var __attribute__ ((unused)),
const char *val)
{
unsigned size;
char *buf;
size = grub_strtoul (val, 0, 0);
if (grub_errno)
return 0;
if (size < GRUB_PXE_MIN_BLKSIZE)
size = GRUB_PXE_MIN_BLKSIZE;
else if (size > GRUB_PXE_MAX_BLKSIZE)
size = GRUB_PXE_MAX_BLKSIZE;
buf = grub_malloc (sizeof ("XXXXXX XXXXXX"));
if (!buf)
return 0;
grub_sprintf (buf, "%d", size);
grub_pxe_blksize = size;
return buf;
}
GRUB_MOD_INIT(pxe)
{
grub_pxe_detect ();
if (grub_pxe_pxenv)
{
char *buf;
buf = grub_malloc (sizeof ("XXXXXX XXXXXX"));
if (buf)
{
grub_sprintf (buf, "%d", grub_pxe_blksize);
grub_env_set ("net_pxe_blksize", buf);
}
set_ip_env ("pxe_default_server", grub_pxe_default_server_ip);
set_ip_env ("pxe_default_gateway", grub_pxe_default_gateway_ip);
set_ip_env ("net_pxe_ip", grub_pxe_your_ip);
grub_register_variable_hook ("net_pxe_default_server", 0,
grub_env_write_pxe_default_server);
grub_register_variable_hook ("net_pxe_default_gateway", 0,
grub_env_write_pxe_default_gateway);
/* XXX: Is it possible to change IP in PXE? */
grub_register_variable_hook ("net_pxe_ip", 0,
grub_env_write_readonly);
grub_register_variable_hook ("net_pxe_blksize", 0,
grub_env_write_pxe_blocksize);
grub_disk_dev_register (&grub_pxe_dev);
grub_fs_register (&grub_pxefs_fs);
}

View file

@ -280,13 +280,13 @@ grub_iso9660_mount (grub_disk_t disk)
sizeof (struct grub_iso9660_primary_voldesc),
(char *) &voldesc))
{
grub_error (GRUB_ERR_BAD_FS, "not a iso9660 filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a ISO9660 filesystem");
goto fail;
}
if (grub_strncmp ((char *) voldesc.voldesc.magic, "CD001", 5) != 0)
{
grub_error (GRUB_ERR_BAD_FS, "not a iso9660 filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a ISO9660 filesystem");
goto fail;
}
@ -315,7 +315,7 @@ grub_iso9660_mount (grub_disk_t disk)
<< GRUB_ISO9660_LOG2_BLKSZ), 0,
sizeof (rootdir), (char *) &rootdir))
{
grub_error (GRUB_ERR_BAD_FS, "not a iso9660 filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a ISO9660 filesystem");
goto fail;
}
@ -331,7 +331,7 @@ grub_iso9660_mount (grub_disk_t disk)
<< GRUB_ISO9660_LOG2_BLKSZ), sua_pos,
sua_size, sua))
{
grub_error (GRUB_ERR_BAD_FS, "not a iso9660 filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a ISO9660 filesystem");
goto fail;
}
@ -832,7 +832,7 @@ grub_iso9660_uuid (grub_device_t device, char **uuid)
&& ! data->voldesc.modified.second[0] && ! data->voldesc.modified.second[1]
&& ! data->voldesc.modified.hundredth[0] && ! data->voldesc.modified.hundredth[1])
{
grub_error (GRUB_ERR_BAD_NUMBER, "No creation date in filesystem to generate UUID.");
grub_error (GRUB_ERR_BAD_NUMBER, "no creation date in filesystem to generate UUID");
*uuid = NULL;
}
else

View file

@ -344,7 +344,7 @@ grub_jfs_mount (grub_disk_t disk)
if (grub_strncmp ((char *) (data->sblock.magic), "JFS1", 4))
{
grub_error (GRUB_ERR_BAD_FS, "not a jfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a JFS filesystem");
goto fail;
}
@ -363,7 +363,7 @@ grub_jfs_mount (grub_disk_t disk)
grub_free (data);
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not a jfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a JFS filesystem");
return 0;
}
@ -715,7 +715,7 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *data, int ino)
grub_jfs_find_file (data, symlink);
if (grub_errno)
grub_error (grub_errno, "Can not follow symlink `%s'.", symlink);
grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
return grub_errno;
}

View file

@ -311,7 +311,7 @@ grub_minix_lookup_symlink (struct grub_minix_data *data, int ino)
grub_minix_find_file (data, symlink);
if (grub_errno)
grub_error (grub_errno, "Can not follow symlink `%s'.", symlink);
grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
return grub_errno;
}

View file

@ -42,7 +42,7 @@ fixup (struct grub_ntfs_data *data, char *buf, int len, char *magic)
ss = u16at (buf, 6) - 1;
if (ss * (int) data->blocksize != len * GRUB_DISK_SECTOR_SIZE)
return grub_error (GRUB_ERR_BAD_FS, "Size not match",
return grub_error (GRUB_ERR_BAD_FS, "size not match",
ss * (int) data->blocksize,
len * GRUB_DISK_SECTOR_SIZE);
pu = buf + u16at (buf, 4);
@ -53,7 +53,7 @@ fixup (struct grub_ntfs_data *data, char *buf, int len, char *magic)
buf += data->blocksize;
pu += 2;
if (u16at (buf, 0) != us)
return grub_error (GRUB_ERR_BAD_FS, "Fixup signature not match");
return grub_error (GRUB_ERR_BAD_FS, "fixup signature not match");
v16at (buf, 0) = v16at (pu, 0);
ss--;
}
@ -147,7 +147,7 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
new_pos += u16at (new_pos, 4);
}
grub_error (GRUB_ERR_BAD_FS,
"Can\'t find 0x%X in attribute list",
"can\'t find 0x%X in attribute list",
(unsigned char) *at->attr_cur);
return NULL;
}
@ -186,7 +186,7 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
if (read_data (at, pa, at->edat_buf, 0, n, 0, 0))
{
grub_error (GRUB_ERR_BAD_FS,
"Fail to read non-resident attribute list");
"fail to read non-resident attribute list");
return NULL;
}
at->attr_nxt = at->edat_buf;
@ -315,7 +315,7 @@ retry:
goto retry;
}
}
return grub_error (GRUB_ERR_BAD_FS, "Run list overflown");
return grub_error (GRUB_ERR_BAD_FS, "run list overflown");
}
run = read_run_data (run + 1, c1, &val, 0); /* length of current VCN */
ctx->curr_vcn = ctx->next_vcn;
@ -369,7 +369,7 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
if (pa[8] == 0)
{
if (ofs + len > u32at (pa, 0x10))
return grub_error (GRUB_ERR_BAD_FS, "Read out of range");
return grub_error (GRUB_ERR_BAD_FS, "read out of range");
grub_memcpy (dest, pa + u32at (pa, 0x14) + ofs, len);
return 0;
}
@ -383,7 +383,7 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
if (ctx->flags & RF_COMP)
{
if (!cached)
return grub_error (GRUB_ERR_BAD_FS, "Attribute can\'t be compressed");
return grub_error (GRUB_ERR_BAD_FS, "attribute can\'t be compressed");
if (at->sbuf)
{
@ -502,7 +502,7 @@ read_attr (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
else
ret =
(grub_errno) ? grub_errno : grub_error (GRUB_ERR_BAD_FS,
"Attribute not found");
"attribute not found");
at->attr_cur = save_cur;
return ret;
}
@ -513,7 +513,7 @@ read_mft (struct grub_ntfs_data *data, char *buf, grub_uint32_t mftno)
if (read_attr
(&data->mmft.attr, buf, mftno * ((grub_disk_addr_t) data->mft_size << BLK_SHR),
data->mft_size << BLK_SHR, 0, 0))
return grub_error (GRUB_ERR_BAD_FS, "Read MFT 0x%X fails", mftno);
return grub_error (GRUB_ERR_BAD_FS, "read MFT 0x%X fails", mftno);
return fixup (data, buf, data->mft_size, "FILE");
}
@ -541,7 +541,7 @@ init_file (struct grub_ntfs_file *mft, grub_uint32_t mftno)
pa = locate_attr (&mft->attr, mft, AT_DATA);
if (pa == NULL)
return grub_error (GRUB_ERR_BAD_FS, "No $DATA in MFT 0x%X", mftno);
return grub_error (GRUB_ERR_BAD_FS, "no $DATA in MFT 0x%X", mftno);
if (!pa[8])
mft->size = u32at (pa, 0x10);
@ -664,7 +664,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
{
if ((cur_pos = find_attr (at, AT_INDEX_ROOT)) == NULL)
{
grub_error (GRUB_ERR_BAD_FS, "No $INDEX_ROOT");
grub_error (GRUB_ERR_BAD_FS, "no $INDEX_ROOT");
goto done;
}
@ -717,7 +717,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
if (read_data (at, cur_pos, bmp, 0, bitmap_len, 0, 0))
{
grub_error (GRUB_ERR_BAD_FS,
"Fails to read non-resident $BITMAP");
"fails to read non-resident $BITMAP");
goto done;
}
bitmap_len = u32at (cur_pos, 0x30);

View file

@ -28,7 +28,7 @@ static grub_err_t
decomp_nextvcn (struct grub_ntfs_comp *cc)
{
if (cc->comp_head >= cc->comp_tail)
return grub_error (GRUB_ERR_BAD_FS, "Compression block overflown");
return grub_error (GRUB_ERR_BAD_FS, "compression block overflown");
if (grub_disk_read
(cc->disk,
(cc->comp_table[cc->comp_head][1] -
@ -87,7 +87,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
{
if (copied > COM_LEN)
return grub_error (GRUB_ERR_BAD_FS,
"Compression block too large");
"compression block too large");
if (!bits)
{
@ -112,7 +112,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
if (!copied)
{
grub_error (GRUB_ERR_BAD_FS, "Context window empty");
grub_error (GRUB_ERR_BAD_FS, "nontext window empty");
return 0;
}
@ -150,7 +150,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
{
if (cnt != COM_LEN)
return grub_error (GRUB_ERR_BAD_FS,
"Invalid compression block size");
"invalid compression block size");
}
}
@ -187,7 +187,7 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, int num)
{
if (ctx->comp.comp_head != ctx->comp.comp_tail)
return grub_error (GRUB_ERR_BAD_FS, "Invalid compression block");
return grub_error (GRUB_ERR_BAD_FS, "invalid compression block");
ctx->comp.comp_head = ctx->comp.comp_tail = 0;
ctx->comp.cbuf_vcn = ctx->target_vcn;
ctx->comp.cbuf_ofs = (ctx->comp.spc << BLK_SHR);

View file

@ -691,7 +691,7 @@ grub_reiserfs_mount (grub_disk_t disk)
if (grub_memcmp (data->superblock.magic_string,
REISERFS_MAGIC_STRING, sizeof (REISERFS_MAGIC_STRING) - 1))
{
grub_error (GRUB_ERR_BAD_FS, "not a reiserfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a ReiserFS filesystem");
goto fail;
}
data->disk = disk;
@ -700,7 +700,7 @@ grub_reiserfs_mount (grub_disk_t disk)
fail:
/* Disk is too small to contain a ReiserFS. */
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not a reiserfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a ReiserFS filesystem");
grub_free (data);
return 0;
@ -998,7 +998,7 @@ grub_reiserfs_open (struct grub_file *file, const char *name)
goto fail;
if (root.block_number == 0)
{
grub_error (GRUB_ERR_BAD_FS, "Unable to find root item");
grub_error (GRUB_ERR_BAD_FS, "unable to find root item");
goto fail; /* Should never happen since checked at mount. */
}
grub_fshelp_find_file (name, &root, &found,
@ -1014,7 +1014,7 @@ grub_reiserfs_open (struct grub_file *file, const char *name)
goto fail;
if (info.block_number == 0)
{
grub_error (GRUB_ERR_BAD_FS, "Unable to find searched item");
grub_error (GRUB_ERR_BAD_FS, "unable to find searched item");
goto fail;
}
entry_version = grub_le_to_cpu16 (info.header.version);
@ -1289,7 +1289,7 @@ grub_reiserfs_dir (grub_device_t device, const char *path,
goto fail;
if (root.block_number == 0)
{
grub_error(GRUB_ERR_BAD_FS, "Root not found");
grub_error(GRUB_ERR_BAD_FS, "root not found");
goto fail;
}
grub_fshelp_find_file (path, &root, &found, grub_reiserfs_iterate_dir,

View file

@ -279,7 +279,7 @@ grub_sfs_mount (grub_disk_t disk)
/* Make sure this is a sfs filesystem. */
if (grub_strncmp ((char *) (data->rblock.header.magic), "SFS", 4))
{
grub_error (GRUB_ERR_BAD_FS, "not a sfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a SFS filesystem");
goto fail;
}
@ -307,7 +307,7 @@ grub_sfs_mount (grub_disk_t disk)
fail:
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not an sfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an SFS filesystem");
grub_free (data);
grub_free (rootobjc_data);

View file

@ -525,7 +525,7 @@ grub_udf_mount (grub_disk_t disk)
if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_vrs), &vrs))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
@ -539,7 +539,7 @@ grub_udf_mount (grub_disk_t disk)
(grub_memcmp (vrs.magic, GRUB_UDF_STD_IDENT_CDW02, 5)) &&
(grub_memcmp (vrs.magic, GRUB_UDF_STD_IDENT_TEA01, 5)))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
}
@ -552,7 +552,7 @@ grub_udf_mount (grub_disk_t disk)
if (grub_disk_read (disk, *sblklist << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_avdp), &avdp))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
@ -565,7 +565,7 @@ grub_udf_mount (grub_disk_t disk)
sblklist++;
if (*sblklist == 0)
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
}
@ -579,7 +579,7 @@ grub_udf_mount (grub_disk_t disk)
if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_tag), &tag))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
@ -596,7 +596,7 @@ grub_udf_mount (grub_disk_t disk)
sizeof (struct grub_udf_pd),
&data->pds[data->npd]))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
@ -612,7 +612,7 @@ grub_udf_mount (grub_disk_t disk)
sizeof (struct grub_udf_lvd),
&data->lvd))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
@ -675,7 +675,7 @@ grub_udf_mount (grub_disk_t disk)
if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_fileset), &root_fs))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}

View file

@ -415,7 +415,7 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino)
grub_ufs_find_file (data, symlink);
if (grub_errno)
grub_error (grub_errno, "Can not follow symlink `%s'.", symlink);
grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
return grub_errno;
}

View file

@ -222,7 +222,7 @@ grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino,
return grub_errno;
if (grub_strncmp ((char *) inode->magic, "IN", 2))
return grub_error (GRUB_ERR_BAD_FS, "not a correct XFS inode.\n");
return grub_error (GRUB_ERR_BAD_FS, "not a correct XFS inode");
return 0;
}
@ -273,7 +273,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
if (grub_strncmp ((char *) leaf->magic, "BMAP", 4))
{
grub_free (leaf);
grub_error (GRUB_ERR_BAD_FS, "not a correct XFS BMAP node.\n");
grub_error (GRUB_ERR_BAD_FS, "not a correct XFS BMAP node");
return 0;
}
@ -290,7 +290,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
else
{
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"xfs does not support inode format %d yet",
"XFS does not support inode format %d yet",
node->inode.format);
return 0;
}
@ -567,7 +567,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
default:
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"xfs does not support inode format %d yet",
"XFS does not support inode format %d yet",
diro->inode.format);
}
return 0;
@ -590,7 +590,7 @@ grub_xfs_mount (grub_disk_t disk)
if (grub_strncmp ((char *) (data->sblock.magic), "XFSB", 4))
{
grub_error (GRUB_ERR_BAD_FS, "not a xfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a XFS filesystem");
goto fail;
}
@ -617,7 +617,7 @@ grub_xfs_mount (grub_disk_t disk)
fail:
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not an xfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an XFS filesystem");
grub_free (data);

View file

@ -243,7 +243,7 @@ grub_mofile_open (const char *filename)
if (version != 0)
{
grub_error (GRUB_ERR_BAD_FILE_TYPE,
"mo: invalid mo version in file: %s\n", filename);
"mo: invalid mo version in file: %s", filename);
fd_mo = 0;
return 0;
}
@ -298,7 +298,7 @@ grub_gettext_init_ext (const char *lang)
}
static void
grub_gettext_delete_list ()
grub_gettext_delete_list (void)
{
struct grub_gettext_msg *item;
@ -347,7 +347,7 @@ GRUB_MOD_INIT (gettext)
grub_gettext_init_ext (lang);
grub_register_command_p1 ("gettext", grub_cmd_translate,
"gettext STRING",
"STRING",
"Translates the string with the current settings.");
/* Reload .mo file information if lang changes. */

View file

@ -22,7 +22,7 @@
#include <grub/i18n.h>
/* Macros for indistinguishibility. */
#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "Access denied.")
#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "access denied")
#define GRUB_GET_PASSWORD(string, len) grub_cmdline_get (N_("Enter password:"), \
string, len, \
'*', 0, 0)

View file

@ -25,6 +25,8 @@
#define CTRL 0x1d
#define ALT 0x38
#define CAPS_LOCK 0x3a
#define NUM_LOCK 0x45
#define SCROLL_LOCK 0x46
#define KEYBOARD_REG_DATA 0x60
#define KEYBOARD_REG_STATUS 0x64

View file

@ -201,7 +201,7 @@ struct grub_pxenv_get_cached_info
#define GRUB_PXE_MAC_ADDR_LEN 16
typedef grub_uint8_t grub_pxe_mac_addr[GRUB_PXE_MAC_ADDR_LEN];
typedef grub_uint8_t grub_pxe_mac_addr_t[GRUB_PXE_MAC_ADDR_LEN];
struct grub_pxenv_boot_player
{
@ -216,7 +216,7 @@ struct grub_pxenv_boot_player
grub_uint32_t your_ip;
grub_uint32_t server_ip;
grub_uint32_t gateway_ip;
grub_pxe_mac_addr mac_addr;
grub_pxe_mac_addr_t mac_addr;
grub_uint8_t server_name[64];
grub_uint8_t boot_file[128];
union
@ -306,10 +306,6 @@ struct grub_pxenv * EXPORT_FUNC(grub_pxe_scan) (void);
int EXPORT_FUNC(grub_pxe_call) (int func, void * data);
extern struct grub_pxenv *grub_pxe_pxenv;
extern grub_uint32_t grub_pxe_your_ip;
extern grub_uint32_t grub_pxe_server_ip;
extern grub_uint32_t grub_pxe_gateway_ip;
extern int grub_pxe_blksize;
void grub_pxe_unload (void);

26
include/grub/search.h Normal file
View file

@ -0,0 +1,26 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_SEARCH_HEADER
#define GRUB_SEARCH_HEADER 1
void grub_search_fs_file (const char *key, const char *var, int no_floppy);
void grub_search_fs_uuid (const char *key, const char *var, int no_floppy);
void grub_search_label (const char *key, const char *var, int no_floppy);
#endif

View file

@ -1,6 +1,5 @@
/*
* multiboot.h - Multiboot header file.
* Copyright (C) 2003,2007,2008,2009 Free Software Foundation, Inc.
/* multiboot.h - Multiboot header file. */
/* Copyright (C) 1999,2003,2007,2008,2009 Free Software Foundation, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -24,70 +23,66 @@
#define MULTIBOOT_HEADER 1
/* How many bytes from the start of the file we search for the header. */
#define MULTIBOOT_SEARCH 8192
#define MULTIBOOT_SEARCH 8192
/* The magic field should contain this. */
#define MULTIBOOT_MAGIC 0x1BADB002
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
/* This should be in %eax. */
#define MULTIBOOT_MAGIC2 0x2BADB002
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
/* The bits in the required part of flags field we don't support. */
#define MULTIBOOT_UNSUPPORTED 0x0000fffc
#define MULTIBOOT_UNSUPPORTED 0x0000fffc
/* Alignment of multiboot modules. */
#define MULTIBOOT_MOD_ALIGN 0x00001000
#define MULTIBOOT_MOD_ALIGN 0x00001000
/* Alignment of the multiboot info structure. */
#define MULTIBOOT_INFO_ALIGN 0x00000004
#define MULTIBOOT_INFO_ALIGN 0x00000004
/*
* Flags set in the 'flags' member of the multiboot header.
*/
/* Flags set in the 'flags' member of the multiboot header. */
/* Align all boot modules on i386 page (4KB) boundaries. */
#define MULTIBOOT_PAGE_ALIGN 0x00000001
#define MULTIBOOT_PAGE_ALIGN 0x00000001
/* Must pass memory information to OS. */
#define MULTIBOOT_MEMORY_INFO 0x00000002
#define MULTIBOOT_MEMORY_INFO 0x00000002
/* Must pass video information to OS. */
#define MULTIBOOT_VIDEO_MODE 0x00000004
#define MULTIBOOT_VIDEO_MODE 0x00000004
/* This flag indicates the use of the address fields in the header. */
#define MULTIBOOT_AOUT_KLUDGE 0x00010000
#define MULTIBOOT_AOUT_KLUDGE 0x00010000
/*
* Flags to be set in the 'flags' member of the multiboot info structure.
*/
/* Flags to be set in the 'flags' member of the multiboot info structure. */
/* is there basic lower/upper memory information? */
#define MULTIBOOT_INFO_MEMORY 0x00000001
#define MULTIBOOT_INFO_MEMORY 0x00000001
/* is there a boot device set? */
#define MULTIBOOT_INFO_BOOTDEV 0x00000002
#define MULTIBOOT_INFO_BOOTDEV 0x00000002
/* is the command-line defined? */
#define MULTIBOOT_INFO_CMDLINE 0x00000004
#define MULTIBOOT_INFO_CMDLINE 0x00000004
/* are there modules to do something with? */
#define MULTIBOOT_INFO_MODS 0x00000008
#define MULTIBOOT_INFO_MODS 0x00000008
/* These next two are mutually exclusive */
/* is there a symbol table loaded? */
#define MULTIBOOT_INFO_AOUT_SYMS 0x00000010
/* is there an ELF section header table? */
#define MULTIBOOT_INFO_ELF_SHDR 0x00000020
#define MULTIBOOT_INFO_ELF_SHDR 0X00000020
/* is there a full memory map? */
#define MULTIBOOT_INFO_MEM_MAP 0x00000040
#define MULTIBOOT_INFO_MEM_MAP 0x00000040
/* Is there drive info? */
#define MULTIBOOT_INFO_DRIVE_INFO 0x00000080
/* Is there a config table? */
#define MULTIBOOT_INFO_CONFIG_TABLE 0x00000100
#define MULTIBOOT_INFO_CONFIG_TABLE 0x00000100
/* Is there a boot loader name? */
#define MULTIBOOT_INFO_BOOT_LOADER_NAME 0x00000200
#define MULTIBOOT_INFO_BOOT_LOADER_NAME 0x00000200
/* Is there a APM table? */
#define MULTIBOOT_INFO_APM_TABLE 0x00000400
@ -97,102 +92,131 @@
#ifndef ASM_FILE
#include <grub/types.h>
typedef unsigned short multiboot_uint16_t;
typedef unsigned int multiboot_uint32_t;
typedef unsigned long long multiboot_uint64_t;
struct multiboot_header
{
/* Must be MULTIBOOT_MAGIC - see above. */
grub_uint32_t magic;
multiboot_uint32_t magic;
/* Feature flags. */
grub_uint32_t flags;
multiboot_uint32_t flags;
/* The above fields plus this one must equal 0 mod 2^32. */
grub_uint32_t checksum;
multiboot_uint32_t checksum;
/* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
grub_uint32_t header_addr;
grub_uint32_t load_addr;
grub_uint32_t load_end_addr;
grub_uint32_t bss_end_addr;
grub_uint32_t entry_addr;
multiboot_uint32_t header_addr;
multiboot_uint32_t load_addr;
multiboot_uint32_t load_end_addr;
multiboot_uint32_t bss_end_addr;
multiboot_uint32_t entry_addr;
/* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
grub_uint32_t mode_type;
grub_uint32_t width;
grub_uint32_t height;
grub_uint32_t depth;
multiboot_uint32_t mode_type;
multiboot_uint32_t width;
multiboot_uint32_t height;
multiboot_uint32_t depth;
};
/* The symbol table for a.out. */
struct multiboot_aout_symbol_table
{
multiboot_uint32_t tabsize;
multiboot_uint32_t strsize;
multiboot_uint32_t addr;
multiboot_uint32_t reserved;
};
typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
/* The section header table for ELF. */
struct multiboot_elf_section_header_table
{
multiboot_uint32_t num;
multiboot_uint32_t size;
multiboot_uint32_t addr;
multiboot_uint32_t shndx;
};
typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;
struct multiboot_info
{
/* Multiboot info version number */
grub_uint32_t flags;
multiboot_uint32_t flags;
/* Available memory from BIOS */
grub_uint32_t mem_lower;
grub_uint32_t mem_upper;
multiboot_uint32_t mem_lower;
multiboot_uint32_t mem_upper;
/* "root" partition */
grub_uint32_t boot_device;
multiboot_uint32_t boot_device;
/* Kernel command line */
grub_uint32_t cmdline;
multiboot_uint32_t cmdline;
/* Boot-Module list */
grub_uint32_t mods_count;
grub_uint32_t mods_addr;
multiboot_uint32_t mods_count;
multiboot_uint32_t mods_addr;
grub_uint32_t syms[4];
union
{
multiboot_aout_symbol_table_t aout_sym;
multiboot_elf_section_header_table_t elf_sec;
} u;
/* Memory Mapping buffer */
grub_uint32_t mmap_length;
grub_uint32_t mmap_addr;
multiboot_uint32_t mmap_length;
multiboot_uint32_t mmap_addr;
/* Drive Info buffer */
grub_uint32_t drives_length;
grub_uint32_t drives_addr;
multiboot_uint32_t drives_length;
multiboot_uint32_t drives_addr;
/* ROM configuration table */
grub_uint32_t config_table;
multiboot_uint32_t config_table;
/* Boot Loader Name */
grub_uint32_t boot_loader_name;
multiboot_uint32_t boot_loader_name;
/* APM table */
grub_uint32_t apm_table;
multiboot_uint32_t apm_table;
/* Video */
grub_uint32_t vbe_control_info;
grub_uint32_t vbe_mode_info;
grub_uint16_t vbe_mode;
grub_uint16_t vbe_interface_seg;
grub_uint16_t vbe_interface_off;
grub_uint16_t vbe_interface_len;
multiboot_uint32_t vbe_control_info;
multiboot_uint32_t vbe_mode_info;
multiboot_uint16_t vbe_mode;
multiboot_uint16_t vbe_interface_seg;
multiboot_uint16_t vbe_interface_off;
multiboot_uint16_t vbe_interface_len;
};
typedef struct multiboot_info multiboot_info_t;
struct multiboot_mmap_entry
{
grub_uint32_t size;
grub_uint64_t addr;
grub_uint64_t len;
multiboot_uint32_t size;
multiboot_uint64_t addr;
multiboot_uint64_t len;
#define MULTIBOOT_MEMORY_AVAILABLE 1
#define MULTIBOOT_MEMORY_RESERVED 2
grub_uint32_t type;
multiboot_uint32_t type;
} __attribute__((packed));
typedef struct multiboot_mmap_entry multiboot_memory_map_t;
struct multiboot_mod_list
{
/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
grub_uint32_t mod_start;
grub_uint32_t mod_end;
multiboot_uint32_t mod_start;
multiboot_uint32_t mod_end;
/* Module command line */
grub_uint32_t cmdline;
multiboot_uint32_t cmdline;
/* padding to take it to 16 bytes (must be zero) */
grub_uint32_t pad;
multiboot_uint32_t pad;
};
typedef struct multiboot_mod_list multiboot_module_t;
#endif /* ! ASM_FILE */

View file

@ -37,7 +37,7 @@ grub_register_command_prio (const char *name,
cmd->name = name;
cmd->func = func;
cmd->summary = (summary) ? summary : name;
cmd->summary = (summary) ? summary : "";
cmd->description = description;
cmd->flags = GRUB_COMMAND_FLAG_BOTH;

View file

@ -190,13 +190,13 @@ void
grub_register_core_commands (void)
{
grub_register_command ("set", grub_core_cmd_set,
"set [ENVVAR=VALUE]", "set an environment variable");
"[ENVVAR=VALUE]", "Set an environment variable.");
grub_register_command ("unset", grub_core_cmd_unset,
"unset ENVVAR", "remove an environment variable");
"ENVVAR", "Remove an environment variable.");
grub_register_command ("export", grub_core_cmd_export,
"export ENVVAR", "Export a variable.");
"ENVVAR", "Export a variable.");
grub_register_command ("ls", grub_core_cmd_ls,
"ls [ARG]", "list devices or files");
"[ARG]", "List devices or files.");
grub_register_command ("insmod", grub_core_cmd_insmod,
"insmod MODULE", "insert a module");
"MODULE", "Insert a module.");
}

View file

@ -74,7 +74,7 @@ grub_elf_file (grub_file_t file)
!= sizeof (elf->ehdr))
{
grub_error_push ();
grub_error (GRUB_ERR_READ_ERROR, "Cannot read ELF header.");
grub_error (GRUB_ERR_READ_ERROR, "cannot read ELF header");
goto fail;
}
@ -134,7 +134,7 @@ grub_elf32_load_phdrs (grub_elf_t elf)
|| (grub_file_read (elf->file, elf->phdrs, phdrs_size) != phdrs_size))
{
grub_error_push ();
return grub_error (GRUB_ERR_READ_ERROR, "Cannot read program headers");
return grub_error (GRUB_ERR_READ_ERROR, "cannot read program headers");
}
return GRUB_ERR_NONE;
@ -200,14 +200,14 @@ grub_elf32_size (grub_elf_t elf)
if (nr_phdrs == 0)
{
grub_error (GRUB_ERR_BAD_OS, "No program headers present");
grub_error (GRUB_ERR_BAD_OS, "no program headers present");
return 0;
}
if (segments_end < segments_start)
{
/* Very bad addresses. */
grub_error (GRUB_ERR_BAD_OS, "Bad program header load addresses");
grub_error (GRUB_ERR_BAD_OS, "bad program header load addresses");
return 0;
}
@ -249,7 +249,7 @@ grub_elf32_load (grub_elf_t _elf, grub_elf32_load_hook_t _load_hook,
{
grub_error_push ();
return grub_error (GRUB_ERR_BAD_OS,
"Invalid offset in program header.");
"invalid offset in program header");
}
if (phdr->p_filesz)
@ -261,8 +261,8 @@ grub_elf32_load (grub_elf_t _elf, grub_elf32_load_hook_t _load_hook,
/* XXX How can we free memory from `load_hook'? */
grub_error_push ();
return grub_error (GRUB_ERR_BAD_OS,
"Couldn't read segment from file: "
"wanted 0x%lx bytes; read 0x%lx bytes.",
"couldn't read segment from file: "
"wanted 0x%lx bytes; read 0x%lx bytes",
phdr->p_filesz, read);
}
}
@ -315,7 +315,7 @@ grub_elf64_load_phdrs (grub_elf_t elf)
|| (grub_file_read (elf->file, elf->phdrs, phdrs_size) != phdrs_size))
{
grub_error_push ();
return grub_error (GRUB_ERR_READ_ERROR, "Cannot read program headers");
return grub_error (GRUB_ERR_READ_ERROR, "cannot read program headers");
}
return GRUB_ERR_NONE;
@ -381,14 +381,14 @@ grub_elf64_size (grub_elf_t elf)
if (nr_phdrs == 0)
{
grub_error (GRUB_ERR_BAD_OS, "No program headers present");
grub_error (GRUB_ERR_BAD_OS, "no program headers present");
return 0;
}
if (segments_end < segments_start)
{
/* Very bad addresses. */
grub_error (GRUB_ERR_BAD_OS, "Bad program header load addresses");
grub_error (GRUB_ERR_BAD_OS, "bad program header load addresses");
return 0;
}
@ -431,7 +431,7 @@ grub_elf64_load (grub_elf_t _elf, grub_elf64_load_hook_t _load_hook,
{
grub_error_push ();
return grub_error (GRUB_ERR_BAD_OS,
"Invalid offset in program header.");
"invalid offset in program header");
}
if (phdr->p_filesz)
@ -443,8 +443,8 @@ grub_elf64_load (grub_elf_t _elf, grub_elf64_load_hook_t _load_hook,
/* XXX How can we free memory from `load_hook'? */
grub_error_push ();
return grub_error (GRUB_ERR_BAD_OS,
"Couldn't read segment from file: "
"wanted 0x%lx bytes; read 0x%lx bytes.",
"couldn't read segment from file: "
"wanted 0x%lx bytes; read 0x%lx bytes",
phdr->p_filesz, read);
}
}

View file

@ -115,7 +115,7 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len)
if (file->offset > file->size)
{
grub_error (GRUB_ERR_OUT_OF_RANGE,
"Attempt to read past the end of file.");
"attempt to read past the end of file");
return -1;
}

View file

@ -66,7 +66,7 @@ multiboot_header:
.long -0x1BADB002 - MULTIBOOT_MEMORY_INFO
codestart:
cmpl $MULTIBOOT_MAGIC2, %eax
cmpl $MULTIBOOT_BOOTLOADER_MAGIC, %eax
jne 0f
movl %ebx, EXT_C(startup_multiboot_info)
0:

View file

@ -764,6 +764,11 @@ FUNCTION(grub_biosdisk_get_diskinfo_int13_extensions)
movw %cx, %ax
movw %bx, %ds
int $0x13 /* do the operation */
jc noclean
/* Clean return value if carry isn't set to workaround
some buggy BIOSes. */
xor %ax, %ax
noclean:
movb %ah, %bl /* save return value in %bl */
/* back to protected mode */
DATA32 call real_to_prot
@ -807,6 +812,11 @@ FUNCTION(grub_biosdisk_get_diskinfo_standard)
.code16
movb $0x8, %ah
int $0x13 /* do the operation */
jc noclean2
/* Clean return value if carry isn't set to workaround
some buggy BIOSes. */
xor %ax, %ax
noclean2:
/* check if successful */
testb %ah, %ah
jnz 1f

View file

@ -164,7 +164,7 @@ static void grub_claim_heap (void)
/* Claim and use it. */
if (grub_claimmap (addr, len) < 0)
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Failed to claim heap at 0x%llx, len 0x%llx\n",
"failed to claim heap at 0x%llx, len 0x%llx",
addr, len);
grub_mm_init_region ((void *) (grub_addr_t) addr, len);
}

View file

@ -44,11 +44,11 @@ grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uin
/* Load `/memory/available'. */
if (grub_ieee1275_finddevice ("/memory", &memory))
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"Couldn't find /memory node");
"couldn't find /memory node");
if (grub_ieee1275_get_integer_property (memory, "available", available,
sizeof available, &available_size))
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"Couldn't examine /memory/available property");
"couldn't examine /memory/available property");
/* Decode each entry and call `hook'. */
i = 0;

View file

@ -308,13 +308,13 @@ grub_ieee1275_parse_args (const char *path, enum grub_ieee1275_parse_type ptype)
file path properly. */
if (grub_ieee1275_finddevice (device, &dev))
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Device %s not found\n", device);
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "device %s not found", device);
goto fail;
}
if (grub_ieee1275_get_property (dev, "device_type", &type, sizeof type, 0))
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"Device %s lacks a device_type property\n", device);
"device %s lacks a device_type property", device);
goto fail;
}

View file

@ -145,13 +145,16 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
*argc = 0;
do
{
if (! *rd)
if (! rd || !*rd)
{
if (getline)
getline (&rd, 1);
else break;
}
if (!rd)
break;
for (; *rd; rd++)
{
grub_parser_state_t newstate;

View file

@ -106,7 +106,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
Elf_Sword delta = value - (Elf_Word) addr;
if (delta << 6 >> 6 != delta)
return grub_error (GRUB_ERR_BAD_MODULE, "Relocation overflow");
return grub_error (GRUB_ERR_BAD_MODULE, "relocation overflow");
*addr = (*addr & 0xfc000003) | (delta & 0x3fffffc);
break;
}
@ -125,7 +125,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
default:
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"This relocation (%d) is not implemented yet",
"this relocation (%d) is not implemented yet",
ELF_R_TYPE (rel->r_info));
}
}

View file

@ -98,7 +98,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
case R_SPARC_32: /* 3 V-word32 */
if (value & 0xFFFFFFFF00000000)
return grub_error (GRUB_ERR_BAD_MODULE,
"Address out of 32 bits range");
"address out of 32 bits range");
*addr = value;
break;
case R_SPARC_WDISP30: /* 7 V-disp30 */
@ -106,7 +106,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
(((value - (Elf_Addr) addr) & 0xFFFFFFFF00000000)
!= 0xFFFFFFFF00000000))
return grub_error (GRUB_ERR_BAD_MODULE,
"Displacement out of 30 bits range");
"displacement out of 30 bits range");
*addr = (*addr & 0xC0000000) |
(((grub_int32_t) ((value - (Elf_Addr) addr) >> 2)) &
0x3FFFFFFF);
@ -114,7 +114,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
case R_SPARC_HI22: /* 9 V-imm22 */
if (((grub_int32_t) value) & 0xFF00000000)
return grub_error (GRUB_ERR_BAD_MODULE,
"High address out of 22 bits range");
"high address out of 22 bits range");
*addr = (*addr & 0xFFC00000) | ((value >> 10) & 0x3FFFFF);
break;
case R_SPARC_LO10: /* 12 T-simm13 */
@ -131,7 +131,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
break;
default:
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"This relocation (%d) is not implemented yet",
"this relocation (%d) is not implemented yet",
ELF_R_TYPE (rel->r_info));
}
}

View file

@ -22,6 +22,7 @@
#include <grub/err.h>
#include <grub/term.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
/* Built-in parser for default options. */
#define SHORT_ARG_HELP -100
@ -30,9 +31,9 @@
static const struct grub_arg_option help_options[] =
{
{"help", SHORT_ARG_HELP, 0,
"Display this help and exit.", 0, ARG_TYPE_NONE},
N_("Display this help and exit."), 0, ARG_TYPE_NONE},
{"usage", SHORT_ARG_USAGE, 0,
"Display the usage of this command and exit.", 0, ARG_TYPE_NONE},
N_("Display the usage of this command and exit."), 0, ARG_TYPE_NONE},
{0, 0, 0, 0, 0, 0}
};
@ -106,7 +107,7 @@ find_long (const struct grub_arg_option *options, const char *s, int len)
static void
show_usage (grub_extcmd_t cmd)
{
grub_printf ("Usage: %s\n", cmd->cmd->summary);
grub_printf ("%s %s %s\n", _("Usage:"), cmd->cmd->name, _(cmd->cmd->summary));
}
void
@ -143,7 +144,7 @@ grub_arg_show_help (grub_extcmd_t cmd)
}
}
const char *doc = opt->doc;
const char *doc = _(opt->doc);
for (;;)
{
while (spacing-- > 0)
@ -176,7 +177,7 @@ grub_arg_show_help (grub_extcmd_t cmd)
}
show_usage (cmd);
grub_printf ("%s\n\n", cmd->cmd->description);
grub_printf ("%s\n\n", _(cmd->cmd->description));
if (cmd->options)
showargs (cmd->options);
showargs (help_options);
@ -274,7 +275,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
if (! opt)
{
grub_error (GRUB_ERR_BAD_ARGUMENT,
"Unknown argument `-%c'\n", *curshort);
"unknown argument `-%c'", *curshort);
goto fail;
}
@ -326,7 +327,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
opt = find_long (cmd->options, arg + 2, arglen);
if (! opt)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown argument `%s'\n", arg);
grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown argument `%s'", arg);
goto fail;
}
}
@ -337,7 +338,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
if (! option)
{
grub_error (GRUB_ERR_BAD_ARGUMENT,
"Missing mandatory option for `%s'\n", opt->longarg);
"missing mandatory option for `%s'", opt->longarg);
goto fail;
}
@ -359,7 +360,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
if (tail == 0 || tail == option || *tail != '\0' || grub_errno)
{
grub_error (GRUB_ERR_BAD_ARGUMENT,
"The argument `%s' requires an integer.",
"the argument `%s' requires an integer",
arg);
goto fail;
@ -382,8 +383,8 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
if (option)
{
grub_error (GRUB_ERR_BAD_ARGUMENT,
"A value was assigned to the argument `%s' while it "
"doesn't require an argument\n", arg);
"a value was assigned to the argument `%s' while it "
"doesn't require an argument", arg);
goto fail;
}

View file

@ -208,7 +208,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(appleloader)
{
cmd = grub_register_command ("appleloader", grub_cmd_appleloader,
"appleloader [OPTS]", "Boot legacy system.");
"[OPTS]", "Boot legacy system.");
my_mod = mod;
}

Some files were not shown because too many files have changed in this diff Show more