Skip to content

Commit d5457a2

Browse files
authored
Merge pull request ceph#54974 from fweimer-rh/c99
GCC 14 compatibility fixes Reviewed-by: Ilya Dryomov <[email protected]> Reviewed-by: Casey Bodley <[email protected]>
2 parents 8be184a + a49d154 commit d5457a2

File tree

7 files changed

+27
-14
lines changed

7 files changed

+27
-14
lines changed

src/pybind/rbd/c_rbd.pxd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from libc.stdint cimport *
44
from ctime cimport time_t, timespec
5+
cimport libcpp
56

67
cdef extern from "rados/librados.h":
78
enum:
@@ -525,7 +526,7 @@ cdef extern from "rbd/librbd.h" nogil:
525526
int rbd_snap_unprotect(rbd_image_t image, const char *snap_name)
526527
int rbd_snap_is_protected(rbd_image_t image, const char *snap_name,
527528
int *is_protected)
528-
int rbd_snap_exists(rbd_image_t image, const char *snapname, bint *exists)
529+
int rbd_snap_exists(rbd_image_t image, const char *snapname, libcpp.bool *exists)
529530
int rbd_snap_get_limit(rbd_image_t image, uint64_t *limit)
530531
int rbd_snap_set_limit(rbd_image_t image, uint64_t limit)
531532
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:
711712
int rbd_namespace_list(rados_ioctx_t io, char *namespace_names,
712713
size_t *size)
713714
int rbd_namespace_exists(rados_ioctx_t io, const char *namespace_name,
714-
bint *exists)
715+
libcpp.bool *exists)
715716

716717
int rbd_pool_init(rados_ioctx_t, bint force)
717718

src/pybind/rbd/mock_rbd.pxi

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
from libc.stdint cimport *
44
from ctime cimport time_t, timespec
55

6+
# Make the bool type available as libcpp.bool, for both C and C++.
7+
cimport libcpp
8+
cdef extern from "<stdbool.h>":
9+
pass
10+
611
cdef nogil:
712
enum:
813
_LIBRADOS_SNAP_HEAD "LIBRADOS_SNAP_HEAD"
@@ -637,7 +642,7 @@ cdef nogil:
637642
int rbd_snap_is_protected(rbd_image_t image, const char *snap_name,
638643
int *is_protected):
639644
pass
640-
int rbd_snap_exists(rbd_image_t image, const char *snapname, bint *exists):
645+
int rbd_snap_exists(rbd_image_t image, const char *snapname, libcpp.bool *exists):
641646
pass
642647
int rbd_snap_get_limit(rbd_image_t image, uint64_t *limit):
643648
pass
@@ -896,7 +901,7 @@ cdef nogil:
896901
size_t *size):
897902
pass
898903
int rbd_namespace_exists(rados_ioctx_t io, const char *namespace_name,
899-
bint *exists):
904+
libcpp.bool *exists):
900905
pass
901906
int rbd_pool_init(rados_ioctx_t io, bint force):
902907
pass

src/pybind/rbd/rbd.pyx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ from libc cimport errno
2323
from libc.stdint cimport *
2424
from libc.stdlib cimport malloc, realloc, free
2525
from libc.string cimport strdup, memset
26+
cimport libcpp
2627

2728
try:
2829
from collections.abc import Iterable
@@ -1935,12 +1936,12 @@ class RBD(object):
19351936
cdef:
19361937
rados_ioctx_t _ioctx = convert_ioctx(ioctx)
19371938
const char *_name = name
1938-
bint _exists = False
1939+
libcpp.bool _exists = False
19391940
with nogil:
19401941
ret = rbd_namespace_exists(_ioctx, _name, &_exists)
19411942
if ret != 0:
19421943
raise make_ex(ret, 'error verifying namespace')
1943-
return bool(_exists != 0)
1944+
return _exists
19441945

19451946
def namespace_list(self, ioctx):
19461947
"""
@@ -3679,12 +3680,12 @@ cdef class Image(object):
36793680
name = cstr(name, 'name')
36803681
cdef:
36813682
char *_name = name
3682-
bint _exists = False
3683+
libcpp.bool _exists = False
36833684
with nogil:
36843685
ret = rbd_snap_exists(self.image, _name, &_exists)
36853686
if ret != 0:
36863687
raise make_ex(ret, 'error getting snapshot exists for %s' % self.name)
3687-
return bool(_exists != 0)
3688+
return _exists
36883689

36893690
@requires_not_closed
36903691
def get_snap_limit(self):

src/pybind/rgw/mock_rgw.pxi

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# cython: embedsignature=True
22

3+
# Make the bool type available as libcpp.bool, for both C and C++.
4+
cimport libcpp
5+
cdef extern from "<stdbool.h>":
6+
pass
7+
38
cdef nogil:
49
ctypedef void* librgw_t
510

@@ -111,8 +116,8 @@ cdef nogil:
111116

112117
int rgw_readdir(rgw_fs *fs,
113118
rgw_file_handle *parent_fh, uint64_t *offset,
114-
bint (*cb)(const char *name, void *arg, uint64_t offset, stat *st, uint32_t st_mask, uint32_t flags) nogil except? -9000,
115-
void *cb_arg, bint *eof, uint32_t flags) except? -9000:
119+
libcpp.bool (*cb)(const char *name, void *arg, uint64_t offset, stat *st, uint32_t st_mask, uint32_t flags) nogil except? -9000,
120+
void *cb_arg, libcpp.bool *eof, uint32_t flags) except? -9000:
116121
pass
117122

118123
int rgw_getattr(rgw_fs *fs,

src/pybind/rgw/rgw.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ from cpython cimport PyObject, ref, exc, array
77
from libc.stdint cimport *
88
from libc.stdlib cimport malloc, realloc, free
99
from cstat cimport stat
10+
cimport libcpp
1011

1112
IF BUILD_DOC:
1213
include "mock_rgw.pxi"
@@ -373,7 +374,7 @@ cdef class LibRGWFS(object):
373374
cdef:
374375
rgw_file_handle *_dir_handler = <rgw_file_handle*>dir_handler.handler
375376
uint64_t _offset = offset
376-
bint _eof
377+
libcpp.bool _eof
377378
uint32_t _flags = flags
378379
with nogil:
379380
ret = rgw_readdir(self.fs, _dir_handler, &_offset, &readdir_cb,

src/tracing/librados.tp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2628,7 +2628,7 @@ TRACEPOINT_EVENT(librados, rados_watch3_enter,
26282628
TP_FIELDS(
26292629
ctf_integer_hex(rados_ioctx_t, ioctx, ioctx)
26302630
ctf_string(oid, oid)
2631-
ctf_integer_hex(uint64_t, phandle, phandle)
2631+
ctf_integer_hex(uint64_t*, phandle, phandle)
26322632
ctf_integer_hex(rados_watchcb2_t, callback, callback)
26332633
ctf_integer(uint32_t, timeout, timeout)
26342634
ctf_integer_hex(void*, arg, arg)
@@ -2658,7 +2658,7 @@ TRACEPOINT_EVENT(librados, rados_aio_watch2_enter,
26582658
ctf_integer_hex(rados_ioctx_t, ioctx, ioctx)
26592659
ctf_string(oid, oid)
26602660
ctf_integer_hex(rados_completion_t, completion, completion)
2661-
ctf_integer_hex(uint64_t, phandle, phandle)
2661+
ctf_integer_hex(uint64_t*, phandle, phandle)
26622662
ctf_integer_hex(rados_watchcb2_t, callback, callback)
26632663
ctf_integer(uint32_t, timeout, timeout)
26642664
ctf_integer_hex(void*, arg, arg)

src/tracing/tracing-common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// type should be an integer type
2222
// val should have type type*
2323
#define ceph_ctf_integerp(type, field, val) \
24-
ctf_integer(type, field, (val) == NULL ? 0 : (val)) \
24+
ctf_integer(type, field, (val) == NULL ? 0 : *(val)) \
2525
ctf_integer(uint8_t, field##_isnull, (val) == NULL)
2626

2727
// val should have type char*

0 commit comments

Comments
 (0)