Commit graph

597 commits

Author SHA1 Message Date
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
Vladimir 'phcoder' Serbinenko
8563e2a670 Small multidevice fix 2011-10-27 02:36:10 +02:00
Vladimir 'phcoder' Serbinenko
34c5965451 Support version 33 including symlinks 2011-10-27 02:04:04 +02:00
Vladimir 'phcoder' Serbinenko
11e50e923a merge mainline into zfs 2011-10-26 19:26:24 +02:00
Vladimir 'phcoder' Serbinenko
5587329c91 ZFS fixes.
* grub-core/fs/zfs/zfs.c (fzap_iterate): Fix handling of indexes
	sharing the same block. Iterate over correct number of indices.
	(dnode_get_path): Handle symlinks correctly.
2011-10-26 17:32:21 +02:00
Vladimir 'phcoder' Serbinenko
c0584900ee * grub-core/fs/jfs.c (grub_jfs_sblock): Fix offset to volname. 2011-10-26 00:35:41 +02:00
Vladimir 'phcoder' Serbinenko
67e2bd718e Read label on HFS+.
* grub-core/fs/hfsplus.c (grub_hfsplus_cmp_catkey_id): New function.
	(grub_hfsplus_btree_search): Fix types.
	(grub_hfsplus_label): Implement.
2011-10-26 00:32:17 +02:00
Vladimir 'phcoder' Serbinenko
e9cc6b7b0e * grub-core/fs/ntfs.c (grub_ntfs_uuid): Fix a memory leak. 2011-10-26 00:29:46 +02:00
Vladimir 'phcoder' Serbinenko
19832ddb37 * grub-core/fs/fat.c (grub_fat_uuid): Make uppercase to match Linux. 2011-10-25 21:53:57 +02:00
Vladimir 'phcoder' Serbinenko
66b4085033 Fix symlink handling on iso9660.
* grub-core/fs/iso9660.c (grub_fshelp_node): Remove dir_off. Add symlink
	All users updated.
	(grub_iso9660_susp_iterate): Accept zero-size iterate.
	(grub_iso9660_read_symlink): Moved most of code ...
	(grub_iso9660_iterate_dir): ... here. Fill node->symlink.
2011-10-25 21:52:48 +02:00
Vladimir 'phcoder' Serbinenko
e12119495d Support multi-extent iso files.
* grub-core/fs/iso9660.c (grub_iso9660_data): Remove first_sector.
	Add node.
	(grub_fshelp_node): Revamp. All users updated.
	(FLAG_*): New enum.
	(read_node): New function.
	(grub_iso9660_susp_iterate): Use read_node. Receive a node as argument.
	All users updated.
	(grub_iso9660_mount): Don't attempt to read sua when there is none.
	(get_node_size): New function.
	(grub_iso9660_iterate_dir): Use read_node. Agglomerate multi-extent
	entries.
	Fix memory leak on . and ..
	(grub_iso9660_read): Use read_node.
	(grub_iso9660_close): Free node.
2011-10-25 18:18:58 +02:00
Vladimir 'phcoder' Serbinenko
d4888031f2 Fix tar 4G limit and handle paths containing dot.
* grub-core/fs/cpio.c (grub_cpio_data): Use grub_off_t for offsets.
	(canonicalize): New function.
	(grub_cpio_find_file): Use canonicalize. Store offs in
	grub_disk_addr_t.
	(grub_cpio_dir): Use grub_disk_addr_t.
	(grub_cpio_open): Likewise.
2011-10-25 18:12:36 +02:00
Vladimir 'phcoder' Serbinenko
9f12e664cc Fix handling of uncompressed blocks on squashfs and break 4G limit.
* grub-core/fs/squash4.c (grub_squash_super): Add block_size. Remove
	unused flags.
	(grub_squash_inode): Add long_file and block_size.
	(grub_squash_cache_inode): New struct.
	(grub_squash_dirent): Make types into enum.
	(SQUASH_TYPE_LONG_REGULAR): New type.
	(grub_squash_frag_desc): Add field size.
	(SQUASH_BLOCK_FLAGS): New enum.
	(grub_squash_data): Use grub_squash_cache_inode.
	(grub_fshelp_node): Make ino_chunk 64-bit.
	(read_chunk): Minor argument change. All users updated.
	(squash_mount): Use correct le_to_cpu.
	(grub_squash_open): Handle LONG_REGULAR.
	(direct_read): New function.
	(grub_squash_read_data): Handle blocks correctly.
2011-10-25 18:09:00 +02:00
Vladimir 'phcoder' Serbinenko
f4d9b64bba * grub-core/fs/romfs.c (grub_romfs_open): Add missing return. 2011-10-25 17:38:22 +02:00
Vladimir 'phcoder' Serbinenko
5bbd28b8ce Fix 2G limit on ZFS.
* grub-core/fs/zfs/zfs.c (zio_checksum_verify): Use more appropriate
	types.
	(uberblock_verify): Likewise.
	(dmu_read): Likewise.
	(grub_zfs_read): Likewise. Remove invalid cast.
2011-10-24 21:33:35 +02:00
Vladimir 'phcoder' Serbinenko
68c72069d9 * grub-core/fs/jfs.c (grub_jfs_blkno): Use more appropriate types.
(grub_jfs_blkno): Fix incorrect shift.
	(grub_jfs_read_file): Use more appropriate types.
2011-10-24 17:02:02 +02:00
Vladimir 'phcoder' Serbinenko
6e536dc8ad Support triple indirect on minix2 and minix3.
* grub-core/fs/minix.c (grub_minix_inode) [MODE_MINIX2 || MODE_MINIX3]:
	Declare triple_indir_zone.
	(grub_minix_get_file_block) [MODE_MINIX2 || MODE_MINIX3]: Handle triple
	indirect.
2011-10-24 16:16:28 +02:00
Vladimir 'phcoder' Serbinenko
e0864e7ab7 Minix FS fixes.
* grub-core/fs/minix.c (GRUB_MINIX_INODE_SIZE): Size is always 32-bit.
	(grub_minix_inode) [!MODE_MINIX2 && !MODE_MINIX3]: Make size 32-bit.
	Rename ctime to mtime. All users updated.
	(grub_minix_get_file_block): Fix types and double indirect computations.
2011-10-24 10:45:47 +02:00
Vladimir 'phcoder' Serbinenko
89481cabbd * grub-core/fs/fat.c (grub_fat_label) [MODE_EXFAT]: Set *label to 0
if no label is found.
	(grub_fat_iterate_dir): Fix file size type.
	(grub_fat_iterate_dir): Likewise.
2011-10-24 01:31:06 +02:00
Vladimir 'phcoder' Serbinenko
a374751b16 ExFAT support.
* Makefile.util.def (libgrubmods.a): Add grub-core/fs/exfat.c.
	* grub-core/Makefile.core.def (exfat): New module.
	* grub-core/fs/exfat.c: New file.
	* grub-core/fs/fat.c (GRUB_FAT_DIR_ENTRY_SIZE): Removed.
	(GRUB_FAT_ATTR_*): Make into an enum.
	(GRUB_FAT_ATTR_LONG_NAME) [MODE_EXFAT]: Removed.
	(GRUB_FAT_ATTR_VALID) [MODE_EXFAT]: Remove GRUB_FAT_ATTR_VOLUME_ID.
	(GRUB_FAT_ATTR_VOLUME_ID) [MODE_EXFAT]: Removed.
	(GRUB_FAT_MAXFILE): Removed.
	(grub_exfat_bpb) [MODE_EXFAT]: New struct.
	(grub_current_fat_bpb_t): New type.
	(grub_fat_dir_entry) [MODE_EXFAT]: New struct.
	(grub_fat_dir_node) [MODE_EXFAT]: New struct.
	(grub_fat_dir_node_t): New type.
	(grub_fat_data) [MODE_EXFAT]: Remove root_sector and num_root_sectors.
	(fat_log2) [MODE_EXFAT]: Removed.
	(grub_fat_mount): Use grub_current_fat_bpb_t. Add some sanity checks.
	(grub_fat_mount) [MODE_EXFAT]: Handle ExFAT.
	(grub_fat_iterate_dir) [MODE_EXFAT]: New function.
	(grub_fat_find_dir) [MODE_EXFAT]: Handle ExFAT.
	(grub_fat_label) [MODE_EXFAT]: New function.
	(grub_fat_fs) [MODE_EXFAT]: Set name to "exfat" and
	reserved_first_sector to 0.
2011-10-19 20:19:25 +02:00
Vladimir 'phcoder' Serbinenko
366e34fa5a Fix few obvious type discrepancies.
* grub-core/fs/affs.c (grub_affs_read_file): Use grub_off_t for offset.
	* grub-core/fs/afs.c (grub_afs_read_file): Likewise.
	* grub-core/fs/fshelp.c (grub_fshelp_find_file): Remove leftover
	variable.
	* grub-core/fs/hfs.c (grub_hfs_read_file): Use grub_off_t for offset
	and connected types.
	* grub-core/fs/nilfs2.c (grub_nilfs2_read_file): Use grub_off_t for
	offset.
	(grub_nilfs2_iterate_dir): Use grub_off_t for fpos.
	* grub-core/fs/sfs.c (grub_sfs_read_file): Use grub_off_t for offset.
	* grub-core/fs/ufs.c (grub_ufs_read_file): Use grub_off_t for offset
	and connected types.
2011-10-16 11:57:48 +02:00
Vladimir 'phcoder' Serbinenko
3b619ae116 * grub-core/fs/xfs.c (grub_xfs_inode): New field fork_offset.
(GRUB_XFS_INO_AGBITS): Make into inline function.
	(GRUB_XFS_INO_INOINAG): Likewise.
	(GRUB_XFS_INO_AG): Likewise.
	(GRUB_XFS_FSB_TO_BLOCK): Likewise.
	(GRUB_XFS_EXTENT_OFFSET): Likewise.
	(GRUB_XFS_EXTENT_BLOCK): Likewise.
	(GRUB_XFS_EXTENT_SIZE): Likewise.
	(GRUB_XFS_ROUND_TO_DIRENT): Likewise.
	(GRUB_XFS_NEXT_DIRENT): Likewise.
	(grub_xfs_read_block): Rewrite the btree parsing. Fixes invalid BMAP.
	(grub_xfs_read_file): Fix offset type.
2011-10-16 11:48:54 +02:00
Vladimir 'phcoder' Serbinenko
d891955241 Fix overflow with >2GiB file on HFS+. >4GiB wasn't tested.
* grub-core/fs/hfsplus.c (grub_hfsplus_btree): Use more appropriate
	types.
	(grub_hfsplus_btree_recoffset): Likewise.
	(grub_hfsplus_btree_recptr): Likewise.
	(grub_hfsplus_find_block): Likewise.
	(grub_hfsplus_btree_search): Likewise.
	(grub_hfsplus_read_block): Likewise.
	(grub_hfsplus_read_file): Likewise.
	(grub_hfsplus_mount): Likewise.
	(grub_hfsplus_btree_iterate_node): Likewise.
	(grub_hfsplus_btree_search): Likewise.
	(grub_hfsplus_iterate_dir): Likewise.
	(grub_hfsplus_read): A small code simplification.
2011-10-14 22:41:21 +02:00
Szymon Janc
0e2b7e39f2 * grub-core/fs/btrfs.c: Include <minilzo.h> instead of "minilzo.h".
* grub-core/io/lzopio.c: Likewise.
2011-10-03 22:25:06 +02:00
Szymon Janc
139d67a82f * grub-core/fs/btrfs.c: Fix code style regressions. 2011-10-03 21:50:32 +02:00
Szymon Janc
579c12fbb4 * grub-core/fs/btrfs.c: Some minor cleanups. 2011-08-24 11:24:10 +02:00
Szymon Janc
00b98c9b2e * grub-core/fs/btrfs.c (grub_btrfs_lzo_decompress): Random fixes and some
cleanup.
2011-08-23 19:49:01 +02:00
Szymon Janc
540c000f0d merge trunk 2011-08-20 09:49:15 +02:00
Szymon Janc
4334690fbf More work on LZO for btrfs support. Some fixes and code refactoring. 2011-08-20 02:05:08 +02:00
Vladimir 'phcoder' Serbinenko
43526629e5 * grub-core/fs/jfs.c (grub_jfs_read_file): New parameter ino.
All users updated.
	(grub_jfs_lookup_symlink): Use correct starting inode.
2011-08-16 23:10:38 +02:00
Szymon Janc
095f077e6d Add support for LZO compression in btrfs.
* Makefile.util.def (libgrubmods.a): Add minilzo.c and add required flags
to cflags in cppflags.
* Makefile.core.def (btrfs): Likewise.
* grub-core/fs/btrfs.c: Include minilzo.h.
(grub_btrfs_superblock): Add sectorsize, nodesize, leafsize, stripsize and
dummy5 field.
(GRUB_BTRFS_COMPRESSION_LZO): New define.
(grub_btrfs_extent_read): Add support for LZO compression type.
2011-08-14 11:46:05 +02:00
Szymon Janc
b6085f3236 * grub-core/fs/btrfs.c: Some code style fixes. 2011-08-14 11:42:53 +02:00
Yves Blusseau
9e322ce8de Display the path of the file when file is not found
* grub-core/fs/fat.c: Display the filename when file is not found.
	* grub-core/fs/fshelp.c: Likewise.
	* grub-core/fs/hfs.c: Likewise.
	* grub-core/fs/jfs.c: Likewise.
	* grub-core/fs/minix.c: Likewise.
	* grub-core/fs/ufs.c: Likewise.
	* grub-core/fs/btrfs.c: Likewise.
	* grub-core/commands/i386/pc/play.c: Likewise.
2011-06-26 21:48:52 +02:00
Szymon Janc
cbf597afb1 * grub-core/commands/cmp.c (grub_cmd_cmp): Remove unnecessary NULL
pointer checks before calling grub_free().
	* grub-core/commands/wildcard.c (match_devices): Likewise.
	* grub-core/commands/wildcard.c (match_files): Likewise.
	* grub-core/fs/cpio.c (grub_cpio_dir): Likewise.
	* grub-core/fs/cpio.c (grub_cpio_open): Likewise.
	* grub-core/fs/udf.c (grub_udf_read_block): Likewise.
	* grub-core/fs/xfs.c (grub_xfs_read_block): Likewise.
	* grub-core/loader/efi/chainloader.c (grub_cmd_chainloader): Likewise.
	* grub-core/normal/cmdline.c (grub_cmdline_get): Likewise.
	* grub-core/script/yylex.l (grub_lexer_unput): Likewise.
	* grub-core/video/readers/jpeg.c (grub_video_reader_jpeg): Likewise.
	* grub-core/video/readers/png.c (grub_png_output_byte): Likewise.
2011-06-26 17:17:41 +02:00
Manoel Rebelo Abranches
90162423e9 Network infrastructure.
The ARP protocol was made by Paulo Pinatti <ppinatti@br.ibm.com>

	* include/grub/net/arp.h: New file.
	* include/grub/net/device.h: Likewise.
	* include/grub/net/ethernet.h: Likewise.
	* include/grub/net/ip.h: Likewise.
	* include/grub/net/netbuff.h: Likewise.
	* include/grub/net/tftp.h: Likewise.
	* include/grub/net/udp.h: Likewise.
	* include/grub/ieee1275/ofnet.h: Likewise.
	* include/grub/emu/export.h: Likewise.
	* include/grub/net.h: Likewise.
	* grub-core/net/arp.c: Likewise.
	* grub-core/net/ethernet.c: Likewise.
	* grub-core/net/ip.c: Likewise.
	* grub-core/net/udp.c: Likewise.
	* grub-core/net/tftp.c: Likewise.
	* grub-core/net/netbuff.c: Likewise.
	* grub-core/net/net.c: Likewise.
	* grub-core/net/drivers/emu/emunet.c: Likewise.
	* grub-core/net/drivers/ieee1275/ofnet.c: Likewise.
	* grub-core/Makefile.am (KERNEL_HEADER_FILES): Add net.h, ofnet.h and
	export.h.
	* grub-core/Makefile.core.def (net): New module.
	(tftp): Likewise.
	(ofnet): Likewise.
	(emunet): Likewise.
	* grub-core/commands/ls.c (grub_ls_list_devices) [!GRUB_UTIL]: List
	network protocols.
	* grub-core/kern/device.c (grub_net_open) : New variable.
	(grub_device_open): Handle network device.
	(grub_device_close): Likewise.
	* grub-core/kern/file.c (grub_file_net_seek) : New variable.
	(grub_grubnet_fini): Likewise.
	(grub_file_seek): Seek in network device.
	* grub-core/kern/fs.c (grub_fs_probe): Handle network devices.
	* grub-core/kern/ieee1275/init.c (grub_machine_set_prefix): Handle
	network root.
	(grub_machine_fini): Call grub_grubnet_fini.
	* grub-core/kern/ieee1275/openfw.c (grub_ieee1275_parse_args): Handle
	network.
	(grub_ieee1275_get_aliasdevname): New function.
	* grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_get_mbi_size):
	Add unofficial Solaris network info.
	(grub_multiboot_make_mbi): Likewise.
	* grub-core/fs/i386/pc/pxe.c: Moved from here ...
	* grub-core/net/i386/pc/pxe.c: ...here. Adapted for new design.
	* include/grub/device.h (grub_fs): Removed.
	* include/grub/err.h (grub_err_t): Add network-related values.
	* include/grub/i386/pc/pxe.h: Removed bootp parts.
	* include/grub/ieee1275/ieee1275.h (grub_ofnetcard_data): New struct.
	(grub_ieee1275_get_aliasdevname): New proto.
	* include/grub/net.h: Rewritten.

	Also-By: Paulo Pinatti <ppinatti@br.ibm.com>

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2011-06-24 22:16:05 +02:00
Vladimir 'phcoder' Serbinenko
98e2f50661 * grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Skip . and .. 2011-06-24 13:02:49 +02:00
Vladimir 'phcoder' Serbinenko
290766fb77 ZFS zlib support
* grub-core/fs/zfs/zfs.c (zlib_decompress): New function.
	(decomp_table): Add zlib entries.
	(zio_read): USe 8 bits for compression function rather than 3.
	* include/grub/zfs/zio.h (zio_compress): Add zlib values.
2011-06-24 00:31:29 +02:00
Vladimir 'phcoder' Serbinenko
005dd67cb6 * grub-core/disk/ahci.c: Add missing license statements.
* grub-core/fs/romfs.c: Likewise.
	* grub-core/lib/ia64/setjmp.S: Likewise.
	* grub-core/loader/i386/pc/freedos.c: Likewise.
	* grub-core/loader/ia64/efi/linux.c: Likewise.
	* grub-core/video/colors.c: Likewise.
	* include/grub/dl.h (GRUB_MOD_DEP): New macro.
2011-06-24 00:29:21 +02:00
Manoel R. Abranches
85fd555441 Merge Mainline. 2011-05-27 00:23:33 -03:00
Colin Watson
09728256a8 * grub-core/fs/squash4.c: Add missing GRUB_MOD_LICENSE. 2011-05-18 17:16:59 +02:00
Vladimir 'phcoder' Serbinenko
bf947d36e3 Use full 64-bit division.
* grub-core/kern/misc.c (grub_divmod64_full): Renamed to ...
	(grub_divmod64): ... this.
	* include/grub/misc.h (grub_divmod64): Removed. All users switch to full
	version.
2011-05-18 15:35:19 +02:00
Vladimir 'phcoder' Serbinenko
1e4b43901a * grub-core/fs/fat.c: Include grub/fat.h.
(grub_fat_bpb): Moved to ...
	* include/grub/fat.h (grub_fat_bpb): ... here. New file.
	* grub-core/loader/i386/pc/chainloader.c: Include grub/fat.h and
	grub/ntfs.h.
	* include/grub/i386/pc/chainloader.h (grub_chainloader_flags_t):
	Moved from here...
	* grub-core/loader/i386/pc/chainloader.c (grub_chainloader_flags_t): ...
	here.
	* grub-core/loader/i386/pc/chainloader.c (grub_chainloader_patch_bpb):
	New function.
	(grub_chainloader_cmd): Patch BPB if --bpb is given.
	(GRUB_MOD_INIT): Show --bpb.
	* grub-core/loader/i386/pc/ntldr.c (grub_cmd_ntldr): Patch BPB.
	* grub-core/normal/main.c (features): New variable.
	(GRUB_MOD_INIT): Set feature_* variables.
	* include/grub/i386/pc/chainloader.h (grub_chainloader_patch_bpb): New
	proto.
	* include/grub/ntfs.h (grub_ntfs_bpb): New field bios_drive.
2011-05-18 12:48:14 +02:00
Vladimir 'phcoder' Serbinenko
b756f75f07 Several FS mtime support.
* grub-core/fs/affs.c (grub_affs_time): New struct.
	(grub_affs_file): New field mtime.
	(grub_fshelp_node): Changed 'block' and 'parent' to more appropriate
	type. Removed 'size'. New field 'di'. All users updated.
	(grub_affs_mount): Simplify checsum checking.
	(grub_affs_iterate_dir): New helper grub_affs_create_node.
	(grub_affs_dir): Handle mtime.
	* grub-core/fs/cpio.c (grub_cpio_find_file): Handle mtime.
	(grub_cpio_dir): Likewise.
	* grub-core/fs/hfs.c (grub_hfs_dirrec): New fields 'ctime' and 'mtime'.
	(grub_hfs_filerec): New field mtime.
	(grub_hfs_dir): Handle mtime.
	(grub_hfs_mtime): New function.
	(grub_hfs_fs): Register grub_hfs_mtime.
	* grub-core/fs/iso9660.c (grub_iso9660_date2): New struct.
	(grub_iso9660_dir): New field mtime.
	(grub_fshelp_node): New field dirent.
	(iso9660_to_unixtime): New function.
	(iso9660_to_unixtime2): Likewise.
	(grub_iso9660_read_symlink): Use node->dirent.
	(grub_iso9660_iterate_dir): Likewise.
	(grub_iso9660_dir): Set mtime.
	(grub_iso9660_mtime): New function.
	(grub_iso9660_fs): Register grub_iso9660_mtime.
	* grub-core/fs/jfs.c (grub_jfs_time): New struct.
	(grub_jfs_inode): New fields atime, ctime and mtime.
	(grub_jfs_dir): Set mtime.
	* grub-core/fs/minix.c (grub_minix_dir): Likewise.
	* grub-core/fs/ntfs.c (list_file): Set mtime.
	(grub_ntfs_dir): Likewise.
	* grub-core/fs/reiserfs.c (grub_fshelp_node): New field 'mtime'.
	(grub_reiserfs_iterate_dir): Set mtime.
	(grub_reiserfs_dir): Likewise.
	* grub-core/fs/sfs.c (grub_sfs_obj): New field mtime.
	(grub_fshelp_node): Likewise.
	(grub_sfs_iterate_dir): Set mtime.
	(grub_sfs_dir): Likewise.
	* grub-core/fs/udf.c (grub_udf_dir): Set mtime.
	* grub-core/fs/xfs.c (grub_xfs_time): New struct.
	(grub_xfs_inode): New fields atime, mtime, ctime.
	(grub_xfs_dir): Set mtime.
	* include/grub/datetime.h (grub_datetime2unixtime): New function.
	* include/grub/hfs.h (grub_hfs_sblock): New fields ctime and mtime.
	* include/grub/ntfs.h (grub_fshelp_node): New field mtime.

	Support UDF symlinks.

	* grub-core/fs/udf.c (grub_udf_iterate_dir): Handle symlinks.
	(grub_ufs_read_symlink): New function. All users updated.

	Check amiga partmap checksum.

	* grub-core/partmap/amiga.c (grub_amiga_rdsk): Pad to 128 bytes.
	(grub_amiga_partition): Likewise.
	(amiga_partition_map_checksum): New function.
	(amiga_partition_map_iterate): Check checksum.
2011-05-15 12:23:54 +02:00
Vladimir 'phcoder' Serbinenko
5470225d58 ROMFS support.
* Makefile.util.def (libgrubmods.a): Add romfs.
	* grub-core/Makefile.core.def (romfs): New module.
	* grub-core/fs/romfs.c: New file.
2011-05-15 12:01:03 +02:00
Vladimir 'phcoder' Serbinenko
d4680a3556 Squashfs v4 support.
* Makefile.util.def (libgrubmods.a): Add squash4.
	* grub-core/Makefile.core.def (squash4): New module.
	* grub-core/fs/squash4.c: New file.
	* grub-core/io/gzio.c (grub_gzio): New members disk_input_off,
	disk_input_start, disk_input.
	(get_byte): Handle disk_input.
	(grub_zlib_disk_read): New function.
	* include/grub/deflate.h (grub_zlib_disk_read): New proto.
2011-05-15 11:58:22 +02:00
Feiran Zheng
bcb18e748f * Makefile.util.def (libgrubmods.a): Add minix3.
* grub-core/Makefile.core.def (minix3): New module.
	* grub-core/fs/minix.c (GRUB_MINIX_MAGIC) [MODE_MINIX3]: New value.
	(GRUB_MINIX_BSIZE): Removed.
	(GRUB_MINIX_INODE_DIR_BLOCKS): New definition. All users updated.
	(grub_minix_ino_t): New type.
	(grub_minix_le_to_cpu_ino): New macro.
	(GRUB_MINIX_ZONE2SECT): New definition. All users updated.
	(grub_minix_sblock) [MODE_MINIX3]: Change for minix3.
	(grub_minix_data): New field block_size.
	(grub_minix_read_file): Handle 64-bit correctly.
	* grub-core/fs/minix3.c: New file.

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2011-05-15 11:53:16 +02:00
Vladimir 'phcoder' Serbinenko
983b414d77 * grub-core/fs/btrfs.c (grub_btrfs_read_logical): Silence spurious
warning. Move variables before code while on it.
2011-05-15 10:23:02 +02:00
Manoel Rebelo Abranches
90eb90e24c Merge mainline. 2011-05-05 12:12:22 -03:00
Colin Watson
bd405bbc55 * grub-core/fs/i386/pc/pxe.c (grub_pxefs_dir): Return
GRUB_ERR_BAD_FS rather than GRUB_ERR_IO if the disk is not a pxe
disk; otherwise grub_fs_probe will not fall back to the next
filesystem.
(grub_pxefs_open): Likewise, for consistency.
Reported and tested by: Ezekiel Grave.
2011-05-03 18:03:05 +01:00
Colin Watson
cff5e5e58d grub-core/fs/squash4.c: Add missing GRUB_MOD_LICENSE. 2011-04-21 10:37:45 +01:00
Colin Watson
2e0fbe00d2 merge trunk 2011-04-21 10:36:09 +01:00
Vladimir 'phcoder' Serbinenko
34faa5955a * grub-core/fs/btrfs.c (grub_btrfs_read_logical): Support huge
chunks.
	* include/grub/err.h (grub_err_t): New enum value GRUB_ERR_BUG.
2011-04-18 23:10:19 +02:00
Vladimir 'phcoder' Serbinenko
fe6b2cbaa6 BtrFS support. Written by me (Vladimir) with important bugfixes and
even more important testing by Colin.

	* Makefile.util.def (libgrubmods.a): Add crc.c and gzio.c
	* grub-core/Makefile.core.def (btrfs): Add crc.c.
	* grub-core/fs/btrfs.c: Stub replaced with real implementation.
	* grub-core/io/gzio.c (grub_gzio): New fields mem_input_size,
	mem_input_off and mem_input. All users updated to accept in-RAM input.
	(gzio_seek): New function.
	(test_zlib_header): Likewise.
	(grub_gzio_read): Likewise.
	(grub_zlib_decompress): Likewise.
	* grub-core/kern/emu/getroot.c (grub_find_root_device_from_mountinfo):
	Accept partial and non-virtual mounts.
	(grub_guess_root_device): Do rescanning after device_from_mountinfo to
	avoid receiving /dev/dm-X as device.
	* grub-core/kern/emu/misc.c (grub_make_system_path_relative_to_its_root):
	Handle bind and partial mounts.
	* grub-core/lib/crc.c: New file.
	* include/grub/deflate.h: Likewise.
	* include/grub/emu/misc.h (grub_find_root_device_from_mountinfo): New
	proto.
	* include/grub/lib/crc.h: New file.
2011-04-11 23:26:41 +02:00
Vladimir 'phcoder' Serbinenko
e745cf0ca6 Implement automatic module license checking according to new GNU
guidelines.

	* grub-core/kern/dl.c (grub_dl_check_license): New function.
	(grub_dl_load_core): Use grub_dl_check_license.
	* include/grub/dl.h (GRUB_MOD_SECTION): New macro.
	(GRUB_MOD_LICENSE): Likewise.
	(GRUB_MOD_DUAL_LICENSE): Likewise.
	All modules updated.
2011-04-11 23:01:51 +02:00
Vladimir 'phcoder' Serbinenko
b6929f5ef5 Transform exfat printfs into dprintfs 2011-04-11 20:38:08 +02:00
Vladimir 'phcoder' Serbinenko
48fe18dcf2 exfat reader 2011-04-11 18:13:00 +02:00
Colin Watson
2a9bc0169e * grub-core/fs/btrfs.c (grub_btrfs_fs) [GRUB_UTIL]: Set
reserved_first_sector to 1.  btrfs reserves plenty of space for boot
loaders.
Reported by: Gene Cumm.  Fixes Ubuntu bug #757446.
2011-04-11 16:06:37 +01:00
Vladimir 'phcoder' Serbinenko
8fc88523dd Add minix3 to util filesystems 2011-04-11 14:09:02 +02:00
Vladimir 'phcoder' Serbinenko
65f01628e1 unify minix3 and minix2 inode declarations 2011-04-11 08:56:42 +02:00
Vladimir 'phcoder' Serbinenko
58ee1408a8 Fix an error in minix inode declaration 2011-04-11 08:53:28 +02:00
Feiran Zheng
3dd3dd335f minix3fs support 2011-04-11 08:16:13 +02:00