From: Thomas Weißschuh Date: Wed, 31 May 2023 10:47:03 +0000 (+0200) Subject: blkzone: don't take address of struct blk_zone X-Git-Tag: v2.39.1~66 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=66fac3e71f9dcb4f3f1b04d523008068173e27f7;p=thirdparty%2Futil-linux.git blkzone: don't take address of struct blk_zone Older versions of GCC do not know the warning so they warn about the unknown ignored warning. As struct blk_zone is only 64 bytes anyway just copy it. Signed-off-by: Thomas Weißschuh --- diff --git a/sys-utils/blkzone.c b/sys-utils/blkzone.c index ff6eff10d7..81191e1bc5 100644 --- a/sys-utils/blkzone.c +++ b/sys-utils/blkzone.c @@ -271,19 +271,12 @@ static int blkzone_report(struct blkzone_control *ctl) break; for (i = 0; i < zi->nr_zones; i++) { -/* - * blk_zone_report hasn't been packed since https://github.com/torvalds/linux/commit/b3e7e7d2d668de0102264302a4d10dd9d4438a42 - * was merged. See https://github.com/util-linux/util-linux/issues/1083 - */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Waddress-of-packed-member" - const struct blk_zone *entry = &zi->zones[i]; -#pragma GCC diagnostic pop - unsigned int type = entry->type; - uint64_t start = entry->start; - uint64_t wp = entry->wp; - uint8_t cond = entry->cond; - uint64_t len = entry->len; + const struct blk_zone entry = zi->zones[i]; + unsigned int type = entry.type; + uint64_t start = entry.start; + uint64_t wp = entry.wp; + uint8_t cond = entry.cond; + uint64_t len = entry.len; uint64_t cap; if (!len) { @@ -292,9 +285,9 @@ static int blkzone_report(struct blkzone_control *ctl) } if (has_zone_capacity(zi)) - cap = zone_capacity(entry); + cap = zone_capacity(&entry); else - cap = entry->len; + cap = entry.len; if (only_capacity_sum) { capacity_sum += cap; @@ -303,7 +296,7 @@ static int blkzone_report(struct blkzone_control *ctl) ", cap 0x%06"PRIx64", wptr 0x%06"PRIx64 " reset:%u non-seq:%u, zcond:%2u(%s) [type: %u(%s)]\n"), start, len, cap, (type == 0x1) ? 0 : wp - start, - entry->reset, entry->non_seq, + entry.reset, entry.non_seq, cond, condition_str[cond & (ARRAY_SIZE(condition_str) - 1)], type, type_text[type]); } else { @@ -311,7 +304,7 @@ static int blkzone_report(struct blkzone_control *ctl) ", wptr 0x%06"PRIx64 " reset:%u non-seq:%u, zcond:%2u(%s) [type: %u(%s)]\n"), start, len, (type == 0x1) ? 0 : wp - start, - entry->reset, entry->non_seq, + entry.reset, entry.non_seq, cond, condition_str[cond & (ARRAY_SIZE(condition_str) - 1)], type, type_text[type]); }