]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
zfs: Use grub_uint64_t instead of 1ULL in BF64_*CODE() macros
authorGlenn Washburn <development@efficientek.com>
Fri, 5 Mar 2021 00:22:45 +0000 (18:22 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 8 Jun 2021 15:47:43 +0000 (17:47 +0200)
The underlying type of 1ULL does not change across architectures but
grub_uint64_t does. This allows using the BF64_*CODE() macros as
arguments to format string functions that use the PRI* format string
macros that also vary with architecture.

Change the grub_error() call, where this was previously an issue and
temporarily fixed by casting and using a format string literal code,
to now use PRI* macros and remove casting.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/fs/zfs/zfs.c
include/grub/zfs/spa.h

index cf4d2ab189a5e2bd5cdb9bddc05e8769792f5c58..44e4e18147af21f7946707a6bf16d6c7a394c47f 100644 (file)
@@ -1869,8 +1869,9 @@ zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf,
     {
       if (BPE_GET_ETYPE(bp) != BP_EMBEDDED_TYPE_DATA)
        return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-                          "unsupported embedded BP (type=%llu)\n",
-                          (long long unsigned int) BPE_GET_ETYPE(bp));
+                          "unsupported embedded BP (type=%"
+                          PRIuGRUB_UINT64_T ")\n",
+                          BPE_GET_ETYPE (bp));
       lsize = BPE_GET_LSIZE(bp);
       psize = BF64_GET_SB(grub_zfs_to_cpu64 ((bp)->blk_prop, endian), 25, 7, 0, 1);
     }
index 8dd1fa8e348f0e88a4a01f64c87fa63064eb23e0..5afbe4ecd424a077dbf73108dcb36693b63b59df 100644 (file)
@@ -44,9 +44,9 @@
  * General-purpose 32-bit and 64-bit bitfield encodings.
  */
 #define        BF32_DECODE(x, low, len)        P2PHASE((x) >> (low), 1U << (len))
-#define        BF64_DECODE(x, low, len)        P2PHASE((x) >> (low), 1ULL << (len))
+#define        BF64_DECODE(x, low, len)        P2PHASE((x) >> (low), ((grub_uint64_t) 1) << (len))
 #define        BF32_ENCODE(x, low, len)        (P2PHASE((x), 1U << (len)) << (low))
-#define        BF64_ENCODE(x, low, len)        (P2PHASE((x), 1ULL << (len)) << (low))
+#define        BF64_ENCODE(x, low, len)        (P2PHASE((x), ((grub_uint64_t) 1) << (len)) << (low))
 
 #define        BF32_GET(x, low, len)           BF32_DECODE(x, low, len)
 #define        BF64_GET(x, low, len)           BF64_DECODE(x, low, len)