librbd: constify specs array in rbd_encryption_load2()

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
Ilya Dryomov 2022-11-13 17:10:05 +01:00
parent 5f816f9b2c
commit adea1ab805
7 changed files with 8 additions and 9 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -974,7 +974,7 @@ int Image<I>::encryption_format(I* ictx, encryption_format_t format,
}
template <typename I>
int Image<I>::encryption_load(I* ictx, encryption_spec_t *specs,
int Image<I>::encryption_load(I* ictx, const encryption_spec_t *specs,
size_t spec_count, bool c_api) {
std::vector<std::unique_ptr<crypto::EncryptionFormat<I>>> formats;

View File

@ -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

View File

@ -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;

View File

@ -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)

View File

@ -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