Commit graph

1584 commits

Author SHA1 Message Date
Vladimir 'phcoder' Serbinenko
d43a777e45 Support powerpc with GCC that defines __PPC__ but not __powerpc__.
* config.h.in (__powerpc__) [__PPC__ && !__powerpc__]: New definition.
	* grub-core/lib/setjmp.S: Treat __PPC__ as equivalent to __powerpc__.
2012-01-18 14:04:52 +01:00
Vladimir 'phcoder' Serbinenko
3ec0fc1c3b Make XZ compression parameters dependent on target and not host CPU.
* configure.ac: Define GRUB_TARGET_CPU_XYZ series.
	* grub-core/lib/xzembed/xz_config.h: Use GRUB_TARGET_CPU_XYZ.
2012-01-18 13:59:03 +01:00
Vladimir 'phcoder' Serbinenko
22489834b3 * grub-core/kern/powerpc/dl.c (grub_arch_dl_get_tramp_got_size): Remove
set but not used variable.
2012-01-18 13:54:59 +01:00
Vladimir 'phcoder' Serbinenko
8502fbca04 * grub-core/fs/reiserfs.c (grub_reiserfs_uuid): Reject 0-uuid as
created when no uuid support is compiled into mkfs.reiser.
2012-01-14 23:36:21 +01:00
Vladimir 'phcoder' Serbinenko
76df2068c4 * grub-core/fs/hfs.c (macroman_to_utf8): Convert / to :.
(utf8_to_macroman): Do the opposite.
	* grub-core/fs/hfsplus.c (grub_hfsplus_iterate_dir): Convert / to :.
2012-01-14 23:34:33 +01:00
Vladimir 'phcoder' Serbinenko
9c2710789f Eliminate grub_min/grub_max prone to overflow usage.
* grub-core/bus/usb/usbhub.c (grub_usb_add_hub): Eliminate grub_min.
	(poll_nonroot_hub): Likewise.
	* grub-core/fs/affs.c (grub_affs_iterate_dir): Likewise.
	(grub_affs_label): Likewise.
	* grub-core/fs/btrfs.c (grub_btrfs_lzo_decompress): Likewise.
	* grub-core/fs/hfs.c (grub_hfs_dir): Likewise.
	(grub_hfs_label): Likewise.
	* grub-core/fs/hfsplus.c (grub_hfsplus_cmp_catkey): Likewise.
	* grub-core/fs/zfs/zfs.c (MIN): Remove.
	(zap_leaf_array_equal): Use grub_size. Remove MIN.
	(zap_leaf_array_get): Likewise.
	(dnode_get_path): Likewise.
	* grub-core/io/lzopio.c (grub_lzopio_read): Eliminate grub_min.
	* grub-core/io/xzio.c (grub_xzio_read): Likewise.
	* grub-core/script/execute.c (grub_script_break): Likewise.
	* grub-core/script/lexer.c (grub_script_lexer_record): Eliminate
	grub_max.
	* grub-core/script/yylex.l (grub_lexer_yyrealloc): Likewise.
	* include/grub/misc.h (grub_min): Removed.
	(grub_max): Likewise.
2012-01-14 15:44:34 +01:00
Vladimir 'phcoder' Serbinenko
80662dbc5d * grub-core/fs/ext2.c (grub_ext2_iterate_dir): Ignore entries with
direct.inode = 0.
2012-01-14 11:55:20 +01:00
Vladimir 'phcoder' Serbinenko
e6da146746 * grub-core/lib/posix_wrap/wctype.h (CHARCLASS_NAME_MAX): New define. 2012-01-14 11:53:29 +01:00
Vladimir 'phcoder' Serbinenko
b4bf7c3b20 * grub-core/lib/posix_wrap/stdlib.h (MB_CUR_MAX): Moved from here ...
* grub-core/lib/posix_wrap/wchar.h (MB_CUR_MAX): ... here. Value fixed.
2012-01-14 11:48:56 +01:00
Vladimir 'phcoder' Serbinenko
8ee1101a97 * grub-core/fs/fshelp.c (grub_fshelp_find_file): Use grub_strcasecmp
rather than a hack for grub_strncasemap.
2012-01-14 11:46:13 +01:00
Vladimir 'phcoder' Serbinenko
280d9d3e3e * grub-core/disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Skip
disks with unknown size.
	* grub-core/disk/raid.c (scan_devices): Allow disks with unknown sizes.
2012-01-14 11:42:52 +01:00
Vladimir 'phcoder' Serbinenko
4d1e2bc9e3 * grub-core/disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Skip
disks with unknown size.
	* grub-core/disk/raid.c (scan_devices): Allow disks with unknown sizes.
2012-01-14 11:37:34 +01:00
Vladimir 'phcoder' Serbinenko
75b49ebed9 Remove defines pertaining to arbitrary limits not affecting GRUB
anymore.

	* grub-core/fs/ext2.c (EXT2_PATH_MAX): Removed.
	(EXT2_MAX_SYMLINKCNT): Likewise.
	* grub-core/fs/nilfs2.c (NILFS_BTREE_LEVEL_MAX): Likewise.
	* grub-core/net/tftp.c (TFTP_MAX_PACKET): Likewise.
	* include/grub/i386/pc/pxe.h (GRUB_PXE_MIN_BLKSIZE): Likewise.
	(GRUB_PXE_MAX_BLKSIZE): Likewise.
	* include/grub/normal.h (GRUB_MAX_CMDLINE): Likewise.
	* include/grub/zfs/dnode.h (DN_MAX_INDBLKSHIFT): Likewise.
	(DN_MAX_OBJECT_SHIFT): Likewise.
	(DN_MAX_OFFSET_SHIFT): Likewise.
	(DN_MAX_OBJECT): Likewise.
	(DNODES_PER_LEVEL_SHIFT): Likewise.
	* include/grub/zfs/spa.h (SPA_MAXBLOCKSHIFT): Likewise.
	(SPA_MAXBLOCKSIZE): Likewise.
	(SPA_BLOCKSIZES): Likewise.
	* include/grub/zfs/zap_impl.h (MZAP_MAX_BLKSHIFT): Likewise.
	(MZAP_MAX_BLKSZ): Likewise.
2012-01-14 11:30:43 +01:00
Vladimir 'phcoder' Serbinenko
74a1dce71d * grub-core/fs/zfs/zfs.c (grub_zfs_read): Remove useless alloc and
handle NULL appropriately.
	Remove MIN.
2012-01-14 11:23:51 +01:00
Vladimir 'phcoder' Serbinenko
30c7d3ce34 Fix efiemu.
* grub-core/efiemu/runtime/efiemu.c: explicitly include right
	cpu/types.h.
	(efiemu_set_virtual_address_map): Remove UINT_TO_PTR.
	* configure.ac: Fix efiemu check.
2012-01-13 15:12:28 +01:00
Vladimir 'phcoder' Serbinenko
3c76ea0c2c * util/grub.d/30_os-prober.in: Fix occurence of grub-probe instead of
grub_probe.
	Reported by: adamwill
2012-01-13 13:54:24 +01:00
Seth Goldberg
7e532280bd * grub-core/lib/arg.c (grub_arg_parse): Fix NULL pointer dereference. 2012-01-12 22:20:29 +01:00
Vladimir 'phcoder' Serbinenko
3049237440 Fix handling of wide characters in gfxterm.
* grub-core/term/gfxterm.c (grub_colored_char): Remove width and index.
	(clear_char): Likewise.
	(paint_char): Skip code == NULL chars.
	(grub_gfxterm_putchar): Set code = NULL on "shadowed" positions.
2012-01-12 22:16:07 +01:00
Vladimir 'phcoder' Serbinenko
e70cb72f73 * grub-core/normal/charset.c: Move comment to right place. 2012-01-12 22:13:20 +01:00
Vladimir 'phcoder' Serbinenko
5c827cf971 * grub-core/fs/affs.c (grub_affs_bblock): Revert flags.
(GRUB_AFFS_FLAG_FFS): Put back where it was.
	(grub_affs_mount): Revert the correct version checking.
2012-01-11 12:53:38 +01:00
Vladimir 'phcoder' Serbinenko
ff094b9b57 * grub-core/fs/squash4.c (squash_mount): Mark endian conversion in
case statements as compile-time one.
	(direct_read): Prevent spurious warnings.
	(grub_squash_read_data): Likewise.
2012-01-11 12:46:50 +01:00
Vladimir 'phcoder' Serbinenko
c029da8a89 Various squash4 fixes and LZO and XZ support.
* Makefile.util.def (libgrubmods.a): Add xzembed directory to cppflags.
	Add xzembed source files.
	* grub-core/Makefile.core.def (squash4): Add xzembed and minilzo flags.
	* grub-core/fs/squash4.c (grub_squash_super): New field compression.
	(grub_squash_inode): New subtype long_dir.
	(SQUASH_TYPE_LONG_DIR): New inode type.
	(COMPRESSION): New enum.
	(XZBUFSIZ): New const.
	(grub_squash_data): New fields blksz, decompress, xzdec, xzbuf.
	(read_chunk): Use data->decompress.
	(zlib_decompress): New function.
	(lzo_decompress): Likewise.
	(xz_decompress): Likewise.
	(squash_mount): Set new data fields.
	(grub_squash_iterate_dir): Handle long dir.
	(squash_unmount): Free xzdec and xzbuf.
	(grub_squash_open): Check ino type.
	(direct_read): Stylistic fixes. Use data->decompress.
	(grub_squash_read_data): Likewise.
	* grub-core/io/gzio.c (grub_gzio): Remove disk_input.
	(get_byte): Likewise.
	(grub_zlib_disk_read): Removed.
	* grub-core/lib/posix_wrap/sys/types.h (ssize_t): New type.
	(GRUB_POSIX_BOOL_DEFINED): New define.
	* grub-core/lib/posix_wrap/unistd.h: Include sys/types.h.
	* grub-core/lib/xzembed/xz.h: Addmissing includes.
	[!GRUB_POSIX_BOOL_DEFINED]: Define bool.
	* include/grub/deflate.h (grub_zlib_disk_read): Removed.
2011-12-26 13:18:01 +01:00
Vladimir 'phcoder' Serbinenko
7a45a539db Don't override more informative errors.
* grub-core/commands/acpi.c (grub_cmd_acpi): Don't override errors.
	* grub-core/font/font.c (open_section): Likewise.
	* grub-core/loader/i386/bsd.c (grub_bsd_load_aout): New argument
	filename. Don't override errors.
	(grub_cmd_openbsd_ramdisk): Don't override errors.
	* grub-core/loader/i386/linux.c (grub_cmd_linux): Likewise.
	(grub_cmd_initrd): Likewise.
	* grub-core/loader/i386/pc/linux.c (grub_cmd_linux): Likewise.
	(grub_cmd_initrd): Likewise.
	* grub-core/loader/ia64/efi/linux.c (grub_load_elf64): Likewise.
	(grub_cmd_linux): Likewise.
	(grub_cmd_initrd): Likewise.
	(grub_cmd_payload): Likewise.
	* grub-core/loader/mips/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/multiboot.c (grub_cmd_multiboot): Likewise.
	(grub_cmd_module): Likewise.
	* grub-core/loader/powerpc/ieee1275/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/sparc64/ieee1275/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/xnu.c (grub_xnu_load_driver): Likewise.
	(grub_cmd_xnu_mkext): Likewise.
	(grub_cmd_xnu_ramdisk): Likewise.
	(grub_xnu_check_os_bundle_required): Likewise.
	(grub_xnu_load_kext_from_dir): Likewise.
	(grub_cmd_xnu_kextdir): Likewise.
	* grub-core/loader/xnu_resume.c (grub_xnu_resume): Likewise.
2011-12-26 12:58:08 +01:00
Vladimir 'phcoder' Serbinenko
b2d004db18 * grub-core/fs/minix.c (grub_minix_mount) [MODE_MINIX3]: Treat 0xffff
as 1024 in block size field. Found on one of my test images.
	Small optimisation while on it.
2011-12-25 22:44:42 +01:00
Vladimir 'phcoder' Serbinenko
ec000eaca9 * docs/grub.texi (Filesystems): Mention SFS as Latin1 filesystem.
* grub-core/fs/sfs.c (grub_sfs_mount): Fix a memory leak while on it.
	(grub_sfs_iterate_dir): Convert Latin1 to UTF8. Stylistic and
	performance fixes while on it.
	(grub_sfs_close): Fix memory leak while on it.
	(grub_sfs_label): Convert Latin1 to UTF-8.
2011-12-25 22:39:56 +01:00
Vladimir 'phcoder' Serbinenko
f50e11653e * grub-core/fs/hfs.c (grub_hfs_dir): Cap keylen to actually available
space to avoid overflows.
	(grub_hfs_label): Convert from macroman to UTF-8.
2011-12-25 22:23:05 +01:00
Vladimir 'phcoder' Serbinenko
2ae254de13 * grub-core/fs/affs.c (grub_affs_label): Interpret label as latin1. 2011-12-25 22:07:15 +01:00
Vladimir 'phcoder' Serbinenko
0108f49101 * grub-core/normal/menu.c (menu_init): Don't stop menu init at gfxterm. 2011-12-25 17:41:55 +01:00
Vladimir 'phcoder' Serbinenko
63fa8ef94e * grub-core/term/gfxterm.c (grub_gfxterm_putchar): Don't set values
outside of range.
2011-12-25 16:15:01 +01:00
Vladimir 'phcoder' Serbinenko
4d8c476536 Avoid cutting in the middle of UTF-8 string.
* include/grub/charset.h (grub_getend): New function.
	* grub-core/script/function.c (grub_script_function_find): Use
	grub_getend.
	* grub-core/normal/completion.c (add_completion): Likewise.
2011-12-25 16:11:41 +01:00
Vladimir 'phcoder' Serbinenko
f3cb4a4e57 * grub-core/normal/charset.c (grub_ucs4_to_utf8): Small stylistic fix.
(grub_bidi_line_logical_to_visual): Skip tags. They are deprecated.
	* include/grub/unicode.h (GRUB_UNICODE_TAG_START): New enum value.
	(GRUB_UNICODE_TAG_END): Likewise.
	(GRUB_UNICODE_LAST_VALID): Likewise.
2011-12-25 16:07:33 +01:00
Vladimir 'phcoder' Serbinenko
5da8dbc5bc * include/grub/unicode.h (grub_unicode_compact_range): Replace end with
len and make it smaller. All users updated.
	* util/import_unicode.py: Put length and not end character.
	Check length.
2011-12-25 16:03:42 +01:00
Vladimir 'phcoder' Serbinenko
8569f13d8d Make better Unicode-compliant and unify some UTF-8 code pathes.
* grub-core/normal/charset.c (grub_utf8_to_utf16): Don't eat possibly
	valid character.
	(grub_is_valid_utf8): Use grub_utf8_process.
	Check resulting code range.
	(grub_utf8_to_ucs4): Use grub_utf8_process.
	* include/grub/charset.h (grub_utf16_to_utf8): Don't eat up a possibly
	valid character.
2011-12-25 15:57:50 +01:00
Vladimir 'phcoder' Serbinenko
cc4fddf5f5 * grub-core/io/bufio.c (grub_bufio_read): Fix handling of corner cases. 2011-12-25 15:43:15 +01:00
Vladimir 'phcoder' Serbinenko
74bbf0dbae Make HFS implementation use MacRoman.
* grub-core/fs/hfs.c (MAX_UTF8_PER_MAC_ROMAN): New define.
	(macroman): New const array.
	(macroman_to_utf8): New function.
	(utf8_to_macroman): Likewise.
	(grub_hfs_find_dir): Use utf8_to_macroman.
	(grub_hfs_dir): Use macroman_to_utf8.
	Set case_insensitive.
2011-12-24 20:20:41 +01:00
Vladimir 'phcoder' Serbinenko
d3c13cbd62 Integrate hints into autogeneration scripts.
* docs/grub.texi (Filesystems): Add a hostdisk example.
	* Makefile.util.def (grub-mkdevicemap): Remove ofpath.
	(grub-probe): Add ofpath.
	* gentpl.py: Remove group nosparc64.
	* grub-core/commands/search.c (cache_entry): New struct.
	(cache): New var.
	(FUNC_NAME): Use and save cache. Fix handling of trailing comma.
	* grub-core/commands/search_wrap.c (options): Add platform-specific
	hint options.
	(grub_cmd_search): Handle platform-specific hints.
	(GRUB_MOD_INIT): Declare grub_cmd_search as accept_dash.
	* grub-core/kern/emu/hostdisk.c (map): New field device_map.
	(grub_util_biosdisk_data): Likewise.
	(grub_util_biosdisk_open): Set device_map.
	(read_device_map): Handle "" as indication of no map.
	Set device_map.
	(find_system_device): Add hostdisk/ prefix for autogenerated entries.
	(grub_util_biosdisk_get_compatibility_hint): New function.
	* grub-core/normal/main.c (features): Add feature_platform_search_hint.
	* include/grub/emu/hostdisk.h
	(grub_util_biosdisk_get_compatibility_hint): New proto.
	* util/grub-install.in: Don't call grub-mkdevicemap.
	Add platform-specific hint to load.cfg.
	* util/grub-mkconfig.in: Don't call grub-mkdevicemap.
	* util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Add
	hints. Set root preliminary to compatibility hint, not to OS name.
	* util/grub-probe.c (PRINT_*): Add hints.
	(print): Make static.
	(escape_of_path): New function.
	(guess_bios_drive): Likewise.
	(guess_efi_drive): Likewise.
	(guess_baremetal_drive): Likewise.
	(print_full_name): Likewise.
	(probe): Handle hints.
	(main): Likewise.
	* util/ieee1275/devicemap.c: Removed.
	* util/ieee1275/ofpath.c (find_obppath): Allow to fail. All users
	updated.
	(grub_util_devname_to_ofpath): Return NULL on failure.

	* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev): Fix
	resource leak.
	* util/getroot.c (grub_util_pull_device): Fix memory leak.

	* po/POTFILES.in: Regenerated.

	Allow purely long options

	* grub-core/lib/arg.c (SHORT_ARG_HELP): Removed.
	(SHORT_ARG_USAGE): Likewise.
	(grub_arg_show_help): Compare opt with help_options.
	(parse_option): Receive opt as argument. If makes big simplificatons.
	All users updated
2011-12-24 15:09:26 +01:00
Vladimir 'phcoder' Serbinenko
00ce2df3d4 * grub-core/lib/libgcrypt_wrap/cipher_wrap.h (WORDS_BIGENDIAN):
Restructure to avoid warning.
2011-12-24 13:12:01 +01:00
Vladimir 'phcoder' Serbinenko
2b5c1a0810 merge mainline into hints 2011-12-24 02:52:43 +01:00
Vladimir 'phcoder' Serbinenko
ce4a999d4d * grub-core/kern/ieee1275/openfw.c (grub_devalias_iterate): Fix
allocation and zero-setting.
	(grub_ieee1275_get_devname): Check that alias is complete.
2011-12-24 02:45:17 +01:00
Vladimir 'phcoder' Serbinenko
379586ad7d * grub-core/kern/disk.c (grub_disk_read): Fix hook calling for
unaligned segments.
2011-12-24 02:43:21 +01:00
Vladimir 'phcoder' Serbinenko
9197b0ade5 * grub-core/disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Add ieee1275/
prefix.
	(grub_ofdisk_open): Check and discard ieee1275 prefix.
	* grub-core/kern/ieee1275/openfw.c (grub_ieee1275_encode_devname):
	Add ieee1275 prefix.
2011-12-24 02:40:18 +01:00
Vladimir 'phcoder' Serbinenko
f4d5a8ce56 search cache 2011-12-23 21:14:34 +01:00
Vladimir 'phcoder' Serbinenko
706c46bdca Fix *end restoring 2011-12-23 21:14:24 +01:00
Vladimir 'phcoder' Serbinenko
aa68ca1250 simplify lib/arg.c and allow purely long options 2011-12-23 21:13:09 +01:00
Vladimir 'phcoder' Serbinenko
2980502850 Fix few bugs and memory leaks 2011-12-23 19:25:24 +01:00
Vladimir 'phcoder' Serbinenko
17785932df merge mainline into hints 2011-12-23 18:49:00 +01:00
Vladimir 'phcoder' Serbinenko
ca74c50c0b merge mainline into hints 2011-12-23 18:46:06 +01:00
Vladimir 'phcoder' Serbinenko
6babad5e59 Initial integration of hints 2011-12-23 18:19:16 +01:00
Vladimir 'phcoder' Serbinenko
a1a8b1b90a Support odc, newc and bigendian cpio formats.
* Makefile.util.def (libgrubmods): Add odc.c, newc.c and cpio_be.c.
	* grub-core/Makefile.core.def (newc): New module.
	(odc): Likewise.
	(cpio_be): Likewise.
	* grub-core/fs/cpio.c (ALIGN_CPIO): New macro.
	(MAGIC): Likewise.
	(MAGIC2): Likewise.
	(head) [MODE_ODC]: Adapt for the format.
	(head) [MODE_NEWC]: Likewise.
	(head) [!MODE_*]: Write fields of interest as arrays.
	(MAGIC_USTAR): Removed.
	(read_number) [MODE_NEWC]: Change to hex.
	(read_number) [!MODE_*]: Parse binary arrays.
	(grub_cpio_find_file): Factor out the code for better structure and
	always use read_number.
	(grub_cpio_mount): Use MAGIC and MAGIC2.
	(grub_cpio_dir): Exit on first hook non-0 return.
	(grub_cpio_fs) [MODE_ODC]: Set name to odc.
	(grub_cpio_fs) [MODE_NEWC]: Set name to newc.
	(GRUB_MOD_INIT) [MODE_ODC]: Set name to odc.
	(GRUB_MOD_INIT) [MODE_NEWC]: Set name to newc.
	(GRUB_MOD_FINI) [MODE_ODC]: Set name to odc.
	(GRUB_MOD_FINI) [MODE_NEWC]: Set name to newc.
	* grub-core/fs/newc.c: New file.
	* grub-core/fs/odc.c: Likewise.
	* grub-core/fs/cpio_be.c: Likewise.
2011-12-23 16:15:18 +01:00
Vladimir 'phcoder' Serbinenko
58eba9eec7 Fix handling of tar numbers occupying the whole field.
* grub-core/fs/cpio.c (read_number): New function.
	(grub_cpio_find_file): Use read_number instead of strtoull.
2011-12-23 14:11:31 +01:00
Vladimir 'phcoder' Serbinenko
a54a0e1270 * grub-core/fs/cpio.c (grub_cpio_find_file): Fix handling of names
occupying the whole field size.
2011-12-23 13:38:21 +01:00
Vladimir 'phcoder' Serbinenko
a93964ce11 * grub-core/net/net.c (grub_cmd_delroute): Add missing out condition. 2011-12-23 11:54:08 +01:00
Seth Goldberg
3ea1ca46c1 * grub-core/Makefile.core.def (lzma_decompress): Add missing
TARGET_IMG_LDFLAGS.
2011-12-23 11:39:30 +01:00
Vladimir 'phcoder' Serbinenko
31355584f1 * grub-core/lib/reed_solomon.c (grub_reed_solomon_add_redundancy): Add
an assert.
	* util/grub-setup.c (setup): Likewise.
2011-12-23 10:23:41 +01:00
Vladimir 'phcoder' Serbinenko
1f0b1a7730 * grub-core/boot/i386/pc/startup_raw.S: Add missing argument for
_LzmaDecodeA.
2011-12-23 10:21:27 +01:00
Vladimir 'phcoder' Serbinenko
198e150aaf IPv6, TCP, HTTP, ICMP and DNS support. Several cleanups and bugfixes.
* grub-core/Makefile.core.def (net): Add net/dns.c, net/tcp.c,
	net/icmp.c and net/icmp6.c.
	(http): New module.
	(priority_queue): Likewise.
	* grub-core/io/bufio.c: Rewritten.
	* grub-core/lib/legacy_parse.c (legacy_command): New argument type
	TYPE_WITH_CONFIGFILE_OPTION.
	(legacy_commands): Add bootp and dhcp.
	(is_option): Handle TYPE_WITH_CONFIGFILE_OPTION.
	(grub_legacy_parse): Likewise.
	* grub-core/lib/priority_queue.c: New file.
	* grub-core/net/arp.c: Add missing license header.
	(arp_find_entry): Removed.
	(arp_find_entry): Likewise.
	(grub_net_arp_resolve): Rename to ...
	(grub_net_arp_send_request): ...this.
	(grub_net_arp_receive): New card argument.
	* grub-core/net/bootp.c (parse_dhcp_vendor): Clean up.
	Set router and DNS server.
	(grub_net_configure_by_dhcp_ack): Handle routing information.
	(grub_cmd_bootp): Set checksum.
	(grub_bootp_init): Remove net_dhcp.
	* grub-core/net/dns.c: New file.
	* grub-core/net/drivers/efi/efinet.c (send_card_buffer): Wait for
	completion.
	(get_card_packet): Handle allocation.
	(grub_efinet_findcards): Set mtu.
	* grub-core/net/drivers/emu/emunet.c: Add missing license header.
	(get_card_packet): Handle allocation.
	(emucard): Set mtu.
	* grub-core/net/drivers/i386/pc/pxe.c (grub_pxe_recv): Handle allocation
	(GRUB_MOD_INIT): Set mtu.
	* grub-core/net/drivers/ieee1275/ofnet.c (grub_ofnetcard_data): Remove
	mtu.
	(get_card_packet): Handle allocation.
	(grub_ofnet_findcards): Set mtu.
	* grub-core/net/ethernet.c (send_ethernet_packet): Add compile time
	assert.
	(grub_net_recv_ethernet_packet): Handle IPv6.
	* grub-core/net/http.c: New file.
	* grub-core/net/icmp.c: Likewise.
	* grub-core/net/icmp6.c: Likewise.
	* grub-core/net/ip.c (ip6addr): New type.
	(ip6hdr): Likewise.
	(reassemble): Likewise.
	(cmp): New function.
	(reassembles): New variable.
	(grub_net_ip_chksum): Handle 0xffff sum and unaligned buffers.
	(id): New variable.
	(send_fragmented): New function.
	(grub_net_send_ip_packet): Rename to ...
	(grub_net_send_ip4_packet): ... this. Send fragmented if needed.
	Handle non-UDP.
	(grub_net_recv_ip_packets): Rename to ...
	(handle_dgram): ... this. Check checksum. Handle non-UDP.
	(free_rsm): New function.
	(free_old_fragments): Likewise.
	(grub_net_recv_ip4_packets): New function.
	(grub_net_send_ip6_packet): Likewise.
	(grub_net_send_ip_packet): Likewise.
	(grub_net_recv_ip6_packets): Likewise.
	(grub_net_recv_ip_packets): Likewise.
	* grub-core/net/net.c (grub_net_link_layer_entry): New struct.
	(LINK_LAYER_CACHE_SIZE): New const.
	(link_layer_find_entry): New function.
	(grub_net_link_layer_add_address): Likewise.
	(grub_net_link_layer_resolve_check): Likewise.
	(grub_net_link_layer_resolve): Likewise.
	(grub_net_ipv6_get_slaac): Likewise.
	(grub_net_ipv6_get_link_local): Likewise.
	(grub_cmd_ipv6_autoconf): Likewise.
	(parse_ip): Handle one number representation.
	(parse_ip6): New functoion.
	(match_net): Handle IPv6.
	(grub_net_resolve_address): Handle IPv6 and DNS.
	(grub_net_resolve_net_address): Handle IPv6.
	(route_cmp): New function.
	(grub_net_route_address): Find best route.
	(grub_net_addr_to_str): Handle IPv6.
	(grub_net_addr_cmp): New function.
	(grub_net_add_addr): Register local route.
	(print_net_address): Handle net address.
	(grub_net_poll_cards): Retransmit TCP.
	(grub_net_poll_cards_idle_real): Likewise.
	(have_ahead): New function.
	(grub_net_seek_real): Use underlying seek.
	(GRUB_MOD_INIT): Register net_ipv6_autoconf and init dns.
	* grub-core/net/tcp.c: New file.
	* grub-core/net/tftp.c (tftp_data): Add priority_queue.
	(cmp): New function.
	(ack): Likewise.
	(tftp_receive): Handle unordered input.
	(destroy_pq): New function.
	(tftp_close): Close pq.
	* grub-core/net/udp.c: Put missing license header.
	(grub_net_udp_socket): New function.
	(udp_socket_register): Likewise.
	(grub_net_udp_close): Likewise.
	(grub_net_recv_udp_packet): Check checksum.
	* include/grub/efi/api.h (grub_efi_simple_network): Add status.
	* include/grub/misc.h (grub_memchr): New function.
	* include/grub/net.h (GRUB_NET_*_SIZE): New enum.
	(grub_net_card_driver): Return buf in recv.
	(grub_net_slaac_mac_list): New struct.
	(grub_network_level_protocol_id): Add ipv6.
	(grub_net_network_level_addr): Likewise.
	(grub_net_network_level_net_addr): Likewise.
	(grub_net_app_protocol): Add seek.
	(grub_net_socket): Removed.
	(grub_net_sockets): Likewise.
	(grub_net_socket_register): Likewise.
	(grub_net_socket_unregister): Likewise.
	(FOR_NET_SOCKETS): Likewise.
	(grub_net_add_addr): Add const.
	(GRUB_NET_BOOTP_*): New enum.
	(grub_net_addr_cmp): New proto.
	(GRUB_NET_MAX_STR_ADDR_LEN): Take IPV6 into account.
	(GRUB_NET_MAX_STR_HWADDR_LEN): New define.
	(grub_net_hwaddr_to_str): NEw proto.
	(FOR_NET_NETWORK_LEVEL_INTERFACES): New macro.
	(FOR_NET_NETWORK_LEVEL_INTERFACES_SAFE): Handle NULL.
	(grub_dns_init): New proto.
	(grub_dns_fini): Likewise.
	(grub_net_tcp_retransmit): Likewise.
	(grub_net_link_layer_add_address): Likewise.
	(grub_net_link_layer_resolve_check): Likewise.
	(grub_net_link_layer_resolve): Likewise.
	(grub_net_dns_lookup): Likewise.
	(grub_net_add_dns_server): Likewise.
	(grub_net_remove_dns_server): Likewise.
	(GRUB_NET_TRIES): New const.
	(GRUB_NET_INTERVAL): Likewise.
	* include/grub/net/arp.h: Mostly rewritten.
	* include/grub/net/ethernet.h (grub_net_ethertype_t): New enum.
	* include/grub/net/ip.h: Mostly rewritten.
	* include/grub/net/netbuff.h: Indent.
	* include/grub/net/tcp.h: New file.
	* include/grub/net/udp.h: Mostly rewritten.
	* include/grub/priority_queue.h: New file.
	* include/grub/types.h (PRIdGRUB_SSIZE): New define.
	(grub_swap_bytes64_compile_time): Likewise.
	(grub_cpu_to_be16_compile_time): Likewise.
	(grub_cpu_to_be32_compile_time): Likewise.
	(grub_cpu_to_be64_compile_time): Likewise.
	(grub_be_to_cpu64_compile_time): Likewise.
2011-12-20 18:17:07 +01:00
Vladimir 'phcoder' Serbinenko
ec08f14936 merge mainline into net 2011-12-16 18:00:16 +01:00
Vladimir 'phcoder' Serbinenko
215c18008e * grub-core/commands/i386/pc/drivemap.c (int13slot): Replace
UINT_TO_PTR with cast.
2011-12-16 17:46:28 +01:00
Vladimir 'phcoder' Serbinenko
aa7d205236 Retrieve DNS names from DHCP/BOOTP 2011-12-16 17:37:47 +01:00
Vladimir 'phcoder' Serbinenko
f0f4253cd2 Integrate DNS with address parsing 2011-12-16 17:12:01 +01:00
Vladimir 'phcoder' Serbinenko
8d4e4fc0e5 DNS cache support 2011-12-16 15:08:46 +01:00
Vladimir 'phcoder' Serbinenko
3729fcfc1a support cname 2011-12-16 13:43:31 +01:00
Vladimir 'phcoder' Serbinenko
34feab6f21 Remerge net branch 2011-12-15 20:53:29 +01:00
Vladimir 'phcoder' Serbinenko
bd67ad0f70 merge mainline into net 2011-12-15 20:51:35 +01:00
Vladimir 'phcoder' Serbinenko
078d2b2e68 Add forgotten file 2011-12-15 20:50:21 +01:00
Vladimir 'phcoder' Serbinenko
e5f4d2607a * grub-core/lib/libgcrypt/cipher/md4.c (transform) [WORDS_BIGENDIAN]:
Add missing const attribute.
	* grub-core/lib/libgcrypt/cipher/md5.c (transform) [WORDS_BIGENDIAN]:
	Likewise.
	* grub-core/lib/libgcrypt/cipher/rmd160.c (transform) [WORDS_BIGENDIAN]:
	Likewise.
2011-12-15 20:26:17 +01:00
Vladimir 'phcoder' Serbinenko
8e54b4b76a * grub-core/lib/libgcrypt/cipher/serpent.c (serpent_key_prepare): Fix
misaligned access.
	(serpent_setkey): Likewise.
	(serpent_encrypt_internal): Likewise.
	(serpent_decrypt_internal): Likewise.
	(serpent_encrypt): Don't put an alignment-increasing cast.
	(serpent_decrypt): Likewise.
	(serpent_test): Likewise.
2011-12-15 20:20:02 +01:00
Vladimir 'phcoder' Serbinenko
813c0a2be8 * grub-core/loader/multiboot.c (grub_cmd_module): Fix target address. 2011-12-15 20:05:27 +01:00
Vladimir 'phcoder' Serbinenko
3a38c67235 forgotten file for previous commit 2011-12-15 20:04:21 +01:00
Vladimir 'phcoder' Serbinenko
f2b60fbdb8 Replace UINT_TO_PTR and PTR_TO_UINT with explicit grub_addr_t casts.
* include/grub/types.h (UINT_TO_PTR): Removed. All users switched to
	grub_addr_t casts.
	(PTR_TO_UINT64): Likewise.
	(PTR_TO_UINT32): Likewise.
2011-12-15 19:59:49 +01:00
Vladimir 'phcoder' Serbinenko
c476e6df16 * grub-core/gfxmenu/gui_label.c (label_paint): Handle the case
text_width > available width a bit more gracefully.
2011-12-15 19:35:54 +01:00
Vladimir 'phcoder' Serbinenko
384ad7cc1b * grub-core/loader/i386/bsdXX.c (grub_freebsd_load_elfmodule): Fix
current address calculation.
2011-12-15 19:32:41 +01:00
Vladimir 'phcoder' Serbinenko
96f8caf812 * grub-core/lib/reed_solomon.c (decode_block): Allocate on heap and not
stack.
	(encode_block): Likewise.
2011-12-15 19:27:01 +01:00
Vladimir 'phcoder' Serbinenko
276b7a8bdd * grub-core/boot/i386/pc/startup_raw.S: Clear direction flag for
certainety.
2011-12-15 19:22:36 +01:00
Vladimir 'phcoder' Serbinenko
e3fd394a10 * grub-core/boot/i386/pc/startup_raw.S: Move realmode routines to
non-RS part to avoid RS messing with GDT.
	* include/grub/offsets.h (GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART):
	Increase to suit in realmode routines.
2011-12-15 19:20:41 +01:00
Vladimir 'phcoder' Serbinenko
b81d609e4c * grub-core/kern/i386/realmode.S: Increase alignment.
* grub-core/boot/i386/pc/startup_raw.S: Likewise.
2011-12-15 19:17:36 +01:00
Vladimir 'phcoder' Serbinenko
ee9c2e7a97 * grub-core/lib/reed_solomon.c (init_powx): Set gf_powx_inv[0] just to
be deterministic.
	(syndroms): Compute 0 syndrom.
	(rs_recover): Use 0 syndrom.
2011-12-15 02:20:21 +01:00
Vladimir 'phcoder' Serbinenko
ca1b552c02 * grub-core/gfxmenu/widget-box.c (get_left_pad): Take corners into
account.
	(get_top_pad): Likewise.
	(get_right_pad): Likewise.
	(get_bottom_pad): Likewise.
2011-12-14 14:20:57 +01:00
Vladimir 'phcoder' Serbinenko
9f59e9fc36 * grub-core/gfxmenu/gui_list.c (draw_menu): Don't use set in if. 2011-12-14 12:05:26 +01:00
Vladimir 'phcoder' Serbinenko
cb8f88ea82 * include/grub/charset.h (grub_utf16_to_utf8): Make src a const pointer.
(grub_ucs4_to_utf8_alloc): Likewise.
	(grub_ucs4_to_utf8): Likewise.
	* grub-core/normal/charset.c (grub_ucs4_to_utf8): Likewise.
	(grub_ucs4_to_utf8_alloc): Likewise.
2011-12-14 10:01:24 +01:00
Vladimir 'phcoder' Serbinenko
309e535231 AFFS never uses unicode.
* include/grub/charset.h (GRUB_MAX_UTF8_PER_LATIN1): New const.
	(grub_latin1_to_utf8): New inline function.
	* grub-core/fs/affs.c (grub_affs_iterate_dir): Convert latin1 to UTF8.
2011-12-14 09:52:00 +01:00
Vladimir 'phcoder' Serbinenko
e7987e1b3b * grub-core/fs/romfs.c (grub_romfs_mount): Fix pointer comparison
overflow.
2011-12-13 23:15:56 +01:00
Vladimir 'phcoder' Serbinenko
efc2616ee1 * grub-core/fs/squash4.c (grub_squash_inode): Fix field sizes.
(grub_squash_dirent_header): Likewise.
	(read_chunk): Don't double swap.
	(grub_squash_iterate_dir): Fix swap sizes.
2011-12-13 23:14:25 +01:00
Vladimir 'phcoder' Serbinenko
3c349f5a37 * grub-core/fs/jfs.c (grub_jfs_getent): Handle UTF16 endianness. 2011-12-13 23:11:48 +01:00
Vladimir 'phcoder' Serbinenko
b453412d2f * grub-core/fs/hfs.c (grub_hfs_find_node): Handle unaligned keys.
(grub_hfs_iterate_dir): Likewise.
2011-12-13 23:10:38 +01:00
Vladimir 'phcoder' Serbinenko
12e9d4d152 Fix video on platforms where unaligned access is forbidden.
Make several optimisations while on it.

	* grub-core/video/fb/fbblit.c (grub_video_fbblit_replace_directN):
	Optimise and use GRUB_VIDEO_FB_ADVANCE_POINTER.
	(grub_video_fbblit_replace_32bit_1bit): Likewise.
	(grub_video_fbblit_replace_24bit_1bit) [!GRUB_HAVE_UNALIGNED_ACCESS]:
	Disable.
	(grub_video_fbblit_replace_16bit_1bit):
	Optimise and use GRUB_VIDEO_FB_ADVANCE_POINTER.
	(grub_video_fbblit_replace_8bit_1bit): Likewise.
	(grub_video_fbblit_replace_BGRX8888_RGBX8888): Likewise.
	(grub_video_fbblit_replace_BGRX8888_RGB888): Likewise.
	(grub_video_fbblit_replace_BGR888_RGBX8888): Likewise.
	(grub_video_fbblit_replace_BGR888_RGBX8888): Likewise.
	(grub_video_fbblit_replace_BGR888_RGB888): Likewise.
	(grub_video_fbblit_replace_RGBX8888_RGB88): Likewise.
	(grub_video_fbblit_replace_RGB888_RGBX888): Likewise.
	(grub_video_fbblit_replace_RGB888_RGBX8888): Likewise.
	(grub_video_fbblit_replace_index_RGBX8888): Likewise.
	(grub_video_fbblit_replace_index_RGB888): Likewise.
	(grub_video_fbblit_blend_BGRA8888_RGBA8888): Likewise.
	(grub_video_fbblit_blend_BGR888_RGBA8888): Likewise.
	(grub_video_fbblit_blend_RGBA8888_RGBA8888): Likewise.
	(grub_video_fbblit_blend_RGB888_RGBA8888): Likewise.
	(grub_video_fbblit_blend_index_RGBA8888): Likewise.
	(grub_video_fbblit_blend_XXXA8888_1bit): Likewise.
	(grub_video_fbblit_blend_XXX888_1bit) [!GRUB_HAVE_UNALIGNED_ACCESS]:
	Disable.
	(grub_video_fbblit_blend_XXX565_1bit):
	Optimise and use GRUB_VIDEO_FB_ADVANCE_POINTER.
	* grub-core/video/fb/fbfill.c (grub_video_fbfill_direct32): Likewise.
	* grub-core/video/fb/fbutil.c (grub_video_fb_get_video_ptr): Return
	void *.
	* grub-core/video/fb/video_fb.c (common_blitter)
	[!GRUB_HAVE_UNALIGNED_ACCESS]: Skip disabled blitters.
	(grub_video_fb_create_render_target_from_pointer)
	[!GRUB_HAVE_UNALIGNED_ACCESS]: Check alignment.
	* include/grub/fbutil.h (grub_video_fb_get_video_ptr): Return void *.
	* include/grub/i386/types.h (GRUB_HAVE_UNALIGNED_ACCESS): New
	definition.
	* include/grub/x86_64/types.h (GRUB_HAVE_UNALIGNED_ACCESS): Likewise.
2011-12-13 20:07:33 +01:00
Vladimir 'phcoder' Serbinenko
ace96609b6 * grub-core/kern/sparc64/dl.c (grub_arch_dl_relocate_symbols): Support
HH22 and HM10 relocations.
2011-12-13 19:56:50 +01:00
Vladimir 'phcoder' Serbinenko
fd261d7300 * grub-core/kern/misc.c (grub_vsnprintf_real): Fix fmt2 parsing. 2011-12-13 19:55:27 +01:00
Vladimir 'phcoder' Serbinenko
e59b7857f8 * grub-core/commands/videotest.c (grub_cmd_videotest): Check that
allocation succeeded.
2011-12-13 19:53:57 +01:00
Vladimir 'phcoder' Serbinenko
9b4baaa4ee * grub-core/fs/iso9660.c (grub_iso9660_convert_string): Make first
argument a u8 pointer. All users updated.
	Handle unaligned buffers.
2011-12-13 16:35:12 +01:00
Vladimir 'phcoder' Serbinenko
dc71319397 * grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Force inlining of
add_part to workaround compiler bug.
2011-12-13 16:33:27 +01:00
Vladimir 'phcoder' Serbinenko
0c6087a8c9 * grub-core/loader/multiboot_mbi2.c (grub_multiboot_add_elfsyms):
Reserve alignment invariants.
	(grub_multiboot_load): Likewise.
	(retrieve_video_parameters): Likewise.
	(grub_multiboot_make_mbi): Likewise.
2011-12-13 16:22:44 +01:00
Vladimir 'phcoder' Serbinenko
c2e777777b * grub-core/loader/i386/xnu.c (grub_xnu_devprop_remove_property): Fix
incorrect pointer.
2011-12-13 16:20:25 +01:00
Vladimir 'phcoder' Serbinenko
b70b6d1107 * grub-core/disk/pata.c (grub_pata_pio_read): Handle unaligned buffer.
(grub_pata_pio_write): Likewise.
2011-12-13 15:55:36 +01:00
Vladimir 'phcoder' Serbinenko
02a2bf8384 Add noreturn attributes and remove unreachable code.
* grub-core/bus/cs5536.c (grub_cs5536_smbus_wait): Remove unreachable
	code.
	* grub-core/commands/halt.c (grub_cmd_halt): Remove unreachable
	code. Mark as noreturn.
	* grub-core/commands/minicmd.c (grub_mini_cmd_exit): Likewise.
	* grub-core/commands/reboot.c (grub_cmd_reboot): Likewise.
	* grub-core/disk/efi/efidisk.c (grub_efidisk_get_device_name): Remove
	unreachable code.
	* grub-core/kern/main.c (grub_main): Mark as noreturn.
	* grub-core/kern/rescue_reader.c (grub_rescue_run): Likewise.
	* grub-core/lib/posix_wrap/stdlib.h (abort): Likewise.
	* grub-core/normal/menu.c (run_menu): Remove unreachable code.
	* include/grub/kernel.h (grub_main): Mark as noreturn.
	* include/grub/reader.h (grub_rescue_run): Likewise.
2011-12-13 15:13:51 +01:00
Vladimir 'phcoder' Serbinenko
6166442083 * grub-core/commands/hdparm.c (le16_to_char): Make src and dest uint16 *
to ensure alignment.
	(grub_hdparm_print_identify): Make argument uint16 * to ensure
	alignment. Ensure tmp alignment.
	(grub_cmd_hdparm): Ensure buf alignment.
	* grub-core/disk/ata.c (grub_ata_strncpy): Make src and dest uint16 *
	to ensure alignment.
	(grub_ata_dumpinfo): Ensure text alignment.
	(grub_atapi_identify): Preserve alignment invariant.
	(grub_ata_identify): Likewise. Use grub_get_unaligned32 when necessary.
2011-12-13 14:57:46 +01:00
Vladimir 'phcoder' Serbinenko
85c85365bb * grub-core/partmap/dvh.c (grub_dvh_is_valid): Make argument
uint32_t * to ensure alignment.
	(dvh_partition_map_iterate): Make `block' a union to ensure alignment.
2011-12-13 14:44:38 +01:00
Vladimir 'phcoder' Serbinenko
93018f6400 * grub-core/partmap/sunpc.c (grub_sun_is_valid): Make argument
uint16_t * to ensure alignment.
	(sun_pc_partition_map_iterate): Make `block' a union to ensure
	alignment.
2011-12-13 14:42:41 +01:00
Vladimir 'phcoder' Serbinenko
a23f2cc4d6 * grub-core/partmap/sun.c (grub_sun_is_valid): make argument uint16_t *
to ensure alignment.
	(sun_partition_map_iterate): Make `block' a union to ensure alignment.
2011-12-13 14:40:41 +01:00
Vladimir 'phcoder' Serbinenko
58acccd645 * grub-core/fs/ntfs.c (u16at): Make into inline function.
Handle unaligned pointers.
	(u32at): Likewise.
	(u64at): Likewise.
	(fixup): Use byte access instead of v16at.
	(find_attr): Fix imporper usage of v32at.
	(read_data): Likewise.
	(list_file): Handle byte-swapping and unaligned strings.
	(grub_ntfs_label): Likewise.
2011-12-13 14:17:24 +01:00
Vladimir 'phcoder' Serbinenko
9b05cad768 * grub-core/fs/udf.c (grub_udf_partmap): Add packed attribute
as it's not necessarily aligned.
2011-12-13 13:58:33 +01:00
Vladimir 'phcoder' Serbinenko
b3950b849f * grub-core/kern/mips/qemu_mips/init.c (grub_at_keyboard_init): Remove
redundant declaration.
	(grub_serial_init): Likewise.
	(grub_terminfo_init): Likewise.
2011-12-13 11:46:29 +01:00
Vladimir 'phcoder' Serbinenko
fcd232b74e * grub-core/fs/zfs/zfs.c (DVA_OFFSET_TO_PHYS_SECTOR): Make into inline
function.
	(ZAP_HASH_IDX): Likewise.
	(ZAP_LEAF_HASH_SHIFT): Likewise.
	(ZAP_LEAF_HASH_NUMENTRIES): Likewise.
	(LEAF_HASH): Likewise.
	(ZAP_LEAF_NUMCHUNKS): Likewise.
	(ZAP_LEAF_CHUNK): Likewise. Changed pointer arithmetic to preserve
	alignment invariants. Return pointer. All users updated.
	(ZAP_LEAF_ENTRY): Make into inline function.
	(NBBY): Removed.
	(xor): LIkewise.
	(xor_out): Use grub_crypto_xor.
	(dnode_get_path): Use grub_get_unaligned.
	(nvlist_find_value): Likewise.
	(grub_zfs_nvlist_lookup_uint64): Likewise.
	(grub_zfs_nvlist_lookup_string): Likewise.
	(get_nvlist_size): Likewise.
	(grub_zfs_open): Likewise.
	(fill_fs_info): Likewise.
	(grub_zfs_dir): Likewise.
	* include/grub/zfs/zap_leaf.h (zap_leaf_phys): Adapt to preserve
	alignment invariants.
	* include/grub/zfs/zio.h (zio_eck_t): Mark as packed as it's not
	necessarily aligned.
2011-12-13 11:33:02 +01:00
Vladimir 'phcoder' Serbinenko
f138623a60 * grub-core/net/netbuff.c (grub_netbuff_alloc): Ensure proper alignment. 2011-12-13 02:15:09 +01:00
Vladimir 'phcoder' Serbinenko
564840dc3d * grub-core/disk/mdraid_linux.c (grub_mdraid_detect): Change pointer
arithmetic to conserve alignment invariants.
2011-12-13 02:13:44 +01:00
Vladimir 'phcoder' Serbinenko
4c5f3056c2 * grub-core/fs/hfsplus.c (grub_hfsplus_btree_recoffset): Handle the
case of aunaligned recptr.
	(grub_hfsplus_read_block): Declare extoverflow as key to ensure
	alignment.
	(grub_hfsplus_btree_search): Handle unaligned index.
2011-12-13 02:05:58 +01:00
Vladimir 'phcoder' Serbinenko
728cba91d2 * grub-core/fs/xfs.c (grub_xfs_iterate_dir): Use grub_get_unaligned16
to get freetag and skip.
2011-12-13 02:02:38 +01:00
Vladimir 'phcoder' Serbinenko
eb561f3123 * grub-core/fs/nilfs2.c (grub_nilfs2_btree_node): Add zero-size keys
array.
	(grub_nilfs2_btree_node_dkeys): Ensure return pointer alignment.
	(grub_nilfs2_btree_lookup): Ensure buffer alignment.
2011-12-13 02:00:44 +01:00
Vladimir 'phcoder' Serbinenko
812e249302 * grub-core/fs/ext2.c (grub_ext4_find_leaf): MAke buf as pointer to
properly aligned memory.
	(grub_ext2_read_block): Ensure buffer alignment.
2011-12-13 01:58:35 +01:00
Vladimir 'phcoder' Serbinenko
20993fbb9f * grub-core/fs/romfs.c (grub_romfs_iterate_dir): Properly align
name for checksum and fix allocation algorithm.
2011-12-13 01:57:07 +01:00
Vladimir 'phcoder' Serbinenko
47ae27ec75 * grub-core/normal/datetime.c (grub_weekday_names): Make const. 2011-12-13 01:45:38 +01:00
Vladimir 'phcoder' Serbinenko
78c2cd1c62 * grub-core/fs/udf.c (read_string): Macroify GRUB_MAX_UTF8_PER_UTF16.
* grub-core/fs/jfs.c (grub_jfs_diropen): Likewise.
	* grub-core/fs/fat.c (grub_fat_iterate_dir): Likewise.
2011-12-13 01:41:16 +01:00
Vladimir 'phcoder' Serbinenko
53072f9b96 * grub-core/term/at_keyboard.c (set_scancodes): Fix preprocessor
conditionals.
2011-12-13 01:36:09 +01:00
Vladimir 'phcoder' Serbinenko
055dc23978 * grub-core/kern/emu/main.c (main): Add missing const qualifier.
* grub-core/loader/efi/appleloader.c (devdata): Likewise.
2011-12-13 01:32:41 +01:00
Vladimir 'phcoder' Serbinenko
496bd07446 Unify and improve RAID and crypto xor.
* grub-core/disk/raid.c (grub_raid_block_xor): Removed. All users
	changed to grub_crypto_xor
	* grub-core/lib/crypto.c (grub_crypto_xor): Moved from here ...
	* include/grub/crypto.h (grub_crypto_xor): ... here. Inlined.
	Use bigger types when possible.
2011-12-13 01:26:53 +01:00
Vladimir 'phcoder' Serbinenko
ef6e433586 * grub-core/disk/raid.c (scan_devices): Fix condition. 2011-12-13 01:19:47 +01:00
Vladimir 'phcoder' Serbinenko
5d048bf210 * grub-core/net/drivers/ieee1275/ofnet.c (bootp_response_properties):
Make name a const ptr.
2011-12-13 01:07:06 +01:00
Vladimir 'phcoder' Serbinenko
ee533335f5 * grub-core/kern/ieee1275/ieee1275.c (grub_ieee1275_finddevice): Make
first argument a const pointer.
	* grub-core/kern/ieee1275/openfw.c (grub_children_iterate): Likewise.
	* include/grub/ieee1275/ieee1275.h (grub_ieee1275_finddevice): Update
	proto.
	(grub_children_iterate): Likewise.
	(grub_machine_mmap_iterate): Remove redundant declaration.
2011-12-13 01:00:34 +01:00
Vladimir 'phcoder' Serbinenko
cc8f366887 * grub-core/commands/acpi.c (grub_acpi_create_ebda) [!x86]: Disable.
(grub_cmd_acpi) [!x86]: Disable EBDA.
2011-12-13 00:55:00 +01:00
Vladimir 'phcoder' Serbinenko
c5fc563aff Enable UTF8 in gnulib regexp.
* config.h.in (RE_ENABLE_I18N) [!GRUB_UTIL]: New define.
	* grub-core/lib/posix_wrap/ctype.h (islower): Use grub_islower.
	(isupper): Use grub_isupper.
	(isascii): New inline function.
	* grub-core/lib/posix_wrap/wchar.h: Replace dummy with real contents.
	* grub-core/lib/posix_wrap/wctype.h: Likewise.
	* grub-core/normal/charset.c (grub_utf8_process): New function.
	(grub_utf8_to_utf16): Use grub_utf8_process.
	(grub_encode_utf8_character): New function.
	(grub_ucs4_to_utf8): Use grub_encode_utf8_character.
	* include/grub/charset.h (grub_utf8_process): New declaration.
	(grub_encode_utf8_character): Likewise.
	* include/grub/misc.h (grub_islower): New inline function.
	(grub_isupper): Likewise.
	(grub_strchrsub): Moved down to fix the definitions.
2011-12-13 00:50:49 +01:00
Vladimir 'phcoder' Serbinenko
0af2346fdb * grub-core/bus/usb/ohci.c (grub_ohci_check_transfer): Add an unsigned
specification.
2011-12-13 00:29:42 +01:00
Vladimir 'phcoder' Serbinenko
74dbd24466 * include/grub/loader.h (grub_loader_register_preboot_hook):
Use struct preboot * and not void * for handle. All users updated.
	(grub_loader_unregister_preboot_hook): Likewise.
2011-12-13 00:28:14 +01:00
Vladimir 'phcoder' Serbinenko
1bc8f60db7 * include/grub/charset.h (GRUB_MAX_UTF8_PER_UTF16): New const.
* grub-core/fs/hfsplus.c (grub_hfsplus_catkey_internal): Change to
	UTF-16-BE. All users updated.
	(grub_hfsplus_cmp_catkey): Fix unicode handling.
	(grub_hfsplus_iterate_dir): Likewise.
	(grub_hfsplus_label): Likewise.
2011-12-12 22:40:43 +01:00
Vladimir 'phcoder' Serbinenko
48d6e45653 * grub-core/disk/ahci.c (grub_ahci_pciinit): Fix compat condition. 2011-12-12 22:20:14 +01:00
Vladimir 'phcoder' Serbinenko
bf3a385792 Add missing const qualifiers.
* grub-core/commands/i386/pc/sendkey.c (keysym): Add missing const.
	* grub-core/commands/lspci.c (grub_pci_classname): Likewise.
	* grub-core/commands/menuentry.c (hotkey_aliases): Likewise.
	* grub-core/disk/lvm.c (grub_lvm_getvalue): Likewise.
	(grub_lvm_check_flag): Likewise.
	* grub-core/efiemu/i386/coredetect.c
	(grub_efiemu_get_default_core_name): Likewise
	* grub-core/efiemu/main.c (grub_efiemu_autocore): Likewise.
	* grub-core/fs/hfsplus.c (grub_hfsplus_catkey_internal): Likewise.
	* grub-core/fs/ntfs.c (fixup): Likewise.
	* grub-core/fs/xfs.c (grub_xfs_iterate_dir): Likewise.
	* grub-core/fs/zfs/zfs.c (decomp_entry): Likewise.
	(fzap_lookup): Likewise.
	(zap_lookup): Likewise.
	* grub-core/gnulib/regcomp.c (init_dfa): Likewise.
	* grub-core/lib/legacy_parse.c (check_option): Likewise.
	* grub-core/lib/posix_wrap/langinfo.h (nl_langinfo): Likewise.
	* grub-core/loader/i386/bsd.c (grub_bsd_add_meta): Likewise.
	(grub_freebsd_add_meta_module): Likewise.
	(grub_cmd_freebsd_module): Likewise.
	* grub-core/loader/i386/xnu.c (tbl_alias): Likewise.
	* grub-core/loader/xnu.c (grub_xnu_register_memory): Likewise.
	(grub_xnu_writetree_get_size): Likewise.
	(grub_xnu_writetree_toheap_real): Likewise.
	(grub_xnu_find_key): Likewise.
	(grub_xnu_create_key): Likewise.
	(grub_xnu_create_value): Likewise.
	(grub_xnu_register_memory): Likewise.
	(grub_xnu_check_os_bundle_required): Likewise.
	(grub_xnu_scan_dir_for_kexts): Likewise.
	(grub_xnu_load_kext_from_dir): Likewise.
	* grub-core/normal/color.c (color_list): Likewise.
	* grub-core/normal/completion.c (current_word): Likewise.
	* grub-core/normal/menu_entry.c (insert_string): Likewise.
	* grub-core/term/serial.c (grub_serial_find): Likewise.
	* grub-core/term/tparm.c (grub_terminfo_tparm): Likewise.
	* include/grub/efiemu/efiemu.h (grub_efiemu_get_default_core_name):
	Likewise.
	* include/grub/i386/bsd.h (grub_bsd_add_meta): Likewise.
	(grub_freebsd_add_meta_module): Likewise.
	* include/grub/lib/arg.h (grub_arg_option): Likewise.
	* include/grub/net.h (grub_net_card_driver): Likewise.
	(grub_net_card): Likewise.
	(grub_net_app_protocol): Likewise.
	* include/grub/parttool.h (grub_parttool_argdesc): Likewise.
	* include/grub/serial.h (grub_serial_find): Likewise.
	* include/grub/tparm.h (grub_terminfo_tparm): Likewise.
	* include/grub/xnu.h (grub_xnu_create_key): Likewise.
	(grub_xnu_create_value): Likewise.
	(grub_xnu_find_key): Likewise.
	(grub_xnu_scan_dir_for_kexts): Likewise.
	(grub_xnu_load_kext_from_dir): Likewise.

	* include/grub/zfs/zio_checksum.h (zio_checksum_t): Moved from here ...
	* grub-core/fs/zfs/zfs.c (zio_checksum_t): ...here.
	* include/grub/zfs/zio_checksum.h (zio_checksum_info):
	Moved from here ...
	* grub-core/fs/zfs/zfs.c (zio_checksum_info): ... here. Added missing const.
2011-11-30 16:20:13 +01:00
Vladimir 'phcoder' Serbinenko
49e891ac9c * grub-core/fs/zfs/zfs.c (recovery): Fix spelling.
(read_device): Fix size calculation.
2011-11-27 02:34:22 +01:00
Vladimir 'phcoder' Serbinenko
adac52113d * grub-core/fs/cpio.c (grub_cpio_dir): Handle subdirs correctly. 2011-11-25 14:12:05 +01:00
Vladimir 'phcoder' Serbinenko
10b64f1cf4 * grub-core/kern/dl.c (grub_dl_load_segments): Fix alignment handling. 2011-11-16 21:40:50 +01:00
Vladimir 'phcoder' Serbinenko
bb41695449 * grub-core/kern/dl.c (grub_dl_unload): Fix freeing segments. 2011-11-16 21:38:00 +01:00
Vladimir 'phcoder' Serbinenko
bdfe9eeb2c * grub-core/kern/x86_64/efi/callwrap.S: Fix the comment. 2011-11-16 21:35:40 +01:00
Vladimir 'phcoder' Serbinenko
581ffa8a24 * grub-core/lib/adler32.c: Add missing license specification.
* grub-core/lib/crc64.c: Likewise.
	* grub-core/loader/i386/pc/plan9.c: Likewise.
	* grub-core/partmap/plan.c: Likewise.
2011-11-14 14:25:09 +01:00
Lubomir Kundrak
2536cf6463 Add facility to debug GRUB with gdb under qemu.
* grub-core/gdb_grub.in: New file.
	* grub-core/gmodule.pl.in: Likewise.
	* grub-core/Makefile.core.def (gmodule.pl): New script.
	(gdb_grub): Likewise.
2011-11-13 22:59:46 +01:00
Vladimir 'phcoder' Serbinenko
111c17782a Plan9 support.
* Makefile.util.def (libgrubmods): Add
	grub-core/partmap/plan.c.
	* docs/grub.texi: Notice Plan9 support.
	* grub-core/Makefile.core.def (plan9): New module.
	(part_plan): Likewise.
	* grub-core/loader/i386/pc/plan9.c: New file.
	* grub-core/partmap/plan.c: Likewise.
	* include/grub/msdos_partition.h (GRUB_PC_PARTITION_TYPE_PLAN9): New
	define.
	(GRUB_PC_PARTITION_TYPE_LINUX_SWAP): Likewise.
	* include/grub/mm.h (grub_extend_alloc): New inline function.
2011-11-13 19:38:08 +01:00
Vladimir 'phcoder' Serbinenko
c30be3b694 Make Reed-Solomon faster by using power of generator representation of
GF(256)*.

	* grub-core/lib/reed_solomon.c (grub_uint16_t) [TEST]: Removed.
	(gf_double_t): Likewise.
	(gf_invert): Removed.
	(gf_powx): New array.
	(gf_powx_inv): Likewise.
	(scratch): Move higher.
	(gf_reduce): Removed.
	(gf_mul): Use powx.
	(gf_invert): Likewise.
	(init_inverts): Replaced with ...
	(init_powx): ...this. All users updated.
	(pol_evaluate): Replace multiplications with additions.
	(rs_encode): Likewise.
	(gauss_eliminate): Call gf_invert.
	(grub_reed_solomon_add_redundancy): Call init_powx.
	(grub_reed_solomon_recover): Call init_powx unconditionally.
2011-11-13 14:48:19 +01:00
Vladimir 'phcoder' Serbinenko
383ceaf060 Fix a mismerge 2011-11-13 12:52:21 +01:00
Vladimir 'phcoder' Serbinenko
4e01c8c165 Merge mainline into plan9 2011-11-13 12:48:39 +01:00
Vladimir 'phcoder' Serbinenko
fa5aeffcc2 * grub-core/partmap/gpt.c (gpt_partition_map_embed): Fix spelling. 2011-11-13 00:07:08 +01:00
Vladimir 'phcoder' Serbinenko
a346b81c7d * grub-core/partmap/gpt.c (gpt_partition_map_embed): Restore
disk->partiton for safety.
2011-11-13 00:01:06 +01:00
Vladimir 'phcoder' Serbinenko
d89ee4141a * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev):
Fix a memory leak.
	(grub_util_biosdisk_get_grub_dev): Add a useful debug info.
2011-11-12 23:46:47 +01:00
Vladimir 'phcoder' Serbinenko
91ee7b6d73 * grub-core/kern/emu/hostdisk.c (find_system_device): Fix a memory leak. 2011-11-12 23:42:49 +01:00
Vladimir 'phcoder' Serbinenko
0cddeb0360 Add copyright year. 2011-11-12 23:16:48 +01:00
Vladimir 'phcoder' Serbinenko
ba102053ce Support ZFS embedding.
* grub-core/fs/zfs/zfs.c (grub_zfs_embed): New function.
	(grub_zfs_fs): Register grub_zfs_embed.
2011-11-12 21:46:52 +01:00
Vladimir 'phcoder' Serbinenko
aa94b87027 Fix MIPS compilation.
* grub-core/boot/mips/startup_raw.S: Use GRUB_DECOMPRESSOR_*
	* include/grub/offsets.h: Rename decompressor fields from
	GRUB_KERNEL_* to GRUB_DECOMPRESSOR_*.
	* util/grub-mkimage.c (image_targets): Use new names.
2011-11-12 21:38:04 +01:00
Vladimir 'phcoder' Serbinenko
5fbdac149b Defer multiboot device parsing until we're in compressed part.
* grub-core/boot/i386/pc/lnxboot.S: Remove setting dos_part and
	bsd_part. setdevice has fallen into disuse.
	* grub-core/boot/i386/pc/startup_raw.S (dos_part): Removed.
	(bsd_part): Likewise.
	(boot_dev): New variable.
	(multiboot_trampoline): Don't parse multiboot device.
	Pass multiboot device in %edx.
	* grub-core/disk/i386/pc/biosdisk.c (GRUB_MOD_INIT): Parse
	grub_boot_device.
	* grub-core/kern/i386/pc/init.c (grub_machine_get_bootlocation):
	Likewise.
	* grub-core/kern/i386/pc/startup.S: Save edx.
	(grub_boot_drive): Removed.
	(grub_install_dos_part): Likewise.
	(grub_install_bsd_part): Likewise.
	(grub_boot_device): New variable.
	* include/grub/i386/pc/kernel.h (grub_install_dos_part): Removed.
	(grub_install_bsd_part): Likewise.
	(grub_boot_drive): Likewise.
	(grub_boot_device): New variable.
	* include/grub/offsets.h (GRUB_KERNEL_I386_PC_INSTALL_DOS_PART):
	Removed.
	(GRUB_KERNEL_I386_PC_INSTALL_BSD_PART): Likewise.
	(GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY): Moved lower.
	(GRUB_KERNEL_MACHINE_INSTALL_BSD_PART): Removed.
	(GRUB_KERNEL_MACHINE_INSTALL_DOS_PART): Likewise.
	* util/grub-install.in: Remove redundant condition.
2011-11-12 21:12:52 +01:00
Vladimir 'phcoder' Serbinenko
691cbb5816 Fix bug introduced by previous commit.
* grub-core/boot/i386/pc/startup_raw.S: Compute RS start correctly.
2011-11-12 20:53:46 +01:00
Vladimir 'phcoder' Serbinenko
60240b8bc1 Use decompressors framework on i386-pc. It increases core size
by 46 bytes but improves compatibility and maintainability.

	* grub-core/Makefile.core.def (lzma_decompress): New image.
	(kernel): Add i386_pc_ldflags.
	* grub-core/kern/i386/pc/startup.S: Move intial part to ..
	* grub-core/boot/i386/pc/startup_raw.S: ... here. Pass pointers
	to real_to_prot, prot_to_real and device info.
	* include/grub/offsets.h: Renamed decompressor offsets.
	* util/grub-mkimage.c (grub_compression_t): New cmpression lzma.
	(image_target_desc): Remove raw_size and rename decompressor fields.
	(compress_kernel): Handle lzma.
	(generate_image): Handle decompressors on i386-pc.
2011-11-12 19:53:25 +01:00
Vladimir 'phcoder' Serbinenko
2b23074a0c Move assembly code to C by using intwrap. It increases core size
by 88 bytes but improves compatibility and maintainability.

	* grub-core/kern/i386/pc/startup.S (grub_console_putchar): Moved to ...
	* grub-core/term/i386/pc/console.c (grub_console_putchar_real):
	... here. Translated to C.
	* grub-core/kern/i386/pc/startup.S (grub_console_getkey): Moved to ...
	* grub-core/term/i386/pc/console.c (grub_console_getkey):
	... here. Translated to C.
	* grub-core/kern/i386/pc/startup.S (grub_console_getxy): Moved to ...
	* grub-core/term/i386/pc/console.c (grub_console_getxy):
	... here. Translated to C.
	* grub-core/kern/i386/pc/startup.S (grub_console_gotoxy): Moved to ...
	* grub-core/term/i386/pc/console.c (grub_console_gotoxy):
	... here. Translated to C.
	* grub-core/kern/i386/pc/startup.S (grub_console_cls): Moved to ...
	* grub-core/term/i386/pc/console.c (grub_console_cls):
	... here. Translated to C.
	* grub-core/kern/i386/pc/startup.S (grub_console_setcursor): Moved to ..
	* grub-core/term/i386/pc/console.c (grub_console_setcursor):
	... here. Translated to C.
	* grub-core/kern/i386/pc/startup.S (grub_get_rtc): Moved to ..
	* grub-core/kern/i386/pc/init.c (grub_get_rtc): ... here.
	Translated to C.
	* grub-core/term/i386/pc/console.c (int10_9): New function.
	(grub_console_putchar): Likewise.
	* include/grub/i386/pc/console.h: Removed the not anymore shared
	functions.
2011-11-12 16:29:04 +01:00
Vladimir 'phcoder' Serbinenko
678f4b6713 Move grub_chainloader_real_boot out of the kernel.
* grub-core/Makefile.am: Remove machine/loader.h.
	* grub-core/kern/i386/pc/startup.S (grub_chainloader_real_boot):
	Removed.
	* grub-core/lib/i386/relocator.c (grub_relocator16_esi): New extern
	variable.
	(grub_relocator16_keep_a20_enabled): Likewise.
	(grub_relocator16_boot): Fill new variables.
	* grub-core/lib/i386/relocator16.S: Add gate a20 handling.
	* grub-core/loader/i386/pc/chainloader.c (grub_chainloader_boot): Use
	relocator.
	(grub_chainloader_unload): Likewise.
	(grub_chainloader_cmd): Likewise.
	* include/grub/i386/pc/loader.h: Removed.
	* include/grub/i386/relocator.h (grub_relocator16_state): Add a20
	and esi. All initialisers updated.
2011-11-12 15:46:50 +01:00
Vladimir 'phcoder' Serbinenko
10f0117bf9 * grub-core/commands/efi/fixvideo.c: Gettextize.
* grub-core/commands/hashsum.c: Likewise.
	* grub-core/commands/i386/cmostest.c: Likewise.
	* grub-core/commands/i386/pc/drivemap.c: Likewise.
	* grub-core/commands/i386/pc/lsapm.c: Likewise.
	* grub-core/commands/i386/pc/sendkey.c: Likewise.
	* grub-core/commands/lsmmap.c: Likewise.
	* grub-core/commands/menuentry.c: Likewise.
	* grub-core/commands/mips/loongson/lsspd.c: Likewise.
	* grub-core/commands/setpci.c: Likewise.
	* grub-core/loader/i386/bsd.c: Likewise.
	* grub-core/loader/i386/linux.c: Likewise.
	* util/getroot.c: Likewise.
	* util/grub-editenv.c: Likewise.
	* util/grub-fstest.c: Likewise.
	* util/grub-mkfont.c: Likewise.
	* util/grub-mkimage.c: Likewise.
	* util/grub-mkpasswd-pbkdf2.c: Likewise.
	* util/grub-pe2elf.c: Likewise.
	* util/grub-probe.c: Likewise.
	* util/grub-setup.c: Likewise.
	* util/ieee1275/ofpath.c: Likewise.
	* util/misc.c: Likewise.
	* util/raid.c: Likewise.
2011-11-12 00:34:14 +01:00
Vladimir 'phcoder' Serbinenko
119d11c885 Replace grub_fatal with normal errors in i386 linux loader.
* grub-core/loader/i386/linux.c (find_efi_mmap_size): Return 0 on error.
	(allocate_pages): Check find_efi_mmap_size return value.
	(grub_e820_add_region): Return error.
	(grub_linux_boot): Check mmap return value.
2011-11-11 22:35:09 +01:00