Page MenuHomeFreeBSD

cddl/sbin/zpool build warning fixes
Needs ReviewPublic

Authored by aprieger_llnw.com on Jun 8 2017, 8:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 23, 4:31 AM
Unknown Object (File)
Sun, Nov 16, 11:54 AM
Unknown Object (File)
Sun, Nov 16, 12:48 AM
Unknown Object (File)
Fri, Nov 14, 2:15 PM
Unknown Object (File)
Tue, Nov 11, 5:22 AM
Unknown Object (File)
Mon, Nov 10, 10:26 PM
Unknown Object (File)
Oct 29 2025, 2:22 AM
Unknown Object (File)
Oct 27 2025, 1:19 PM
Subscribers
None

Details

Summary

cddl/sbin/zpool build warning fixes

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Changelog:
Pre-fix warnings are at: https://gist.github.com/aprieger-llnw/cf6d6401aa8e52d3e6fabc094b997bcb

  1. cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
    • warning: field width should have type 'int', but argument has type 'size_t' (aka 'unsigned long') [-Wformat]
      • fix: added the explicit modifier (int) to the parameter on lines 2847, 2849, 2917, 2919, 2961
    • warning: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]
      • fix: changed the print format modifier from "%llu" to "%"PRIu64 on lines 2949, 4605, 4609, 4879, 4886, 5083, 5206
    • warning: format specifies type 'long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]
      • fix: changed the print format modifier from "%lld" to "%"PRIu64 on lines 5194, 5200
  2. cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
    • warning: taking the absolute value of unsigned type 'unsigned long' has no effect [-Wabsolute-value]
      • fix: explicitly casted the two sides of the subtraction expression to (long) from (unsigned longs) because unsigned longs cannot become negative and will instead loop to the higher bound of the number limits

Made a mistake in casting the unsigned longs to integers, needed to be cast to longs to accomodate for the size differences

cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
5192

This is changing the output from signed to unsigned. The value does appear to be unsigned, but we want to make sure we don't change this if it should be signed

cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
5192

fnvlist_lookup_uint64() seems to return uint64_t ... so isn't this change "more correct"?

sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c

uint64_t
fnvlist_lookup_uint64(nvlist_t *nvl, const char *name)
{
        uint64_t rv;
        VERIFY0(nvlist_lookup_uint64(nvl, name, &rv));
        return (rv);
}