]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Make 1-bit bitfields unsigned
authorBrooks Davis <brooks@one-eyed-alien.net>
Tue, 1 Nov 2022 20:43:32 +0000 (20:43 +0000)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 3 Nov 2022 17:16:16 +0000 (10:16 -0700)
This fixes -Wsingle-bit-bitfield-constant-conversion warning from
clang-16 like:

lib/libzfs/libzfs_dataset.c:4529:19: error: implicit truncation
  from 'int' to a one-bit wide bit-field changes value from
  1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                flags.nounmount = B_TRUE;
^ ~~~~~~

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Brooks Davis <brooks.davis@sri.com>
Closes #14125

include/libzfs.h
lib/libzfs/libzfs_pool.c

index df17873369ada506349b59e87b2da708c3426cf8..2806d1f7cff5ead6c6ca26f99b9f0b639e36ff5d 100644 (file)
@@ -260,10 +260,10 @@ _LIBZFS_H int zpool_add(zpool_handle_t *, nvlist_t *);
 
 typedef struct splitflags {
        /* do not split, but return the config that would be split off */
-       int dryrun : 1;
+       unsigned int dryrun : 1;
 
        /* after splitting, import the pool */
-       int import : 1;
+       unsigned int import : 1;
        int name_flags;
 } splitflags_t;
 
@@ -690,13 +690,13 @@ _LIBZFS_H int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t);
 
 typedef struct renameflags {
        /* recursive rename */
-       int recursive : 1;
+       unsigned int recursive : 1;
 
        /* don't unmount file systems */
-       int nounmount : 1;
+       unsigned int nounmount : 1;
 
        /* force unmount file systems */
-       int forceunmount : 1;
+       unsigned int forceunmount : 1;
 } renameflags_t;
 
 _LIBZFS_H int zfs_rename(zfs_handle_t *, const char *, renameflags_t);
index f0bb2370a4c86ff7d5df7a1c5f1228b5cd3ec3b4..7f7e19a090bc5d32d39614d7dc0b5a42f7582a7c 100644 (file)
@@ -60,9 +60,9 @@
 static boolean_t zpool_vdev_is_interior(const char *name);
 
 typedef struct prop_flags {
-       int create:1;   /* Validate property on creation */
-       int import:1;   /* Validate property on import */
-       int vdevprop:1; /* Validate property as a VDEV property */
+       unsigned int create:1;  /* Validate property on creation */
+       unsigned int import:1;  /* Validate property on import */
+       unsigned int vdevprop:1; /* Validate property as a VDEV property */
 } prop_flags_t;
 
 /*