Commit graph

225 commits

Author SHA1 Message Date
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