[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 14/14] zfs: Use grub_uint64_t instead of 1ULL in BF64_*CODE ma
From: |
Glenn Washburn |
Subject: |
[PATCH v6 14/14] zfs: Use grub_uint64_t instead of 1ULL in BF64_*CODE macros |
Date: |
Thu, 4 Mar 2021 18:22:45 -0600 |
The underlying type of grub_uint64_t changes across architectures, but 1ULL
does not. This allows using these 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>
---
grub-core/fs/zfs/zfs.c | 5 +++--
include/grub/zfs/spa.h | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
index f9e755197..a266a936e 100644
--- a/grub-core/fs/zfs/zfs.c
+++ b/grub-core/fs/zfs/zfs.c
@@ -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);
}
diff --git a/include/grub/zfs/spa.h b/include/grub/zfs/spa.h
index 8dd1fa8e3..5afbe4ecd 100644
--- a/include/grub/zfs/spa.h
+++ b/include/grub/zfs/spa.h
@@ -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)
--
2.27.0
- [PATCH v6 07/14] efi: Format string error in grub_error, (continued)
- [PATCH v6 07/14] efi: Format string error in grub_error, Glenn Washburn, 2021/03/04
- [PATCH v6 02/14] error: grub_error missing format string argument, Glenn Washburn, 2021/03/04
- [PATCH v6 06/14] pgp: Format code for grub_error is incorrect, Glenn Washburn, 2021/03/04
- [PATCH v6 10/14] error: Use format code PRIxGRUB_UINT64_T for 64-bit arg in grub_error, Glenn Washburn, 2021/03/04
- [PATCH v6 08/14] error: Use PRI* macros to get correct format string code across architectures, Glenn Washburn, 2021/03/04
- [PATCH v6 01/14] misc: Format string for grub_error should be a literal, Glenn Washburn, 2021/03/04
- [PATCH v6 03/14] error: grub_error format string add missing format code, Glenn Washburn, 2021/03/04
- [PATCH v6 05/14] grub_error: Use format code PRIuGRUB_SIZE for variables of type grub_size_t, Glenn Washburn, 2021/03/04
- [PATCH v6 09/14] error: Use format code PRIxGRUB_UINT64_T for 64-bit uint argument in grub_error, Glenn Washburn, 2021/03/04
- [PATCH v6 04/14] dmraid_nvidia: Format string error in grub_error, Glenn Washburn, 2021/03/04
- [PATCH v6 14/14] zfs: Use grub_uint64_t instead of 1ULL in BF64_*CODE macros,
Glenn Washburn <=
- [PATCH v6 11/14] error: Use format code PRIuGRUB_UINT64_T for 64-bit typed fileblock in grub_error, Glenn Washburn, 2021/03/04
- [PATCH v6 13/14] error: Do compile-time format string checking on grub_error, Glenn Washburn, 2021/03/04
- [PATCH v6 12/14] error: Use format code llu for 64-bit uint bp->blk_prop in grub_error, Glenn Washburn, 2021/03/04
- Re: [PATCH v6 00/14] error: Do compile-time format string checking on grub>, Daniel Kiper, 2021/03/05