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.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-10-27 02:49:50 +02:00
commit 1869edb5bc
7 changed files with 879 additions and 315 deletions

View file

@ -29,6 +29,9 @@ typedef struct sa_hdr_phys {
} sa_hdr_phys_t;
#define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 16, 3, 0)
#define SA_TYPE_OFFSET 0x0
#define SA_SIZE_OFFSET 0x8
#define SA_MTIME_OFFSET 0x38
#define SA_SYMLINK_OFFSET 0xa0
#endif /* _SYS_SA_IMPL_H */

View file

@ -28,7 +28,7 @@
/*
* On-disk version number.
*/
#define SPA_VERSION 28ULL
#define SPA_VERSION 33ULL
/*
* The following are configuration names used in the nvlist describing a pool's
@ -112,12 +112,14 @@ grub_err_t grub_zfs_fetch_nvlist (grub_device_t dev, char **nvlist);
grub_err_t grub_zfs_getmdnobj (grub_device_t dev, const char *fsfilename,
grub_uint64_t *mdnobj);
char *grub_zfs_nvlist_lookup_string (char *nvlist, char *name);
char *grub_zfs_nvlist_lookup_nvlist (char *nvlist, char *name);
int grub_zfs_nvlist_lookup_uint64 (char *nvlist, char *name,
char *grub_zfs_nvlist_lookup_string (const char *nvlist, const char *name);
char *grub_zfs_nvlist_lookup_nvlist (const char *nvlist, const char *name);
int grub_zfs_nvlist_lookup_uint64 (const char *nvlist, const char *name,
grub_uint64_t *out);
char *grub_zfs_nvlist_lookup_nvlist_array (char *nvlist, char *name,
char *grub_zfs_nvlist_lookup_nvlist_array (const char *nvlist,
const char *name,
grub_size_t index);
int grub_zfs_nvlist_lookup_nvlist_array_get_nelm (char *nvlist, char *name);
int grub_zfs_nvlist_lookup_nvlist_array_get_nelm (const char *nvlist,
const char *name);
#endif /* ! GRUB_ZFS_HEADER */