From 1cc6a6c44b91e873b2b26a09922f75cf9dfc457c Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Tue, 26 Dec 2017 03:39:34 -0500 Subject: [PATCH] osdc: Use unqualified encode/decode This is a portion of Part 1 of the namespace project: using ADL properly in encode and decode so we can use namespaces easily in Ceph. Signed-off-by: Adam C. Emerson --- src/osdc/Journaler.cc | 22 +++++++++++----------- src/osdc/Journaler.h | 28 ++++++++++++++-------------- src/osdc/Objecter.cc | 12 ++++++------ 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/osdc/Journaler.cc b/src/osdc/Journaler.cc index 21ce6d410b0..3e6241196e5 100644 --- a/src/osdc/Journaler.cc +++ b/src/osdc/Journaler.cc @@ -226,7 +226,7 @@ void Journaler::_finish_reread_head(int r, bufferlist& bl, Context *finish) Header h; bufferlist::iterator p = bl.begin(); try { - ::decode(h, p); + decode(h, p); } catch (const buffer::error &e) { finish->complete(-EINVAL); return; @@ -273,7 +273,7 @@ void Journaler::_finish_read_head(int r, bufferlist& bl) Header h; bufferlist::iterator p = bl.begin(); try { - ::decode(h, p); + decode(h, p); if (h.magic != magic) { ldout(cct, 0) << "on disk magic '" << h.magic << "' != my magic '" @@ -457,7 +457,7 @@ void Journaler::_write_head(Context *oncommit) last_wrote_head = ceph::real_clock::now(); bufferlist bl; - ::encode(last_written, bl); + encode(last_written, bl); SnapContext snapc; object_t oid = file_object_t(ino, 0); @@ -1402,13 +1402,13 @@ bool JournalStream::readable(bufferlist &read_buf, uint64_t *need) const } if (read_buf.length() >= *need) { if (format >= JOURNAL_FORMAT_RESILIENT) { - ::decode(entry_sentinel, p); + decode(entry_sentinel, p); if (entry_sentinel != sentinel) { throw buffer::malformed_input("Invalid sentinel"); } } - ::decode(entry_size, p); + decode(entry_size, p); } else { return false; } @@ -1455,19 +1455,19 @@ size_t JournalStream::read(bufferlist &from, bufferlist *entry, bufferlist::iterator from_ptr = from.begin(); if (format >= JOURNAL_FORMAT_RESILIENT) { uint64_t entry_sentinel = 0; - ::decode(entry_sentinel, from_ptr); + decode(entry_sentinel, from_ptr); // Assertion instead of clean check because of precondition of this // fn is that readable() already passed assert(entry_sentinel == sentinel); } - ::decode(entry_size, from_ptr); + decode(entry_size, from_ptr); // Read out the payload from_ptr.copy(entry_size, *entry); // Consume the envelope suffix (start_ptr) if (format >= JOURNAL_FORMAT_RESILIENT) { - ::decode(*start_ptr, from_ptr); + decode(*start_ptr, from_ptr); } else { *start_ptr = 0; } @@ -1489,12 +1489,12 @@ size_t JournalStream::write(bufferlist &entry, bufferlist *to, uint32_t const entry_size = entry.length(); if (format >= JOURNAL_FORMAT_RESILIENT) { - ::encode(sentinel, *to); + encode(sentinel, *to); } - ::encode(entry_size, *to); + encode(entry_size, *to); to->claim_append(entry); if (format >= JOURNAL_FORMAT_RESILIENT) { - ::encode(start_ptr, *to); + encode(start_ptr, *to); } if (format >= JOURNAL_FORMAT_RESILIENT) { diff --git a/src/osdc/Journaler.h b/src/osdc/Journaler.h index 1c3028045e7..898ad3a4ecf 100644 --- a/src/osdc/Journaler.h +++ b/src/osdc/Journaler.h @@ -149,25 +149,25 @@ public: void encode(bufferlist &bl) const { ENCODE_START(2, 2, bl); - ::encode(magic, bl); - ::encode(trimmed_pos, bl); - ::encode(expire_pos, bl); - ::encode(unused_field, bl); - ::encode(write_pos, bl); - ::encode(layout, bl, 0); // encode in legacy format - ::encode(stream_format, bl); + encode(magic, bl); + encode(trimmed_pos, bl); + encode(expire_pos, bl); + encode(unused_field, bl); + encode(write_pos, bl); + encode(layout, bl, 0); // encode in legacy format + encode(stream_format, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); - ::decode(magic, bl); - ::decode(trimmed_pos, bl); - ::decode(expire_pos, bl); - ::decode(unused_field, bl); - ::decode(write_pos, bl); - ::decode(layout, bl); + decode(magic, bl); + decode(trimmed_pos, bl); + decode(expire_pos, bl); + decode(unused_field, bl); + decode(write_pos, bl); + decode(layout, bl); if (struct_v > 1) { - ::decode(stream_format, bl); + decode(stream_format, bl); } else { stream_format = JOURNAL_FORMAT_LEGACY; } diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 531a36c1623..53fd8c9fc96 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -618,7 +618,7 @@ void Objecter::_linger_commit(LingerOp *info, int r, bufferlist& outbl) // make note of the notify_id bufferlist::iterator p = outbl.begin(); try { - ::decode(info->notify_id, p); + decode(info->notify_id, p); ldout(cct, 10) << "_linger_commit notify_id=" << info->notify_id << dendl; } @@ -3806,9 +3806,9 @@ void Objecter::_nlist_reply(NListContext *list_context, int r, bufferlist::iterator iter = list_context->bl.begin(); pg_nls_response_t response; bufferlist extra_info; - ::decode(response, iter); + decode(response, iter); if (!iter.end()) { - ::decode(extra_info, iter); + decode(extra_info, iter); } // if the osd returns 1 (newer code), or handle MAX, it means we @@ -3902,7 +3902,7 @@ struct C_SelfmanagedSnap : public Context { void finish(int r) override { if (r == 0) { bufferlist::iterator p = bl.begin(); - ::decode(*psnapid, p); + decode(*psnapid, p); } fin->complete(r); } @@ -5182,9 +5182,9 @@ void Objecter::_enumerate_reply( // XXX extra_info doesn't seem used anywhere? bufferlist extra_info; - ::decode(response, iter); + decode(response, iter); if (!iter.end()) { - ::decode(extra_info, iter); + decode(extra_info, iter); } ldout(cct, 10) << __func__ << ": got " << response.entries.size() -- 2.39.5