From 3d6c08fb36beab1249854098852bca8134439a6b Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Wed, 14 Feb 2018 15:18:03 -0800 Subject: [PATCH] rgw: fixes following rebase Signed-off-by: Yehuda Sadeh --- src/cls/otp/cls_otp.cc | 44 ++++++++++++++++---------------- src/cls/otp/cls_otp_client.cc | 20 +++++++-------- src/cls/otp/cls_otp_ops.h | 44 ++++++++++++++++---------------- src/cls/otp/cls_otp_types.h | 48 +++++++++++++++++------------------ src/rgw/rgw_op.cc | 2 +- src/rgw/rgw_otp.cc | 3 +-- 6 files changed, 80 insertions(+), 81 deletions(-) diff --git a/src/cls/otp/cls_otp.cc b/src/cls/otp/cls_otp.cc index d2380828a907f..76e25522b8ba1 100644 --- a/src/cls/otp/cls_otp.cc +++ b/src/cls/otp/cls_otp.cc @@ -45,12 +45,12 @@ struct otp_header { void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(ids, bl); + encode(ids, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(ids, bl); + decode(ids, bl); DECODE_FINISH(bl); } }; @@ -66,16 +66,16 @@ struct otp_instance { void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(otp, bl); - ::encode(last_checks, bl); - ::encode(last_success, bl); + encode(otp, bl); + encode(last_checks, bl); + encode(last_success, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(otp, bl); - ::decode(last_checks, bl); - ::decode(last_success, bl); + decode(otp, bl); + decode(last_checks, bl); + decode(last_success, bl); DECODE_FINISH(bl); } @@ -176,7 +176,7 @@ static int get_otp_instance(cls_method_context_t hctx, const string& id, otp_ins try { bufferlist::iterator it = bl.begin(); - ::decode(*instance, it); + decode(*instance, it); } catch (const buffer::error &err) { CLS_ERR("ERROR: failed to decode %s", key.c_str()); return -EIO; @@ -190,7 +190,7 @@ static int write_otp_instance(cls_method_context_t hctx, const otp_instance& ins string key = otp_key_prefix + instance.otp.id; bufferlist bl; - ::encode(instance, bl); + encode(instance, bl); int r = cls_cxx_map_set_val(hctx, key, &bl); if (r < 0) { @@ -217,7 +217,7 @@ static int remove_otp_instance(cls_method_context_t hctx, const string& id) static int read_header(cls_method_context_t hctx, otp_header *h) { bufferlist bl; - ::encode(h, bl); + encode(h, bl); int r = cls_cxx_map_get_val(hctx, otp_header_key, &bl); if (r == -ENOENT || r == -ENODATA) { *h = otp_header(); @@ -235,7 +235,7 @@ static int read_header(cls_method_context_t hctx, otp_header *h) auto iter = bl.begin(); try { - ::decode(*h, iter); + decode(*h, iter); } catch (buffer::error& err) { CLS_ERR("failed to decode otp_header"); return -EIO; @@ -247,7 +247,7 @@ static int read_header(cls_method_context_t hctx, otp_header *h) static int write_header(cls_method_context_t hctx, const otp_header& h) { bufferlist bl; - ::encode(h, bl); + encode(h, bl); int r = cls_cxx_map_set_val(hctx, otp_header_key, &bl); if (r < 0) { @@ -298,7 +298,7 @@ static int otp_set_op(cls_method_context_t hctx, cls_otp_set_otp_op op; try { auto iter = in->begin(); - ::decode(op, iter); + decode(op, iter); } catch (const buffer::error &err) { CLS_ERR("ERROR: %s(): failed to decode request", __func__); return -EINVAL; @@ -347,7 +347,7 @@ static int otp_remove_op(cls_method_context_t hctx, cls_otp_remove_otp_op op; try { auto iter = in->begin(); - ::decode(op, iter); + decode(op, iter); } catch (const buffer::error &err) { CLS_ERR("ERROR: %s(): failed to decode request", __func__); return -EINVAL; @@ -393,7 +393,7 @@ static int otp_get_op(cls_method_context_t hctx, cls_otp_get_otp_op op; try { auto iter = in->begin(); - ::decode(op, iter); + decode(op, iter); } catch (const buffer::error &err) { CLS_ERR("ERROR: %s(): failed to decode request", __func__); return -EINVAL; @@ -432,7 +432,7 @@ static int otp_get_op(cls_method_context_t hctx, result.found_entries.push_back(instance.otp); } - ::encode(result, *out); + encode(result, *out); return 0; } @@ -444,7 +444,7 @@ static int otp_check_op(cls_method_context_t hctx, cls_otp_check_otp_op op; try { auto iter = in->begin(); - ::decode(op, iter); + decode(op, iter); } catch (const buffer::error &err) { CLS_ERR("ERROR: %s(): failed to decode request", __func__); return -EINVAL; @@ -480,7 +480,7 @@ static int otp_get_result(cls_method_context_t hctx, cls_otp_check_otp_op op; try { auto iter = in->begin(); - ::decode(op, iter); + decode(op, iter); } catch (const buffer::error &err) { CLS_ERR("ERROR: %s(): failed to decode request", __func__); return -EINVAL; @@ -498,7 +498,7 @@ static int otp_get_result(cls_method_context_t hctx, cls_otp_get_result_reply reply; instance.find(op.token, &reply.result); - ::encode(reply, *out); + encode(reply, *out); return 0; } @@ -510,7 +510,7 @@ static int otp_get_current_time_op(cls_method_context_t hctx, cls_otp_get_current_time_op op; try { auto iter = in->begin(); - ::decode(op, iter); + decode(op, iter); } catch (const buffer::error &err) { CLS_ERR("ERROR: %s(): failed to decode request", __func__); return -EINVAL; @@ -518,7 +518,7 @@ static int otp_get_current_time_op(cls_method_context_t hctx, cls_otp_get_current_time_reply reply; reply.time = real_clock::now(); - ::encode(reply, *out); + encode(reply, *out); return 0; } diff --git a/src/cls/otp/cls_otp_client.cc b/src/cls/otp/cls_otp_client.cc index 126e46d5eeb25..31f18a4991c83 100644 --- a/src/cls/otp/cls_otp_client.cc +++ b/src/cls/otp/cls_otp_client.cc @@ -33,7 +33,7 @@ namespace rados { cls_otp_set_otp_op op; op.entries.push_back(config); bufferlist in; - ::encode(op, in); + encode(op, in); rados_op->exec("otp", "otp_set", in); } @@ -42,7 +42,7 @@ namespace rados { cls_otp_set_otp_op op; op.entries = entries; bufferlist in; - ::encode(op, in); + encode(op, in); rados_op->exec("otp", "otp_set", in); } @@ -51,7 +51,7 @@ namespace rados { cls_otp_remove_otp_op op; op.ids.push_back(id); bufferlist in; - ::encode(op, in); + encode(op, in); rados_op->exec("otp", "otp_remove", in); } @@ -67,7 +67,7 @@ namespace rados { bufferlist in; bufferlist out; - ::encode(op, in); + encode(op, in); int r = ioctx.exec(oid, "otp", "otp_check", in, out); if (r < 0) { return r; @@ -77,7 +77,7 @@ namespace rados { op2.token = buf; bufferlist in2; bufferlist out2; - ::encode(op2, in2); + encode(op2, in2); r = ioctx.exec(oid, "otp", "otp_get_result", in, out); if (r < 0) { return r; @@ -86,7 +86,7 @@ namespace rados { auto iter = out.begin(); cls_otp_get_result_reply ret; try { - ::decode(ret, iter); + decode(ret, iter); } catch (buffer::error& err) { return -EBADMSG; } @@ -111,7 +111,7 @@ namespace rados { bufferlist in; bufferlist out; int op_ret; - ::encode(op, in); + encode(op, in); rop->exec("otp", "otp_get", in, &out, &op_ret); int r = ioctx.operate(oid, rop, nullptr); if (r < 0) { @@ -124,7 +124,7 @@ namespace rados { cls_otp_get_otp_reply ret; auto iter = out.begin(); try { - ::decode(ret, iter); + decode(ret, iter); } catch (buffer::error& err) { return -EBADMSG; } @@ -163,7 +163,7 @@ namespace rados { bufferlist in; bufferlist out; int op_ret; - ::encode(op, in); + encode(op, in); ObjectReadOperation rop; rop.exec("otp", "get_current_time", in, &out, &op_ret); int r = ioctx.operate(oid, &rop, nullptr); @@ -177,7 +177,7 @@ namespace rados { cls_otp_get_current_time_reply ret; auto iter = out.begin(); try { - ::decode(ret, iter); + decode(ret, iter); } catch (buffer::error& err) { return -EBADMSG; } diff --git a/src/cls/otp/cls_otp_ops.h b/src/cls/otp/cls_otp_ops.h index 2ec1897569a53..b5c931a48bcf7 100644 --- a/src/cls/otp/cls_otp_ops.h +++ b/src/cls/otp/cls_otp_ops.h @@ -11,12 +11,12 @@ struct cls_otp_set_otp_op void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(entries, bl); + encode(entries, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(entries, bl); + decode(entries, bl); DECODE_FINISH(bl); } }; @@ -30,16 +30,16 @@ struct cls_otp_check_otp_op void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(id, bl); - ::encode(val, bl); - ::encode(token, bl); + encode(id, bl); + encode(val, bl); + encode(token, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(id, bl); - ::decode(val, bl); - ::decode(token, bl); + decode(id, bl); + decode(val, bl); + decode(token, bl); DECODE_FINISH(bl); } }; @@ -51,12 +51,12 @@ struct cls_otp_get_result_op void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(token, bl); + encode(token, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(token, bl); + decode(token, bl); DECODE_FINISH(bl); } }; @@ -68,12 +68,12 @@ struct cls_otp_get_result_reply void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(result, bl); + encode(result, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(result, bl); + decode(result, bl); DECODE_FINISH(bl); } }; @@ -85,12 +85,12 @@ struct cls_otp_remove_otp_op void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(ids, bl); + encode(ids, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(ids, bl); + decode(ids, bl); DECODE_FINISH(bl); } }; @@ -103,14 +103,14 @@ struct cls_otp_get_otp_op void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(get_all, bl); - ::encode(ids, bl); + encode(get_all, bl); + encode(ids, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(get_all, bl); - ::decode(ids, bl); + decode(get_all, bl); + decode(ids, bl); DECODE_FINISH(bl); } }; @@ -122,12 +122,12 @@ struct cls_otp_get_otp_reply void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(found_entries, bl); + encode(found_entries, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(found_entries, bl); + decode(found_entries, bl); DECODE_FINISH(bl); } }; @@ -152,12 +152,12 @@ struct cls_otp_get_current_time_reply void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(time, bl); + encode(time, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(time, bl); + decode(time, bl); DECODE_FINISH(bl); } }; diff --git a/src/cls/otp/cls_otp_types.h b/src/cls/otp/cls_otp_types.h index 24f1f20948d15..cc752d3e7fed9 100644 --- a/src/cls/otp/cls_otp_types.h +++ b/src/cls/otp/cls_otp_types.h @@ -41,32 +41,32 @@ namespace rados { void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode((uint8_t)type, bl); + encode((uint8_t)type, bl); /* if we ever implement anything other than TOTP * then we'll need to branch here */ - ::encode(id, bl); - ::encode(seed, bl); - ::encode((uint8_t)seed_type, bl); - ::encode(seed_bin, bl); - ::encode(time_ofs, bl); - ::encode(step_size, bl); - ::encode(window, bl); + encode(id, bl); + encode(seed, bl); + encode((uint8_t)seed_type, bl); + encode(seed_bin, bl); + encode(time_ofs, bl); + encode(step_size, bl); + encode(window, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); uint8_t t; - ::decode(t, bl); + decode(t, bl); type = (OTPType)t; - ::decode(id, bl); - ::decode(seed, bl); + decode(id, bl); + decode(seed, bl); uint8_t st; - ::decode(st, bl); + decode(st, bl); seed_type = (SeedType)st; - ::decode(seed_bin, bl); - ::decode(time_ofs, bl); - ::decode(step_size, bl); - ::decode(window, bl); + decode(seed_bin, bl); + decode(time_ofs, bl); + decode(step_size, bl); + decode(window, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; @@ -87,17 +87,17 @@ namespace rados { void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(token, bl); - ::encode(timestamp, bl); - ::encode((char)result, bl); + encode(token, bl); + encode(timestamp, bl); + encode((char)result, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(token, bl); - ::decode(timestamp, bl); + decode(token, bl); + decode(timestamp, bl); uint8_t t; - ::decode(t, bl); + decode(t, bl); result = (OTPCheckResult)t; DECODE_FINISH(bl); } @@ -111,12 +111,12 @@ namespace rados { void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(entries, bl); + encode(entries, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(entries, bl); + decode(entries, bl); DECODE_FINISH(bl); } }; diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 8193d77b14e32..12eb7116d0d88 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -2187,7 +2187,7 @@ void RGWSetBucketVersioning::execute() bool modified = mfa_set_status; - op_ret = retry_raced_bucket_write(store, s, [this] { + op_ret = retry_raced_bucket_write(store, s, [&] { if (mfa_set_status) { if (mfa_status) { s->bucket_info.flags |= BUCKET_MFA_ENABLED; diff --git a/src/rgw/rgw_otp.cc b/src/rgw/rgw_otp.cc index 263293ffea457..73f10af71fc9e 100644 --- a/src/rgw/rgw_otp.cc +++ b/src/rgw/rgw_otp.cc @@ -10,7 +10,6 @@ #include "common/errno.h" #include "common/Formatter.h" #include "common/ceph_json.h" -#include "common/backport14.h" #include "rgw_rados.h" #include "include/types.h" @@ -96,7 +95,7 @@ public: int list_keys_init(RGWRados *store, const string& marker, void **phandle) override { - auto info = ceph::make_unique(); + auto info = std::make_unique(); info->store = store; -- 2.39.5