From: Ilya Dryomov Date: Sun, 13 Nov 2022 16:10:05 +0000 (+0100) Subject: librbd: constify specs array in rbd_encryption_load2() X-Git-Tag: v18.1.0~754^2~7 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=adea1ab805efee44ec08bbdf857af7a9a8a599ad;p=ceph.git librbd: constify specs array in rbd_encryption_load2() Signed-off-by: Ilya Dryomov --- diff --git a/src/include/rbd/librbd.h b/src/include/rbd/librbd.h index 1d08dd44cf9d6..b99421d1f2a52 100644 --- a/src/include/rbd/librbd.h +++ b/src/include/rbd/librbd.h @@ -872,7 +872,7 @@ CEPH_RBD_API int rbd_encryption_load(rbd_image_t image, * interpreted as plaintext. */ CEPH_RBD_API int rbd_encryption_load2(rbd_image_t image, - rbd_encryption_spec_t *specs, + const rbd_encryption_spec_t *specs, size_t spec_count); /* snapshots */ diff --git a/src/include/rbd/librbd.hpp b/src/include/rbd/librbd.hpp index 010aa6397ff29..5d307cdedf50f 100644 --- a/src/include/rbd/librbd.hpp +++ b/src/include/rbd/librbd.hpp @@ -600,7 +600,7 @@ public: size_t opts_size); int encryption_load(encryption_format_t format, encryption_options_t opts, size_t opts_size); - int encryption_load2(encryption_spec_t *specs, size_t spec_count); + int encryption_load2(const encryption_spec_t *specs, size_t spec_count); /* striping */ uint64_t get_stripe_unit() const; diff --git a/src/librbd/api/Image.cc b/src/librbd/api/Image.cc index f077602595de4..08437701c03f2 100644 --- a/src/librbd/api/Image.cc +++ b/src/librbd/api/Image.cc @@ -974,7 +974,7 @@ int Image::encryption_format(I* ictx, encryption_format_t format, } template -int Image::encryption_load(I* ictx, encryption_spec_t *specs, +int Image::encryption_load(I* ictx, const encryption_spec_t *specs, size_t spec_count, bool c_api) { std::vector>> formats; diff --git a/src/librbd/api/Image.h b/src/librbd/api/Image.h index e843f5b51e216..29398d6cdffb8 100644 --- a/src/librbd/api/Image.h +++ b/src/librbd/api/Image.h @@ -73,9 +73,8 @@ struct Image { static int encryption_format(ImageCtxT *ictx, encryption_format_t format, encryption_options_t opts, size_t opts_size, bool c_api); - static int encryption_load(ImageCtxT *ictx, encryption_spec_t *specs, + static int encryption_load(ImageCtxT *ictx, const encryption_spec_t *specs, size_t spec_count, bool c_api); - }; } // namespace api diff --git a/src/librbd/librbd.cc b/src/librbd/librbd.cc index e52c83057ea1f..54a2d02051eb6 100644 --- a/src/librbd/librbd.cc +++ b/src/librbd/librbd.cc @@ -2101,7 +2101,7 @@ namespace librbd { return librbd::api::Image<>::encryption_load(ictx, &spec, 1, false); } - int Image::encryption_load2(encryption_spec_t *specs, size_t spec_count) + int Image::encryption_load2(const encryption_spec_t *specs, size_t spec_count) { ImageCtx *ictx = (ImageCtx *)ctx; return librbd::api::Image<>::encryption_load( @@ -4394,7 +4394,7 @@ extern "C" int rbd_encryption_load(rbd_image_t image, } extern "C" int rbd_encryption_load2(rbd_image_t image, - rbd_encryption_spec_t *specs, + const rbd_encryption_spec_t *specs, size_t spec_count) { librbd::ImageCtx *ictx = (librbd::ImageCtx *)image; diff --git a/src/pybind/rbd/c_rbd.pxd b/src/pybind/rbd/c_rbd.pxd index 2415290b175bb..885f7bd46abde 100644 --- a/src/pybind/rbd/c_rbd.pxd +++ b/src/pybind/rbd/c_rbd.pxd @@ -728,5 +728,5 @@ cdef extern from "rbd/librbd.h" nogil: rbd_encryption_format_t format, rbd_encryption_options_t opts, size_t opts_size) int rbd_encryption_load2(rbd_image_t image, - rbd_encryption_spec_t *specs, + const rbd_encryption_spec_t *specs, size_t spec_count) diff --git a/src/pybind/rbd/mock_rbd.pxi b/src/pybind/rbd/mock_rbd.pxi index 9d8df1328037a..11872bd8146de 100644 --- a/src/pybind/rbd/mock_rbd.pxi +++ b/src/pybind/rbd/mock_rbd.pxi @@ -918,6 +918,6 @@ cdef nogil: rbd_encryption_options_t opts, size_t opts_size): pass int rbd_encryption_load2(rbd_image_t image, - rbd_encryption_spec_t *specs, + const rbd_encryption_spec_t *specs, size_t spec_count): pass