void-packages/srcpkgs/grub/patches/zfs.patch

56 lines
2.0 KiB
Diff
Raw Normal View History

2014-08-07 17:24:03 +02:00
--- grub-core/fs/zfs/zfs.c
+++ 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");
--- include/grub/zfs/zfs.h
+++ include/grub/zfs/zfs.h
@@ -36,8 +36,13 @@ 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 5000ULL
+#define SPA_VERSION_FEATURES 5000ULL
+#define SPA_VERSION_IS_SUPPORTED(v) \
+ (((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
+ ((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
/*
* The following are configuration names used in the nvlist describing a pool's
* configuration.