Commit graph

1243 commits

Author SHA1 Message Date
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
11ee4389e2 Use a power of generator representation of GF(256) multiplication group
to save space time and complexity.

	* grub-core/disk/raid6_recover.c (raid6_table1): Removed.
	(raid6_table2): Likewise.
	(powx): New array.
	(powx_inv): Likewise.
	(poly): New const.
	(grub_raid_block_mul): Replace with ...
	(grub_raid_block_mulx): ...this.
	(grub_raid6_init_table): Rewritten.
	(grub_raid6_recover): Use power of generator representation.
2011-11-04 13:27:50 +01:00
Vladimir 'phcoder' Serbinenko
09e2763fb1 * grub-core/disk/raid6_recover.c (grub_raid6_recover): Get start_sector
for the right device.
2011-11-04 13:22:38 +01:00
Vladimir 'phcoder' Serbinenko
dbd3a32e43 * grub-core/disk/raid.c (scan_devices): Don't derference NULL on whole
disk.
	* grub-core/disk/lvm.c (do_lvm_scan): Likewise.
2011-11-04 13:15:29 +01:00
Vladimir 'phcoder' Serbinenko
1e51cabd7b * grub-core/gettext/gettext.c (grub_gettext_init_ext): Exit if local is
NULL.
2011-11-03 16:04:26 +01:00
Vladimir 'phcoder' Serbinenko
158dc1ea26 XZ CRC64 and SHA256 support.
* Makefile.util.def (libgrubmods): Add crc64.c.
	* grub-core/Makefile.core.def (crc64): New module.
	* grub-core/lib/crc64.c: New file.
	* grub-core/lib/xzembed/xz_dec_stream.c (xz_dec_hash)
	[!GRUB_EMBED_DECOMPRESSOR]: Rename crc32_context to hash_context.
	Fix the type.
	(MAX_HASH_SIZE): New define.
	(xz_dec) [!GRUB_EMBED_DECOMPRESSOR]: Add generic hash fields.
	(dec_block) [!GRUB_EMBED_DECOMPRESSOR]: Handle non-crc32 hashes.
	(index_update) [!GRUB_EMBED_DECOMPRESSOR]: Likewise.
	(dec_index) [!GRUB_EMBED_DECOMPRESSOR]: Likewise.
	(crc32_validate) [!GRUB_EMBED_DECOMPRESSOR]: Rename to ...
	(hash_validate) [!GRUB_EMBED_DECOMPRESSOR]: ... this.
	Handle non-crc32 hashes.
	(hashes) [!GRUB_EMBED_DECOMPRESSOR]: New variable.
	(dec_stream_header): Handle non-crc32 hashes.
	(dec_stream_footer): Likewise.
	(dec_block_header): Likewise.
	(dec_main): Likewise.
	(xz_dec_init): Likewise.
	(xz_dec_reset): Likewise.
	(xz_dec_end): Likewise.
	* util/import_gcry.py: Add CRC64 line.
2011-11-03 15:13:30 +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
94ef05c265 * grub-core/loader/mips/linux.c (loongson_machtypes): Fix fuloong type
string.
2011-10-30 19:30:04 +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
6563f63dfd * grub-core/disk/raid.c (scan_devices): Check partition.
* grub-core/disk/lvm.c (do_lvm_scan): Likewise.
2011-10-28 15:52:15 +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
8e32442e80 * grub-core/commands/xnu_uuid.c (grub_cmd_xnu_uuid): Support
-l argument. Add newline at the end if printing.
	(GRUB_MOD_INIT): Document -l.
2011-10-27 02:55:07 +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