Skip to content

Commit

Permalink
rgw: fixes following rebase
Browse files Browse the repository at this point in the history
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
  • Loading branch information
yehudasa committed Mar 8, 2018
1 parent 8a0dac8 commit 69a9839
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 81 deletions.
44 changes: 22 additions & 22 deletions src/cls/otp/cls_otp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand All @@ -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);
}

Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -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();
Expand All @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand All @@ -510,15 +510,15 @@ 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;
}

cls_otp_get_current_time_reply reply;
reply.time = real_clock::now();
::encode(reply, *out);
encode(reply, *out);

return 0;
}
Expand Down
20 changes: 10 additions & 10 deletions src/cls/otp/cls_otp_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
}
Expand All @@ -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) {
Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down
44 changes: 22 additions & 22 deletions src/cls/otp/cls_otp_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand All @@ -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);
}
};
Expand All @@ -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);
}
};
Expand All @@ -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);
}
};
Expand All @@ -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);
}
};
Expand All @@ -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);
}
};
Expand All @@ -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);
}
};
Expand All @@ -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);
}
};
Expand Down

0 comments on commit 69a9839

Please sign in to comment.