diff --git a/ChangeLog b/ChangeLog index 8a7c7665f..a36426a71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ -20013-07-14 Massimo Maggi +2013-07-14 Massimo Maggi + + * 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 Massimo Maggi * grub-core/fs/zfs/zfsinfo.c (print_vdev_info): Fix RAIDZ reporting. diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c index 3d57978f4..beea55509 100644 --- a/grub-core/fs/zfs/zfs.c +++ b/grub-core/fs/zfs/zfs.c @@ -490,15 +490,11 @@ uberblock_verify (uberblock_phys_t * ub, grub_uint64_t offset, if (grub_zfs_to_cpu64 (uber->ub_magic, GRUB_ZFS_LITTLE_ENDIAN) == UBERBLOCK_MAGIC - && grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_LITTLE_ENDIAN) > 0 - && grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_LITTLE_ENDIAN) - <= SPA_VERSION) - endian = GRUB_ZFS_LITTLE_ENDIAN; + && SPA_VERSION_IS_SUPPORTED(grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_LITTLE_ENDIAN))) + endian = GRUB_ZFS_LITTLE_ENDIAN; if (grub_zfs_to_cpu64 (uber->ub_magic, GRUB_ZFS_BIG_ENDIAN) == UBERBLOCK_MAGIC - && grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_BIG_ENDIAN) > 0 - && grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_BIG_ENDIAN) - <= SPA_VERSION) + && SPA_VERSION_IS_SUPPORTED(grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_BIG_ENDIAN))) endian = GRUB_ZFS_BIG_ENDIAN; if (endian == GRUB_ZFS_UNKNOWN_ENDIAN) @@ -845,13 +841,13 @@ check_pool_label (struct grub_zfs_data *data, } grub_dprintf ("zfs", "check 8 passed\n"); - if (version > SPA_VERSION) + if (!SPA_VERSION_IS_SUPPORTED(version)) { grub_free (nvlist); return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "too new version %llu > %llu", (unsigned long long) version, - (unsigned long long) SPA_VERSION); + (unsigned long long) SPA_VERSION_BEFORE_FEATURES); } grub_dprintf ("zfs", "check 9 passed\n"); diff --git a/include/grub/zfs/zfs.h b/include/grub/zfs/zfs.h index e326c8b2f..429424820 100644 --- a/include/grub/zfs/zfs.h +++ b/include/grub/zfs/zfs.h @@ -36,8 +36,12 @@ typedef enum grub_zfs_endian /* * On-disk version number. */ -#define SPA_VERSION 33ULL - +#define SPA_VERSION_INITIAL 1ULL +#define SPA_VERSION_BEFORE_FEATURES 33ULL +#define SPA_VERSION_FEATURES 5000ULL +#define SPA_VERSION_IS_SUPPORTED(v) \ + (((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \ + ((v) == SPA_VERSION_FEATURES)) /* * The following are configuration names used in the nvlist describing a pool's * configuration.