From e97a8f1bd76a4a138824a52b53648390c3b2718e Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Sat, 7 Feb 2015 09:57:36 -0500 Subject: [PATCH] librados_test_stub: added IoCtx::write_full implementation Mapped IoCtx::write_full to existing test method used by the ObjectWriteOperation::write_full API method. Also added missing cls_log implementation for debugging. Signed-off-by: Jason Dillaman --- .../librados_test_stub/LibradosTestStub.cc | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/test/librados_test_stub/LibradosTestStub.cc b/src/test/librados_test_stub/LibradosTestStub.cc index fc8b80cf9ac76..f9cf32bb0797f 100644 --- a/src/test/librados_test_stub/LibradosTestStub.cc +++ b/src/test/librados_test_stub/LibradosTestStub.cc @@ -5,6 +5,7 @@ #include "common/ceph_argparse.h" #include "common/common_init.h" #include "common/config.h" +#include "common/debug.h" #include "common/snap_types.h" #include "global/global_context.h" #include "librados/AioCompletionImpl.h" @@ -17,6 +18,9 @@ #include #include #include +#include "include/assert.h" + +#define dout_subsys ceph_subsys_rados static librados::TestClassHandler *get_class_handler() { static librados::TestClassHandler *s_class_handler = NULL; @@ -524,6 +528,11 @@ int IoCtx::write(const std::string& oid, bufferlist& bl, size_t len, return ctx->write(oid, bl, len, off); } +int IoCtx::write_full(const std::string& oid, bufferlist& bl) { + TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); + return ctx->write_full(oid, bl); +} + static int save_operation_result(int result, int *pval) { if (pval != NULL) { *pval = result; @@ -956,6 +965,19 @@ int cls_cxx_write_full(cls_method_context_t hctx, bufferlist *inbl) { } int cls_log(int level, const char *format, ...) { + int size = 256; + va_list ap; + while (1) { + char buf[size]; + va_start(ap, format); + int n = vsnprintf(buf, size, format, ap); + va_end(ap); + if ((n > -1 && n < size) || size > 8196) { + dout(level) << buf << dendl; + return n; + } + size *= 2; + } return 0; } -- 2.39.5