HomeFreeBSD

OpenZFS 8652 - Tautological comparisons with ZPROP_INVAL

Description

OpenZFS 8652 - Tautological comparisons with ZPROP_INVAL

usr/src/uts/common/sys/fs/zfs.h
Change ZPROP_INVAL and ZPROP_CONT from macros to enum values. Clang
and GCC both prefer to use unsigned ints to store enums. That was
causing tautological comparison warnings (and likely eliminating
error handling code at compile time) whenever a zfs_prop_t or
zpool_prop_t was compared to ZPROP_INVAL or ZPROP_CONT. Making the
error flags be explicity enum values forces the enum types to be
signed.

ZPROP_INVAL was also compared against two different enum types. I
had to change its name to ZPOOL_PROP_INVAL whenever its compared to
a zpool_prop_t. There are still some places where ZPROP_INVAL or
ZPROP_CONT is compared to a plain int, in code that doesn't know
whether the int is storing a zfs_prop_t or a zpool_prop_t.

usr/src/uts/common/fs/zfs/spa.c
s/ZPROP_INVAL/ZPOOL_PROP_INVAL/

Authored by: Alan Somers <asomers@gmail.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: George Melikov <mail@gmelikov.ru>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>

OpenZFS-issue: https://www.illumos.org/issues/8652
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/c2de80dc74
Closes #7061

Details

Provenance
Brian Behlendorf <behlendorf1@llnl.gov>Authored on Jan 19 2018, 5:22 PM
GitHub <noreply@github.com>Committed on Jan 19 2018, 5:22 PM
Parents
rG1574c73bd068: OpenZFS 8641 - "zpool clear" and "zinject" don't work on "spare" or "replacing"…
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rG31864e3d8c9f: OpenZFS 8652 - Tautological comparisons with ZPROP_INVAL (authored by Brian Behlendorf <behlendorf1@llnl.gov>).Jan 19 2018, 5:22 PM