Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1lHyFn-0004ZN-CV for mharc-grub-devel@gnu.org; Thu, 04 Mar 2021 19:23:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHyFi-0004OF-0t for grub-devel@gnu.org; Thu, 04 Mar 2021 19:23:35 -0500 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]:45212) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lHyFW-0006VU-4y for grub-devel@gnu.org; Thu, 04 Mar 2021 19:23:33 -0500 Received: by mail-qt1-x835.google.com with SMTP id j3so412239qtj.12 for ; Thu, 04 Mar 2021 16:23:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R1bctJF5hRqwbQytKWvaiNg2Icli5wITvStZ5uBhro0=; b=eTWUSUFi2aCoNd+DCAwn15C0CFfaGipnjm4z45gqiUz6lYWEspv5GN0xHQo1JRjWKY pwnlEpV6WVyifNoL9xC3dmVSQ3Arcnig6Af5ql8cUXPrMmP6Ig+QkzuwiuHz3YK9GIUu 8W7syj0KRjFPo1LZXwZeyHzifEGrktizrwMIuuGJYMlG+kvlWwbAsNV5c6fUTJBx1L0p f6iZXvjOhWktUEY6r1P8vOjPMdV4oUI10vxKFlpfn24RGI4rTAM4i3xnBt3qT85ZywsB JTo5RDzw/4g5ywAEEWSX0Wz0NFbv1TIxVehCwtJuMLCkxnatub2nSS+IYCtNWD5y+OER A+PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R1bctJF5hRqwbQytKWvaiNg2Icli5wITvStZ5uBhro0=; b=lL7KLiEAvCwMvP3eglbBvGqJjZyJB4U0AHX2pgMbE90JxWsgK29F5KvuPE9SkPp4AK dIOeIAaJx5xWWWClkGp7WOJcBaOGcNR1s5QSce3l8HJ1meYMMwhhb6fTCgb3eQuj9x1o SyJ36+rRNAQ5ft7hhqCkzzAcEgQdapip4tG+cR4CocI6fx5p/ZgE8SiwJh284rNoD9hd cky8B2l9GSKjQehBAwsc6en9Q7ErHU+fy1Rc9+US1Nq/sj3Goby15S8ksMHh3y+xf0R4 nXllv2cBBC2AUQW2+uIZpYY2drU4TPYoUB6NuuNBup0iKWJZiJGyQFsNnyOwrCJz/MXd /VDQ== X-Gm-Message-State: AOAM533whXxw92Njgoo+epQPwolHreHAcSeQJbmJc945TfvId3xbRqrt rS65wxmREhTBy7SoU2b/WF1ZV6Xfmp2ciw== X-Google-Smtp-Source: ABdhPJwYsmu5aTOD814vTDb88T1EbgK+3muiZNEKGn4ONK9nwAieGssKztUDbHLXYhT8l5ymnHN4mA== X-Received: by 2002:ac8:5912:: with SMTP id 18mr6845176qty.18.1614903799757; Thu, 04 Mar 2021 16:23:19 -0800 (PST) Received: from localhost.localdomain ([2605:a601:aac5:3700:9763:81c2:19e4:8a8f]) by smtp.gmail.com with ESMTPSA id 75sm674558qkd.114.2021.03.04.16.23.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 16:23:19 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: 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 Message-Id: <004d029b5f2ba313fa0c7953788d6459647e3555.1614903653.git.development@efficientek.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::835; envelope-from=development@efficientek.com; helo=mail-qt1-x835.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Mar 2021 00:23:36 -0000 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 --- 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