Commit graph

557 commits

Author SHA1 Message Date
Vladimir 'phcoder' Serbinenko
df042ccb21 * grub-core/fs/hfsplus.c (grub_hfsplus_catfile): New field parentid.
(grub_hfsplus_iterate_dir): Add "." and "..".
2012-05-27 00:56:55 +02:00
Vladimir 'phcoder' Serbinenko
fc977f485f * grub-core/fs/cpio.c (canonicalize): Handle "..".
(grub_cpio_find_file) [MODE_USTAR]: Handle hardlinks.
2012-05-27 00:54:41 +02:00
Vladimir 'phcoder' Serbinenko
f3250e5f1f * grub-core/fs/btrfs.c (GRUB_BTRFS_ITEM_TYPE_INODE_REF): New enum value.
(find_path): Handle "." and "..".
2012-05-27 00:47:37 +02:00
Vladimir 'phcoder' Serbinenko
fd8ed4c5c5 * grub-core/fs/affs.c (grub_affs_file): New field hardlink.
(GRUB_AFFS_FILETYPE_HARDLINK): New enum value.
	(grub_affs_iterate_dir): Handle hardlinks.
2012-05-27 00:45:41 +02:00
Vladimir 'phcoder' Serbinenko
77ceedb634 Fix extent overflow comparator.
* grub-core/fs/hfsplus.c (grub_hfsplus_extkey_internal): Add type.
	(grub_hfsplus_read_block): Set type.
	(grub_hfsplus_cmp_extkey): Compare type.
2012-05-26 11:54:20 +02:00
Vladimir 'phcoder' Serbinenko
0a9aa0f6e1 * grub-core/fs/hfsplus.c (grub_hfsplus_label): Use found ptr rather
than 0.
2012-05-25 00:47:49 +02:00
Vladimir 'phcoder' Serbinenko
4cf6be1bd9 * grub-core/fs/squash4.c (grub_squash_read_data): Add missing byte-swap. 2012-05-22 08:38:17 +02:00
Vladimir 'phcoder' Serbinenko
937d1c44b1 * grub-core/fs/reiserfs.c (grub_reiserfs_iterate_dir): Fix size byteswap
with old reiserfs.
	(grub_reiserfs_open): Don't free root.
2012-05-22 08:30:57 +02:00
Vladimir 'phcoder' Serbinenko
021d90ecac * grub-core/fs/fshelp.c (grub_fshelp_find_file): Set currnode to 0
after freeing for safety.
2012-05-22 08:24:27 +02:00
Vladimir 'phcoder' Serbinenko
a4469c8806 * grub-core/fs/affs.c (grub_affs_mtime): Add missing grub_dl_ref. 2012-05-21 22:07:28 +02:00
Vladimir 'phcoder' Serbinenko
aa78f5c4e6 * grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Mark plain
ISO9660 names as case-insensitive, lowercase it and remove trailing dot.
2012-05-18 12:51:02 +02:00
Vladimir 'phcoder' Serbinenko
197626b569 * grub-core/fs/jfs.c (grub_jfs_data): New field caseins.
(grub_jfs_mount): Fill caseins.
	(grub_jfs_find_file): Respect caseins.
2012-05-17 13:50:33 +02:00
Vladimir 'phcoder' Serbinenko
8ad3f28cec * grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Don't strrchr
through UTF-16.
2012-05-17 13:47:23 +02:00
Vladimir 'phcoder' Serbinenko
0c6c324e90 * grub-core/fs/fat.c (grub_fat_find_dir): Fix error message.
New argument origpath. All users updated.
2012-05-17 13:45:00 +02:00
Vladimir 'phcoder' Serbinenko
c6666ba687 * grub-core/fs/ntfs.c (read_data): Prevent overflow.
(read_attr): Ensure that we read start of possibly compressed block.
2012-05-15 17:17:06 +02:00
Vladimir 'phcoder' Serbinenko
e28e5fe519 * include/grub/ntfs.h (grub_ntfs_comp_table_element): New struct.
(grub_ntfs_comp): Use grub_ntfs_comp_table_element for comp_table.
	All users updated.
2012-05-15 17:09:14 +02:00
Vladimir 'phcoder' Serbinenko
def3df7520 * grub-core/fs/udf.c (read_string): Bail out on size=0.
(grub_udf_read_symlink): Handle read_string failure.
2012-05-13 20:18:33 +02:00
Vladimir 'phcoder' Serbinenko
c1ad82db74 Fix handling of UDF symlinks.
* grub-core/fs/udf.c (read_string): New argument outbuf.
	All users updated.
	(grub_ufs_read_symlink): Rename to ...
	(grub_udf_read_symlink): ... this. All users updated.
	Handle symlinks with more than one component.
2012-05-12 13:54:26 +02:00
Vladimir 'phcoder' Serbinenko
33eca6e005 * grub-core/fs/affs.c (grub_affs_read_symlink): Fix handling of long
symlinks. Replace leading colon with a slash.
2012-05-12 13:44:48 +02:00
Vladimir 'phcoder' Serbinenko
57f4a70b0d * grub-core/fs/jfs.c (grub_jfs_find_file): Handle multiple slashes in
filename.
2012-05-12 13:41:02 +02:00
Vladimir 'phcoder' Serbinenko
38c8ee20ca * grub-core/fs/bfs.c (find_in_b_tree) [MODE_AFS]: Fix handling of exact
match in inner node.
2012-05-12 13:35:58 +02:00
Vladimir 'phcoder' Serbinenko
2e57f28fc7 * grub-core/fs/bfs.c (mount): Improve filesystem detection reliability.
* grub-core/fs/ext2.c (grub_ext2_mount): Likewise.
	* grub-core/fs/hfs.c (grub_hfs_mount): Likewise.
	* grub-core/fs/hfsplus.c (grub_hfsplus_mount): Likewise.
	* grub-core/fs/jfs.c (grub_jfs_mount): Likewise.
	* grub-core/fs/minix.c (grub_minix_mount): Likewise.
	* grub-core/fs/ntfs.c (grub_ntfs_mount): Likewise.
	* grub-core/fs/romfs.c (grub_romfs_mount): Likewise.
	* grub-core/fs/xfs.c (grub_xfs_mount): Likewise.
2012-05-12 13:31:05 +02:00
Vladimir 'phcoder' Serbinenko
690434e81d * grub-core/fs/cpio.c (grub_cpio_find_file): Handle prefix.
(handle_symlink): Fix off-by-one error.
	Canonicalize the target.
	(grub_cpio_dir): Canonicalize the name.
	Fix memory leak.
	Set directory.
	(grub_cpio_open): Canonicalize the name.
2012-05-10 23:38:01 +02:00
Vladimir 'phcoder' Serbinenko
742d2be63a * grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Fix symlink
handling.
2012-05-10 23:35:03 +02:00
Vladimir 'phcoder' Serbinenko
3244fe96e7 * grub-core/fs/ufs.c (grub_ufs_find_file): Fix handling of double slash.
* grub-core/fs/minix.c (grub_minix_find_file): Likewise.
2012-05-10 23:33:44 +02:00
Vladimir 'phcoder' Serbinenko
6d521c5b41 Fix UFS1 big file support.
* grub-core/fs/ufs.c (INODE): Removed.
	(INODE_SIZE): Always use 64-bit byte-swap since size field is always
	64-bit.
	(INODE_MODE): Simplify.
	(grub_ufs_inode): Use uint64_t for size and not int64_t.
	(grub_ufs_lookup_symlink): Don't use INODE.
2012-05-10 00:25:36 +02:00
Vladimir 'phcoder' Serbinenko
21b82e176e Fix minixfs with non-power-of-two blocks since it's supported by minix.
* grub-core/fs/minix.c (GRUB_MINIX_ZONESZ): Use block_size.
	(grub_minix_data): Replace log_block_size with block_size.
	(grub_minix_read_file): Use block_size but avoid 64-bit division.
	(grub_minix_mount): Fill block_size.
2012-05-10 00:12:02 +02:00
Vladimir 'phcoder' Serbinenko
f417ed0432 Fix wrapped HFS+ handling.
* grub-core/fs/fshelp.c (grub_fshelp_read_file): New argument
	blocks_start. All users updated.
	* grub-core/fs/hfsplus.c (grub_hfsplus_read_block): Don't add
	wrapping offset.
	(grub_hfsplus_read_file): Pass embedding offset to fshelp_read_file.
2012-05-09 13:02:59 +02:00
Vladimir 'phcoder' Serbinenko
607d282b29 Fix long symlinks on reiserfs.
* grub-core/fs/reiserfs.c (grub_fshelp_node): New field size.
	(grub_reiserfs_read_symlink): Use grub_reiserfs_read_real.
	(grub_reiserfs_iterate_dir): Save size for non-directories.
	(grub_reiserfs_open): Don't reread stat block as we already know the
	size.
	(grub_reiserfs_read): Split into...
	(grub_reiserfs_read_real): ... and ...
	(grub_reiserfs_read): ...this.
2012-05-09 12:55:43 +02:00
Vladimir 'phcoder' Serbinenko
ae16024d92 Fix non-indexed JFS.
* grub-core/fs/jfs.c (grub_jfs_sblock): New field flags.
	(grub_jfs_data): New field namecomponentlen.
	(grub_jfs_mount): Fill namecomponentlen.
	(grub_jfs_getent): Use namecomponentlen rather than hardcoded 11.
2012-05-09 02:12:16 +02:00
Vladimir 'phcoder' Serbinenko
6ae485aaef Fix AFFS with non-512B blocks.
* grub-core/fs/affs.c (grub_affs_rblock): Make type uint32_t.
	(AFFS_MAX_LOG_BLOCK_SIZE): New definition.
	(grub_affs_data): Replace blocksize with log_blocksize.
	(grub_affs_read_block): Fix non-512B blocks.
	(grub_affs_read_symlink): Likewise.
	(grub_affs_iterate_dir): Likewise. Fix freeing corruption.
	(grub_affs_read): Fix non-512B blocks.
	(grub_affs_label): Likewise.
	(grub_affs_mtime): Likewise.
	(grub_affs_mount): Fix block detection routine.
2012-05-08 04:38:19 +02:00
Vladimir 'phcoder' Serbinenko
d20fab8471 Add filesystem mtime to AFFS.
* grub-core/fs/affs.c (grub_affs_file): Make type unsigned.
	(aftime2ctime): New function.
	(grub_affs_dir): Use aftime2ctime.
	(grub_affs_label): Fix return value.
	(grub_affs_mtime): New function.
	(grub_affs_fs): Add mtime.
2012-05-08 01:51:34 +02:00
Vladimir 'phcoder' Serbinenko
e87b10f5d6 * grub-core/fs/affs.c (grub_affs_read_symlink): Convert latin1 into
UTF-8.
2012-05-07 22:00:19 +02:00
Vladimir 'phcoder' Serbinenko
7dceec9b69 * grub-core/fs/sfs.c (grub_sfs_read_symlink): Convert latin1 into
UTF-8.
2012-05-07 21:57:51 +02:00
Vladimir 'phcoder' Serbinenko
2f48221f5c * grub-core/fs/affs.c (grub_affs_iterate_dir): Mark as case insensitive. 2012-05-07 19:09:02 +02:00
Vladimir 'phcoder' Serbinenko
dacd85cfb0 * grub-core/fs/sfs.c (grub_sfs_rblock): New fields createtime and
flags.
	(FLAGS_CASE_SENSITIVE): New enum value.
	(cache_entry): New struct.
	(grub_fshelp_node): Add fields cache_off, next_extent, cache_allocated,
	cache_size and cache.
	(grub_sfs_data): Remove blocksize. All users switched to log_blocksize.
	Add log_blocksize and fshelp_flags.
	(grub_sfs_read_extent): Handle non-512 blocks.
	(grub_sfs_read_block): Add cаche and handle non-512 blocks.
	(grub_sfs_read_file): Handle non-512 blocks.
	(grub_sfs_mount): Handle non-512 blocks. Fill log_blocksize and
	fshelp_flags.
	(grub_sfs_read_symlink): Handle non-512 blocks.
	(grub_sfs_iterate_dir): Init new fields. Mark as case-insensitive.
	(grub_sfs_dir): Free cache.
	(grub_sfs_close): Likewise.
2012-05-07 19:07:16 +02:00
Vladimir 'phcoder' Serbinenko
24e9a854b8 * grub-core/fs/bfs.c (read_bfs_file): Fix overflow with over 2TiB
filesystems.
2012-05-06 16:20:55 +02:00
Vladimir 'phcoder' Serbinenko
62ace64dd9 * grub-core/fs/affs.c (grub_affs_read_block): Fix theoretical overflow. 2012-05-06 16:18:00 +02:00
Vladimir 'phcoder' Serbinenko
75ccaea346 * grub-core/fs/sfs.c (grub_fshelp_node): Fix types.
(grub_sfs_read_extent): Likewise.
	(grub_sfs_read_block): Likewise.
	(grub_sfs_mount): Likewise.
	(grub_sfs_iterate_dir): Likewise.
	(grub_sfs_read_symlink): Use strncpy instead of strcpy.
	(grub_sfs_read): Remove unnecessarry and wrong temporary variable.
2012-05-06 04:42:28 +02:00
Vladimir 'phcoder' Serbinenko
1b8463f2c4 Fix errors on compressed NTFS with 512B clusters.
* include/grub/ntfs.h (grub_ntfscomp_func_t): Use appropriately sized
	types.
	* grub-core/fs/ntfs.c (grub_ntfs_read): Return correct -1 on error and
	not 0.
	* grub-core/fs/ntfscomp.c (read_block): Use appropriately-sized types.
	Relax check for inline extents.
	(ntfscomp): Return correct -1 on error and not 0.
2012-05-04 17:37:17 +02:00
Vladimir 'phcoder' Serbinenko
6f5d5ee865 * grub-core/fs/squash4.c (grub_squash_inode): Fix offset field.
(grub_squash_read_data): Fix offset byte-swapping.
2012-05-04 17:13:24 +02:00
Vladimir 'phcoder' Serbinenko
ce41ab7aab * grub-core/kern/misc.c (grub_strcmp): Use unsigned comparison as
per common usage and preffered in several parts of code.
	(grub_memcmp): Likewise.
	(grub_strncmp): Likewise.
	* include/grub/misc.h (grub_strcasecmp): Likewise.
	(grub_strncasecmp): Likewise.
	* Makefile.util.def (cmp_test): New test.
	(grub_script_strcmp): Likewise.
	* tests/cmp_unit_test.c: New file.
	* tests/grub_script_strcmp.in: Likewise.
	* grub-core/fs/hfsplus.c (grub_hfsplus_cmp_catkey): Add a comment.
2012-05-04 12:08:22 +02:00
Vladimir 'phcoder' Serbinenko
0a308f64e9 * grub-core/fs/bfs.c (bfs_strcmp) [MODE_AFS]: Use signed comparison. 2012-05-04 10:52:26 +02:00
Vladimir 'phcoder' Serbinenko
9e8bc27a40 * grub-core/fs/btrfs.c (grub_btrfs_lzo_decompress): Fix offset when
crossing page boundary.
2012-05-03 22:16:45 +02:00
Vladimir 'phcoder' Serbinenko
aa01499d05 Fix B-tree search in BFS, especially in presence of non-ASCII
characters.

	* grub-core/fs/bfs.c (bfs_strcmp): New function.
	(find_in_b_tree): Use standard bsearch + btree algorithm.
2012-05-03 20:29:10 +02:00
Vladimir 'phcoder' Serbinenko
1516bfb43a * grub-core/fs/reiserfs.c (grub_reiserfs_iterate_dir): Put a trailing
zero after directory block since last entry may be not 0-terminated if
	it ends on block boundary. Use continue instead of if spanning whole
	loop.
2012-05-03 16:43:05 +02:00
Vladimir 'phcoder' Serbinenko
a3a0eace51 Support 4K sectors UDF inline files.
* grub-core/fs/udf.c (grub_udf_file_entry): Don't specify padding size.
	(grub_udf_extended_file_entry): Likewise.
	(grub_fshelp_node): Name the anonymous union. Put block at the end.
	All users updated.
	(get_fshelp_size): New function.
	(grub_udf_read_icb): Read whole block.
	(grub_udf_iterate_dir): Likewise.
	(grub_udf_dir): Likewise.
	(grub_udf_open): Likewise.
2012-05-03 09:29:20 +02:00
Vladimir 'phcoder' Serbinenko
c82f16c1be * grub-core/fs/ufs.c (grub_ufs_get_file_block): Support triple indirect. 2012-05-03 09:25:25 +02:00
Vladimir 'phcoder' Serbinenko
59fd2aacd0 * grub-core/fs/ufs.c (grub_ufs_lookup_symlink): Use proper check for
inline symlinks in addition to workaround.
2012-05-03 09:21:09 +02:00
Vladimir 'phcoder' Serbinenko
3b4afb4de1 * grub-core/fs/xfs.c (grub_xfs_iterate_dir): Handle read_inode errors. 2012-05-03 09:15:29 +02:00
Vladimir 'phcoder' Serbinenko
f45c794ab5 * grub-core/fs/xfs.c (GRUB_XFS_EXTENT_BLOCK): Fix bitmask. 2012-05-03 09:11:32 +02:00
Vladimir 'phcoder' Serbinenko
f25cecbdb3 * grub-core/fs/zfs/zfs.c (nvlist_find_value): Fix return value. 2012-05-03 09:09:30 +02:00
Vladimir 'phcoder' Serbinenko
bb9a34e88d Fix reiserfs big seek times.
* grub-core/fs/reiserfs.c (grub_reiserfs_get_item): New argument
	exact. All users updated.
	(grub_reiserfs_read): Use nearest btree search for seeking.
	Fix return value on error.
2012-05-02 10:30:52 +02:00
Vladimir 'phcoder' Serbinenko
5ed554f014 Handle RAIDZ on non-512B sectors.
* grub-core/fs/zfs/zfs.c (grub_zfs_device_desc): New member
	max_children_ashift.
	(fill_vdev_info_real): Fill max_children_ashift.
	(read_device): Use max_children_ashift.
2012-05-01 15:05:26 +02:00
Vladimir 'phcoder' Serbinenko
ddc583571e * grub-core/fs/fshelp.c (grub_fshelp_find_file): Fix memory leak. 2012-05-01 15:03:27 +02:00
Vladimir 'phcoder' Serbinenko
5cb5387977 * grub-core/fs/nilfs2.c (grub_nilfs2_palloc_entry_offset_log):
Fix argument to grub_nilfs2_palloc_bitmap_block_offset.
2012-04-26 12:49:35 +02:00
Vladimir 'phcoder' Serbinenko
b282dfe5ac * grub-core/fs/squash4.c (lzo_decompress): Set grub_errno on error.
Allocate at lest 8192 for temporary buffer as required for lzo.
2012-04-26 01:16:25 +02:00
Vladimir 'phcoder' Serbinenko
daa59f47f6 * grub-core/fs/fat.c (grub_fat_mount): Don't add logical_sector_bits
to cluster_bits, since it's already added in.
	(grub_fat_read_data): Likewise.
2012-04-25 16:28:06 +02:00
Vladimir 'phcoder' Serbinenko
986748ce79 * grub-core/fs/ntfs.c (grub_ntfs_mount): Support 256-byte sectors,
as long as cluster size is multiple of 512 bytes.
2012-04-25 11:56:24 +02:00
Vladimir 'phcoder' Serbinenko
e0595a73b2 * grub-core/fs/zfs/zfs.c: Disable -Wstrict-aliasing. 2012-04-13 19:26:36 +02:00
Vladimir 'phcoder' Serbinenko
4ed80652d2 * grub-core/fs/minix.c (grub_minix_data): Fix ino type.
(grub_minix_read_file): Likewise.
	(grub_minix_read_inode): Likewise.
	(grub_minix_find_file): Likewise.
	(grub_minix_dir): Likewise.
2012-04-13 17:08:38 +02:00
Vladimir 'phcoder' Serbinenko
491c57a815 * grub-core/commands/usbtest.c (usb_print_str): Silence spurious
warning.
2012-04-07 20:03:38 +02:00
Vladimir 'phcoder' Serbinenko
ac66b453df Handle big-endian minixfs (fixes minixfs tests on bigendian).
* grub-core/fs/minix.c: Replace le with minix. Add necessary defines,
	modify names. Introduce MODE_BIGENDIAN.
	* grub-core/fs/minix_be.c: New file.
	* grub-core/fs/minix2_be.c: Likewise
	* grub-core/fs/minix3_be.c: Likewise.
	* Makefile.util.def (libgrubmods): Add minix_be, minix2_be and
	minix3_be.
	* grub-core/Makefile.core.def (minix_be): New module.
	(minix2_be): Likewise.
	(minix3_be): Likewise.
2012-04-01 21:35:18 +02:00
Vladimir 'phcoder' Serbinenko
d73ff15de4 Fix exfat endianness handling.
* grub-core/fs/fat.c (grub_fat_data): Make fat_sector 32-bit.
	(grub_fat_mount) [MODE_EXFAT]: Fix bpb.num_reserved_sectors byte-swap.
	(grub_fat_iterate_dir) [MODE_EXFAT]: Fix attr byte-swap.
	Byte-swap utf16 when necessary.
	(grub_fat_label) [MODE_EXFAT]: Byte-swap utf16 when necessary.
2012-03-31 19:04:13 +02:00
Anton Blanchard
bbb39a458b Fix btrfs endianness handling.
* grub-core/fs/btrfs.c (key_cmp): Use grub_le_to_cpu for clarity.
	(lower_bound): Make root uint64_t. Use root in le.
	(grub_btrfs_read_logical): Fix template key init. Fix address byteswap.
	(find_path): Fix template key init.
	(grub_btrfs_dir): Fix mtime byteswap.
	* include/grub/types.h (grub_cpu_to_le64_compile_time): New macro.

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2012-03-31 18:45:13 +02:00
Vladimir 'phcoder' Serbinenko
354e0af7d3 * grub-core/fs/btrfs.c (grub_btrfs_read_logical): New argument
recursion_depth. Break infinite resursions. All users updated.
2012-03-31 18:38:29 +02:00
Anton Blanchard
255818026e * grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Do not byteswap
8 bit values.
2012-03-31 12:08:50 +02:00
Vladimir 'phcoder' Serbinenko
d2d58d0ab4 * grub-core/fs/jfs.c (grub_jfs_label): Use first label if second one
starts with control character.
2012-03-19 11:07:28 +01:00
Vladimir 'phcoder' Serbinenko
40211ab884 * grub-core/commands/acpihalt.c: Add TRANSLATORS comments.
* grub-core/commands/keystatus.c: Likewise.
	* grub-core/commands/loadenv.c: Likewise.
	* grub-core/commands/probe.c: Likewise.
	* grub-core/commands/regexp.c: Likewise.
	* grub-core/commands/true.c: Likewise.
	* grub-core/commands/videoinfo.c: Likewise.
	* grub-core/disk/cryptodisk.c: Likewise.
	* grub-core/disk/ldm.c: Likewise.
	* grub-core/disk/loopback.c: Likewise.
	* grub-core/disk/luks.c: Likewise.
	* grub-core/fs/zfs/zfsinfo.c: Likewise.
	* grub-core/kern/disk.c: Likewise.
	* grub-core/kern/emu/hostdisk.c: Likewise.
2012-03-03 12:59:28 +01:00
Vladimir 'phcoder' Serbinenko
0c7d99c7c2 * grub-core/fs/zfs/zfsinfo.c (print_vdev_info): Add TRANSLATORS comment.
* util/grub-install.in: Add missing quote in the comment.
2012-03-02 21:08:38 +01:00
Vladimir 'phcoder' Serbinenko
8822a8a02b * grub-core/fs/zfs/zfsinfo.c (print_vdev_info): Add TRANSLATORS
comments.
	* grub-core/gdb/gdb.c (grub_cmd_gdbstub): Likewise.
	(GRUB_MOD_INIT): Likewise.
	* grub-core/loader/i386/linux.c (grub_cmd_linux): Clarify that it's
	VGA mode.
	* grub-core/net/net.c (grub_net_route_address): Add TRANSLATORS
	comments.
	* util/grub-install.in (usage): Likewise.
	Spell ID in whole letters.
	Add missing ending dot.
	Quote variables.
	* util/grub-reboot.in: Fix capitalisation.
	* util/grub-set-default.in: Likewise.
2012-03-02 11:53:50 +01:00
Colin Watson
e3c78337c3 * include/grub/partition.h (grub_partition_map): Change prototype of
embed to take a maximum value for nsectors.
	* include/grub/emu/hostdisk.h (grub_util_ldm_embed): Likewise.
	* include/grub/fs.h (grub_fs): Likewise.
	* grub-core/partmap/msdos.c (embed_signatures): New array.
	(pc_partition_map_embed): Check for and avoid sectors matching any
	of the signatures in embed_signatures, up to max_nsectors.
	* grub-core/partmap/gpt.c (gpt_partition_map_embed): Restrict
	returned sector map to max_nsectors.
	* grub-core/disk/ldm.c (grub_util_ldm_embed): Likewise.
	* grub-core/fs/btrfs.c (grub_btrfs_embed): Likewise.
	* grub-core/fs/zfs/zfs.c (grub_zfs_embed): Likewise.
	* util/grub-setup.c (setup): Allow for the embedding area being
	split into multiple blocklists.  Tell dest_partmap->embed the
	maximum number of sectors we care about.
2012-02-27 22:25:39 +01:00
Vladimir 'phcoder' Serbinenko
e1e49678b9 * util/grub-install.in: Clarify strings.
Fix source dir check.
2012-02-27 21:36:58 +01:00
Vladimir 'phcoder' Serbinenko
67093bc0ed Another round of string clarification and adding TRANSLATORS comments. 2012-02-26 17:28:05 +01:00
Vladimir 'phcoder' Serbinenko
ed167a8027 * grub-core/fs/hfsplus.c (grub_hfsplus_btree_iterate_node): Add btree
loop check using Brent algorithm.
	(grub_hfsplus_btree_search): Likewise.
2012-02-24 22:28:45 +01:00
Vladimir 'phcoder' Serbinenko
4e27343fb0 * conf/Makefile.common (CFLAGS_GNULIB): Add
-Wno-unsafe-loop-optimizations.
	* configure.ac: Remove -Wmissing-declarations and -Wmissing-prototypes
	on tools.
	* grub-core/commands/legacycfg.c: Add pragma to skip
	-Wunsafe-loop-optimizations.
	(check_password_md5_real): Fix loop counter type.
	* grub-core/commands/testload.c (grub_cmd_testload): Fix over the EOF
	reading.
	* grub-core/disk/ldm.c (grub_util_get_ldm): Fix logic error.
	* grub-core/fs/zfs/zfs_sha256.c (zio_checksum_SHA256): Add safety
	loop condition.
	* grub-core/io/gzio.c: Add pragma to skip -Wunsafe-loop-optimizations.
	* grub-core/lib/LzmaEnc.c (GetOptimum): Avoid possible infinite loop.
	* grub-core/net/net.c (grub_net_route_address): Add safety loop
	condition.
	* grub-core/normal/charset.c (bidi_line_wrap): Likewise.
	* grub-core/normal/cmdline.c (grub_set_history): Fix loop types and
	avoid possible infinite loops.
	* grub-core/script/parser.y: Add pragma to skip -Wmissing-declarations
	and -Wunsafe-loop-optimizations.
	* grub-core/script/yylex.l: Likewise.
	* util/grub-mkfont.c: Add pragma to skip -Wunsafe-loop-optimizations.
	(print_glyphs): Avoid infinite loops.
	* util/grub-mkimage.c (compress_kernel_xz): Fix format security.
2012-02-24 12:30:32 +01:00
Vladimir 'phcoder' Serbinenko
fe42ce0924 * grub-core/fs/btrfs.c (find_device): Fix typos.
* grub-core/fs/zfs/zfs.c (read_device): Likewise.
	* util/grub-mkrelpath.c (argp_parser): Likewise.
	Reported by: Yuri Chornoivan.
2012-02-23 22:27:25 +01:00
Vladimir 'phcoder' Serbinenko
84f9d341b0 * grub-core/fs/affs.c (grub_affs_read_block): Avoid <= in loop
condition to avoid possibly infinite loops.
	* grub-core/lib/pbkdf2.c (grub_crypto_pbkdf2): Likewise.
	* grub-core/lib/xzembed/xz_dec_bcj.c (bcj_powerpc): Likewise.
2012-02-22 05:22:39 +01:00
Vladimir 'phcoder' Serbinenko
b4ba8e025b * grub-core/fs/zfs/zfs.c (zfs_fetch_nvlist): Mark unknown member here
as GRUB_ERR_BUG. Don't malloc if no device is available.
2012-02-12 19:19:57 +01:00
Vladimir 'phcoder' Serbinenko
e7b02f9ec0 * grub-core/fs/ntfs.c (locate_attr): Avoid set in if.
(grub_ntfs_iterate_dir): Likewise.
2012-02-12 18:47:46 +01:00
Vladimir 'phcoder' Serbinenko
d61386e21d Improve string. Gettextize. 2012-02-12 15:25:25 +01:00
Vladimir 'phcoder' Serbinenko
ebcecdf1c3 Increase warning level.
* conf/Makefile.common (CFLAGS_GNULIB): Add -Wno-redundant-decls
	-Wno-unreachable-code -Wno-conversion -Wno-old-style-definition.
	* configure.ac (HOST_CFLAGS): Add bunch of -W arguments.
	(TARGET_CFLAGS): Likewise.
	(HOST_CFLAGS): Add -Werror unless --disable-werror is activated.
	* grub-core/Makefile.core.def (decompressor_xz): Add
	-Wno-unreachable-code.
	(normal): Add -Wno-redundant-decls.
	(xzio): Add -Wno-unreachable-code.
	(lzopio): Add -Wno-redundant-decls -Wno-error.
	* grub-core/commands/acpi.c: Add exception to -Wcast-align.
	* grub-core/commands/lsacpi.c: Add exception to -Wcast-align.
	* grub-core/gensymlist.sh: Add exception to -Wmissing-format-attribute.
	* grub-core/kern/dl.c: Add exception to -Wcast-align.
	* grub-core/kern/efi/efi.c (grub_efi_modules_addr): Likewise.
	* grub-core/kern/i386/coreboot/init.c: Add exception to
	-Wsuggest-attribute=noreturn.
	* grub-core/kern/ia64/dl.c: Add exception to -Wcast-align.
	* grub-core/kern/ia64/dl_helper.c: Likewise.
	* grub-core/kern/mips/dl.c: Likewise.
	* grub-core/kern/sparc64/dl.c: Likewise.
	* grub-core/lib/LzmaEnc.c: Add exception to -Wshadow.
	* grub-core/lib/libgcrypt_wrap/cipher_wrap.h (memcpy): Likewise.
	(memcmp): Likewise.
	* grub-core/lib/pbkdf2.c: Add exception to -Wunreachable-code.
	* grub-core/loader/ia64/efi/linux.c: Add exception to -Wcast-align.
	* grub-core/loader/mips/linux.c: Likewise.
	* grub-core/loader/multiboot_elfxx.c: Likewise.
	* grub-core/script/parser.y: Add exception to -Wunreachable-code.
	* grub-core/video/sm712.c: Add exception to -Wcast-align.
	* util/import_gcry.py: Add -Wno-cast-align to modules checked by hand.
	* grub-core/font/font.c (grub_font_loader_init): Add explicit cast and
	fixme.
	* grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Likewise.
	* grub-core/kern/i386/multiboot_mmap.c (grub_machine_mmap_init):
	Fix prototype.
2012-02-10 16:48:48 +01:00
Vladimir 'phcoder' Serbinenko
22965bce9b * grub-core/fs/squash4.c (direct_read): Rename read to curread to
avoid shadowing.
2012-02-10 12:17:40 +01:00
Vladimir 'phcoder' Serbinenko
e1ea3ade95 * grub-core/fs/cpio.c (grub_cpio_dir): Fix a bug with multiple listing.
Explicitly init restart while on it.
2012-02-09 14:27:05 +01:00
Vladimir 'phcoder' Serbinenko
9c4b5c13e6 Improve gettext support. Stylistic fixes and error handling fixes while
on it.
2012-02-08 19:26:01 +01:00
Vladimir 'phcoder' Serbinenko
a646a366bb * grub-core/fs/reiserfs.c (grub_reiserfs_get_item): Use proper error
number.
2012-02-03 11:50:18 +01:00
Vladimir 'phcoder' Serbinenko
2f53a9ed1f * grub-core/fs/zfs/zfscrypt.c: Add link to documentation. 2012-02-01 18:30:51 +01:00
Vladimir 'phcoder' Serbinenko
b1d51f028b * grub-core/fs/fat.c (grub_fat_mount) [!MODE_EXFAT]: Remove fstype
check as some mkfs implementations omit it.
2012-01-31 23:26:07 +01:00
Vladimir 'phcoder' Serbinenko
6c0920e31b * grub-core/fs/jfs.c (grub_jfs_sblock): Make volname a char array.
Add new member volname2.
	(grub_jfs_label): Use volname2 if available.
2012-01-31 22:49:11 +01:00
Vladimir 'phcoder' Serbinenko
d1a46f9abd * grub-core/fs/nilfs2.c (grub_nilfs2_super_block): Expand volume_name
over last_mounted as seen in image generated by mkfs.nilfs2.
	(grub_nilfs2_label): Use sizeof for the size of s_volume_name.
2012-01-31 22:43:29 +01:00
Vladimir 'phcoder' Serbinenko
dec8ed14b9 * grub-core/fs/fat.c (grub_fat_dir_entry) [MODE_EXFAT]: Expand label
to 15 UTF-16 characters as seen in FS generated by mkexfatfs.
	(grub_fat_label) [MODE_EXFAT]: Use macros for size.
2012-01-31 22:38:08 +01:00
Vladimir 'phcoder' Serbinenko
7397c69bb8 * grub-core/fs/romfs.c (grub_romfs_mount): Fix a bug with labels going
over the sector.
2012-01-31 22:25:07 +01:00
Vladimir 'phcoder' Serbinenko
b3fe42adb7 * grub-core/fs/zfs/zfs.c (get_filesystem_dnode): Support space in
subvolume name (by removing a bogus and useless check).
2012-01-31 22:20:37 +01:00
Vladimir 'phcoder' Serbinenko
10476bb0db * grub-core/fs/ext2.c (grub_ext2_label): Fix field size. Change to
sizeof while on it.
2012-01-31 22:12:57 +01:00
Vladimir 'phcoder' Serbinenko
df71143ea1 * grub-core/fs/cpio.c (handle_symlink): Fix a bug. 2012-01-29 15:36:06 +01:00
Vladimir 'phcoder' Serbinenko
28ea58cf69 * grub-core/fs/zfs/zfs.c (nvlist_find_value): Check that we don't go
pastthe end.
2012-01-27 13:50:21 +01:00
Vladimir 'phcoder' Serbinenko
f6e4ea709f * grub-core/fs/squash4.c (xz_decompress): Fix return value.
(direct_read): Use correct compressed size.
	(grub_squash_read_data): Likewise.
2012-01-27 13:09:57 +01:00
Vladimir 'phcoder' Serbinenko
e06c2e7abc * grub-core/fs/btrfs.c (grub_btrfs_device): New field size.
(read_sblock): Don't attempt to read superblocks outside the disk size.
2012-01-25 15:10:56 +01:00
Vladimir 'phcoder' Serbinenko
ff4479581d * grub-core/fs/nilfs2.c (grub_nilfs2_load_sb): Use device size from
first superblock to find the second one when possible.
2012-01-25 15:09:00 +01:00
Mario Limonciello
d779e9bdac * configure.ac: Add back in test for limits.h. 2012-01-22 16:43:14 +01:00
Vladimir 'phcoder' Serbinenko
b508af6989 Support 4K-sector NTFS.
* include/grub/ntfs.h (GRUB_NTFS_MAX_MFT): Increase to 8.
	(grub_ntfs_data): Remove blocksize.
	* grub-core/fs/ntfs.c (fixup): Fix size comparison.
	Remove data argument. All users updated.
2012-01-20 15:01:35 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
6e0632e28c * grub-core/commands/acpihalt.c: Gettextized.
* grub-core/commands/cacheinfo.c: Likewise.
	* grub-core/commands/cmp.c: Likewise.
	* grub-core/commands/efi/loadbios.c: Likewise.
	* grub-core/commands/gptsync.c: Likewise.
	* grub-core/commands/ieee1275/suspend.c: Likewise.
	* grub-core/commands/legacycfg.c: Likewise.
	* grub-core/commands/memrw.c: Likewise.
	* grub-core/commands/minicmd.c: Likewise.
	* grub-core/commands/parttool.c: Likewise.
	* grub-core/commands/time.c: Likewise.
	* grub-core/commands/videoinfo.c: Likewise.
	* grub-core/disk/geli.c: Likewise.
	* grub-core/disk/i386/pc/biosdisk.c: Likewise.
	* grub-core/disk/luks.c: Likewise.
	* grub-core/disk/lvm.c: Likewise.
	* grub-core/font/font_cmd.c: Likewise.
	* grub-core/fs/zfs/zfscrypt.c: Likewise.
	* grub-core/fs/zfs/zfsinfo.c: Likewise.
	* grub-core/gfxmenu/view.c: Likewise.
	* grub-core/kern/emu/hostdisk.c: Likewise.
	* grub-core/kern/emu/main.c: Likewise.
	* grub-core/kern/emu/misc.c: Likewise.
	* grub-core/kern/emu/mm.c: Likewise.
	* grub-core/kern/mips/arc/init.c: Likewise.
	* grub-core/kern/mips/loongson/init.c: Likewise.
	* grub-core/kern/partition.c: Likewise.
	* grub-core/lib/i386/halt.c: Likewise.
	* grub-core/lib/mips/arc/reboot.c: Likewise.
	* grub-core/lib/mips/loongson/reboot.c: Likewise.
	* grub-core/loader/i386/pc/chainloader.c: Likewise.
	* grub-core/loader/i386/xnu.c: Likewise.
	* grub-core/loader/multiboot.c: Likewise.
	* grub-core/net/bootp.c: Likewise.
	* grub-core/net/net.c: Likewise.
	* grub-core/normal/term.c: Likewise.
	* grub-core/partmap/bsdlabel.c: Likewise.
	* grub-core/parttool/msdospart.c: Likewise.
	* grub-core/term/gfxterm.c: Likewise.
	* grub-core/term/terminfo.c: Likewise.
	* grub-core/video/i386/pc/vbe.c: Likewise.
	* util/grub-menulst2cfg.c: Likewise.
	* util/grub-mkdevicemap.c: Likewise.
	* util/grub-mklayout.c: Likewise.
	* util/grub-mkrelpath.c: Likewise.
	* util/grub-script-check.c: Likewise.
	* util/ieee1275/grub-ofpathname.c: Likewise.
	* util/resolve.c: Likewise.
2011-11-11 21:44:56 +01:00
Vladimir 'phcoder' Serbinenko
e2d22baf41 * grub-core/fs/zfs/zfscrypt.c (GRUB_MOD_INIT), (GRUB_MOD_FINI):
Fix module name.
2011-11-11 17:21:33 +01:00
Vladimir 'phcoder' Serbinenko
53dc859065 * grub-core/fs/ntfs.c (grub_ntfs_read_symlink): Stylistic fix. Remove
leftover debug printf.
2011-11-11 17:18:34 +01:00
Vladimir 'phcoder' Serbinenko
6c1892942d * grub-core/fs/btrfs.c (grub_btrfs_embed): Spelling fix. 2011-11-11 17:13:23 +01:00
Vladimir 'phcoder' Serbinenko
f627652531 Put symlink at the end of the node and fix a potential
memory corruption.

	* grub-core/fs/iso9660.c (grub_fshelp_node): New field have_symlink.
	Make symlink into an array.
	(set_rockridge): Set have_symlink and alloc_dirents.
	(grub_iso9660_read_symlink): Use new layout.
	(grub_iso9660_iterate_dir): Fix memory corruption.
	Use new layout.
	(grub_iso9660_dir): Set have_symlink.
	(grub_iso9660_open): Likewise.
2011-11-10 09:31:06 +01:00
Vladimir 'phcoder' Serbinenko
cb544caa2e * grub-core/fs/zfs/zfs.c (zfs_mount): Fix spurious warning. 2011-11-10 08:43:08 +01:00
Vladimir 'phcoder' Serbinenko
45bd824d2e Fix ZFS memory and resource leaks.
* grub-core/fs/zfs/zfs.c (fill_vdev_info_real): New paramter inserted.
	All users updated.
	Free type on exit.
	(fill_vdev_info): New parameter inserted. All users updated.
	(check_pool_label): Likewise.
	(scan_disk): Likewise.
	(scan_devices): Close non-inserted disks.
	(fzap_iterate): Free l.
	(unmount_device): Free children descripto memory.
2011-11-10 08:38:06 +01:00
Vladimir 'phcoder' Serbinenko
ad9a2f44b4 * grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Fix grub_strncat
argument (access out of bounds).
2011-11-10 08:16:27 +01:00
Vladimir 'phcoder' Serbinenko
6b68db81fc * grub-core/fs/btrfs.c (grub_btrfs_read_logical): Fix RAID10 logic for
>= 6 drives.
2011-11-10 08:09:33 +01:00
Vladimir 'phcoder' Serbinenko
8a5a3a5b5a Fix several memory leaks.
* grub-core/fs/btrfs.c (grub_btrfs_dir): Fix memory leak.
	* grub-core/fs/cpio.c (grub_cpio_find_file): Likewise.
	(grub_cpio_dir): Likewise.
	* grub-core/fs/fat.c (grub_fat_label): Likewise.
	* grub-core/fs/jfs.c (grub_jfs_label): Likewise.
	* grub-core/fs/romfs.c (grub_romfs_close): Likewise.
	(grub_romfs_label): Likewise.
	* grub-core/fs/squash4.c (squash_mount): Use zalloc for safety.
	(squash_unmount): New function.
	(grub_squash_dir): Fix memory leak.
	(grub_squash_open): Likewise.
	(grub_squash_read): Likewise.
	(grub_squash_mtime): Likewise.
	* grub-core/fs/xfs.c (grub_xfs_open): Likewise.
	* grub-core/fs/zfs/zfs.c (check_pool_label): Likewise.
	* util/grub-fstest.c (fstest): Likewise.
2011-11-09 15:01:58 +01:00
Vladimir 'phcoder' Serbinenko
52b656c037 Several AFFS fixes.
* grub-core/fs/affs.c (grub_affs_bblock): Replace flags with version.
	(GRUB_AFFS_FLAG_FFS): Removed.
	(GRUB_AFFS_SYMLINK_SIZE): Likewise.
	(GRUB_AFFS_FILETYPE_DIR): Make positive and unsigned.
	(GRUB_AFFS_FILETYPE_DIR), (GRUB_AFFS_FILETYPE_REG): Fix a mix-up.
	(grub_fshelp_node): Make block 32-bit.
	Add block_cache and last_block_cache.
	(grub_affs_read_block): Fill and use block cache.
	(grub_affs_read_file): Removed.
	(grub_affs_mount): Zero-fill node. Fix version check. Don't reread
	boot block.
	(grub_affs_read_symlink): Fix symlink size. Add a \0 at the end for
	safety.
	(grub_affs_iterate_dir): Use more appropriate types. Zero-fill allocated
	space.
	(grub_affs_close): Free block cache.
	(grub_affs_read): Use grub_fshelp_read_file directly.
2011-11-09 11:43:39 +01:00
Vladimir 'phcoder' Serbinenko
438a746a3f * grub-core/fs/zfs/zfs.c (read_dva): Issue an error if read failed
with no error set.
2011-11-08 20:03:06 +01:00
Vladimir 'phcoder' Serbinenko
3ae17eb83c Fix potential problem with calling zfs_to_cpu and cpu_to_be in a row.
* grub-core/fs/zfs/zfscrypt.c (grub_zfs_decrypt_real): Use explicit
	byteswap when needed.
2011-11-08 19:44:18 +01:00
Vladimir 'phcoder' Serbinenko
4a19b6017d Fix ZFS crypto error types.
* grub-core/fs/zfs/zfscrypt.c (grub_ccm_decrypt): Fix return type.
	(grub_gcm_decrypt): Likewise.
	(grub_zfs_load_key_real): Fix error code type. Handle possible error
	from PBKDF2.
2011-11-08 16:07:27 +01:00
Vladimir 'phcoder' Serbinenko
9f421dd1f0 * grub-core/fs/zfs/zfs.c (zap_iterate): Remove set but not used
variable.
2011-11-08 11:32:19 +01:00
Vladimir 'phcoder' Serbinenko
3084ede4c7 ZFS crypto support.
* Makefile.util.def (libgrubmods): Add grub-core/fs/zfs/zfscrypt.c.
	* grub-core/Makefile.core.def (zfscrypt): New module.
	* grub-core/fs/zfs/zfs.c (subvolume): New structure.
	(grub_zfs_data): Replace mdn with subvol. Put case_insensitivity inside
	it. All users updated.
	(grub_zfs_decrypt): New var.
	(grub_zfs_load_key): Likewise.
	(zio_checksum_functions): Add SHA256+MAC.
	(zio_checksum_verify): Handle incomplete comparison due to MAC.
	(zio_read): Handle encrypted blocks.
	(zap_verify): Remove incorrect check.
	(fzap_iterate): Handle non-standard fzap.
	(zap_iterate): Likewise.
	(zap_iterate_u64): New function.
	(dnode_get_fullpath): Load keys.
	* grub-core/fs/zfs/zfscrypt.c: New file.
	* grub-core/lib/crypto.c (grub_crypto_cipher_close): Removed.
	(grub_crypto_ecb_encrypt): Make input const.
	* include/grub/crypto.h (grub_crypto_cipher_close): Inline.
	(grub_crypto_ecb_encrypt): Make input const.
	(GRUB_CIPHER_AES): New macro.
	* include/grub/zfs/dmu.h (dmu_object_type): Add DMU_OT_DSL_KEYCHAIN.
	* include/grub/zfs/dsl_dir.h (dsl_dir_phys): Add keychain.
	* include/grub/zfs/spa.h (grub_zfs_endian): Moved from here ...
	* include/grub/zfs/zfs.h (grub_zfs_endian): ... here. Added GURB_ZFS_
	prefix. All users updated.
	(grub_zfs_add_key): New proto.
	(grub_zfs_decrypt): Likewise.
	(grub_zfs_load_key): Likewise.
	* include/grub/zfs/zio.h (zio_checksum): Add SHA256+MAC.
	* util/grub-fstest.c (options): Add -K option.
	(argp_parser): Likewise.
2011-11-06 21:44:48 +01:00
Vladimir 'phcoder' Serbinenko
ae9a20d973 Small cleanup 2011-11-06 21:08:32 +01:00
Vladimir 'phcoder' Serbinenko
bc1de0bc26 GCM support 2011-11-06 21:05:25 +01:00
Vladimir 'phcoder' Serbinenko
d99b3726e5 Support ZFS subvolumes with multiple keys 2011-11-06 17:13:38 +01:00
Vladimir 'phcoder' Serbinenko
ed746949af ZFS passphrase support 2011-11-06 16:30:52 +01:00
Vladimir 'phcoder' Serbinenko
f003a8c5e7 Move ZFS crypto to separate module 2011-11-06 15:18:25 +01:00
Vladimir 'phcoder' Serbinenko
2cdc899567 ZFS crypto key adding 2011-11-06 14:44:29 +01:00
Vladimir 'phcoder' Serbinenko
1bc7cc1b4d First part of zfs-crypto. CCM support with 0-filled keys 2011-11-06 13:18:27 +01:00
Vladimir 'phcoder' Serbinenko
b632b404e0 Support zle compression on ZFS.
* grub-core/fs/zfs/zfs.c (zle_decompress): New function.
	(decomp_table): Add zle.
	* include/grub/zfs/zio.h (zio_compress): Add zle.
2011-11-05 14:50:53 +01:00
Vladimir 'phcoder' Serbinenko
c7ba4f6984 Support BtrFS embedding.
* grub-core/fs/btrfs.c (grub_btrfs_embed) [GRUB_UTIL]: New function.
	(grub_btrfs_fs) [GRUB_UTIL]: Set embed.
	* include/grub/fs.h (grub_fs) [GRUB_UTIL]: New field embed.
	* util/grub-setup.c (setup): Use fs embedding if available.
	Add additional sanity check.
2011-11-05 14:47:25 +01:00
Vladimir 'phcoder' Serbinenko
c2fd16cacb Support third redundancy strip on raidz3.
* grub-core/fs/zfs/zfs.c (recovery): Add Gauss for general case.
	Return error on singularity. All users updated.
	(read_device): Don't stop on 3rd failure on raidz3.
2011-11-04 15:19:23 +01:00
Vladimir 'phcoder' Serbinenko
8622923b66 Support case-insensitive ZFS subvolumes.
* grub-core/fs/zfs/zfs.c (mzap_lookup): New parameter case_insensitive.
	All users updated.
	(zap_hash): Likewise.
	(name_cmp): New function.
	(zap_leaf_array_equal): New parameter case_insensitive.
	All users updated.
	(zap_leaf_lookup): Likewise.
	(fzap_lookup): Likewise.
	(zap_lookup): Likewise.
	(dnode_get_path): New parameter case_insensitive. Retrieve case
	sensitiviness of a volume. All users updated.
	(dnode_get_fullpath): New parameter case_insensitive.
	All users updated.
	(grub_zfs_dir): Set info.case_insensitiveness.
2011-11-04 13:44:56 +01:00
Vladimir 'phcoder' Serbinenko
95f2e86095 Support second redundancy strip on raidz(2,3).
* grub-core/fs/zfs/zfs.c (powx): New array.
	(powx_inv): Likewise.
	(poly): New const.
	(xor_out): New function.
	(gf_mul): Likewise.
	(recovery): Likewise.
	(read_device): Use second redundancy strip.
2011-11-04 13:36:08 +01:00
Vladimir 'phcoder' Serbinenko
9d9b3d2f02 * grub-core/fs/ufs.c (grub_ufs_mtime) [MODE_UFS2]: Check mtime field
as well.
2011-11-03 15:00:45 +01:00
Vladimir 'phcoder' Serbinenko
7d0ac93163 Make reiserfs label retrieval similar to other *_label functions.
* grub-core/fs/reiserfs.c (grub_reiserfs_superblock): New field label.
	(REISERFS_MAX_LABEL_LENGTH): Removed.
	(REISERFS_LABEL_OFFSET): Likewise.
	(grub_reiserfs_label): Rewritten.
2011-11-03 14:57:34 +01:00
Vladimir 'phcoder' Serbinenko
f92ece7d45 * grub-core/fs/nilfs2.c (grub_nilfs2_mtime): Use correct superblock
field.
2011-11-03 14:52:59 +01:00
Vladimir 'phcoder' Serbinenko
cf5ba824ea * grub-core/fs/zfs/zfs.c (read_device): Support raidz3. 2011-11-03 07:29:35 +01:00
Vladimir 'phcoder' Serbinenko
177440046d * grub-core/fs/zfs/zfs.c (read_device): Add ability to sustain a single
drive failure on both raidz and raidz2.
2011-11-02 23:28:25 +01:00
Vladimir 'phcoder' Serbinenko
aca5aefc7c Fix RAIDZ(2) for >= 5 devices.
* grub-core/fs/zfs/zfs.c (read_device): Fix length formula. Remove
	asize argument. All users updated.
2011-11-02 20:48:04 +01:00
Vladimir 'phcoder' Serbinenko
ce8ca56ed9 Fix RAIDZ(2).
* grub-core/fs/zfs/zfs.c (grub_zfs_device_desc): New member ashift.
	(fill_vdev_info_real): Set ashift.
	(read_device): Rewrite RAIDZ part based on reverse engineering.
2011-11-01 20:05:28 +01:00
Vladimir 'phcoder' Serbinenko
7c01e783dc * grub-core/fs/btrfs.c (grub_btrfs_extent_read): Add sanity check and
don't report potentially unavialiable fields in debug output.
	(find_path): Fix double-free and memory leak.
2011-10-31 13:56:52 +01:00
Vladimir 'phcoder' Serbinenko
ce109e843c Read label on UFS1.
* grub-core/fs/ufs.c (grub_ufs_label): Remove MODE_UFS2 condition.
	(grub_ufs_fs): Always set .label.
2011-10-31 10:52:39 +01:00
Vladimir 'phcoder' Serbinenko
87661123b2 Use shifts in UFS.
* grub-core/fs/ufs.c (UFS_LOG_BLKSZ): New macro.
	(grub_ufs_data): New field log2_blksz.
	(grub_ufs_read_file): Use shifts.
	(grub_ufs_mount): Check block size and logarithm it.
2011-10-31 10:50:43 +01:00
Vladimir 'phcoder' Serbinenko
46bc1dc244 * grub-core/fs/ufs.c (grub_ufs_lookup_symlink): Fix handling of
long symlinks.
2011-10-31 10:40:30 +01:00
Vladimir 'phcoder' Serbinenko
19ee298767 Handle symlinks and long names on tar and cpio.
* grub-core/fs/cpio.c (ATTR_TYPE): New definition.
	(ATTR_FILE): Likewise.
	(ATTR_DIR): Likewise.
	(ATTR_LNK): Likewise.
	(grub_cpio_data) [MODE_USTAR]: New fields linkname and linkname_alloc.
	(grub_cpio_find_file): Fill mode, handle linkname field as well as
	L and K entries.
	(grub_cpio_mount): Zero-fill data.
	(handle_symlink): New function.
2011-10-30 23:06:25 +01:00
Vladimir 'phcoder' Serbinenko
c83a08d84a Fix iso9660 filename limitations and fix memory leaks.
* grub-core/fs/iso9660.c (set_rockridge): Free sua at the end.
	(grub_iso9660_iterate_dir): Fix slash handling in symlinks.
2011-10-30 20:23:05 +01:00
Vladimir 'phcoder' Serbinenko
45cdd3ea37 Fix JFS file name length limitations.
* grub-core/fs/jfs.c (grub_jfs_inode): Fix in-place symlink length.
	(grub_jfs_diropen): Fix maximum filename length.
	(grub_jfs_getent): Fix filename length.
	(grub_jfs_lookup_symlink): Fix size checks.
2011-10-30 20:14:57 +01:00
Vladimir 'phcoder' Serbinenko
eb0b6b45f3 Leverage BFS implementation to read AFS.
* Makefile.util.def (libgrubmods): Add afs.c.
	* grub-core/Makefile.core.def (afs): New module
	* grub-core/fs/afs.c: New file.
	* grub-core/fs/bfs.c [MODE_AFS]: Adapt for AFS.
2011-10-30 16:10:18 +01:00
Vladimir 'phcoder' Serbinenko
80f9f81424 Fix a mistake in previous commit 2011-10-30 14:25:53 +01:00
Vladimir 'phcoder' Serbinenko
785ab8c760 * grub-core/fs/bfs.c: MAcroify and add some necessary sanity checks. 2011-10-30 14:17:44 +01:00
Vladimir 'phcoder' Serbinenko
c4a1628f67 * grub-core/fs/bfs.c: Run indent. 2011-10-30 13:27:53 +01:00
Vladimir 'phcoder' Serbinenko
5825b3794b BFS implementation based on the specification.
* grub-core/fs/bfs.c: New file.
	* Makefile.util.def (libgrubmods): Add bfs.c.
	* grub-core/Makefile.core.def (bfs): New module.
2011-10-30 13:25:51 +01:00
Vladimir 'phcoder' Serbinenko
faba3d163a Remove afs and befs because of copyright problem.
* grub-core/fs/afs.c: Removed.
	* grub-core/fs/afs_be.c: Removed.
	* grub-core/fs/befs.c: Removed.
	* grub-core/fs/befs_be.c: Removed.
	* Makefile.util.def (libgrubkern): Remove afs, afs_be, befs and befs_be.
	* grub-core/Makefile.core.def (afs): Removed.
	(afs_be): Likewise.
	(befs): Likewise.
	(befs_be): Likewise.
2011-10-29 11:29:34 +02:00
Vladimir 'phcoder' Serbinenko
c39224b052 Prefer rockridge over Joliet.
* grub-core/fs/iso9660.c (grub_iso9660_mount): Move rockridge detection
	to ...
	(set_rockridge): ... here.
	(grub_iso9660_mount): Check rockridge on the primary label when
	discovering. Ignore Joliet if Rockridge is present.
2011-10-28 16:26:17 +02:00
Vladimir 'phcoder' Serbinenko
e551115a26 Use shifts in nilfs2.
* grub-core/fs/nilfs2.c (LOG_INODE_SIZE): New definition.
	(LOG_NILFS_DAT_ENTRY_SIZE): Likewise.
	(grub_nilfs2_palloc_entries_per_group): Replace with ...
	(grub_nilfs2_log_palloc_entries_per_group): ... this.
	(grub_nilfs2_palloc_group): Use shifts and bitmasks.
	(grub_nilfs2_entries_per_block): Replaced with ...
	(grub_nilfs2_log_entries_per_block_log): ... this.
	(grub_nilfs2_blocks_per_group): Replaced with ...
	(grub_nilfs2_blocks_per_group_log): ... this.
	(grub_nilfs2_blocks_per_desc_block): Replaced with ...
	(grub_nilfs2_blocks_per_desc_block_log): ... this.
	(grub_nilfs2_palloc_desc_block_offset): Replaced with ...
	(grub_nilfs2_palloc_desc_block_offset_log): ... this.
	(grub_nilfs2_palloc_entry_offset): Replaced ...
	(grub_nilfs2_palloc_entry_offset_log): ... this. Use shifts.
	(grub_nilfs2_dat_translate): Use shifts.
	(grub_nilfs2_read_inode): Likewise.
	(GRUB_MOD_INIT): Ensure that logs are correct.
2011-10-28 16:21:18 +02:00
Vladimir 'phcoder' Serbinenko
564dd58c2a Use shifts in minix filesystem.
* grub-core/fs/minix.c (GRUB_MINIX_ZONESZ): Use log_block_size.
	(GRUB_MINIX_ZONE2SECT): Likewise.
	(grub_minix_data): Replace block_size with log_block_size.
	(grub_minix_read_file): Use shifts.
	(grub_minix_mount): Check block size and take a logarithm.
2011-10-28 16:09:20 +02:00
Vladimir 'phcoder' Serbinenko
ed9ba06dd0 Use shifts in squash4.
* grub-core/fs/squash4.c (grub_squash_data): New field log2_blksz.
	(squash_mount): Check block size and take logarithm.
	(direct_read): Use shifts.
2011-10-28 16:05:16 +02:00
Vladimir 'phcoder' Serbinenko
ad03fe768e Correct befs block counting logic.
* grub-core/fs/afs.c (GRUB_AFS_BLOCKS_PER_DI_RUN): Replaced with...
	(GRUB_AFS_LOG_BLOCKS_PER_DI_RUN): ... this.
	(GRUB_AFS_BLOCKRUN_LOG_SIZE): New definition.
	(grub_afs_read_inode): Use block_shift.
	(RANGE_SHIFT): New definition.
	(grub_afs_read_block): Account for RANGE_SHIFT, emit errors on
	unexpected conditions, use shifts and appropriate types.
	(GRUB_MOD_INIT): Check the value of GRUB_AFS_BLOCKRUN_LOG_SIZE.
2011-10-28 15:59:47 +02:00
Vladimir 'phcoder' Serbinenko
5b1ae25f06 Support BFS (befs) UUID.
* grub-core/fs/afs.c (grub_afs_inode): Make small_data zero-size.
	(grub_afs_small_data_element_header): New struct.
	(grub_afs_read_inode): Read complete inode. Fix ino type while on it.
	(grub_afs_read_attribute) [MODE_BFS]: New function.
	(grub_afs_iterate_dir): Allocate for complete inode.
	(grub_afs_mount): Likewise.
	(grub_afs_uuid) [MODE_BFS]: New function.
	(grub_afs_fs) [MODE_BFS]: Add .uuid.
2011-10-27 20:58:52 +02:00
Vladimir 'phcoder' Serbinenko
f8d82408d9 * grub-core/fs/zfs/zfs.c (read_device): Silence spurious warning.
(zfs_unmount): Fix memory leak.
2011-10-27 20:55:09 +02:00
Vladimir 'phcoder' Serbinenko
5773fb6410 Support NTFS reparse points.
* grub-core/fs/ntfs.c (list_file): Set symlink type when appropriate.
	(symlink_descriptor): New struct.
	(grub_ntfs_read_symlink): New function.
	(grub_ntfs_iterate_dir): Use grub_ntfs_read_symlink.
	(grub_ntfs_open): Likewise.
2011-10-27 03:04:27 +02:00
Vladimir 'phcoder' Serbinenko
91c3fdde0d * include/grub/ntfs.h: Add GRUB_NTFS_ prefix. All users updated. 2011-10-27 02:59:45 +02:00
Vladimir 'phcoder' Serbinenko
52a050751b * grub-core/fs/nilfs2.c (grub_nilfs2_uuid): Add missing field length. 2011-10-27 02:52:54 +02:00
Vladimir 'phcoder' Serbinenko
1869edb5bc ZFS multi-device and version 33 support.
* Makefile.util.def (libgrubkern): Add grub-core/fs/zfs/zfsinfo.c.
	* grub-core/fs/zfs/zfs.c (grub_zfs_device_desc): New struct.
	(grub_zfs_data): Add multidev-ice-related fields.
	(zio_checksum_verify): Zero-pad printed values. Print checksum name.
	(dva_get_offset): Make dva const.
	(zfs_fetch_nvlist): New function.
	(fill_vdev_info_real): Likewise.
	(fill_vdev_info): Likewise.
	(check_pool_label): Likewise.
	(scan_disk): Likewise.
	(scan_devices): Likewise.
	(read_device): Likewise.
	(read_dva): Likewise.
	(zio_read_gang): Use read_dva.
	(zio_read_data): Likewise.
	(zap_leaf_lookup): Add missing endian conversion.
	(zap_verify): Add missing endian conversion. All users updated.
	(fzap_lookup): Likewise.
	(fzap_iterate): Likewise.
	(dnode_get_path): Handle SA bonus.
	(nvlist_find_value): Make input const. All users updated.
	(unmount_device): New function.
	(zfs_unmount): Use unmount_device.
	(zfs_mount): Use scan_disk.
	(zfs_mtime): New function.
	(grub_zfs_open): Handle system attributes.
	(fill_fs_info): Likewise.
	(grub_zfs_dir): Likewise.
	(grub_zfs_fs): Add mtime.
	* grub-core/fs/zfs/zfsinfo.c (print_vdev_info): Add missing return.
	* include/grub/zfs/sa_impl.h (SA_TYPE_OFFSET): New definition.
	(SA_MTIME_OFFSET): Likewise.
	(SA_SYMLINK_OFFSET): Likewise.
	* include/grub/zfs/zfs.h (SPA_VERSION): Increase to 33.
	* util/grub-fstest.c (CMD_ZFSINFO): New enum value.
	(fstest): Support zfsinfo.
	(argp_parser): Likewise.
2011-10-27 02:49:50 +02:00