ceph/ceph-c99-2.patch
Kaleb S. KEITHLEY 4db83e6332 gcc-14
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
2024-01-24 18:50:50 -05:00

179 lines
7.0 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

commit a49d154f4a8e493baf2296a15c7b5c56cd25e993
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Dec 20 14:59:19 2023 +0100
pybind: Fix C type errors in Cython-generated Python bindings
Several Ceph APIs use bool * types, which correspond to
libcpp.bool * types in Cython. The bint type has an incorrect
size 4 and cannot be used as a replacement.
This prevents a compilation failure with future compilers:
…-build/src/pybind/rbd/rbd.c: In function __pyx_pf_3rbd_3RBD_104namespace_exists:
…-build/src/pybind/rbd/rbd.c:42165:76: error: passing argument 3 of rbd_namespace_exists from incompatible pointer type
42165 | __pyx_v_ret = rbd_namespace_exists(__pyx_v__ioctx, __pyx_v__name, (&__pyx_v__exists));
| ~^~~~~~~~~~~~~~~~~
| |
| int *
In file included from …-build/src/pybind/rbd/rbd.c:1268:
…/src/include/rbd/librbd.h:1496:45: note: expected _Bool * but argument is of type int *
1496 | bool *exists);
| ^
Signed-off-by: Florian Weimer <fweimer@redhat.com>
diff --git a/src/pybind/rbd/c_rbd.pxd b/src/pybind/rbd/c_rbd.pxd
index 885f7bd46a..bda23bbc47 100644
--- a/src/pybind/rbd/c_rbd.pxd
+++ b/src/pybind/rbd/c_rbd.pxd
@@ -2,6 +2,7 @@
from libc.stdint cimport *
from ctime cimport time_t, timespec
+cimport libcpp
cdef extern from "rados/librados.h":
enum:
@@ -525,7 +526,7 @@ cdef extern from "rbd/librbd.h" nogil:
int rbd_snap_unprotect(rbd_image_t image, const char *snap_name)
int rbd_snap_is_protected(rbd_image_t image, const char *snap_name,
int *is_protected)
- int rbd_snap_exists(rbd_image_t image, const char *snapname, bint *exists)
+ int rbd_snap_exists(rbd_image_t image, const char *snapname, libcpp.bool *exists)
int rbd_snap_get_limit(rbd_image_t image, uint64_t *limit)
int rbd_snap_set_limit(rbd_image_t image, uint64_t limit)
int rbd_snap_get_timestamp(rbd_image_t image, uint64_t snap_id, timespec *timestamp)
@@ -711,7 +712,7 @@ cdef extern from "rbd/librbd.h" nogil:
int rbd_namespace_list(rados_ioctx_t io, char *namespace_names,
size_t *size)
int rbd_namespace_exists(rados_ioctx_t io, const char *namespace_name,
- bint *exists)
+ libcpp.bool *exists)
int rbd_pool_init(rados_ioctx_t, bint force)
diff --git a/src/pybind/rbd/mock_rbd.pxi b/src/pybind/rbd/mock_rbd.pxi
index 11872bd814..364f965fba 100644
--- a/src/pybind/rbd/mock_rbd.pxi
+++ b/src/pybind/rbd/mock_rbd.pxi
@@ -3,6 +3,11 @@
from libc.stdint cimport *
from ctime cimport time_t, timespec
+# Make the bool type available as libcpp.bool, for both C and C++.
+cimport libcpp
+cdef extern from "<stdbool.h>":
+ pass
+
cdef nogil:
enum:
_LIBRADOS_SNAP_HEAD "LIBRADOS_SNAP_HEAD"
@@ -637,7 +642,7 @@ cdef nogil:
int rbd_snap_is_protected(rbd_image_t image, const char *snap_name,
int *is_protected):
pass
- int rbd_snap_exists(rbd_image_t image, const char *snapname, bint *exists):
+ int rbd_snap_exists(rbd_image_t image, const char *snapname, libcpp.bool *exists):
pass
int rbd_snap_get_limit(rbd_image_t image, uint64_t *limit):
pass
@@ -896,7 +901,7 @@ cdef nogil:
size_t *size):
pass
int rbd_namespace_exists(rados_ioctx_t io, const char *namespace_name,
- bint *exists):
+ libcpp.bool *exists):
pass
int rbd_pool_init(rados_ioctx_t io, bint force):
pass
diff --git a/src/pybind/rbd/rbd.pyx b/src/pybind/rbd/rbd.pyx
index fcb2fb3470..f59ba23f0f 100644
--- a/src/pybind/rbd/rbd.pyx
+++ b/src/pybind/rbd/rbd.pyx
@@ -23,6 +23,7 @@ from libc cimport errno
from libc.stdint cimport *
from libc.stdlib cimport malloc, realloc, free
from libc.string cimport strdup, memset
+cimport libcpp
try:
from collections.abc import Iterable
@@ -1935,12 +1936,12 @@ class RBD(object):
cdef:
rados_ioctx_t _ioctx = convert_ioctx(ioctx)
const char *_name = name
- bint _exists = False
+ libcpp.bool _exists = False
with nogil:
ret = rbd_namespace_exists(_ioctx, _name, &_exists)
if ret != 0:
raise make_ex(ret, 'error verifying namespace')
- return bool(_exists != 0)
+ return _exists
def namespace_list(self, ioctx):
"""
@@ -3679,12 +3680,12 @@ cdef class Image(object):
name = cstr(name, 'name')
cdef:
char *_name = name
- bint _exists = False
+ libcpp.bool _exists = False
with nogil:
ret = rbd_snap_exists(self.image, _name, &_exists)
if ret != 0:
raise make_ex(ret, 'error getting snapshot exists for %s' % self.name)
- return bool(_exists != 0)
+ return _exists
@requires_not_closed
def get_snap_limit(self):
diff --git a/src/pybind/rgw/mock_rgw.pxi b/src/pybind/rgw/mock_rgw.pxi
index ca893a5bb8..806d4df75d 100644
--- a/src/pybind/rgw/mock_rgw.pxi
+++ b/src/pybind/rgw/mock_rgw.pxi
@@ -1,5 +1,10 @@
# cython: embedsignature=True
+# Make the bool type available as libcpp.bool, for both C and C++.
+cimport libcpp
+cdef extern from "<stdbool.h>":
+ pass
+
cdef nogil:
ctypedef void* librgw_t
@@ -111,8 +116,8 @@ cdef nogil:
int rgw_readdir(rgw_fs *fs,
rgw_file_handle *parent_fh, uint64_t *offset,
- bint (*cb)(const char *name, void *arg, uint64_t offset, stat *st, uint32_t st_mask, uint32_t flags) nogil except? -9000,
- void *cb_arg, bint *eof, uint32_t flags) except? -9000:
+ libcpp.bool (*cb)(const char *name, void *arg, uint64_t offset, stat *st, uint32_t st_mask, uint32_t flags) nogil except? -9000,
+ void *cb_arg, libcpp.bool *eof, uint32_t flags) except? -9000:
pass
int rgw_getattr(rgw_fs *fs,
diff --git a/src/pybind/rgw/rgw.pyx b/src/pybind/rgw/rgw.pyx
index 9bbcdfff58..d210a70bbb 100644
--- a/src/pybind/rgw/rgw.pyx
+++ b/src/pybind/rgw/rgw.pyx
@@ -7,6 +7,7 @@ from cpython cimport PyObject, ref, exc, array
from libc.stdint cimport *
from libc.stdlib cimport malloc, realloc, free
from cstat cimport stat
+cimport libcpp
IF BUILD_DOC:
include "mock_rgw.pxi"
@@ -373,7 +374,7 @@ cdef class LibRGWFS(object):
cdef:
rgw_file_handle *_dir_handler = <rgw_file_handle*>dir_handler.handler
uint64_t _offset = offset
- bint _eof
+ libcpp.bool _eof
uint32_t _flags = flags
with nogil:
ret = rgw_readdir(self.fs, _dir_handler, &_offset, &readdir_cb,