]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Make inline ABD predicates compatible with C++
authorRyan Moeller <freqlabs@FreeBSD.org>
Mon, 15 Feb 2021 18:15:50 +0000 (13:15 -0500)
committerGitHub <noreply@github.com>
Mon, 15 Feb 2021 18:15:50 +0000 (10:15 -0800)
FreeBSD's zfsd fails to build after e2af2acce3 due to strict type
checking errors from the implicit conversion between bool and boolean_t
in the inline predicate definitions in abd.h.

Use conditionals to return the correct value type from these functions.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes #11592

include/sys/abd.h

index 55db8c1a05bd40cd1a63959350faf87987e25a40..a7eee89ca91670a8ddb70a606ca015002b9010c1 100644 (file)
@@ -177,19 +177,19 @@ abd_zero(abd_t *abd, size_t size)
 static inline boolean_t
 abd_is_linear(abd_t *abd)
 {
-       return ((abd->abd_flags & ABD_FLAG_LINEAR) != 0);
+       return ((abd->abd_flags & ABD_FLAG_LINEAR) ? B_TRUE : B_FALSE);
 }
 
 static inline boolean_t
 abd_is_linear_page(abd_t *abd)
 {
-       return ((abd->abd_flags & ABD_FLAG_LINEAR_PAGE) != 0);
+       return ((abd->abd_flags & ABD_FLAG_LINEAR_PAGE) ? B_TRUE : B_FALSE);
 }
 
 static inline boolean_t
 abd_is_gang(abd_t *abd)
 {
-       return ((abd->abd_flags & ABD_FLAG_GANG) != 0);
+       return ((abd->abd_flags & ABD_FLAG_GANG) ? B_TRUE : B_FALSE);
 }
 
 static inline uint_t