Commit graph

559 commits

Author SHA1 Message Date
Vladimir 'phcoder' Serbinenko
68714c4392 * grub-core/fs/zfs/zfs.c (nvlist_next_nvpair): Fix improper cast. 2013-07-14 16:24:18 +02:00
Vladimir 'phcoder' Serbinenko
af211babd8 * grub-core/fs/zfs/zfs_lz4.c: Remove restrict keyword. 2013-07-14 16:05:14 +02:00
Massimo Maggi
0036f02d7b * grub-core/fs/zfs/zfs.c (nvlist_next_nvpair): Error is encode_size
<= 0.
2013-07-14 14:22:02 +02:00
Massimo Maggi
6d0ddff3d9 * grub-core/fs/zfs/zfs.c: Split nvpair iterators into separate
functions.
2013-07-14 14:17:36 +02:00
Massimo Maggi
038016f48a * grub-core/fs/zfs/zfs_lz4.c: New file.
* grub-core/fs/zfs/zfs.c: Tie up lz4 decompression.
2013-07-14 14:12:58 +02:00
Massimo Maggi
776bdce291 * grub-core/fs/zfs/zfs.c: Check for feature compatibility. 2013-07-14 14:10:42 +02:00
Massimo Maggi
c71dbd40a9 * grub-core/fs/zfs/zfs.c (uberblock_verify): Accept version 5000.
(check_pool_label): Likewise.
	* include/grub/zfs/zfs.h: Rewrite SPA_VERSION_* macros.
2013-07-14 14:01:27 +02:00
Massimo Maggi
53618046da * grub-core/fs/zfs/zfsinfo.c (print_vdev_info): Fix RAIDZ reporting. 2013-07-14 13:49:01 +02:00
Vladimir 'phcoder' Serbinenko
4aa237c8a4 Fix casts when compiling coreboot-specific code for 64-bit EFI. 2013-06-16 04:19:38 +02:00
Vladimir 'phcoder' Serbinenko
93d8479b70 Don't try to detect cbfs on *-emu. 2013-06-16 04:06:41 +02:00
Vladimir 'phcoder' Serbinenko
5027af38cf Support for cbfs. Also factor out the part which is common
for all archives to a separate module. This splits tar from cpio
	as they are very different but keeps cpio, cpio_be, odc and newc
	together since they're very similar.
2013-06-16 00:06:13 +02:00
Vladimir 'phcoder' Serbinenko
3d84cb1793 Move flavour-specific parts out of common cpio.c file and
rename remaining to cpio_common.c
2013-06-14 20:44:59 +02:00
Vladimir 'phcoder' Serbinenko
d128901ace * grub-core/fs/hfspluscomp.c (grub_hfsplus_compress_attr): Add packed
attribute since structure is not necessarily aligned.
2013-05-11 09:59:59 +02:00
Vladimir 'phcoder' Serbinenko
8098f65556 Compressed HFS+ support. 2013-05-07 15:46:17 +02:00
Vladimir 'phcoder' Serbinenko
fb2666b560 Simplify few strings. 2013-05-07 11:44:15 +02:00
Vladimir 'phcoder' Serbinenko
ce50dbd746 Add new 'proc' filesystem framework and put luks_script into it. 2013-03-24 13:05:59 +01:00
Vladimir 'phcoder' Serbinenko
e73ba5e8ca * grub-core/fs/zfs/zfs.c: Fix incorrect handling of special volumes. 2013-03-22 22:18:38 +01:00
Vladimir 'phcoder' Serbinenko
3dac5878ec * grub-core/fs/hfs.c (grub_hfs_read_file): Avoid divmod64 since the
maximum size is 4G - 1 on hfs
2013-03-10 18:27:53 +01:00
Vladimir 'phcoder' Serbinenko
fc3ff2a2ad * grub-core/fs/fshelp.c (grub_fshelp_log2blksize): Remove now unused
function.
2013-03-10 14:27:04 +01:00
Andrey Borzenkov
81455e8e7a * grub-core/fs/iso9660.c (add_part): Remove always_inline attribute
causing gcc error with gcc 4.7.1.
2013-03-07 09:11:36 +01:00
Vladimir 'phcoder' Serbinenko
b46d4213d5 * grub-core/fs/hfs.c: Remove nested functions. 2013-03-02 11:31:00 +01:00
Vladimir 'phcoder' Serbinenko
e114c3cc54 * grub-core/fs/hfsplus.c (grub_hfsplus_btree_iterate_node): Pass
the context through.
	(grub_hfsplus_iterate_dir): Move nested function out of its parent.
2013-03-01 14:02:27 +01:00
Vladimir 'phcoder' Serbinenko
4fc40ff8f3 * grub-core/fs/jfs.c: Remove nested functions. 2013-02-28 10:51:32 +01:00
Vladimir 'phcoder' Serbinenko
be42d97a79 * grub-core/fs/minix.c: Remove nested functions. 2013-02-28 10:50:01 +01:00
Vladimir 'phcoder' Serbinenko
99373ce472 * grub-core/fs/iso9660.c: Remove nested functions. 2013-02-28 10:30:35 +01:00
Colin Watson
4eb8b75659 Remove nested functions from disk and file read hooks.
* include/grub/disk.h (grub_disk_read_hook_t): New type.
	(struct grub_disk): Add read_hook_data member.
	* include/grub/file.h (struct grub_file): Likewise.
	* include/grub/fshelp.h (grub_fshelp_read_file): Add read_hook_data
	argument.

	Update all callers.
2013-02-27 17:19:15 +01:00
Vladimir 'phcoder' Serbinenko
3f078c0fca * grub-core/fs/fshelp.c (find_file): Set oldnode to zero after
freeing it.
2013-02-01 21:51:09 +01:00
Vladimir 'phcoder' Serbinenko
cf94fd6209 * grub-core/fs/xfs.c (grub_xfs_read_block): Fix computation in presence
of extended attributes.
2013-01-30 09:22:43 +01:00
Colin Watson
fc524edf65 Remove nested functions from filesystem directory iterators.
* include/grub/fs.h (grub_fs_dir_hook_t): New type.
(struct grub_fs.dir): Add hook_data argument.

Update all implementations and callers.
2013-01-21 01:33:46 +00:00
Colin Watson
25239370fd Remove nested functions from device iterators.
* include/grub/arc/arc.h (grub_arc_iterate_devs_hook_t): New type.
(grub_arc_iterate_devs): Add hook_data argument.
* include/grub/ata.h (grub_ata_dev_iterate_hook_t): New type.
(struct grub_ata_dev.iterate): Add hook_data argument.
* include/grub/device.h (grub_device_iterate_hook_t): New type.
(grub_device_iterate): Add hook_data argument.
* include/grub/disk.h (grub_disk_dev_iterate_hook_t): New type.
(struct grub_disk_dev.iterate): Add hook_data argument.
(grub_disk_dev_iterate): Likewise.
* include/grub/gpt_partition.h (grub_gpt_partition_map_iterate):
Likewise.
* include/grub/msdos_partition.h (grub_partition_msdos_iterate):
Likewise.
* include/grub/partition.h (grub_partition_iterate_hook_t): New
type.
(struct grub_partition_map.iterate): Add hook_data argument.
(grub_partition_iterate): Likewise.
* include/grub/scsi.h (grub_scsi_dev_iterate_hook_t): New type.
(struct grub_scsi_dev.iterate): Add hook_data argument.

Update all callers.
2013-01-20 15:52:15 +00:00
Vladimir 'phcoder' Serbinenko
535714bdcf * grub-core/fs/ntfs.c: Ue more appropriate types.
* grub-core/fs/ntfscomp.c: Likewise.
	* include/grub/ntfs.h: Likewise.
2013-01-11 07:41:05 +01:00
Vladimir 'phcoder' Serbinenko
c6f1e92f0b * grub-core/fs/minix.c (grub_minix_read_file): Simplify arithmetics. 2013-01-07 11:27:18 +01:00
Vladimir 'phcoder' Serbinenko
f797ec85a0 * grub-core/fs/ext2.c (grub_ext2_read_block): Use shifts rather than
divisions.
2013-01-05 18:37:34 +01:00
Vladimir 'phcoder' Serbinenko
033d0b4b0b * grub-core/fs/ntfs.c: Eliminate useless divisions in favor of shifts.
* grub-core/fs/ntfscomp.c: Likewise.
	* include/grub/ntfs.h (grub_ntfs_data): Replace spc with log_spc.
	(grub_ntfs_comp): Likewise.
2013-01-05 17:36:04 +01:00
Vladimir 'phcoder' Serbinenko
21d1b9a029 * grub-core/fs/nilfs2.c (-grub_nilfs2_palloc_groups_per_desc_block):
Rename to ...
	(grub_nilfs2_palloc_log_groups_per_desc_block): ... this. Return log
	of groups_per_block. All users updated.
2013-01-05 16:53:04 +01:00
Vladimir 'phcoder' Serbinenko
dadddb7665 * grub-core/fs/iso9660.c (grub_iso9660_susp_iterate): Avoid hang if
entry->len = 0.
2013-01-03 21:27:00 +01:00
Vladimir 'phcoder' Serbinenko
cc1ce5f9b4 * grub-core/fs/ufs.c (grub_ufs_dir): Stop if direntlen is 0 to avoid
infinite loop on corrupted FS.
2012-12-10 09:22:40 +01:00
Vladimir 'phcoder' Serbinenko
e77a16ca02 Fix big-endian mtime.
* grub-core/fs/ufs.c (grub_ufs_inode): Split improperly attached
	together sec and usec.
	(grub_ufs_dir): Use correct byteswapping for UFS time.
2012-12-08 21:14:08 +01:00
Vladimir 'phcoder' Serbinenko
d9c48c7b7c Support big-endian UFS1.
* Makefile.util.def (libgrubmods): Add ufs_be.c
	* grub-core/Makefile.core.def (ufs1_be): New module.
	* grub-core/fs/ufs_be.c: New file.
	* grub-core/fs/ufs.c: Declare grub_ufs_to_le* and use them throughout
	the file.
2012-12-08 20:56:58 +01:00
Vladimir 'phcoder' Serbinenko
b78c312722 * grub-core/fs/affs.c (grub_affs_mount): Support AFFS bootblock in
sector 1.
2012-09-26 09:33:41 +02:00
Vladimir 'phcoder' Serbinenko
a40994852d * grub-core/fs/xfs.c (grub_xfs_read_block): Make keys a const pointer. 2012-09-05 08:45:07 +02:00
Vladimir 'phcoder' Serbinenko
073b57bb8e * grub-core/fs/ext2.c: Experimental support for 64-bit. 2012-07-02 11:28:42 +02:00
Vladimir 'phcoder' Serbinenko
c59bdff709 * grub-core/fs/fshelp.c (grub_fshelp_find_file): Don't free oldnode if
it's equal to currnode. This can happen with "" symlink.
2012-06-27 19:37:40 +02:00
Vladimir 'phcoder' Serbinenko
9f3fc8835f Handle slash in HFS label.
* grub-core/fs/hfs.c (macroman_to_utf8): New argument slash_translate.
	(grub_hfs_dir): Tanslate slash.
	(grub_hfs_label): Don't translate slash.
2012-06-26 14:53:35 +02:00
Vladimir 'phcoder' Serbinenko
fb022c79ef * grub-core/fs/fat.c (grub_fat_iterate_dir_next): Don't stop on a space
character but still remove trainling spaces.
	(grub_fat_label): Ignore archive flag.
2012-06-25 17:47:52 +02:00
Vladimir 'phcoder' Serbinenko
918a25179c Restructure FAT driver to avoid hook in label reading as it hits a
GCC bug.

	* include/grub/err.h (grub_err_t): New enum value GRUB_ERR_EOF.
	* grub-core/fs/fat.c (grub_fat_iterate_context): New struct.
	(grub_fat_iterate_dir): Split into ...
	(grub_fat_iterate_init): ... this, ...
	(grub_fat_iterate_fini): ... this, ...
	(grub_fat_iterate_dir_next): ... and this. All users updated.
2012-06-20 23:29:28 +02:00
Vladimir 'phcoder' Serbinenko
7de5e20af4 * grub-core/fs/hfs.c (grub_hfs_dir): Use memset instead of
initialisation to avoid __bzero reference.
2012-05-28 17:54:18 +02:00
Vladimir 'phcoder' Serbinenko
9da59c3275 * grub-core/fs/bfs.c (iterate_in_b_tree): Add missing NESTED_FUNC_ATTR.
(grub_bfs_dir): Likewise.
2012-05-27 15:31:54 +02:00
Vladimir 'phcoder' Serbinenko
20dd511c8c Handle "." and ".." on squashfs.
* grub-core/fs/squash4.c (grub_fshelp_node): New field stsize.
	Make inode numbers into stack.
	(grub_squash_read_symlink): Use stack.
	(grub_squash_iterate_dir): Use stack. Create "." and ".." nodes.
	(make_root_node): Fill stack.
	(grub_squash_open): Use stack.
2012-05-27 13:44:48 +02:00
Vladimir 'phcoder' Serbinenko
8b43f587ae * grub-core/fs/jfs.c (grub_jfs_find_file): Handle "." and "..". 2012-05-27 01:03:26 +02:00
Vladimir 'phcoder' Serbinenko
80a3dc3fb4 * grub-core/fs/ntfs.c (list_file): Set mtime to correct value. 2012-05-27 01:00:46 +02:00
Vladimir 'phcoder' Serbinenko
47e297d4a4 * grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Don't skip "." and
"..".
2012-05-27 00:58:48 +02:00
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