* 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.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-12-13 11:33:02 +01:00
parent f138623a60
commit fcd232b74e
4 changed files with 104 additions and 47 deletions

View file

@ -69,7 +69,8 @@ typedef struct zap_leaf_phys {
* with the ZAP_LEAF_CHUNK() macro.
*/
grub_uint16_t l_hash[1];
grub_uint16_t l_hash[0];
grub_properly_aligned_t l_entries[0];
} zap_leaf_phys_t;
typedef union zap_leaf_chunk {

View file

@ -30,7 +30,7 @@
typedef struct zio_eck {
grub_uint64_t zec_magic; /* for validation, endianness */
zio_cksum_t zec_cksum; /* 256-bit checksum */
} zio_eck_t;
} __attribute__ ((packed)) zio_eck_t;
/*
* Gang block headers are self-checksumming and contain an array