From: Kefu Chai Date: Tue, 15 May 2018 15:54:47 +0000 (+0800) Subject: rgw: use const_iterator for decode X-Git-Tag: v14.0.0~97^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7a8e740f009dc7aa11b1497e73a1fe52bae689d2;p=ceph.git rgw: use const_iterator for decode Signed-off-by: Kefu Chai --- diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index bb8876cf8a4fa..0a4c6238f0fa9 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -363,7 +363,7 @@ static int read_bucket_header(cls_method_context_t hctx, struct rgw_bucket_dir_h *header = rgw_bucket_dir_header(); return 0; } - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { decode(*header, iter); } catch (buffer::error& err) { @@ -376,7 +376,7 @@ static int read_bucket_header(cls_method_context_t hctx, struct rgw_bucket_dir_h int rgw_bucket_list(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); struct rgw_cls_list_op op; try { @@ -420,7 +420,7 @@ int rgw_bucket_list(cls_method_context_t hctx, bufferlist *in, bufferlist *out) } bufferlist& entrybl = kiter->second; - bufferlist::iterator eiter = entrybl.begin(); + auto eiter = entrybl.cbegin(); try { decode(entry, eiter); } catch (buffer::error& err) { @@ -492,7 +492,7 @@ static int check_index(cls_method_context_t hctx, struct rgw_bucket_dir_header * } struct rgw_bucket_dir_entry entry; - bufferlist::iterator eiter = kiter->second.begin(); + auto eiter = kiter->second.cbegin(); try { decode(entry, eiter); } catch (buffer::error& err) { @@ -550,7 +550,7 @@ int rgw_bucket_update_stats(cls_method_context_t hctx, bufferlist *in, bufferlis { // decode request rgw_cls_bucket_update_stats_op op; - auto iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -581,8 +581,6 @@ int rgw_bucket_update_stats(cls_method_context_t hctx, bufferlist *in, bufferlis int rgw_bucket_init_index(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator iter; - bufferlist header_bl; int rc = cls_cxx_map_read_header(hctx, &header_bl); if (rc < 0) { @@ -609,7 +607,7 @@ int rgw_bucket_set_tag_timeout(cls_method_context_t hctx, bufferlist *in, buffer { // decode request rgw_cls_tag_timeout_op op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -636,7 +634,7 @@ int rgw_bucket_prepare_op(cls_method_context_t hctx, bufferlist *in, bufferlist { // decode request rgw_cls_obj_prepare_op op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -736,7 +734,7 @@ static int read_index_entry(cls_method_context_t hctx, string& name, T *entry) return rc; } - bufferlist::iterator cur_iter = current_entry.begin(); + auto cur_iter = current_entry.cbegin(); try { decode(*entry, cur_iter); } catch (buffer::error& err) { @@ -784,7 +782,7 @@ int rgw_bucket_complete_op(cls_method_context_t hctx, bufferlist *in, bufferlist { // decode request rgw_cls_obj_complete_op op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -1178,7 +1176,7 @@ public: map::reverse_iterator last = keys.rbegin(); try { - bufferlist::iterator iter = last->second.begin(); + auto iter = last->second.cbegin(); decode(next_entry, iter); } catch (buffer::error& err) { CLS_LOG(0, "ERROR; failed to decode entry: %s", last->first.c_str()); @@ -1369,7 +1367,7 @@ static int rgw_bucket_link_olh(cls_method_context_t hctx, bufferlist *in, buffer // decode request rgw_cls_link_olh_op op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -1551,7 +1549,7 @@ static int rgw_bucket_unlink_instance(cls_method_context_t hctx, bufferlist *in, // decode request rgw_cls_unlink_instance_op op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -1696,7 +1694,7 @@ static int rgw_bucket_read_olh_log(cls_method_context_t hctx, bufferlist *in, bu { // decode request rgw_cls_read_olh_log_op op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -1749,7 +1747,7 @@ static int rgw_bucket_trim_olh_log(cls_method_context_t hctx, bufferlist *in, bu { // decode request rgw_cls_trim_olh_log_op op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -1800,7 +1798,7 @@ static int rgw_bucket_clear_olh(cls_method_context_t hctx, bufferlist *in, buffe { // decode request rgw_cls_bucket_clear_olh_op op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -1880,7 +1878,7 @@ int rgw_dir_suggest_changes(cls_method_context_t hctx, std::chrono::seconds( header.tag_timeout ? header.tag_timeout : CEPH_RGW_TAG_TIMEOUT)); - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); while (!in_iter.end()) { __u8 op; @@ -1902,7 +1900,7 @@ int rgw_dir_suggest_changes(cls_method_context_t hctx, return -EINVAL; if (cur_disk_bl.length()) { - bufferlist::iterator cur_disk_iter = cur_disk_bl.begin(); + auto cur_disk_iter = cur_disk_bl.cbegin(); try { decode(cur_disk, cur_disk_iter); } catch (buffer::error& error) { @@ -2004,7 +2002,7 @@ static int rgw_obj_remove(cls_method_context_t hctx, bufferlist *in, bufferlist { // decode request rgw_cls_obj_remove_op op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -2077,7 +2075,7 @@ static int rgw_obj_store_pg_ver(cls_method_context_t hctx, bufferlist *in, buffe { // decode request rgw_cls_obj_store_pg_ver_op op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -2101,7 +2099,7 @@ static int rgw_obj_check_attrs_prefix(cls_method_context_t hctx, bufferlist *in, { // decode request rgw_cls_obj_check_attrs_prefix op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -2144,7 +2142,7 @@ static int rgw_obj_check_mtime(cls_method_context_t hctx, bufferlist *in, buffer { // decode request rgw_cls_obj_check_mtime op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -2207,7 +2205,7 @@ static int rgw_bi_get_op(cls_method_context_t hctx, bufferlist *in, bufferlist * { // decode request rgw_cls_bi_get_op op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -2254,7 +2252,7 @@ static int rgw_bi_put_op(cls_method_context_t hctx, bufferlist *in, bufferlist * { // decode request rgw_cls_bi_put_op op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -2303,7 +2301,7 @@ static int list_plain_entries(cls_method_context_t hctx, const string& name, con entry.idx = iter->first; entry.data = iter->second; - bufferlist::iterator biter = entry.data.begin(); + auto biter = entry.data.cbegin(); rgw_bucket_dir_entry e; try { @@ -2391,7 +2389,7 @@ static int list_instance_entries(cls_method_context_t hctx, const string& name, CLS_LOG(20, "%s(): entry.idx=%s", __func__, escape_str(entry.idx).c_str()); - bufferlist::iterator biter = entry.data.begin(); + auto biter = entry.data.cbegin(); rgw_bucket_dir_entry e; try { @@ -2476,7 +2474,7 @@ static int list_olh_entries(cls_method_context_t hctx, const string& name, const CLS_LOG(20, "%s(): entry.idx=%s", __func__, escape_str(entry.idx).c_str()); - bufferlist::iterator biter = entry.data.begin(); + auto biter = entry.data.cbegin(); rgw_bucket_olh_entry e; try { @@ -2506,7 +2504,7 @@ static int rgw_bi_list_op(cls_method_context_t hctx, bufferlist *in, bufferlist { // decode request rgw_cls_bi_list_op op; - bufferlist::iterator iter = in->begin(); + auto iter = in->cbegin(); try { decode(op, iter); } catch (buffer::error& err) { @@ -2563,7 +2561,7 @@ static int rgw_bi_list_op(cls_method_context_t hctx, bufferlist *in, bufferlist int bi_log_record_decode(bufferlist& bl, rgw_bi_log_entry& e) { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { decode(e, iter); } catch (buffer::error& err) { @@ -2672,7 +2670,7 @@ static int bi_log_list_entries(cls_method_context_t hctx, const string& marker, static int rgw_bi_log_list(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); cls_rgw_bi_log_list_op op; try { @@ -2723,7 +2721,7 @@ static int bi_log_list_trim_entries(cls_method_context_t hctx, static int rgw_bi_log_trim(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); cls_rgw_bi_log_trim_op op; try { @@ -2854,7 +2852,7 @@ static void usage_record_name_by_user(const string& user, uint64_t epoch, string static int usage_record_decode(bufferlist& record_bl, rgw_usage_log_entry& e) { - bufferlist::iterator kiter = record_bl.begin(); + auto kiter = record_bl.cbegin(); try { decode(e, kiter); } catch (buffer::error& err) { @@ -2869,7 +2867,7 @@ int rgw_user_usage_log_add(cls_method_context_t hctx, bufferlist *in, bufferlist { CLS_LOG(10, "rgw_user_usage_log_add()"); - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); rgw_cls_usage_log_add_op op; try { @@ -3035,7 +3033,7 @@ int rgw_user_usage_log_read(cls_method_context_t hctx, bufferlist *in, bufferlis { CLS_LOG(10, "rgw_user_usage_log_read()"); - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); rgw_cls_usage_log_read_op op; try { @@ -3090,7 +3088,7 @@ int rgw_user_usage_log_trim(cls_method_context_t hctx, bufferlist *in, bufferlis if (ret < 0) return ret; - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); rgw_cls_usage_log_trim_op op; try { @@ -3153,7 +3151,7 @@ static int gc_omap_get(cls_method_context_t hctx, int type, const string& key, c return ret; try { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); decode(*info, iter); } catch (buffer::error& err) { CLS_LOG(0, "ERROR: rgw_cls_gc_omap_get(): failed to decode index=%s\n", index.c_str()); @@ -3243,7 +3241,7 @@ static int gc_defer_entry(cls_method_context_t hctx, const string& tag, uint32_t int gc_record_decode(bufferlist& bl, cls_rgw_gc_obj_info& e) { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { decode(e, iter); } catch (buffer::error& err) { @@ -3255,7 +3253,7 @@ int gc_record_decode(bufferlist& bl, cls_rgw_gc_obj_info& e) static int rgw_cls_gc_set_entry(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); cls_rgw_gc_set_entry_op op; try { @@ -3270,7 +3268,7 @@ static int rgw_cls_gc_set_entry(cls_method_context_t hctx, bufferlist *in, buffe static int rgw_cls_gc_defer_entry(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); cls_rgw_gc_defer_entry_op op; try { @@ -3374,7 +3372,7 @@ static int gc_list_entries(cls_method_context_t hctx, const string& marker, static int rgw_cls_gc_list(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); cls_rgw_gc_list_op op; try { @@ -3429,7 +3427,7 @@ static int gc_remove(cls_method_context_t hctx, vector& tags) static int rgw_cls_gc_remove(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); cls_rgw_gc_remove_op op; try { @@ -3444,7 +3442,7 @@ static int rgw_cls_gc_remove(cls_method_context_t hctx, bufferlist *in, bufferli static int rgw_cls_lc_set_entry(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); cls_rgw_lc_set_entry_op op; try { @@ -3463,7 +3461,7 @@ static int rgw_cls_lc_set_entry(cls_method_context_t hctx, bufferlist *in, buffe static int rgw_cls_lc_rm_entry(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); cls_rgw_lc_rm_entry_op op; try { @@ -3479,7 +3477,7 @@ static int rgw_cls_lc_rm_entry(cls_method_context_t hctx, bufferlist *in, buffer static int rgw_cls_lc_get_next_entry(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); cls_rgw_lc_get_next_entry_ret op_ret; cls_rgw_lc_get_next_entry_op op; try { @@ -3515,7 +3513,7 @@ static int rgw_cls_lc_get_next_entry(cls_method_context_t hctx, bufferlist *in, static int rgw_cls_lc_list_entries(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { cls_rgw_lc_list_entries_op op; - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); try { decode(op, in_iter); } catch (buffer::error& err) { @@ -3524,7 +3522,7 @@ static int rgw_cls_lc_list_entries(cls_method_context_t hctx, bufferlist *in, bu } cls_rgw_lc_list_entries_ret op_ret; - bufferlist::iterator iter; + bufferlist::const_iterator iter; map vals; string filter_prefix; int ret = cls_cxx_map_get_vals(hctx, op.marker, filter_prefix, op.max_entries, &vals, &op_ret.is_truncated); @@ -3533,7 +3531,7 @@ static int rgw_cls_lc_list_entries(cls_method_context_t hctx, bufferlist *in, bu map::iterator it; pair entry; for (it = vals.begin(); it != vals.end(); ++it) { - iter = it->second.begin(); + iter = it->second.cbegin(); try { decode(entry, iter); } catch (buffer::error& err) { @@ -3548,7 +3546,7 @@ static int rgw_cls_lc_list_entries(cls_method_context_t hctx, bufferlist *in, bu static int rgw_cls_lc_put_head(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); cls_rgw_lc_put_head_op op; try { @@ -3572,7 +3570,7 @@ static int rgw_cls_lc_get_head(cls_method_context_t hctx, bufferlist *in, buffe return ret; cls_rgw_lc_obj_head head; if (bl.length() != 0) { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { decode(head, iter); } catch (buffer::error& err) { @@ -3591,7 +3589,7 @@ static int rgw_cls_lc_get_head(cls_method_context_t hctx, bufferlist *in, buffe static int rgw_reshard_add(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); cls_rgw_reshard_add_op op; try { @@ -3619,7 +3617,7 @@ static int rgw_reshard_add(cls_method_context_t hctx, bufferlist *in, bufferlist static int rgw_reshard_list(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { cls_rgw_reshard_list_op op; - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); try { decode(op, in_iter); } catch (buffer::error& err) { @@ -3627,7 +3625,7 @@ static int rgw_reshard_list(cls_method_context_t hctx, bufferlist *in, bufferlis return -EINVAL; } cls_rgw_reshard_list_ret op_ret; - bufferlist::iterator iter; + bufferlist::const_iterator iter; map vals; string filter_prefix; #define MAX_RESHARD_LIST_ENTRIES 1000 @@ -3640,7 +3638,7 @@ static int rgw_reshard_list(cls_method_context_t hctx, bufferlist *in, bufferlis cls_rgw_reshard_entry entry; int i = 0; for (it = vals.begin(); i < (int)op.max && it != vals.end(); ++it, ++i) { - iter = it->second.begin(); + iter = it->second.cbegin(); try { decode(entry, iter); } catch (buffer::error& err) { @@ -3659,7 +3657,7 @@ static int get_reshard_entry(cls_method_context_t hctx, const string& key, cls_r int ret = cls_cxx_map_get_val(hctx, key, &bl); if (ret < 0) return ret; - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { decode(*entry, iter); } catch (buffer::error& err) { @@ -3671,7 +3669,7 @@ static int get_reshard_entry(cls_method_context_t hctx, const string& key, cls_r static int rgw_reshard_get(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); cls_rgw_reshard_get_op op; try { @@ -3697,7 +3695,7 @@ static int rgw_reshard_get(cls_method_context_t hctx, bufferlist *in, bufferlis static int rgw_reshard_remove(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); cls_rgw_reshard_remove_op op; try { @@ -3732,7 +3730,7 @@ static int rgw_set_bucket_resharding(cls_method_context_t hctx, bufferlist *in, { cls_rgw_set_bucket_resharding_op op; - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); try { decode(op, in_iter); } catch (buffer::error& err) { @@ -3756,7 +3754,7 @@ static int rgw_clear_bucket_resharding(cls_method_context_t hctx, bufferlist *in { cls_rgw_set_bucket_resharding_op op; - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); try { decode(op, in_iter); } catch (buffer::error& err) { @@ -3779,7 +3777,7 @@ static int rgw_guard_bucket_resharding(cls_method_context_t hctx, bufferlist *in { cls_rgw_guard_bucket_resharding_op op; - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); try { decode(op, in_iter); } catch (buffer::error& err) { @@ -3805,7 +3803,7 @@ static int rgw_get_bucket_resharding(cls_method_context_t hctx, bufferlist *in, { cls_rgw_get_bucket_resharding_op op; - bufferlist::iterator in_iter = in->begin(); + auto in_iter = in->cbegin(); try { decode(op, in_iter); } catch (buffer::error& err) { diff --git a/src/cls/rgw/cls_rgw_client.cc b/src/cls/rgw/cls_rgw_client.cc index a0560b2b36f48..361a08d20e4b8 100644 --- a/src/cls/rgw/cls_rgw_client.cc +++ b/src/cls/rgw/cls_rgw_client.cc @@ -26,7 +26,7 @@ public: void handle_completion(int r, bufferlist& outbl) override { if (r >= 0) { try { - bufferlist::iterator iter = outbl.begin(); + auto iter = outbl.cbegin(); decode((*data), iter); } catch (buffer::error& err) { r = -EIO; @@ -266,7 +266,7 @@ int cls_rgw_bi_get(librados::IoCtx& io_ctx, const string oid, return r; struct rgw_cls_bi_get_ret op_ret; - bufferlist::iterator iter = out.begin(); + auto iter = out.cbegin(); try { decode(op_ret, iter); } catch (buffer::error& err) { @@ -315,7 +315,7 @@ int cls_rgw_bi_list(librados::IoCtx& io_ctx, const string oid, return r; struct rgw_cls_bi_list_ret op_ret; - bufferlist::iterator iter = out.begin(); + auto iter = out.cbegin(); try { decode(op_ret, iter); } catch (buffer::error& err) { @@ -400,7 +400,7 @@ int cls_rgw_get_olh_log(IoCtx& io_ctx, string& oid, librados::ObjectReadOperatio struct rgw_cls_read_olh_log_ret ret; try { - bufferlist::iterator iter = out.begin(); + auto iter = out.cbegin(); decode(ret, iter); } catch (buffer::error& err) { return -EIO; @@ -560,7 +560,7 @@ public: void handle_completion(int r, bufferlist& outbl) override { struct rgw_cls_list_ret ret; try { - bufferlist::iterator iter = outbl.begin(); + auto iter = outbl.cbegin(); decode(ret, iter); } catch (buffer::error& err) { r = -EIO; @@ -610,7 +610,7 @@ int cls_rgw_usage_log_read(IoCtx& io_ctx, string& oid, string& user, try { rgw_cls_usage_log_read_ret result; - bufferlist::iterator iter = out.begin(); + auto iter = out.cbegin(); decode(result, iter); read_iter = result.next_iter; if (is_truncated) @@ -700,7 +700,7 @@ int cls_rgw_gc_list(IoCtx& io_ctx, string& oid, string& marker, uint32_t max, bo cls_rgw_gc_list_ret ret; try { - bufferlist::iterator iter = out.begin(); + auto iter = out.cbegin(); decode(ret, iter); } catch (buffer::error& err) { return -EIO; @@ -732,7 +732,7 @@ int cls_rgw_lc_get_head(IoCtx& io_ctx, string& oid, cls_rgw_lc_obj_head& head) cls_rgw_lc_get_head_ret ret; try { - bufferlist::iterator iter = out.begin(); + auto iter = out.cbegin(); decode(ret, iter); } catch (buffer::error& err) { return -EIO; @@ -764,7 +764,7 @@ int cls_rgw_lc_get_next_entry(IoCtx& io_ctx, string& oid, string& marker, pair= 2) { @@ -606,7 +606,7 @@ struct rgw_cls_bi_get_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(key, bl); uint8_t c; @@ -628,7 +628,7 @@ struct rgw_cls_bi_get_ret { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entry, bl); DECODE_FINISH(bl); @@ -647,7 +647,7 @@ struct rgw_cls_bi_put_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entry, bl); DECODE_FINISH(bl); @@ -670,7 +670,7 @@ struct rgw_cls_bi_list_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(max, bl); decode(name, bl); @@ -693,7 +693,7 @@ struct rgw_cls_bi_list_ret { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entries, bl); decode(is_truncated, bl); @@ -720,7 +720,7 @@ struct rgw_cls_usage_log_read_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(start_epoch, bl); decode(end_epoch, bl); @@ -745,7 +745,7 @@ struct rgw_cls_usage_log_read_ret { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(usage, bl); decode(truncated, bl); @@ -768,7 +768,7 @@ struct rgw_cls_usage_log_trim_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(start_epoch, bl); decode(end_epoch, bl); @@ -790,7 +790,7 @@ struct cls_rgw_gc_set_entry_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(expiration_secs, bl); decode(info, bl); @@ -814,7 +814,7 @@ struct cls_rgw_gc_defer_entry_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(expiration_secs, bl); decode(tag, bl); @@ -841,7 +841,7 @@ struct cls_rgw_gc_list_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(marker, bl); decode(max, bl); @@ -871,7 +871,7 @@ struct cls_rgw_gc_list_ret { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(entries, bl); if (struct_v >= 2) @@ -896,7 +896,7 @@ struct cls_rgw_gc_remove_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(tags, bl); DECODE_FINISH(bl); @@ -920,7 +920,7 @@ struct cls_rgw_bi_log_list_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(marker, bl); decode(max, bl); @@ -945,7 +945,7 @@ struct cls_rgw_bi_log_trim_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(start_marker, bl); decode(end_marker, bl); @@ -970,7 +970,7 @@ struct cls_rgw_bi_log_list_ret { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entries, bl); decode(truncated, bl); @@ -992,7 +992,7 @@ struct cls_rgw_lc_get_next_entry_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(marker, bl); DECODE_FINISH(bl); @@ -1011,7 +1011,7 @@ struct cls_rgw_lc_get_next_entry_ret { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entry, bl); DECODE_FINISH(bl); @@ -1030,7 +1030,7 @@ struct cls_rgw_lc_rm_entry_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entry, bl); DECODE_FINISH(bl); @@ -1048,7 +1048,7 @@ struct cls_rgw_lc_set_entry_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entry, bl); DECODE_FINISH(bl); @@ -1068,7 +1068,7 @@ struct cls_rgw_lc_put_head_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(head, bl); DECODE_FINISH(bl); @@ -1088,7 +1088,7 @@ struct cls_rgw_lc_get_head_ret { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(head, bl); DECODE_FINISH(bl); @@ -1110,7 +1110,7 @@ struct cls_rgw_lc_list_entries_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(marker, bl); decode(max_entries, bl); @@ -1133,7 +1133,7 @@ struct cls_rgw_lc_list_entries_ret { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(entries, bl); if (struct_v >= 2) { @@ -1156,7 +1156,7 @@ struct cls_rgw_reshard_add_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entry, bl); DECODE_FINISH(bl); @@ -1179,7 +1179,7 @@ struct cls_rgw_reshard_list_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(max, bl); decode(marker, bl); @@ -1204,7 +1204,7 @@ struct cls_rgw_reshard_list_ret { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entries, bl); decode(is_truncated, bl); @@ -1226,7 +1226,7 @@ struct cls_rgw_reshard_get_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entry, bl); DECODE_FINISH(bl); @@ -1247,7 +1247,7 @@ struct cls_rgw_reshard_get_ret { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entry, bl); DECODE_FINISH(bl); @@ -1272,7 +1272,7 @@ struct cls_rgw_reshard_remove_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(tenant, bl); decode(bucket_name, bl); @@ -1293,7 +1293,7 @@ struct cls_rgw_set_bucket_resharding_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entry, bl); DECODE_FINISH(bl); @@ -1309,7 +1309,7 @@ struct cls_rgw_clear_bucket_resharding_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); DECODE_FINISH(bl); } @@ -1327,7 +1327,7 @@ struct cls_rgw_guard_bucket_resharding_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(ret_err, bl); DECODE_FINISH(bl); @@ -1345,7 +1345,7 @@ struct cls_rgw_get_bucket_resharding_op { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); DECODE_FINISH(bl); } @@ -1364,7 +1364,7 @@ struct cls_rgw_get_bucket_resharding_ret { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(new_instance, bl); DECODE_FINISH(bl); diff --git a/src/cls/rgw/cls_rgw_types.cc b/src/cls/rgw/cls_rgw_types.cc index 931dd3c38e1bd..9430c0022825b 100644 --- a/src/cls/rgw/cls_rgw_types.cc +++ b/src/cls/rgw/cls_rgw_types.cc @@ -154,7 +154,7 @@ void rgw_bucket_dir_entry::decode_json(JSONObj *obj) { static void dump_bi_entry(bufferlist bl, BIIndexType index_type, Formatter *formatter) { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); switch (index_type) { case PlainIdx: case InstanceIdx: @@ -243,7 +243,7 @@ void rgw_cls_bi_entry::dump(Formatter *f) const bool rgw_cls_bi_entry::get_info(cls_rgw_obj_key *key, uint8_t *category, rgw_bucket_category_stats *accounted_stats) { bool account = false; - bufferlist::iterator iter = data.begin(); + auto iter = data.cbegin(); using ceph::decode; switch (type) { case PlainIdx: diff --git a/src/cls/rgw/cls_rgw_types.h b/src/cls/rgw/cls_rgw_types.h index fa08a48b9a133..d1af718afe6e2 100644 --- a/src/cls/rgw/cls_rgw_types.h +++ b/src/cls/rgw/cls_rgw_types.h @@ -73,7 +73,7 @@ struct rgw_bucket_pending_info { encode(op, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator &bl) { + void decode(bufferlist::const_iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); uint8_t s; decode(s, bl); @@ -115,7 +115,7 @@ struct rgw_bucket_dir_entry_meta { encode(user_data, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator &bl) { + void decode(bufferlist::const_iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(5, 3, 3, bl); decode(category, bl); decode(size, bl); @@ -169,7 +169,7 @@ void encode_packed_val(T val, bufferlist& bl) } template -void decode_packed_val(T& val, bufferlist::iterator& bl) +void decode_packed_val(T& val, bufferlist::const_iterator& bl) { using ceph::decode; unsigned char c; @@ -227,7 +227,7 @@ struct rgw_bucket_entry_ver { encode_packed_val(epoch, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator &bl) { + void decode(bufferlist::const_iterator &bl) { DECODE_START(1, bl); decode_packed_val(pool, bl); decode_packed_val(epoch, bl); @@ -274,7 +274,7 @@ struct cls_rgw_obj_key { encode(instance, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator &bl) { + void decode(bufferlist::const_iterator &bl) { DECODE_START(1, bl); decode(name, bl); decode(instance, bl); @@ -331,7 +331,7 @@ struct rgw_bucket_dir_entry { encode(versioned_epoch, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator &bl) { + void decode(bufferlist::const_iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(8, 3, 3, bl); decode(key.name, bl); decode(ver.epoch, bl); @@ -403,7 +403,7 @@ struct rgw_cls_bi_entry { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); uint8_t c; decode(c, bl); @@ -446,7 +446,7 @@ struct rgw_bucket_olh_log_entry { encode(delete_marker, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator &bl) { + void decode(bufferlist::const_iterator &bl) { DECODE_START(1, bl); decode(epoch, bl); uint8_t c; @@ -485,7 +485,7 @@ struct rgw_bucket_olh_entry { encode(pending_removal, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator &bl) { + void decode(bufferlist::const_iterator &bl) { DECODE_START(1, bl); decode(key, bl); decode(delete_marker, bl); @@ -537,7 +537,7 @@ struct rgw_bi_log_entry { encode(zones_trace, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator &bl) { + void decode(bufferlist::const_iterator &bl) { DECODE_START(4, bl); decode(id, bl); decode(object, bl); @@ -589,7 +589,7 @@ struct rgw_bucket_category_stats { encode(actual_size, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator &bl) { + void decode(bufferlist::const_iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl); decode(total_size, bl); decode(total_size_rounded, bl); @@ -625,7 +625,7 @@ struct cls_rgw_bucket_instance_entry { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); uint8_t s; decode(s, bl); @@ -680,7 +680,7 @@ struct rgw_bucket_dir_header { encode(syncstopped,bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator &bl) { + void decode(bufferlist::const_iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(6, 2, 2, bl); decode(stats, bl); if (struct_v > 2) { @@ -729,7 +729,7 @@ struct rgw_bucket_dir { encode(m, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator &bl) { + void decode(bufferlist::const_iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); decode(header, bl); decode(m, bl); @@ -758,7 +758,7 @@ struct rgw_usage_data { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(bytes_sent, bl); decode(bytes_received, bl); @@ -804,7 +804,7 @@ struct rgw_usage_log_entry { } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(3, bl); string s; decode(s, bl); @@ -869,7 +869,7 @@ struct rgw_usage_log_info { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entries, bl); DECODE_FINISH(bl); @@ -893,7 +893,7 @@ struct rgw_user_bucket { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(user, bl); decode(bucket, bl); @@ -934,7 +934,7 @@ struct cls_rgw_obj { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(pool, bl); decode(key.name, bl); @@ -980,7 +980,7 @@ struct cls_rgw_obj_chain { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(objs, bl); DECODE_FINISH(bl); @@ -1021,7 +1021,7 @@ struct cls_rgw_gc_obj_info ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(tag, bl); decode(chain, bl); @@ -1061,7 +1061,7 @@ struct cls_rgw_lc_obj_head ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); uint64_t t; decode(t, bl); @@ -1099,7 +1099,7 @@ struct cls_rgw_reshard_entry ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(time, bl); decode(tenant, bl); diff --git a/src/rgw/rgw_acl.h b/src/rgw/rgw_acl.h index 42a401d9133d7..32736663965d8 100644 --- a/src/rgw/rgw_acl.h +++ b/src/rgw/rgw_acl.h @@ -60,7 +60,7 @@ public: encode(flags, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); decode(flags, bl); DECODE_FINISH(bl); @@ -86,7 +86,7 @@ public: encode(type, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); decode(type, bl); DECODE_FINISH(bl); @@ -157,7 +157,7 @@ public: encode(url_spec, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(5, 3, 3, bl); decode(type, bl); string s; @@ -246,7 +246,7 @@ struct ACLReferer { encode(perm, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl); decode(url_spec, bl); decode(perm, bl); @@ -319,7 +319,7 @@ public: encode(referer_list, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(4, 3, 3, bl); bool maps_initialized; decode(maps_initialized, bl); @@ -376,7 +376,7 @@ public: encode(display_name, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl); string s; decode(s, bl); @@ -428,7 +428,7 @@ public: encode(acl, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); decode(owner, bl); decode(acl, bl); @@ -436,7 +436,7 @@ public: } void dump(Formatter *f) const; static void generate_test_instances(list& o); - void decode_owner(bufferlist::iterator& bl) { // sometimes we only need that, should be faster + void decode_owner(bufferlist::const_iterator& bl) { // sometimes we only need that, should be faster DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); decode(owner, bl); DECODE_FINISH(bl); diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index f9bfc861d8313..6a5651474762b 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -984,7 +984,7 @@ BIIndexType get_bi_index_type(const string& type_str) { void dump_bi_entry(bufferlist& bl, BIIndexType index_type, Formatter *formatter) { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); switch (index_type) { case PlainIdx: case InstanceIdx: @@ -1190,7 +1190,7 @@ static bool decode_dump(const char *field_name, bufferlist& bl, Formatter *f) { T t; - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { decode(t, iter); @@ -1344,7 +1344,7 @@ int check_min_obj_stripe_size(RGWRados *store, RGWBucketInfo& bucket_info, rgw_o try { bufferlist& bl = iter->second; - bufferlist::iterator biter = bl.begin(); + auto biter = bl.cbegin(); decode(manifest, biter); } catch (buffer::error& err) { ldout(store->ctx(), 0) << "ERROR: failed to decode manifest" << dendl; @@ -7119,7 +7119,7 @@ next: for (auto& cls_entry : entries) { rgw_sync_error_info log_entry; - auto iter = cls_entry.data.begin(); + auto iter = cls_entry.data.cbegin(); try { decode(log_entry, iter); } catch (buffer::error& err) { diff --git a/src/rgw/rgw_basic_types.h b/src/rgw/rgw_basic_types.h index 179f2b94a7e09..21e7a81ba9334 100644 --- a/src/rgw/rgw_basic_types.h +++ b/src/rgw/rgw_basic_types.h @@ -31,7 +31,7 @@ struct rgw_user { encode(id, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(tenant, bl); decode(id, bl); diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 6e4c56858bb7a..34036572848d3 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -840,7 +840,7 @@ int RGWBucket::link(RGWBucketAdminOpState& op_state, std::string *err_msg) RGWAccessControlPolicy policy; ACLOwner owner; try { - bufferlist::iterator iter = aclbl.begin(); + auto iter = aclbl.cbegin(); decode(policy, iter); owner = policy.get_owner(); } catch (buffer::error& err) { @@ -1196,7 +1196,7 @@ int RGWBucket::check_index(RGWBucketAdminOpState& op_state, int RGWBucket::policy_bl_to_stream(bufferlist& bl, ostream& o) { RGWAccessControlPolicy_S3 policy(g_ceph_context); - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { policy.decode(iter); } catch (buffer::error& err) { @@ -1209,7 +1209,7 @@ int RGWBucket::policy_bl_to_stream(bufferlist& bl, ostream& o) static int policy_decode(RGWRados *store, bufferlist& bl, RGWAccessControlPolicy& policy) { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { policy.decode(iter); } catch (buffer::error& err) { @@ -1914,7 +1914,7 @@ int RGWDataChangesLog::list_entries(int shard, const real_time& start_time, cons log_entry.log_id = iter->id; real_time rt = iter->timestamp.to_real_time(); log_entry.log_timestamp = rt; - bufferlist::iterator liter = iter->data.begin(); + auto liter = iter->data.cbegin(); try { decode(log_entry.entry, liter); } catch (buffer::error& err) { diff --git a/src/rgw/rgw_bucket.h b/src/rgw/rgw_bucket.h index 3079a936163d6..6542b5bf87951 100644 --- a/src/rgw/rgw_bucket.h +++ b/src/rgw/rgw_bucket.h @@ -116,7 +116,7 @@ public: using ceph::encode; encode(buckets, bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { using ceph::decode; decode(buckets, bl); } @@ -359,7 +359,7 @@ struct rgw_data_change { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); uint8_t t; decode(t, bl); @@ -387,7 +387,7 @@ struct rgw_data_change_log_entry { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(log_id, bl); decode(log_timestamp, bl); diff --git a/src/rgw/rgw_cache.h b/src/rgw/rgw_cache.h index d62f0a391b7ef..1911db9bcf4ba 100644 --- a/src/rgw/rgw_cache.h +++ b/src/rgw/rgw_cache.h @@ -38,7 +38,7 @@ struct ObjectMetaInfo { encode(mtime, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); decode(size, bl); decode(mtime, bl); @@ -74,7 +74,7 @@ struct ObjectCacheInfo { encode(version, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(5, 3, 3, bl); decode(status, bl); decode(flags, bl); @@ -112,7 +112,7 @@ struct RGWCacheNotifyInfo { encode(ns, obl); ENCODE_FINISH(obl); } - void decode(bufferlist::iterator& ibl) { + void decode(bufferlist::const_iterator& ibl) { DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, ibl); decode(op, ibl); decode(obj, ibl); @@ -583,7 +583,7 @@ int RGWCache::watch_cb(uint64_t notify_id, RGWCacheNotifyInfo info; try { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); decode(info, iter); } catch (buffer::end_of_buffer& err) { mydout(0) << "ERROR: got bad notification" << dendl; diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 42c7e979da3bc..788deafe4d718 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -1800,7 +1800,7 @@ string rgw_pool::to_str() const return esc_name + ":" + esc_ns; } -void rgw_raw_obj::decode_from_rgw_obj(bufferlist::iterator& bl) +void rgw_raw_obj::decode_from_rgw_obj(bufferlist::const_iterator& bl) { using ceph::decode; rgw_obj old_obj; diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 9cc0a96aed64a..44b3e23693c04 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -531,7 +531,7 @@ struct RGWAccessKey { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN_32(2, 2, 2, bl); decode(id, bl); decode(key, bl); @@ -560,7 +560,7 @@ struct RGWSubUser { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN_32(2, 2, 2, bl); decode(name, bl); decode(perm_mask, bl); @@ -591,7 +591,7 @@ public: encode(caps, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(caps, bl); DECODE_FINISH(bl); @@ -703,7 +703,7 @@ struct RGWUserInfo encode(mfa_ids, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN_32(20, 9, 9, bl); if (struct_v >= 2) decode(auid, bl); else auid = CEPH_AUTH_UID_DEFAULT; @@ -827,9 +827,9 @@ struct rgw_pool { ENCODE_FINISH(bl); } - void decode_from_bucket(bufferlist::iterator& bl); + void decode_from_bucket(bufferlist::const_iterator& bl); - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(10, 3, 3, bl); decode(name, bl); @@ -947,9 +947,9 @@ struct rgw_raw_obj { ENCODE_FINISH(bl); } - void decode_from_rgw_obj(bufferlist::iterator& bl); + void decode_from_rgw_obj(bufferlist::const_iterator& bl); - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { unsigned ofs = bl.get_off(); DECODE_START(6, bl); if (struct_v < 6) { @@ -1040,7 +1040,7 @@ struct rgw_bucket { } ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(10, 3, 3, bl); decode(name, bl); if (struct_v < 10) { @@ -1282,7 +1282,7 @@ struct RGWBucketInfo { encode(new_bucket_instance_id, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN_32(19, 4, 4, bl); decode(bucket, bl); if (struct_v >= 2) { @@ -1393,8 +1393,8 @@ struct RGWBucketEntryPoint encode(creation_time, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { - bufferlist::iterator orig_iter = bl; + void decode(bufferlist::const_iterator& bl) { + auto orig_iter = bl; DECODE_START_LEGACY_COMPAT_LEN_32(10, 4, 4, bl); if (struct_v < 8) { /* ouch, old entry, contains the bucket info itself */ @@ -1733,7 +1733,7 @@ struct rgw_obj_key { encode(ns, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(name, bl); decode(instance, bl); @@ -1963,7 +1963,7 @@ struct RGWBucketEnt { encode(placement_rule, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(6, 5, 5, bl); __u32 mt; uint64_t s; @@ -2055,7 +2055,7 @@ struct rgw_obj { // encode(placement_id, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(6, 3, 3, bl); if (struct_v < 6) { string s; diff --git a/src/rgw/rgw_cors.h b/src/rgw/rgw_cors.h index b525ddcd0d804..892cda787ce40 100644 --- a/src/rgw/rgw_cors.h +++ b/src/rgw/rgw_cors.h @@ -70,7 +70,7 @@ public: encode(exposable_hdrs, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(max_age, bl); decode(allowed_methods, bl); @@ -103,7 +103,7 @@ class RGWCORSConfiguration encode(rules, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(rules, bl); DECODE_FINISH(bl); diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index dbd863a5846d1..283af95c3a65a 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -657,7 +657,7 @@ int RGWAsyncRemoveObj::_send_request() /* decode policy */ map::iterator iter = state->attrset.find(RGW_ATTR_ACL); if (iter != state->attrset.end()) { - bufferlist::iterator bliter = iter->second.begin(); + auto bliter = iter->second.cbegin(); try { policy.decode(bliter); } catch (buffer::error& err) { diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index e275ffa9b6446..1bf0271e0e271 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -248,7 +248,7 @@ int RGWSimpleRadosReadCR::request_complete() return ret; } try { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); if (iter.end()) { // allow successful reads with empty buffers. ReadSyncStatus coroutines // depend on this to be able to read without locking, because the diff --git a/src/rgw/rgw_crypt.cc b/src/rgw/rgw_crypt.cc index 2143bf0c1aaee..26aeb719ff2af 100644 --- a/src/rgw/rgw_crypt.cc +++ b/src/rgw/rgw_crypt.cc @@ -536,7 +536,7 @@ int RGWGetObj_BlockDecrypt::read_manifest(bufferlist& manifest_bl) { parts_len.clear(); RGWObjManifest manifest; if (manifest_bl.length()) { - bufferlist::iterator miter = manifest_bl.begin(); + auto miter = manifest_bl.cbegin(); try { decode(manifest, miter); } catch (buffer::error& err) { diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 7edc3d6ab1c3e..7fb4c14e5bb20 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -2013,7 +2013,7 @@ static void decode_attr(CephContext *cct, map& attrs, const return; } - bufferlist::iterator biter = iter->second.begin(); + auto biter = iter->second.cbegin(); try { decode(*val, biter); } catch (buffer::error& err) { diff --git a/src/rgw/rgw_data_sync.h b/src/rgw/rgw_data_sync.h index 8c6b7e2a88851..d5d2e3534da8c 100644 --- a/src/rgw/rgw_data_sync.h +++ b/src/rgw/rgw_data_sync.h @@ -46,7 +46,7 @@ struct rgw_data_sync_info { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(state, bl); decode(num_shards, bl); @@ -120,7 +120,7 @@ struct rgw_data_sync_marker { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(state, bl); decode(marker, bl); @@ -184,7 +184,7 @@ struct rgw_data_sync_status { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(sync_info, bl); /* sync markers are decoded separately */ @@ -396,7 +396,7 @@ struct rgw_bucket_shard_full_sync_marker { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(position, bl); decode(count, bl); @@ -421,7 +421,7 @@ struct rgw_bucket_shard_inc_sync_marker { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(position, bl); DECODE_FINISH(bl); @@ -459,7 +459,7 @@ struct rgw_bucket_shard_sync_info { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(state, bl); decode(full_marker, bl); diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index e363d7d96341d..ab6b27f13e060 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -984,7 +984,7 @@ namespace rgw { using ceph::decode; DecodeAttrsResult dar { false, false }; fh_key fhk; - auto bl_iter_key1 = const_cast(ux_key1)->begin(); + auto bl_iter_key1 = ux_key1->cbegin(); decode(fhk, bl_iter_key1); if (fhk.version >= 2) { assert(this->fh.fh_hk == fhk.fh_hk); @@ -992,7 +992,7 @@ namespace rgw { get<0>(dar) = true; } - auto bl_iter_unix1 = const_cast(ux_attrs1)->begin(); + auto bl_iter_unix1 = ux_attrs1->cbegin(); decode(*this, bl_iter_unix1); if (this->state.version < 2) { get<1>(dar) = true; diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index 5e0c86d0bfbe0..62a1401ca75ba 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -129,7 +129,7 @@ namespace rgw { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(fh_hk.bucket, bl); decode(fh_hk.object, bl); @@ -633,7 +633,7 @@ namespace rgw { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); uint32_t fh_type; decode(fh_type, bl); diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 5aa57d384dc7f..84bc59df171bb 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -376,7 +376,7 @@ int RGWLC::bucket_lc_process(string& shard_id) if (aiter == bucket_attrs.end()) return 0; - bufferlist::iterator iter(&aiter->second); + bufferlist::const_iterator iter{&aiter->second}; try { config.decode(iter); } catch (const buffer::error& e) { @@ -425,7 +425,7 @@ int RGWLC::bucket_lc_process(string& shard_id) } RGWObjTags dest_obj_tags; try { - auto iter = tags_bl.begin(); + auto iter = tags_bl.cbegin(); dest_obj_tags.decode(iter); } catch (buffer::error& err) { ldout(cct,0) << "ERROR: caught buffer::error, couldn't decode TagSet" << dendl; diff --git a/src/rgw/rgw_lc.h b/src/rgw/rgw_lc.h index ec8a0e20fea2a..8a7edb994a0cd 100644 --- a/src/rgw/rgw_lc.h +++ b/src/rgw/rgw_lc.h @@ -51,7 +51,7 @@ public: encode(date, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl); decode(days, bl); if (struct_v >= 3) { @@ -135,7 +135,7 @@ class LCFilter encode(obj_tags, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(prefix, bl); if (struct_v >= 2) { @@ -241,7 +241,7 @@ public: encode(filter, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(5, 1, 1, bl); decode(id, bl); decode(prefix, bl); @@ -305,7 +305,7 @@ public: encode(rule_map, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl); decode(rule_map, bl); multimap::iterator iter; diff --git a/src/rgw/rgw_log.h b/src/rgw/rgw_log.h index 23a00c10ecfb9..9614624d6a9ec 100644 --- a/src/rgw/rgw_log.h +++ b/src/rgw/rgw_log.h @@ -61,7 +61,7 @@ struct rgw_log_entry { encode(x_headers, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator &p) { + void decode(bufferlist::const_iterator &p) { DECODE_START_LEGACY_COMPAT_LEN(8, 5, 5, p); decode(object_owner.id, p); if (struct_v > 3) diff --git a/src/rgw/rgw_meta_sync_status.h b/src/rgw/rgw_meta_sync_status.h index 2935b8727e86a..0fdc5cabaf103 100644 --- a/src/rgw/rgw_meta_sync_status.h +++ b/src/rgw/rgw_meta_sync_status.h @@ -26,7 +26,7 @@ struct rgw_meta_sync_info { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(state, bl); decode(num_shards, bl); @@ -72,7 +72,7 @@ struct rgw_meta_sync_marker { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(state, bl); decode(marker, bl); @@ -105,7 +105,7 @@ struct rgw_meta_sync_status { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(sync_info, bl); decode(sync_markers, bl); diff --git a/src/rgw/rgw_metadata.cc b/src/rgw/rgw_metadata.cc index d432612ced966..8ee97ce55496c 100644 --- a/src/rgw/rgw_metadata.cc +++ b/src/rgw/rgw_metadata.cc @@ -52,7 +52,7 @@ void RGWMetadataLogData::encode(bufferlist& bl) const { ENCODE_FINISH(bl); } -void RGWMetadataLogData::decode(bufferlist::iterator& bl) { +void RGWMetadataLogData::decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(read_version, bl); decode(write_version, bl); @@ -375,7 +375,7 @@ int read_history(RGWRados *store, RGWMetadataLogHistory *state, return -ENOENT; } try { - auto p = bl.begin(); + auto p = bl.cbegin(); state->decode(p); } catch (buffer::error& e) { ldout(store->ctx(), 1) << "failed to decode the mdlog history: " @@ -953,7 +953,7 @@ void RGWMetadataManager::dump_log_entry(cls_log_entry& entry, Formatter *f) try { RGWMetadataLogData log_data; - bufferlist::iterator iter = entry.data.begin(); + auto iter = entry.data.cbegin(); decode(log_data, iter); encode_json("data", log_data, f); diff --git a/src/rgw/rgw_metadata.h b/src/rgw/rgw_metadata.h index b2337587588c6..b4f39f16d74de 100644 --- a/src/rgw/rgw_metadata.h +++ b/src/rgw/rgw_metadata.h @@ -263,7 +263,7 @@ struct RGWMetadataLogData { RGWMetadataLogData() : status(MDLOG_STATUS_UNKNOWN) {} void encode(bufferlist& bl) const; - void decode(bufferlist::iterator& bl); + void decode(bufferlist::const_iterator& bl); void dump(Formatter *f) const; void decode_json(JSONObj *obj); }; @@ -279,7 +279,7 @@ struct RGWMetadataLogHistory { encode(oldest_period_id, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& p) { + void decode(bufferlist::const_iterator& p) { DECODE_START(1, p); decode(oldest_realm_epoch, p); decode(oldest_period_id, p); diff --git a/src/rgw/rgw_multi.cc b/src/rgw/rgw_multi.cc index 20fd44a030514..d2af62ae8ca75 100644 --- a/src/rgw/rgw_multi.cc +++ b/src/rgw/rgw_multi.cc @@ -119,7 +119,7 @@ int list_multipart_parts(RGWRados *store, RGWBucketInfo& bucket_info, CephContex for (i = 0, iter = parts_map.begin(); (i < num_parts || !sorted_omap) && iter != parts_map.end(); ++iter, ++i) { bufferlist& bl = iter->second; - bufferlist::iterator bli = bl.begin(); + auto bli = bl.cbegin(); RGWUploadPartInfo info; try { decode(info, bli); diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 4e3e327fc74bc..789999e8695e4 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -146,7 +146,7 @@ static int decode_policy(CephContext *cct, bufferlist& bl, RGWAccessControlPolicy *policy) { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { policy->decode(iter); } catch (buffer::error& err) { @@ -590,7 +590,7 @@ void rgw_add_to_iam_environment(rgw::IAM::Environment& e, std::string_view key, static int rgw_iam_add_tags_from_bl(struct req_state* s, bufferlist& bl){ RGWObjTags tagset; try { - auto bliter = bl.begin(); + auto bliter = bl.cbegin(); tagset.decode(bliter); } catch (buffer::error& err) { ldout(s->cct,0) << "ERROR: caught buffer::error, couldn't decode TagSet" << dendl; @@ -1023,7 +1023,7 @@ int RGWOp::read_bucket_cors() bl = aiter->second; - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { bucket_cors.decode(iter); } catch (buffer::error& err) { @@ -1513,7 +1513,7 @@ int RGWGetObj::handle_user_manifest(const char *prefix) int RGWGetObj::handle_slo_manifest(bufferlist& bl) { RGWSLOInfo slo_info; - bufferlist::iterator bliter = bl.begin(); + auto bliter = bl.cbegin(); try { decode(slo_info, bliter); } catch (buffer::error& err) { @@ -4296,7 +4296,7 @@ void RGWPutMetadataObject::execute() int RGWDeleteObj::handle_slo_manifest(bufferlist& bl) { RGWSLOInfo slo_info; - bufferlist::iterator bliter = bl.begin(); + auto bliter = bl.cbegin(); try { decode(slo_info, bliter); } catch (buffer::error& err) { @@ -5444,7 +5444,7 @@ static int get_multipart_info(RGWRados *store, struct req_state *s, string name = iter->first; if (name.compare(RGW_ATTR_ACL) == 0) { bufferlist& bl = iter->second; - bufferlist::iterator bli = bl.begin(); + auto bli = bl.cbegin(); try { decode(*policy, bli); } catch (buffer::error& err) { diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index 4c58277bf574d..554c7a55bd67b 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -941,7 +941,7 @@ struct rgw_slo_entry { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(path, bl); decode(etag, bl); @@ -973,7 +973,7 @@ struct RGWSLOInfo { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(entries, bl); decode(total_size, bl); diff --git a/src/rgw/rgw_orphan.h b/src/rgw/rgw_orphan.h index 9f9763a50e428..f0f4b5136ff4d 100644 --- a/src/rgw/rgw_orphan.h +++ b/src/rgw/rgw_orphan.h @@ -54,7 +54,7 @@ struct RGWOrphanSearchStage { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); int s; decode(s, bl); @@ -83,7 +83,7 @@ struct RGWOrphanSearchInfo { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(job_name, bl); string s; @@ -111,7 +111,7 @@ struct RGWOrphanSearchState { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(info, bl); decode(stage, bl); diff --git a/src/rgw/rgw_period_pusher.cc b/src/rgw/rgw_period_pusher.cc index ec676c2394376..df5d3aea25dab 100644 --- a/src/rgw/rgw_period_pusher.cc +++ b/src/rgw/rgw_period_pusher.cc @@ -175,7 +175,7 @@ RGWPeriodPusher::RGWPeriodPusher(RGWRados* store) RGWPeriodPusher::~RGWPeriodPusher() = default; void RGWPeriodPusher::handle_notify(RGWRealmNotify type, - bufferlist::iterator& p) + bufferlist::const_iterator& p) { // decode the period RGWZonesNeedPeriod info; diff --git a/src/rgw/rgw_period_pusher.h b/src/rgw/rgw_period_pusher.h index be833f5fc036e..fdadd22662166 100644 --- a/src/rgw/rgw_period_pusher.h +++ b/src/rgw/rgw_period_pusher.h @@ -27,7 +27,7 @@ class RGWPeriodPusher final : public RGWRealmWatcher::Watcher, ~RGWPeriodPusher() override; /// respond to realm notifications by pushing new periods to other zones - void handle_notify(RGWRealmNotify type, bufferlist::iterator& p) override; + void handle_notify(RGWRealmNotify type, bufferlist::const_iterator& p) override; /// avoid accessing RGWRados while dynamic reconfiguration is in progress. /// notifications will be enqueued until resume() diff --git a/src/rgw/rgw_quota.h b/src/rgw/rgw_quota.h index 54e2f48a79ae5..5b7bdea778226 100644 --- a/src/rgw/rgw_quota.h +++ b/src/rgw/rgw_quota.h @@ -68,7 +68,7 @@ public: encode(check_on_raw, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(3, 1, 1, bl); int64_t max_size_kb; decode(max_size_kb, bl); diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 51c6ef990dfd7..c52c423efb960 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -584,7 +584,7 @@ int RGWSystemMetaObj::read_default(RGWDefaultSystemMetaObjInfo& default_info, co return ret; try { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); decode(default_info, iter); } catch (buffer::error& err) { ldout(cct, 0) << "error decoding data from " << pool << ":" << oid << dendl; @@ -650,7 +650,7 @@ int RGWSystemMetaObj::read_id(const string& obj_name, string& object_id) RGWNameToId nameToId; try { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); decode(nameToId, iter); } catch (buffer::error& err) { ldout(cct, 0) << "ERROR: failed to decode obj from " << pool << ":" << oid << dendl; @@ -771,7 +771,7 @@ int RGWSystemMetaObj::read_info(const string& obj_id, bool old_format) using ceph::decode; try { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); decode(*this, iter); } catch (buffer::error& err) { ldout(cct, 0) << "ERROR: failed to decode obj from " << pool << ":" << oid << dendl; @@ -1054,7 +1054,7 @@ int RGWPeriodConfig::read(RGWRados *store, const std::string& realm_id) } using ceph::decode; try { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); decode(*this, iter); } catch (buffer::error& err) { return -EIO; @@ -1201,7 +1201,7 @@ int RGWPeriod::read_latest_epoch(RGWPeriodLatestEpochInfo& info, return ret; } try { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); using ceph::decode; decode(info, iter); } catch (buffer::error& err) { @@ -1342,7 +1342,7 @@ int RGWPeriod::read_info() try { using ceph::decode; - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); decode(*this, iter); } catch (buffer::error& err) { ldout(cct, 0) << "ERROR: failed to decode obj from " << pool << ":" << get_period_oid() << dendl; @@ -1923,7 +1923,7 @@ void RGWPeriodMap::encode(bufferlist& bl) const { ENCODE_FINISH(bl); } -void RGWPeriodMap::decode(bufferlist::iterator& bl) { +void RGWPeriodMap::decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(id, bl); decode(zonegroups, bl); @@ -2044,7 +2044,7 @@ void RGWRegionMap::encode(bufferlist& bl) const { ENCODE_FINISH(bl); } -void RGWRegionMap::decode(bufferlist::iterator& bl) { +void RGWRegionMap::decode(bufferlist::const_iterator& bl) { DECODE_START(3, bl); decode(regions, bl); decode(master_region, bl); @@ -2064,7 +2064,7 @@ void RGWZoneGroupMap::encode(bufferlist& bl) const { ENCODE_FINISH(bl); } -void RGWZoneGroupMap::decode(bufferlist::iterator& bl) { +void RGWZoneGroupMap::decode(bufferlist::const_iterator& bl) { DECODE_START(3, bl); decode(zonegroups, bl); decode(master_zonegroup, bl); @@ -3913,7 +3913,7 @@ int RGWRados::convert_regionmap() } try { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); decode(zonegroupmap, iter); } catch (buffer::error& err) { ldout(cct, 0) << "error decoding regionmap from " << pool << ":" << oid << dendl; @@ -5020,7 +5020,7 @@ int RGWRados::log_remove(const string& name) struct log_show_state { librados::IoCtx io_ctx; bufferlist bl; - bufferlist::iterator p; + bufferlist::const_iterator p; string name; uint64_t pos; bool eof; @@ -5066,7 +5066,7 @@ int RGWRados::log_show_next(RGWAccessHandle handle, rgw_log_entry *entry) state->bl.clear(); state->bl.claim(old); state->bl.claim_append(more); - state->p = state->bl.begin(); + state->p = state->bl.cbegin(); if ((unsigned)r < chunk) state->eof = true; ldout(cct, 10) << " read " << r << dendl; @@ -5491,7 +5491,7 @@ int RGWRados::objexp_hint_parse(cls_timeindex_entry &ti_entry, /* in */ objexp_hint_entry& hint_entry) /* out */ { try { - bufferlist::iterator iter = ti_entry.value.begin(); + auto iter = ti_entry.value.cbegin(); decode(hint_entry, iter); } catch (buffer::error& err) { ldout(cct, 0) << "ERROR: couldn't decode avail_pools" << dendl; @@ -5552,7 +5552,7 @@ int RGWRados::unlock(rgw_pool& pool, const string& oid, string& zone_id, string& int RGWRados::decode_policy(bufferlist& bl, ACLOwner *owner) { - bufferlist::iterator i = bl.begin(); + auto i = bl.cbegin(); RGWAccessControlPolicy policy(cct); try { policy.decode_owner(i); @@ -5571,7 +5571,7 @@ int rgw_policy_from_attrset(CephContext *cct, map& attrset, return -EIO; bufferlist& bl = aiter->second; - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { policy->decode(iter); } catch (buffer::error& err) { @@ -6204,7 +6204,7 @@ int RGWRados::select_legacy_bucket_placement(RGWZonePlacementInfo *rule_info) } try { - bufferlist::iterator iter = map_bl.begin(); + auto iter = map_bl.cbegin(); decode(m, iter); } catch (buffer::error& err) { ldout(cct, 0) << "ERROR: couldn't decode avail_pools" << dendl; @@ -8104,7 +8104,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx, uint64_t pg_ver = 0; auto i = attrs.find(RGW_ATTR_PG_VER); if (i != attrs.end() && i->second.length() > 0) { - bufferlist::iterator iter = i->second.begin(); + auto iter = i->second.cbegin(); try { decode(pg_ver, iter); } catch (buffer::error& err) { @@ -9163,7 +9163,7 @@ int RGWRados::Object::Delete::delete_obj() if (state->get_attr(RGW_ATTR_DELETE_AT, bl)) { try { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); decode(delete_at, iter); } catch (buffer::error& err) { ldout(store->ctx(), 0) << "ERROR: couldn't decode RGW_ATTR_DELETE_AT" << dendl; @@ -9507,7 +9507,7 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket // use uncompressed size for accounted_size try { RGWCompressionInfo info; - auto p = iter->second.begin(); + auto p = iter->second.cbegin(); decode(info, p); s->accounted_size = info.orig_size; } catch (buffer::error&) { @@ -9531,7 +9531,7 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket bufferlist manifest_bl = s->attrset[RGW_ATTR_MANIFEST]; if (manifest_bl.length()) { - bufferlist::iterator miter = manifest_bl.begin(); + auto miter = manifest_bl.cbegin(); try { decode(s->manifest, miter); s->has_manifest = true; @@ -9566,7 +9566,7 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket if (aiter != s->attrset.end()) { bufferlist& pg_ver_bl = aiter->second; if (pg_ver_bl.length()) { - bufferlist::iterator pgbl = pg_ver_bl.begin(); + auto pgbl = pg_ver_bl.cbegin(); try { decode(s->pg_ver, pgbl); } catch (buffer::error& err) { @@ -9578,7 +9578,7 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket if (aiter != s->attrset.end()) { bufferlist& zone_short_id_bl = aiter->second; if (zone_short_id_bl.length()) { - bufferlist::iterator zbl = zone_short_id_bl.begin(); + auto zbl = zone_short_id_bl.cbegin(); try { decode(s->zone_short_id, zbl); } catch (buffer::error& err) { @@ -9718,7 +9718,7 @@ int RGWRados::Object::Stat::finish() map::iterator iter = result.attrs.find(RGW_ATTR_MANIFEST); if (iter != result.attrs.end()) { bufferlist& bl = iter->second; - bufferlist::iterator biter = bl.begin(); + auto biter = bl.cbegin(); try { decode(result.manifest, biter); } catch (buffer::error& err) { @@ -11740,7 +11740,7 @@ int RGWRados::get_olh(const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWO } try { - bufferlist::iterator biter = iter->second.begin(); + auto biter = iter->second.cbegin(); decode(*olh, biter); } catch (buffer::error& err) { ldout(cct, 0) << "ERROR: failed to decode olh info" << dendl; @@ -11758,7 +11758,7 @@ void RGWRados::check_pending_olh_entries(map& pending_entrie real_time now = real_clock::now(); while (iter != pending_entries.end()) { - bufferlist::iterator biter = iter->second.begin(); + auto biter = iter->second.cbegin(); RGWOLHPendingInfo pending_info; try { decode(pending_info, biter); @@ -11839,7 +11839,7 @@ int RGWRados::follow_olh(const RGWBucketInfo& bucket_info, RGWObjectCtx& obj_ctx assert(iter != state->attrset.end()); RGWOLHInfo olh; try { - bufferlist::iterator biter = iter->second.begin(); + auto biter = iter->second.cbegin(); decode(olh, biter); } catch (buffer::error& err) { ldout(cct, 0) << "ERROR: failed to decode olh info" << dendl; @@ -12138,7 +12138,7 @@ int RGWRados::get_bucket_instance_from_oid(RGWObjectCtx& obj_ctx, const string& return ret; } - bufferlist::iterator iter = epbl.begin(); + auto iter = epbl.cbegin(); try { decode(info, iter); } catch (buffer::error& err) { @@ -12170,7 +12170,7 @@ int RGWRados::get_bucket_entrypoint_info(RGWObjectCtx& obj_ctx, return ret; } - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { decode(entry_point, iter); } catch (buffer::error& err) { @@ -12875,7 +12875,7 @@ int RGWRados::bi_get_instance(const RGWBucketInfo& bucket_info, rgw_obj& obj, rg if (r < 0) { return r; } - bufferlist::iterator iter = bi_entry.data.begin(); + auto iter = bi_entry.data.cbegin(); try { decode(*dirent, iter); } catch (buffer::error& err) { @@ -14424,7 +14424,7 @@ int RGWRados::delete_obj_aio(const rgw_obj& obj, int rgw_compression_info_from_attrset(map& attrs, bool& need_decompress, RGWCompressionInfo& cs_info) { map::iterator value = attrs.find(RGW_ATTR_COMPRESSION); if (value != attrs.end()) { - bufferlist::iterator bliter = value->second.begin(); + auto bliter = value->second.cbegin(); try { decode(cs_info, bliter); } catch (buffer::error& err) { diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index dcfea619cb41b..06335368467b5 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -193,7 +193,7 @@ struct compression_block { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(old_ofs, bl); decode(new_ofs, bl); @@ -222,7 +222,7 @@ struct RGWCompressionInfo { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(compression_type, bl); decode(orig_size, bl); @@ -248,7 +248,7 @@ struct RGWOLHInfo { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(target, bl); decode(removed, bl); @@ -270,7 +270,7 @@ struct RGWOLHPendingInfo { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(time, bl); DECODE_FINISH(bl); @@ -332,7 +332,7 @@ struct RGWObjManifestPart { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN_32(2, 2, 2, bl); decode(loc, bl); decode(loc_ofs, bl); @@ -382,7 +382,7 @@ struct RGWObjManifestRule { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(start_part_num, bl); decode(start_ofs, bl); @@ -502,7 +502,7 @@ public: ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN_32(7, 2, 2, bl); decode(obj_size, bl); decode(objs, bl); @@ -845,7 +845,7 @@ struct RGWUploadPartInfo { encode(accounted_size, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl); decode(num, bl); decode(size, bl); @@ -1001,7 +1001,7 @@ struct RGWDefaultSystemMetaObjInfo { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(default_id, bl); DECODE_FINISH(bl); @@ -1021,7 +1021,7 @@ struct RGWNameToId { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(obj_id, bl); DECODE_FINISH(bl); @@ -1071,7 +1071,7 @@ public: ENCODE_FINISH(bl); } - virtual void decode(bufferlist::iterator& bl) { + virtual void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(id, bl); decode(name, bl); @@ -1124,7 +1124,7 @@ struct RGWZonePlacementInfo { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(6, bl); string index_pool_str; string data_pool_str; @@ -1234,7 +1234,7 @@ struct RGWZoneParams : RGWSystemMetaObj { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) override { + void decode(bufferlist::const_iterator& bl) override { DECODE_START(12, bl); decode(domain_root, bl); decode(control_pool, bl); @@ -1379,7 +1379,7 @@ struct RGWZone { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(7, bl); decode(name, bl); if (struct_v < 4) { @@ -1430,7 +1430,7 @@ struct RGWDefaultZoneGroupInfo { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(default_zonegroup, bl); DECODE_FINISH(bl); @@ -1464,7 +1464,7 @@ struct RGWZoneGroupPlacementTarget { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(name, bl); decode(tags, bl); @@ -1540,7 +1540,7 @@ struct RGWZoneGroup : public RGWSystemMetaObj { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) override { + void decode(bufferlist::const_iterator& bl) override { DECODE_START(4, bl); decode(name, bl); decode(api_name, bl); @@ -1597,7 +1597,7 @@ struct RGWPeriodMap string master_zonegroup; void encode(bufferlist& bl) const; - void decode(bufferlist::iterator& bl); + void decode(bufferlist::const_iterator& bl); int update(const RGWZoneGroup& zonegroup, CephContext *cct); @@ -1626,7 +1626,7 @@ struct RGWPeriodConfig ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(bucket_quota, bl); decode(user_quota, bl); @@ -1658,7 +1658,7 @@ struct RGWRegionMap { RGWQuotaInfo user_quota; void encode(bufferlist& bl) const; - void decode(bufferlist::iterator& bl); + void decode(bufferlist::const_iterator& bl); void dump(Formatter *f) const; void decode_json(JSONObj *obj); @@ -1679,7 +1679,7 @@ struct RGWZoneGroupMap { int read(CephContext *cct, RGWRados *store); void encode(bufferlist& bl) const; - void decode(bufferlist::iterator& bl); + void decode(bufferlist::const_iterator& bl); void dump(Formatter *f) const; void decode_json(JSONObj *obj); @@ -1705,7 +1705,7 @@ struct objexp_hint_entry { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { // XXX Do we want DECODE_START_LEGACY_COMPAT_LEN(2, 1, 1, bl); ? DECODE_START(2, bl); decode(bucket_name, bl); @@ -1745,7 +1745,7 @@ public: ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) override { + void decode(bufferlist::const_iterator& bl) override { DECODE_START(1, bl); RGWSystemMetaObj::decode(bl); decode(current_period, bl); @@ -1793,7 +1793,7 @@ struct RGWPeriodLatestEpochInfo { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(epoch, bl); DECODE_FINISH(bl); @@ -1945,7 +1945,7 @@ public: ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(id, bl); decode(epoch, bl); diff --git a/src/rgw/rgw_realm_reloader.cc b/src/rgw/rgw_realm_reloader.cc index 8e7d28db4041b..3a91e552484af 100644 --- a/src/rgw/rgw_realm_reloader.cc +++ b/src/rgw/rgw_realm_reloader.cc @@ -49,7 +49,7 @@ class RGWRealmReloader::C_Reload : public Context { }; void RGWRealmReloader::handle_notify(RGWRealmNotify type, - bufferlist::iterator& p) + bufferlist::const_iterator& p) { if (!store) { /* we're in the middle of reload */ diff --git a/src/rgw/rgw_realm_reloader.h b/src/rgw/rgw_realm_reloader.h index ab9f4e56ec4b1..aea21d5833820 100644 --- a/src/rgw/rgw_realm_reloader.h +++ b/src/rgw/rgw_realm_reloader.h @@ -37,7 +37,7 @@ class RGWRealmReloader : public RGWRealmWatcher::Watcher { ~RGWRealmReloader() override; /// respond to realm notifications by scheduling a reload() - void handle_notify(RGWRealmNotify type, bufferlist::iterator& p) override; + void handle_notify(RGWRealmNotify type, bufferlist::const_iterator& p) override; private: /// pause frontends and replace the RGWRados instance diff --git a/src/rgw/rgw_realm_watcher.cc b/src/rgw/rgw_realm_watcher.cc index 7389c3f80b95f..ae77128e10a6e 100644 --- a/src/rgw/rgw_realm_watcher.cc +++ b/src/rgw/rgw_realm_watcher.cc @@ -51,7 +51,7 @@ void RGWRealmWatcher::handle_notify(uint64_t notify_id, uint64_t cookie, pool_ctx.notify_ack(watch_oid, notify_id, cookie, reply); try { - auto p = bl.begin(); + auto p = bl.cbegin(); while (!p.end()) { RGWRealmNotify notify; decode(notify, p); diff --git a/src/rgw/rgw_realm_watcher.h b/src/rgw/rgw_realm_watcher.h index 7ef40f458a0d6..9f9bab829efc2 100644 --- a/src/rgw/rgw_realm_watcher.h +++ b/src/rgw/rgw_realm_watcher.h @@ -33,7 +33,7 @@ class RGWRealmWatcher : public librados::WatchCtx2 { virtual ~Watcher() = default; virtual void handle_notify(RGWRealmNotify type, - bufferlist::iterator& p) = 0; + bufferlist::const_iterator& p) = 0; }; RGWRealmWatcher(CephContext* cct, RGWRealm& realm); diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 67d0712f1f1b3..b60bbeb58e108 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -158,7 +158,7 @@ int decode_attr_bl_single_value(map& attrs, const char *attr *result = def_val; return 0; } - bufferlist::iterator bliter = bl.begin(); + auto bliter = bl.cbegin(); try { decode(*result, bliter); } catch (buffer::error& err) { @@ -299,7 +299,7 @@ int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs, } else if (iter->first.compare(RGW_ATTR_TAGS) == 0) { RGWObjTags obj_tags; try{ - bufferlist::iterator it = iter->second.begin(); + auto it = iter->second.cbegin(); obj_tags.decode(it); } catch (buffer::error &err) { ldout(s->cct,0) << "Error caught buffer::error couldn't decode TagSet " << dendl; @@ -375,7 +375,7 @@ void RGWGetObjTags_ObjStore_S3::send_response_data(bufferlist& bl) s->formatter->open_object_section("TagSet"); if (has_tags){ RGWObjTagSet_S3 tagset; - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { tagset.decode(iter); } catch (buffer::error& err) { @@ -2263,7 +2263,7 @@ void RGWGetLC_ObjStore_S3::execute() return; } - bufferlist::iterator iter(&aiter->second); + bufferlist::const_iterator iter{&aiter->second}; try { config.decode(iter); } catch (const buffer::error& e) { diff --git a/src/rgw/rgw_role.cc b/src/rgw/rgw_role.cc index 8fe173d9cffe4..525da75bbb2cc 100644 --- a/src/rgw/rgw_role.cc +++ b/src/rgw/rgw_role.cc @@ -303,7 +303,7 @@ int RGWRole::read_id(const string& role_name, const string& tenant, string& role RGWNameToId nameToId; try { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); using ceph::decode; decode(nameToId, iter); } catch (buffer::error& err) { @@ -331,7 +331,7 @@ int RGWRole::read_info() try { using ceph::decode; - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); decode(*this, iter); } catch (buffer::error& err) { ldout(cct, 0) << "ERROR: failed to decode role info from pool: " << pool.name << @@ -359,7 +359,7 @@ int RGWRole::read_name() RGWNameToId nameToId; try { using ceph::decode; - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); decode(nameToId, iter); } catch (buffer::error& err) { ldout(cct, 0) << "ERROR: failed to decode role name from pool: " << pool.name << ": " diff --git a/src/rgw/rgw_role.h b/src/rgw/rgw_role.h index 1aa96ca78b68e..fa2b382eeeee0 100644 --- a/src/rgw/rgw_role.h +++ b/src/rgw/rgw_role.h @@ -96,7 +96,7 @@ public: ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(id, bl); decode(name, bl); diff --git a/src/rgw/rgw_swift_auth.cc b/src/rgw/rgw_swift_auth.cc index d73b6d51d9635..9092f3ebe1a01 100644 --- a/src/rgw/rgw_swift_auth.cc +++ b/src/rgw/rgw_swift_auth.cc @@ -507,7 +507,7 @@ SignedTokenEngine::authenticate(const std::string& token, std::string swift_user; try { - /*const*/ auto iter = tok_bl.begin(); + auto iter = tok_bl.cbegin(); using ceph::decode; decode(swift_user, iter); diff --git a/src/rgw/rgw_sync.h b/src/rgw/rgw_sync.h index bc902e72ca964..d43dcb20cf23c 100644 --- a/src/rgw/rgw_sync.h +++ b/src/rgw/rgw_sync.h @@ -43,7 +43,7 @@ struct rgw_mdlog_entry { name = le.name; timestamp = le.timestamp.to_real_time(); try { - bufferlist::iterator iter = le.data.begin(); + auto iter = le.data.cbegin(); decode(log_data, iter); } catch (buffer::error& err) { return false; @@ -96,7 +96,7 @@ struct rgw_sync_error_info { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(source_zone, bl); decode(error_code, bl); diff --git a/src/rgw/rgw_sync_log_trim.cc b/src/rgw/rgw_sync_log_trim.cc index 28b5cc99ad084..87a64e9ef7264 100644 --- a/src/rgw/rgw_sync_log_trim.cc +++ b/src/rgw/rgw_sync_log_trim.cc @@ -52,7 +52,7 @@ WRITE_RAW_ENCODER(TrimNotifyType); struct TrimNotifyHandler { virtual ~TrimNotifyHandler() = default; - virtual void handle(bufferlist::iterator& input, bufferlist& output) = 0; + virtual void handle(bufferlist::const_iterator& input, bufferlist& output) = 0; }; /// api to share the bucket trim counters between gateways in the same zone. @@ -69,7 +69,7 @@ struct TrimCounters { : bucket(bucket), count(count) {} void encode(bufferlist& bl) const; - void decode(bufferlist::iterator& p); + void decode(bufferlist::const_iterator& p); }; using Vector = std::vector; @@ -78,7 +78,7 @@ struct TrimCounters { uint16_t max_buckets; //< maximum number of bucket counters to return void encode(bufferlist& bl) const; - void decode(bufferlist::iterator& p); + void decode(bufferlist::const_iterator& p); }; /// return the current bucket trim counters @@ -86,7 +86,7 @@ struct TrimCounters { Vector bucket_counters; void encode(bufferlist& bl) const; - void decode(bufferlist::iterator& p); + void decode(bufferlist::const_iterator& p); }; /// server interface to query the hottest buckets @@ -103,7 +103,7 @@ struct TrimCounters { public: explicit Handler(Server *server) : server(server) {} - void handle(bufferlist::iterator& input, bufferlist& output) override; + void handle(bufferlist::const_iterator& input, bufferlist& output) override; }; }; std::ostream& operator<<(std::ostream& out, const TrimCounters::BucketCounter& rhs) @@ -118,7 +118,7 @@ void TrimCounters::BucketCounter::encode(bufferlist& bl) const encode(bucket, bl); encode(count, bl); } -void TrimCounters::BucketCounter::decode(bufferlist::iterator& p) +void TrimCounters::BucketCounter::decode(bufferlist::const_iterator& p) { using ceph::decode; decode(bucket, p); @@ -132,7 +132,7 @@ void TrimCounters::Request::encode(bufferlist& bl) const encode(max_buckets, bl); ENCODE_FINISH(bl); } -void TrimCounters::Request::decode(bufferlist::iterator& p) +void TrimCounters::Request::decode(bufferlist::const_iterator& p) { DECODE_START(1, p); decode(max_buckets, p); @@ -146,7 +146,7 @@ void TrimCounters::Response::encode(bufferlist& bl) const encode(bucket_counters, bl); ENCODE_FINISH(bl); } -void TrimCounters::Response::decode(bufferlist::iterator& p) +void TrimCounters::Response::decode(bufferlist::const_iterator& p) { DECODE_START(1, p); decode(bucket_counters, p); @@ -154,7 +154,7 @@ void TrimCounters::Response::decode(bufferlist::iterator& p) } WRITE_CLASS_ENCODER(TrimCounters::Response); -void TrimCounters::Handler::handle(bufferlist::iterator& input, +void TrimCounters::Handler::handle(bufferlist::const_iterator& input, bufferlist& output) { Request request; @@ -171,11 +171,11 @@ void TrimCounters::Handler::handle(bufferlist::iterator& input, struct TrimComplete { struct Request { void encode(bufferlist& bl) const; - void decode(bufferlist::iterator& p); + void decode(bufferlist::const_iterator& p); }; struct Response { void encode(bufferlist& bl) const; - void decode(bufferlist::iterator& p); + void decode(bufferlist::const_iterator& p); }; /// server interface to reset bucket counters @@ -187,7 +187,7 @@ struct TrimComplete { public: explicit Handler(Server *server) : server(server) {} - void handle(bufferlist::iterator& input, bufferlist& output) override; + void handle(bufferlist::const_iterator& input, bufferlist& output) override; }; }; @@ -196,7 +196,7 @@ void TrimComplete::Request::encode(bufferlist& bl) const ENCODE_START(1, 1, bl); ENCODE_FINISH(bl); } -void TrimComplete::Request::decode(bufferlist::iterator& p) +void TrimComplete::Request::decode(bufferlist::const_iterator& p) { DECODE_START(1, p); DECODE_FINISH(p); @@ -208,14 +208,14 @@ void TrimComplete::Response::encode(bufferlist& bl) const ENCODE_START(1, 1, bl); ENCODE_FINISH(bl); } -void TrimComplete::Response::decode(bufferlist::iterator& p) +void TrimComplete::Response::decode(bufferlist::const_iterator& p) { DECODE_START(1, p); DECODE_FINISH(p); } WRITE_CLASS_ENCODER(TrimComplete::Response); -void TrimComplete::Handler::handle(bufferlist::iterator& input, +void TrimComplete::Handler::handle(bufferlist::const_iterator& input, bufferlist& output) { Request request; @@ -306,7 +306,7 @@ class BucketTrimWatcher : public librados::WatchCtx2 { } bufferlist reply; try { - auto p = bl.begin(); + auto p = bl.cbegin(); TrimNotifyType type; decode(type, p); @@ -545,14 +545,14 @@ int accumulate_peer_counters(bufferlist& bl, BucketChangeCounter& counter) try { // decode notify responses - auto p = bl.begin(); + auto p = bl.cbegin(); std::map, bufferlist> replies; std::set> timeouts; decode(replies, p); decode(timeouts, p); for (auto& peer : replies) { - auto q = peer.second.begin(); + auto q = peer.second.cbegin(); TrimCounters::Response response; decode(response, q); for (const auto& b : response.bucket_counters) { diff --git a/src/rgw/rgw_sync_log_trim.h b/src/rgw/rgw_sync_log_trim.h index 39823c1a7ee2b..3c9023cf72b44 100644 --- a/src/rgw/rgw_sync_log_trim.h +++ b/src/rgw/rgw_sync_log_trim.h @@ -93,7 +93,7 @@ struct BucketTrimStatus { encode(marker, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& p) { + void decode(bufferlist::const_iterator& p) { DECODE_START(1, p); decode(marker, p); DECODE_FINISH(p); diff --git a/src/rgw/rgw_sync_module_aws.cc b/src/rgw/rgw_sync_module_aws.cc index 50cb113aaae94..9dac4cbb470ff 100644 --- a/src/rgw/rgw_sync_module_aws.cc +++ b/src/rgw/rgw_sync_module_aws.cc @@ -691,7 +691,7 @@ static int do_decode_rest_obj(CephContext *cct, map& attrs, auto aiter = attrs.find(RGW_ATTR_ACL); if (aiter != attrs.end()) { bufferlist& bl = aiter->second; - bufferlist::iterator bliter = bl.begin(); + auto bliter = bl.cbegin(); try { info->acls.decode(bliter); } catch (buffer::error& err) { @@ -1531,7 +1531,7 @@ int decode_attr(map& attrs, const char *attr_name, T *result *result = def_val; return 0; } - bufferlist::iterator bliter = bl.begin(); + auto bliter = bl.cbegin(); try { decode(*result, bliter); } catch (buffer::error& err) { diff --git a/src/rgw/rgw_sync_module_aws.h b/src/rgw/rgw_sync_module_aws.h index dca647572540f..334f466277d61 100644 --- a/src/rgw/rgw_sync_module_aws.h +++ b/src/rgw/rgw_sync_module_aws.h @@ -18,7 +18,7 @@ struct rgw_sync_aws_multipart_part_info { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(part_num, bl); decode(ofs, bl); @@ -46,7 +46,7 @@ struct rgw_sync_aws_src_obj_properties { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(mtime, bl); decode(etag, bl); @@ -83,7 +83,7 @@ struct rgw_sync_aws_multipart_upload_info { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(upload_id, bl); decode(obj_size, bl); diff --git a/src/rgw/rgw_sync_module_es.cc b/src/rgw/rgw_sync_module_es.cc index 4b85ef9e0257e..0528e7049904b 100644 --- a/src/rgw/rgw_sync_module_es.cc +++ b/src/rgw/rgw_sync_module_es.cc @@ -285,7 +285,7 @@ struct es_obj_metadata { if (name == "acl") { try { - auto i = val.begin(); + auto i = val.cbegin(); decode(policy, i); } catch (buffer::error& err) { ldout(cct, 0) << "ERROR: failed to decode acl for " << bucket_info.bucket << "/" << key << dendl; @@ -305,11 +305,11 @@ struct es_obj_metadata { } } } else if (name == "x-amz-tagging") { - auto tags_bl = val.begin(); + auto tags_bl = val.cbegin(); decode(obj_tags, tags_bl); } else if (name == "compression") { RGWCompressionInfo cs_info; - auto vals_bl = val.begin(); + auto vals_bl = val.cbegin(); decode(cs_info, vals_bl); out_attrs[name] = cs_info.compression_type; } else { diff --git a/src/rgw/rgw_tag.h b/src/rgw/rgw_tag.h index c18254b184039..6c8467deef020 100644 --- a/src/rgw/rgw_tag.h +++ b/src/rgw/rgw_tag.h @@ -22,7 +22,7 @@ class RGWObjTags ENCODE_FINISH(bl); } - void decode(bufferlist::iterator &bl) { + void decode(bufferlist::const_iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl); decode(tag_map,bl); DECODE_FINISH(bl); diff --git a/src/rgw/rgw_token.h b/src/rgw/rgw_token.h index 38fc75a149002..d0496aedf5989 100644 --- a/src/rgw/rgw_token.h +++ b/src/rgw/rgw_token.h @@ -101,7 +101,7 @@ namespace rgw { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { string name; string typestr; uint32_t version; diff --git a/src/rgw/rgw_user.cc b/src/rgw/rgw_user.cc index 7f694c249b90f..93af4afe621c8 100644 --- a/src/rgw/rgw_user.cc +++ b/src/rgw/rgw_user.cc @@ -279,7 +279,7 @@ int rgw_get_user_info_from_index(RGWRados * const store, rgw_cache_entry_info cache_info; - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { decode(uid, iter); int ret = rgw_get_user_info_by_uid(store, uid.user_id, e.info, &e.objv_tracker, NULL, &cache_info); @@ -324,7 +324,7 @@ int rgw_get_user_info_by_uid(RGWRados *store, return ret; } - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); try { decode(user_id, iter); if (user_id.user_id.compare(uid) != 0) { diff --git a/src/rgw/rgw_user.h b/src/rgw/rgw_user.h index c9bca868bd4e0..dcfad360661ff 100644 --- a/src/rgw/rgw_user.h +++ b/src/rgw/rgw_user.h @@ -40,7 +40,7 @@ struct RGWUID using ceph::encode; encode(s, bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { string s; using ceph::decode; decode(s, bl); diff --git a/src/rgw/rgw_website.h b/src/rgw/rgw_website.h index c689ef73685f1..7695345cb8c81 100644 --- a/src/rgw/rgw_website.h +++ b/src/rgw/rgw_website.h @@ -35,7 +35,7 @@ struct RGWRedirectInfo encode(http_redirect_code, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(protocol, bl); decode(hostname, bl); @@ -62,7 +62,7 @@ struct RGWBWRedirectInfo encode(replace_key_with, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(redirect, bl); decode(replace_key_prefix_with, bl); @@ -88,7 +88,7 @@ struct RGWBWRoutingRuleCondition encode(http_error_code_returned_equals, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(key_prefix_equals, bl); decode(http_error_code_returned_equals, bl); @@ -118,7 +118,7 @@ struct RGWBWRoutingRule encode(redirect_info, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(condition, bl); decode(redirect_info, bl); @@ -154,7 +154,7 @@ struct RGWBWRoutingRules encode(rules, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); decode(rules, bl); DECODE_FINISH(bl); @@ -197,7 +197,7 @@ struct RGWBucketWebsiteConf encode(listing_enabled, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START(2, bl); decode(index_doc_suffix, bl); decode(error_doc, bl); diff --git a/src/test/rgw/test_rgw_common.h b/src/test/rgw/test_rgw_common.h index 6684dff516e79..029dadb6adc0b 100644 --- a/src/test/rgw/test_rgw_common.h +++ b/src/test/rgw/test_rgw_common.h @@ -57,7 +57,7 @@ struct old_rgw_bucket { encode(tenant, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(8, 3, 3, bl); decode(name, bl); decode(data_pool, bl); @@ -391,7 +391,7 @@ public: } ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(5, 3, 3, bl); decode(bucket.name, bl); decode(loc, bl); diff --git a/src/test/rgw/test_rgw_manifest.cc b/src/test/rgw/test_rgw_manifest.cc index aeb9a879cb3e1..57a7ff323d669 100644 --- a/src/test/rgw/test_rgw_manifest.cc +++ b/src/test/rgw/test_rgw_manifest.cc @@ -46,7 +46,7 @@ struct OldObjManifestPart { ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN_32(2, 2, 2, bl); decode(loc, bl); decode(loc_ofs, bl); @@ -92,7 +92,7 @@ public: ENCODE_FINISH(bl); } - void decode(bufferlist::iterator& bl) { + void decode(bufferlist::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN_32(6, 2, 2, bl); decode(obj_size, bl); decode(objs, bl); @@ -362,7 +362,7 @@ TEST(TestRGWManifest, old_obj_manifest) { RGWObjManifest manifest; try { - auto iter = bl.begin(); + auto iter = bl.cbegin(); decode(manifest, iter); } catch (buffer::error& err) { ASSERT_TRUE(false); diff --git a/src/test/rgw/test_rgw_obj.cc b/src/test/rgw/test_rgw_obj.cc index 91dfc8dc66b36..ad8ef69566302 100644 --- a/src/test/rgw/test_rgw_obj.cc +++ b/src/test/rgw/test_rgw_obj.cc @@ -233,7 +233,7 @@ TEST(TestRGWObj, old_to_raw) { rgw_raw_obj raw_obj; try { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); decode(new_obj, iter); iter = bl.begin(); @@ -254,7 +254,7 @@ TEST(TestRGWObj, old_to_raw) { cout << "raw=" << raw_obj << std::endl; try { - bufferlist::iterator iter = bl.begin(); + auto iter = bl.cbegin(); decode(new_obj2, iter); /*