From 077210e828fbc8eebb68a647bf6b9463dbf22f38 Mon Sep 17 00:00:00 2001 From: Shengqi Chen Date: Thu, 22 Aug 2024 13:59:24 +0800 Subject: [PATCH] Fix compilation on GCC 14 This commit fixes some warnings that become errors on GCC 14. Some definitions under pxd/ are also aligned with latest headers. See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1078240 Signed-off-by: Shengqi Chen --- libzfs.pyx | 4 ++-- nvpair.pxi | 8 ++++---- pxd/libzfs.pxd | 4 ++-- pxd/nvpair.pxd | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libzfs.pyx b/libzfs.pyx index 592f56f..dff7ceb 100644 --- a/libzfs.pyx +++ b/libzfs.pyx @@ -3008,9 +3008,9 @@ cdef class ZFSPool(object): cdef char* msg_id if self.handle != NULL: IF HAVE_ZPOOL_GET_STATUS == 3: - return PoolStatus(libzfs.zpool_get_status(self.handle, &msg_id, NULL)) + return PoolStatus(libzfs.zpool_get_status(self.handle, &msg_id, NULL)) ELSE: - return PoolStatus(libzfs.zpool_get_status(self.handle, &msg_id)) + return PoolStatus(libzfs.zpool_get_status(self.handle, &msg_id)) def __warning_statuses(self): return [ diff --git a/nvpair.pxi b/nvpair.pxi index 7cf4586..8786395 100644 --- a/nvpair.pxi +++ b/nvpair.pxi @@ -59,7 +59,7 @@ cdef class NVList(object): datatype = nvpair.nvpair_type(pair) if datatype == nvpair.DATA_TYPE_STRING: - nvpair.nvpair_value_string(pair, &cstr) + nvpair.nvpair_value_string(pair, &cstr) return (cstr).decode('utf-8') if datatype == nvpair.DATA_TYPE_BOOLEAN: @@ -139,7 +139,7 @@ cdef class NVList(object): return [x for x in (carray)[:carraylen]] if datatype == nvpair.DATA_TYPE_STRING_ARRAY: - nvpair.nvpair_value_string_array(pair, &carray, &carraylen) + nvpair.nvpair_value_string_array(pair, &carray, &carraylen) return [x for x in (carray)[:carraylen]] if datatype == nvpair.DATA_TYPE_NVLIST: @@ -255,7 +255,7 @@ cdef class NVList(object): for idx, i in enumerate(value): (carray)[idx] = i - nvpair.nvlist_add_string_array(self.handle, key, carray, len(value)) + nvpair.nvlist_add_string_array(self.handle, key, carray, len(value)) if typeid == nvpair.DATA_TYPE_BOOLEAN_ARRAY: carray = malloc(len(value) * sizeof(char*)) @@ -334,7 +334,7 @@ cdef class NVList(object): cnvlist = i (carray)[idx] = cnvlist.handle - nvpair.nvlist_add_nvlist_array(self.handle, key, carray, len(value)) + nvpair.nvlist_add_nvlist_array(self.handle, key, carray, len(value)) if carray != NULL: free(carray) diff --git a/pxd/libzfs.pxd b/pxd/libzfs.pxd index 6afa275..39acc37 100644 --- a/pxd/libzfs.pxd +++ b/pxd/libzfs.pxd @@ -278,9 +278,9 @@ cdef extern from "libzfs.h" nogil: extern int zpool_events_next(libzfs_handle_t *, nvpair.nvlist_t **, int *, unsigned, int); IF HAVE_ZPOOL_GET_STATUS == 3 and HAVE_ZPOOL_ERRATA_T_ENUM: - extern zpool_status_t zpool_get_status(zpool_handle_t *, char **, zfs.zpool_errata_t *) + extern zpool_status_t zpool_get_status(zpool_handle_t *, const char **, zfs.zpool_errata_t *) ELSE: - extern zpool_status_t zpool_get_status(zpool_handle_t *, char **) + extern zpool_status_t zpool_get_status(zpool_handle_t *, const char **) extern zpool_status_t zpool_import_status(nvpair.nvlist_t *, char **) extern void zpool_dump_ddt(const zfs.ddt_stat_t *dds, const zfs.ddt_histogram_t *ddh) diff --git a/pxd/nvpair.pxd b/pxd/nvpair.pxd index e4b0b25..ed2ef69 100644 --- a/pxd/nvpair.pxd +++ b/pxd/nvpair.pxd @@ -102,8 +102,8 @@ IF HAVE_NVPAIR_IN_SYS: int nvlist_add_uint32_array(nvlist_t *, const char *, uint32_t *, uint_t) int nvlist_add_int64_array(nvlist_t *, const char *, int64_t *, uint_t) int nvlist_add_uint64_array(nvlist_t *, const char *, uint64_t *, uint_t) - int nvlist_add_string_array(nvlist_t *, const char *, char * const *, uint_t) - int nvlist_add_nvlist_array(nvlist_t *, const char *, nvlist_t **, uint_t) + int nvlist_add_string_array(nvlist_t *, const char *, const char * const *, uint_t) + int nvlist_add_nvlist_array(nvlist_t *, const char *, const nvlist_t * const *, uint_t) int nvlist_add_hrtime(nvlist_t *, const char *, hrtime_t) int nvlist_add_double(nvlist_t *, const char *, double) @@ -214,8 +214,8 @@ IF HAVE_NVPAIR_IN_SYS: void fnvlist_add_uint32_array(nvlist_t *, const char *, uint32_t *, uint_t) void fnvlist_add_int64_array(nvlist_t *, const char *, int64_t *, uint_t) void fnvlist_add_uint64_array(nvlist_t *, const char *, uint64_t *, uint_t) - void fnvlist_add_string_array(nvlist_t *, const char *, char * const *, uint_t) - void fnvlist_add_nvlist_array(nvlist_t *, const char *, nvlist_t **, uint_t) + void fnvlist_add_string_array(nvlist_t *, const char *, const char * const *, uint_t) + void fnvlist_add_nvlist_array(nvlist_t *, const char *, const nvlist_t * const *, uint_t) void fnvlist_remove(nvlist_t *, const char *) void fnvlist_remove_nvpair(nvlist_t *, nvpair_t *) @@ -407,7 +407,7 @@ ELSE: int nvpair_value_uint32(nvpair_t *, uint32_t *) int nvpair_value_int64(nvpair_t *, int64_t *) int nvpair_value_uint64(nvpair_t *, uint64_t *) - int nvpair_value_string(nvpair_t *, char **) + int nvpair_value_string(nvpair_t *, const char **) int nvpair_value_nvlist(nvpair_t *, nvlist_t **) int nvpair_value_boolean_array(nvpair_t *, boolean_t **, uint_t *) int nvpair_value_byte_array(nvpair_t *, uchar_t **, uint_t *) @@ -419,7 +419,7 @@ ELSE: int nvpair_value_uint32_array(nvpair_t *, uint32_t **, uint_t *) int nvpair_value_int64_array(nvpair_t *, int64_t **, uint_t *) int nvpair_value_uint64_array(nvpair_t *, uint64_t **, uint_t *) - int nvpair_value_string_array(nvpair_t *, char ***, uint_t *) + int nvpair_value_string_array(nvpair_t *, const char ***, uint_t *) int nvpair_value_nvlist_array(nvpair_t *, nvlist_t ***, uint_t *) int nvpair_value_hrtime(nvpair_t *, hrtime_t *) int nvpair_value_double(nvpair_t *, double *)