bufferlist mapbl;
tmp.encode(mapbl, CEPH_FEATURES_ALL);
bufferlist final;
- ::encode(v, final);
- ::encode(mapbl, final);
+ encode(v, final);
+ encode(mapbl, final);
auto t(std::make_shared<MonitorDBStore::Transaction>());
// save it
KeyRing keyring;
bufferlist::iterator p = bl.begin();
- ::decode(keyring, p);
+ decode(keyring, p);
import_keyring(keyring);
}
}
dout(7) << __func__ << " latest length " << latest_bl.length() << dendl;
bufferlist::iterator p = latest_bl.begin();
__u8 struct_v;
- ::decode(struct_v, p);
- ::decode(max_global_id, p);
- ::decode(mon->key_server, p);
+ decode(struct_v, p);
+ decode(max_global_id, p);
+ decode(mon->key_server, p);
mon->key_server.set_ver(latest_full);
keys_ver = latest_full;
}
bufferlist::iterator p = bl.begin();
__u8 v;
- ::decode(v, p);
+ decode(v, p);
while (!p.end()) {
Incremental inc;
- ::decode(inc, p);
+ decode(inc, p);
switch (inc.inc_type) {
case GLOBAL_ID:
max_global_id = inc.max_global_id;
{
KeyServerData::Incremental auth_inc;
bufferlist::iterator iter = inc.auth_data.begin();
- ::decode(auth_inc, iter);
+ decode(auth_inc, iter);
mon->key_server.apply_data_incremental(auth_inc);
break;
}
bufferlist bl;
__u8 v = 1;
- ::encode(v, bl);
+ encode(v, bl);
vector<Incremental>::iterator p;
for (p = pending_auth.begin(); p != pending_auth.end(); ++p)
p->encode(bl, mon->get_quorum_con_features());
<< (mon->key_server.has_secrets() ? "" : "no ")
<< "secrets!" << dendl;
__u8 v = 1;
- ::encode(v, full_bl);
- ::encode(max_global_id, full_bl);
- ::encode(mon->key_server, full_bl);
+ encode(v, full_bl);
+ encode(max_global_id, full_bl);
+ encode(mon->key_server, full_bl);
put_version_full(t, version, full_bl);
put_version_latest_full(t, version);
try {
__u8 struct_v = 1;
- ::decode(struct_v, indata);
- ::decode(supported, indata);
- ::decode(entity_name, indata);
- ::decode(s->global_id, indata);
+ decode(struct_v, indata);
+ decode(supported, indata);
+ decode(entity_name, indata);
+ decode(s->global_id, indata);
} catch (const buffer::error &e) {
dout(10) << "failed to decode initial auth message" << dendl;
ret = -EINVAL;
bufferlist::iterator p = caps_info.caps.begin();
string str;
try {
- ::decode(str, p);
+ decode(str, p);
} catch (const buffer::error &err) {
derr << "corrupt cap data for " << entity_name << " in auth db" << dendl;
str.clear();
if (p.inc_type == AUTH_DATA) {
KeyServerData::Incremental inc;
bufferlist::iterator q = p.auth_data.begin();
- ::decode(inc, q);
+ decode(inc, q);
if (inc.op == KeyServerData::AUTH_INC_ADD &&
inc.name == entity) {
return true;
bufferlist _encode_cap(const string& cap)
{
bufferlist bl;
- ::encode(cap, bl);
+ encode(cap, bl);
return bl;
}
bufferlist::iterator iter = bl.begin();
KeyRing keyring;
try {
- ::decode(keyring, iter);
+ decode(keyring, iter);
} catch (const buffer::error &ex) {
ss << "error decoding keyring" << " " << ex.what();
err = -EINVAL;
if (has_keyring) {
bufferlist::iterator iter = bl.begin();
try {
- ::decode(new_keyring, iter);
+ decode(new_keyring, iter);
} catch (const buffer::error &ex) {
ss << "error decoding keyring";
err = -EINVAL;
it += 2) {
string sys = *it;
bufferlist cap;
- ::encode(*(it+1), cap);
+ encode(*(it+1), cap);
new_caps[sys] = cap;
}
it += 2) {
const std::string &sys = *it;
bufferlist cap;
- ::encode(*(it+1), cap);
+ encode(*(it+1), cap);
wanted_caps[sys] = cap;
}
if (p->inc_type == AUTH_DATA) {
KeyServerData::Incremental auth_inc;
bufferlist::iterator q = p->auth_data.begin();
- ::decode(auth_inc, q);
+ decode(auth_inc, q);
if (auth_inc.op == KeyServerData::AUTH_INC_ADD &&
auth_inc.name == entity) {
wait_for_finished_proposal(op, new Monitor::C_Command(mon, op, 0, rs,
map<string,bufferlist> newcaps;
for (vector<string>::iterator it = caps_vec.begin();
it != caps_vec.end(); it += 2)
- ::encode(*(it+1), newcaps[*it]);
+ encode(*(it+1), newcaps[*it]);
auth_inc.op = KeyServerData::AUTH_INC_ADD;
auth_inc.auth.caps = newcaps;
continue;
try {
bufferlist::iterator it = p->second.caps["mon"].begin();
- ::decode(mon_caps, it);
+ decode(mon_caps, it);
}
catch (buffer::error) {
dout(10) << __func__ << " unable to parse mon cap for "
<< mon_caps << " to " << new_caps << dendl;
bufferlist bl;
- ::encode(new_caps, bl);
+ encode(new_caps, bl);
KeyServerData::Incremental auth_inc;
auth_inc.name = p->first;
if (newcap.length() > 0) {
dout(5) << " giving " << n << " mgr '" << newcap << "'" << dendl;
bufferlist bl;
- ::encode(newcap, bl);
+ encode(newcap, bl);
KeyServerData::Incremental auth_inc;
auth_inc.name = p->first;
// the kraken ceph-mgr@.service set the mon cap to 'allow *'.
auto blp = p->second.caps["mon"].begin();
string oldcaps;
- ::decode(oldcaps, blp);
+ decode(oldcaps, blp);
if (oldcaps == "allow *") {
dout(5) << " fixing " << n << " mon cap to 'allow profile mgr'"
<< dendl;
bufferlist bl;
- ::encode("allow profile mgr", bl);
+ encode("allow profile mgr", bl);
KeyServerData::Incremental auth_inc;
auth_inc.name = p->first;
auth_inc.auth = p->second;
if (!mon->key_server.contains(bootstrap_mgr_name)) {
KeyServerData::Incremental auth_inc;
auth_inc.name = bootstrap_mgr_name;
- ::encode("allow profile bootstrap-mgr", auth_inc.auth.caps["mon"]);
+ encode("allow profile bootstrap-mgr", auth_inc.auth.caps["mon"]);
auth_inc.op = KeyServerData::AUTH_INC_ADD;
// generate key
auth_inc.auth.key.create(g_ceph_context, CEPH_CRYPTO_AES);
Incremental() : inc_type(GLOBAL_ID), max_global_id(0), auth_type(0) {}
void encode(bufferlist& bl, uint64_t features=-1) const {
+ using ceph::encode;
if ((features & CEPH_FEATURE_MONENC) == 0) {
__u8 v = 1;
- ::encode(v, bl);
+ encode(v, bl);
__u32 _type = (__u32)inc_type;
- ::encode(_type, bl);
+ encode(_type, bl);
if (_type == GLOBAL_ID) {
- ::encode(max_global_id, bl);
+ encode(max_global_id, bl);
} else {
- ::encode(auth_type, bl);
- ::encode(auth_data, bl);
+ encode(auth_type, bl);
+ encode(auth_data, bl);
}
return;
}
ENCODE_START(2, 2, bl);
__u32 _type = (__u32)inc_type;
- ::encode(_type, bl);
+ encode(_type, bl);
if (_type == GLOBAL_ID) {
- ::encode(max_global_id, bl);
+ encode(max_global_id, bl);
} else {
- ::encode(auth_type, bl);
- ::encode(auth_data, bl);
+ encode(auth_type, bl);
+ encode(auth_data, bl);
}
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& bl) {
DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
__u32 _type;
- ::decode(_type, bl);
+ decode(_type, bl);
inc_type = (IncType)_type;
assert(inc_type >= GLOBAL_ID && inc_type <= AUTH_DATA);
if (_type == GLOBAL_ID) {
- ::decode(max_global_id, bl);
+ decode(max_global_id, bl);
} else {
- ::decode(auth_type, bl);
- ::decode(auth_data, bl);
+ decode(auth_type, bl);
+ decode(auth_data, bl);
}
DECODE_FINISH(bl);
}
void push_cephx_inc(KeyServerData::Incremental& auth_inc) {
Incremental inc;
inc.inc_type = AUTH_DATA;
- ::encode(auth_inc, inc.auth_data);
+ encode(auth_inc, inc.auth_data);
inc.auth_type = CEPH_AUTH_CEPHX;
pending_auth.push_back(inc);
}
#include <map>
#include <set>
+
#include "include/encoding.h"
+#include "include/utime.h"
+
+#include "osd/osd_types.h"
struct creating_pgs_t {
epoch_t last_scan_epoch = 0;
return start >= end;
}
void encode(bufferlist& bl) const {
- ::encode(created, bl);
- ::encode(modified, bl);
- ::encode(start, bl);
- ::encode(end, bl);
+ using ceph::encode;
+ encode(created, bl);
+ encode(modified, bl);
+ encode(start, bl);
+ encode(end, bl);
}
void decode(bufferlist::iterator& p) {
- ::decode(created, p);
- ::decode(modified, p);
- ::decode(start, p);
- ::decode(end, p);
+ using ceph::decode;
+ decode(created, p);
+ decode(modified, p);
+ decode(start, p);
+ decode(end, p);
}
};
}
void encode(bufferlist& bl) const {
ENCODE_START(2, 1, bl);
- ::encode(last_scan_epoch, bl);
- ::encode(pgs, bl);
- ::encode(created_pools, bl);
- ::encode(queue, bl);
+ encode(last_scan_epoch, bl);
+ encode(pgs, bl);
+ encode(created_pools, bl);
+ encode(queue, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& bl) {
DECODE_START(2, bl);
- ::decode(last_scan_epoch, bl);
- ::decode(pgs, bl);
- ::decode(created_pools, bl);
+ decode(last_scan_epoch, bl);
+ decode(pgs, bl);
+ decode(created_pools, bl);
if (struct_v >= 2)
- ::decode(queue, bl);
+ decode(queue, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const {
mon->store->get(service_name, "quorum", qbl);
if (qbl.length()) {
auto p = qbl.begin();
- ::decode(quorum_checks, p);
+ decode(quorum_checks, p);
} else {
quorum_checks.clear();
}
mon->store->get(service_name, "leader", lbl);
if (lbl.length()) {
auto p = lbl.begin();
- ::decode(leader_checks, p);
+ decode(leader_checks, p);
} else {
leader_checks.clear();
}
put_last_committed(t, version);
bufferlist qbl;
- ::encode(quorum_checks, qbl);
+ encode(quorum_checks, qbl);
t->put(service_name, "quorum", qbl);
bufferlist lbl;
- ::encode(leader_checks, lbl);
+ encode(leader_checks, lbl);
t->put(service_name, "leader", lbl);
health_check_map_t pending_health;
assert(latest_bl.length() != 0);
dout(7) << __func__ << " loading summary e" << latest_full << dendl;
bufferlist::iterator p = latest_bl.begin();
- ::decode(summary, p);
+ decode(summary, p);
dout(7) << __func__ << " loaded summary e" << summary.version << dendl;
}
bufferlist::iterator p = bl.begin();
__u8 v;
- ::decode(v, p);
+ decode(v, p);
while (!p.end()) {
LogEntry le;
le.decode(p);
bufferlist bl;
dout(10) << __func__ << " v" << version << dendl;
__u8 v = 1;
- ::encode(v, bl);
+ encode(v, bl);
multimap<utime_t,LogEntry>::iterator p;
for (p = pending_log.begin(); p != pending_log.end(); ++p)
p->second.encode(bl, mon->get_quorum_con_features());
assert(get_last_committed() == summary.version);
bufferlist summary_bl;
- ::encode(summary, summary_bl, mon->get_quorum_con_features());
+ encode(summary, summary_bl, mon->get_quorum_con_features());
put_version_full(t, summary.version, summary_bl);
put_version_latest_full(t, summary.version);
assert(bl.length());
bufferlist::iterator p = bl.begin();
__u8 v;
- ::decode(v,p);
+ decode(v,p);
while (!p.end()) {
LogEntry le;
le.decode(p);
MonitorDBStore::TransactionRef t = paxos->get_pending_transaction();
bufferlist bl;
- ::encode(pending_metadata, bl);
+ encode(pending_metadata, bl);
t->put(MDS_METADATA_PREFIX, "last_metadata", bl);
paxos->trigger_propose();
}
if (!update)
return;
bufferlist bl;
- ::encode(pending_metadata, bl);
+ encode(pending_metadata, bl);
t->put(MDS_METADATA_PREFIX, "last_metadata", bl);
}
}
bufferlist::iterator it = bl.begin();
- ::decode(m, it);
+ decode(m, it);
return 0;
}
void encode(bufferlist& bl) const
{
ENCODE_START(2, 1, bl);
- ::encode(gid, bl);
- ::encode(name, bl);
- ::encode(available_modules, bl);
+ encode(gid, bl);
+ encode(name, bl);
+ encode(available_modules, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& p)
{
DECODE_START(2, p);
- ::decode(gid, p);
- ::decode(name, p);
+ decode(gid, p);
+ decode(name, p);
if (struct_v >= 2) {
- ::decode(available_modules, p);
+ decode(available_modules, p);
}
DECODE_FINISH(p);
}
void encode(bufferlist& bl, uint64_t features) const
{
ENCODE_START(3, 1, bl);
- ::encode(epoch, bl);
- ::encode(active_addr, bl, features);
- ::encode(active_gid, bl);
- ::encode(available, bl);
- ::encode(active_name, bl);
- ::encode(standbys, bl);
- ::encode(modules, bl);
- ::encode(available_modules, bl);
- ::encode(services, bl);
+ encode(epoch, bl);
+ encode(active_addr, bl, features);
+ encode(active_gid, bl);
+ encode(available, bl);
+ encode(active_name, bl);
+ encode(standbys, bl);
+ encode(modules, bl);
+ encode(available_modules, bl);
+ encode(services, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& p)
{
DECODE_START(2, p);
- ::decode(epoch, p);
- ::decode(active_addr, p);
- ::decode(active_gid, p);
- ::decode(available, p);
- ::decode(active_name, p);
- ::decode(standbys, p);
+ decode(epoch, p);
+ decode(active_addr, p);
+ decode(active_gid, p);
+ decode(available, p);
+ decode(active_name, p);
+ decode(standbys, p);
if (struct_v >= 2) {
- ::decode(modules, p);
- ::decode(available_modules, p);
+ decode(modules, p);
+ decode(available_modules, p);
}
if (struct_v >= 3) {
- ::decode(services, p);
+ decode(services, p);
}
DECODE_FINISH(p);
}
derr << "Failed to load mgr commands: " << cpp_strerror(r) << dendl;
} else {
auto p = loaded_commands.begin();
- ::decode(command_descs, p);
+ decode(command_descs, p);
}
}
}
p.set_flag(MonCommand::FLAG_MGR);
}
bufferlist bl;
- ::encode(pending_command_descs, bl);
+ encode(pending_command_descs, bl);
t->put(command_descs_prefix, "", bl);
pending_command_descs.clear();
}
pending_map.active_gid = m->get_gid();
pending_map.active_name = m->get_name();
pending_map.available_modules = m->get_available_modules();
- ::encode(m->get_metadata(), pending_metadata[m->get_name()]);
+ encode(m->get_metadata(), pending_metadata[m->get_name()]);
pending_metadata_rm.erase(m->get_name());
mon->clog->info() << "Activating manager daemon "
<< " started";
pending_map.standbys[m->get_gid()] = {m->get_gid(), m->get_name(),
m->get_available_modules()};
- ::encode(m->get_metadata(), pending_metadata[m->get_name()]);
+ encode(m->get_metadata(), pending_metadata[m->get_name()]);
pending_metadata_rm.erase(m->get_name());
updated = true;
}
return r;
try {
bufferlist::iterator p = bl.begin();
- ::decode(m, p);
+ decode(m, p);
}
catch (buffer::error& e) {
if (err)
dout(10) << __func__ << dendl;
version = 0;
service_map.epoch = 1;
- ::encode(service_map, pending_service_map_bl, CEPH_FEATURES_ALL);
+ encode(service_map, pending_service_map_bl, CEPH_FEATURES_ALL);
}
void MgrStatMonitor::update_from_paxos(bool *need_bootstrap)
assert(bl.length());
try {
auto p = bl.begin();
- ::decode(digest, p);
- ::decode(service_map, p);
+ decode(digest, p);
+ decode(service_map, p);
dout(10) << __func__ << " v" << version
<< " service_map e" << service_map.epoch << dendl;
}
pending_digest = digest;
pending_health_checks = get_health_checks();
pending_service_map_bl.clear();
- ::encode(service_map, pending_service_map_bl, mon->get_quorum_con_features());
+ encode(service_map, pending_service_map_bl, mon->get_quorum_con_features());
}
void MgrStatMonitor::encode_pending(MonitorDBStore::TransactionRef t)
++version;
dout(10) << " " << version << dendl;
bufferlist bl;
- ::encode(pending_digest, bl, mon->get_quorum_con_features());
+ encode(pending_digest, bl, mon->get_quorum_con_features());
assert(pending_service_map_bl.length());
bl.append(pending_service_map_bl);
put_version(t, version, bl);
auto m = static_cast<MMonMgrReport*>(op->get_req());
bufferlist bl = m->get_data();
auto p = bl.begin();
- ::decode(pending_digest, p);
+ decode(pending_digest, p);
pending_health_checks.swap(m->health_checks);
if (m->service_map_bl.length()) {
pending_service_map_bl.swap(m->service_map_bl);
void MonCap::encode(bufferlist& bl) const
{
ENCODE_START(4, 4, bl); // legacy MonCaps was 3, 3
- ::encode(text, bl);
+ encode(text, bl);
ENCODE_FINISH(bl);
}
{
string s;
DECODE_START(4, bl);
- ::decode(s, bl);
+ decode(s, bl);
DECODE_FINISH(bl);
parse(s, NULL);
}
string cur_mon = monmap.get_name(peer);
bufferlist::iterator p = m->monmapbl.begin();
- ::decode(monmap, p);
+ decode(monmap, p);
ldout(cct, 10) << " got monmap " << monmap.epoch
<< ", mon." << cur_mon << " is now rank " << monmap.get_rank(cur_mon)
m->protocol = 0;
m->monmap_epoch = epoch;
__u8 struct_v = 1;
- ::encode(struct_v, m->auth_payload);
- ::encode(auth_supported.get_supported_set(), m->auth_payload);
- ::encode(entity_name, m->auth_payload);
- ::encode(global_id, m->auth_payload);
+ encode(struct_v, m->auth_payload);
+ encode(auth_supported.get_supported_set(), m->auth_payload);
+ encode(entity_name, m->auth_payload);
+ encode(global_id, m->auth_payload);
con->send_message(m);
}
struct MAuthReply;
class MAuthRotating;
class LogClient;
-struct AuthAuthorizer;
+class AuthAuthorizer;
class AuthMethodList;
class AuthClientHandler;
class KeyRing;
bufferlist &payload = m->get_payload();
if (result && payload.length() > 0) {
bufferlist::iterator p = payload.begin();
- ::decode(*result, p);
+ decode(*result, p);
}
done = true;
ping_recvd_cond.SignalAll();
void encode(bufferlist &bl) const {
ENCODE_START(1, 1, bl);
encode_bare(bl);
- ::encode(flags, bl);
+ encode(flags, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator &bl) {
DECODE_START(1, bl);
decode_bare(bl);
- ::decode(flags, bl);
+ decode(flags, bl);
DECODE_FINISH(bl);
}
* Unversioned encoding for use within encode_array.
*/
void encode_bare(bufferlist &bl) const {
- ::encode(cmdstring, bl);
- ::encode(helpstring, bl);
- ::encode(module, bl);
- ::encode(req_perms, bl);
- ::encode(availability, bl);
+ using ceph::encode;
+ encode(cmdstring, bl);
+ encode(helpstring, bl);
+ encode(module, bl);
+ encode(req_perms, bl);
+ encode(availability, bl);
}
void decode_bare(bufferlist::iterator &bl) {
- ::decode(cmdstring, bl);
- ::decode(helpstring, bl);
- ::decode(module, bl);
- ::decode(req_perms, bl);
- ::decode(availability, bl);
+ using ceph::decode;
+ decode(cmdstring, bl);
+ decode(helpstring, bl);
+ decode(module, bl);
+ decode(req_perms, bl);
+ decode(availability, bl);
}
bool is_compat(const MonCommand* o) const {
return cmdstring == o->cmdstring &&
static void encode_array(const MonCommand *cmds, int size, bufferlist &bl) {
ENCODE_START(2, 1, bl);
uint16_t s = size;
- ::encode(s, bl);
+ encode(s, bl);
for (int i = 0; i < size; ++i) {
cmds[i].encode_bare(bl);
}
for (int i = 0; i < size; i++) {
- ::encode(cmds[i].flags, bl);
+ encode(cmds[i].flags, bl);
}
ENCODE_FINISH(bl);
}
bufferlist::iterator &bl) {
DECODE_START(2, bl);
uint16_t s = 0;
- ::decode(s, bl);
+ decode(s, bl);
*size = s;
*cmds = new MonCommand[*size];
for (int i = 0; i < *size; ++i) {
}
if (struct_v >= 2) {
for (int i = 0; i < *size; i++)
- ::decode((*cmds)[i].flags, bl);
+ decode((*cmds)[i].flags, bl);
} else {
for (int i = 0; i < *size; i++)
(*cmds)[i].flags = 0;
bufferlist &bl) {
ENCODE_START(2, 1, bl);
uint16_t s = cmds.size();
- ::encode(s, bl);
+ encode(s, bl);
for (unsigned i = 0; i < s; ++i) {
cmds[i].encode_bare(bl);
}
for (unsigned i = 0; i < s; i++) {
- ::encode(cmds[i].flags, bl);
+ encode(cmds[i].flags, bl);
}
ENCODE_FINISH(bl);
}
bufferlist::iterator &bl) {
DECODE_START(2, bl);
uint16_t s = 0;
- ::decode(s, bl);
+ decode(s, bl);
cmds.resize(s);
for (unsigned i = 0; i < s; ++i) {
cmds[i].decode_bare(bl);
}
if (struct_v >= 2) {
for (unsigned i = 0; i < s; i++)
- ::decode(cmds[i].flags, bl);
+ decode(cmds[i].flags, bl);
} else {
for (unsigned i = 0; i < s; i++)
cmds[i].flags = 0;
void mon_info_t::encode(bufferlist& bl, uint64_t features) const
{
ENCODE_START(2, 1, bl);
- ::encode(name, bl);
- ::encode(public_addr, bl, features);
- ::encode(priority, bl);
+ encode(name, bl);
+ encode(public_addr, bl, features);
+ encode(priority, bl);
ENCODE_FINISH(bl);
}
void mon_info_t::decode(bufferlist::iterator& p)
{
DECODE_START(1, p);
- ::decode(name, p);
- ::decode(public_addr, p);
+ decode(name, p);
+ decode(public_addr, p);
if (struct_v >= 2) {
- ::decode(priority, p);
+ decode(priority, p);
}
DECODE_FINISH(p);
}
}
if ((con_features & CEPH_FEATURE_MONNAMES) == 0) {
+ using ceph::encode;
__u16 v = 1;
- ::encode(v, blist);
- ::encode_raw(fsid, blist);
- ::encode(epoch, blist);
+ encode(v, blist);
+ encode_raw(fsid, blist);
+ encode(epoch, blist);
vector<entity_inst_t> mon_inst(mon_addr.size());
for (unsigned n = 0; n < mon_addr.size(); n++)
mon_inst[n] = get_inst(n);
- ::encode(mon_inst, blist, con_features);
- ::encode(last_changed, blist);
- ::encode(created, blist);
+ encode(mon_inst, blist, con_features);
+ encode(last_changed, blist);
+ encode(created, blist);
return;
}
if ((con_features & CEPH_FEATURE_MONENC) == 0) {
+ using ceph::encode;
__u16 v = 2;
- ::encode(v, blist);
- ::encode_raw(fsid, blist);
- ::encode(epoch, blist);
- ::encode(mon_addr, blist, con_features);
- ::encode(last_changed, blist);
- ::encode(created, blist);
+ encode(v, blist);
+ encode_raw(fsid, blist);
+ encode(epoch, blist);
+ encode(mon_addr, blist, con_features);
+ encode(last_changed, blist);
+ encode(created, blist);
}
ENCODE_START(5, 3, blist);
- ::encode_raw(fsid, blist);
- ::encode(epoch, blist);
- ::encode(mon_addr, blist, con_features);
- ::encode(last_changed, blist);
- ::encode(created, blist);
- ::encode(persistent_features, blist);
- ::encode(optional_features, blist);
+ encode_raw(fsid, blist);
+ encode(epoch, blist);
+ encode(mon_addr, blist, con_features);
+ encode(last_changed, blist);
+ encode(created, blist);
+ encode(persistent_features, blist);
+ encode(optional_features, blist);
// this superseeds 'mon_addr'
- ::encode(mon_info, blist, con_features);
+ encode(mon_info, blist, con_features);
ENCODE_FINISH(blist);
}
{
map<string,entity_addr_t> mon_addr;
DECODE_START_LEGACY_COMPAT_LEN_16(5, 3, 3, p);
- ::decode_raw(fsid, p);
- ::decode(epoch, p);
+ decode_raw(fsid, p);
+ decode(epoch, p);
if (struct_v == 1) {
vector<entity_inst_t> mon_inst;
- ::decode(mon_inst, p);
+ decode(mon_inst, p);
for (unsigned i = 0; i < mon_inst.size(); i++) {
char n[2];
n[0] = '0' + i;
mon_addr[name] = mon_inst[i].addr;
}
} else {
- ::decode(mon_addr, p);
+ decode(mon_addr, p);
}
- ::decode(last_changed, p);
- ::decode(created, p);
+ decode(last_changed, p);
+ decode(created, p);
if (struct_v >= 4) {
- ::decode(persistent_features, p);
- ::decode(optional_features, p);
+ decode(persistent_features, p);
+ decode(optional_features, p);
}
if (struct_v >= 5) {
- ::decode(mon_info, p);
+ decode(mon_info, p);
} else {
// we may be decoding to an existing monmap; if we do not
// clear the mon_info map now, we will likely incur in problems
// Attempt to decode and extract keyring only if it is found.
KeyRing keyring;
bufferlist::iterator p = bl.begin();
- ::decode(keyring, p);
+ decode(keyring, p);
extract_save_mon_key(keyring);
}
}
if (r >= 0) {
try {
bufferlist::iterator p = bl.begin();
- ::decode(fingerprint, p);
+ decode(fingerprint, p);
}
catch (buffer::error& e) {
dout(10) << __func__ << " failed to decode cluster_fingerprint" << dendl;
sync_providers.erase(sp.cookie);
}
- ::encode(*tx, reply->chunk_bl);
+ encode(*tx, reply->chunk_bl);
m->get_connection()->send_message(reply);
}
// do that anyway for other reasons, though.
MonitorDBStore::TransactionRef t = paxos->get_pending_transaction();
bufferlist bl;
- ::encode(m, bl);
+ encode(m, bl);
t->put(MONITOR_STORE_PREFIX, "last_metadata", bl);
}
f->close_section();
stringstream ss;
f->flush(ss);
- ::encode(ss.str(), payload);
+ encode(ss.str(), payload);
reply->set_payload(payload);
dout(10) << __func__ << " reply payload len " << reply->get_payload().length() << dendl;
messenger->send_message(reply, inst);
MonitorDBStore::TransactionRef t = paxos->get_pending_transaction();
bufferlist bl;
- ::encode(pending_metadata, bl);
+ encode(pending_metadata, bl);
t->put(MONITOR_STORE_PREFIX, "last_metadata", bl);
paxos->trigger_propose();
}
if (r)
return r;
bufferlist::iterator it = bl.begin();
- ::decode(mon_metadata, it);
+ decode(mon_metadata, it);
pending_metadata = mon_metadata;
return 0;
dout(10) << __func__ << " proposing cluster_fingerprint " << nf << dendl;
bufferlist bl;
- ::encode(nf, bl);
+ encode(nf, bl);
t->put(MONITOR_NAME, "cluster_fingerprint", bl);
}
return false;
}
bufferlist ticket_data;
- ::encode(blob, ticket_data);
+ encode(blob, ticket_data);
bufferlist::iterator iter = ticket_data.begin();
CephXTicketHandler handler(g_ceph_context, service_id);
- ::decode(handler.ticket, iter);
+ decode(handler.ticket, iter);
handler.session_key = info.session_key;
void encode(bufferlist& encode_bl) const {
ENCODE_START(2, 1, encode_bl);
- ::encode(type, encode_bl);
- ::encode(prefix, encode_bl);
- ::encode(key, encode_bl);
- ::encode(bl, encode_bl);
- ::encode(endkey, encode_bl);
+ encode(type, encode_bl);
+ encode(prefix, encode_bl);
+ encode(key, encode_bl);
+ encode(bl, encode_bl);
+ encode(endkey, encode_bl);
ENCODE_FINISH(encode_bl);
}
void decode(bufferlist::iterator& decode_bl) {
DECODE_START(2, decode_bl);
- ::decode(type, decode_bl);
- ::decode(prefix, decode_bl);
- ::decode(key, decode_bl);
- ::decode(bl, decode_bl);
+ decode(type, decode_bl);
+ decode(prefix, decode_bl);
+ decode(key, decode_bl);
+ decode(bl, decode_bl);
if (struct_v >= 2)
- ::decode(endkey, decode_bl);
+ decode(endkey, decode_bl);
DECODE_FINISH(decode_bl);
}
}
void put(string prefix, string key, version_t ver) {
+ using ceph::encode;
bufferlist bl;
- ::encode(ver, bl);
+ encode(ver, bl);
put(prefix, key, bl);
}
void encode(bufferlist& bl) const {
ENCODE_START(2, 1, bl);
- ::encode(ops, bl);
- ::encode(bytes, bl);
- ::encode(keys, bl);
+ encode(ops, bl);
+ encode(bytes, bl);
+ encode(keys, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& bl) {
DECODE_START(2, bl);
- ::decode(ops, bl);
+ decode(ops, bl);
if (struct_v >= 2) {
- ::decode(bytes, bl);
- ::decode(keys, bl);
+ decode(bytes, bl);
+ decode(keys, bl);
}
DECODE_FINISH(bl);
}
last_key.second = key;
if (g_conf->mon_sync_debug) {
- ::encode(prefix, crc_bl);
- ::encode(key, crc_bl);
- ::encode(value, crc_bl);
+ encode(prefix, crc_bl);
+ encode(key, crc_bl);
+ encode(value, crc_bl);
}
return true;
assert(bl.length());
version_t ver;
bufferlist::iterator p = bl.begin();
- ::decode(ver, p);
+ decode(ver, p);
return ver;
}
}
-struct C_UpdateCreatingPGs : public Context {
+class C_UpdateCreatingPGs : public Context {
+public:
OSDMonitor *osdmon;
utime_t start;
epoch_t epoch;
<< " legacy removed_snaps" << dendl;
string k = make_snap_epoch_key(p.first, pending_inc.epoch);
bufferlist v;
- ::encode(p.second.removed_snaps, v);
+ encode(p.second.removed_snaps, v);
t->put(OSD_SNAP_PREFIX, k, v);
for (auto q = p.second.removed_snaps.begin();
q != p.second.removed_snaps.end();
dout(10) << __func__ << " encoding full map with " << features << dendl;
bufferlist fullbl;
- ::encode(tmp, fullbl, features | CEPH_FEATURE_RESERVED);
+ encode(tmp, fullbl, features | CEPH_FEATURE_RESERVED);
pending_inc.full_crc = tmp.get_crc();
// include full map in the txn. note that old monitors will
// encode
assert(get_last_committed() + 1 == pending_inc.epoch);
bufferlist bl;
- ::encode(pending_inc, bl, features | CEPH_FEATURE_RESERVED);
+ encode(pending_inc, bl, features | CEPH_FEATURE_RESERVED);
dout(20) << " full_crc " << tmp.get_crc()
<< " inc_crc " << pending_inc.inc_crc << dendl;
// and pg creating, also!
auto pending_creatings = update_pending_pgs(pending_inc);
bufferlist creatings_bl;
- ::encode(pending_creatings, creatings_bl);
+ encode(pending_creatings, creatings_bl);
t->put(OSD_PG_CREATING_PREFIX, "creating", creatings_bl);
// removed_snaps
// all snaps removed this epoch
string k = make_snap_epoch_key(i.first, pending_inc.epoch);
bufferlist v;
- ::encode(i.second, v);
+ encode(i.second, v);
t->put(OSD_SNAP_PREFIX, k, v);
}
for (auto q = i.second.begin();
return r;
try {
bufferlist::iterator p = bl.begin();
- ::decode(m, p);
+ decode(m, p);
}
catch (buffer::error& e) {
if (err)
// metadata
bufferlist osd_metadata;
- ::encode(m->metadata, osd_metadata);
+ encode(m->metadata, osd_metadata);
pending_metadata[from] = osd_metadata;
pending_metadata_rm.erase(from);
if (v.length()) {
auto q = v.begin();
OSDMap::snap_interval_set_t snaps;
- ::decode(snaps, q);
+ decode(snaps, q);
t.union_of(snaps);
}
}
{
// encode the *last* epoch in the key so that we can use forward
// iteration only to search for an epoch in an interval.
- ::encode(snap, *v);
- ::encode(snap + num, *v);
- ::encode(epoch, *v);
+ encode(snap, *v);
+ encode(snap + num, *v);
+ encode(epoch, *v);
return make_snap_key(pool, snap + num - 1);
}
{
// encode the *last* epoch in the key so that we can use forward
// iteration only to search for an epoch in an interval.
- ::encode(snap, *v);
- ::encode(snap + num, *v);
- ::encode(epoch, *v);
+ encode(snap, *v);
+ encode(snap + num, *v);
+ encode(epoch, *v);
return make_snap_purged_key(pool, snap + num - 1);
}
}
bufferlist v = it->value();
auto p = v.begin();
- ::decode(*begin, p);
- ::decode(*end, p);
+ decode(*begin, p);
+ decode(*end, p);
if (snap < *begin || snap >= *end) {
return -ENOENT;
}
stringstream& ss)
{
OSDMap::Incremental new_pending = pending_inc;
- ::encode(*newcrush, new_pending.crush, mon->get_quorum_con_features());
+ encode(*newcrush, new_pending.crush, mon->get_quorum_con_features());
OSDMap newmap;
newmap.deepish_copy_from(osdmap);
newmap.apply_incremental(new_pending);
{
uint64_t snapid;
pp.add_unmanaged_snap(snapid);
- ::encode(snapid, reply_data);
+ encode(snapid, reply_data);
changed = true;
}
break;
v = 1;
}
ENCODE_START(v, 1, bl);
- ::encode(num_pg, bl);
- ::encode(num_pg_active, bl);
- ::encode(num_pg_unknown, bl);
- ::encode(num_osd, bl);
- ::encode(pg_pool_sum, bl, features);
- ::encode(pg_sum, bl, features);
- ::encode(osd_sum, bl);
+ encode(num_pg, bl);
+ encode(num_pg_active, bl);
+ encode(num_pg_unknown, bl);
+ encode(num_osd, bl);
+ encode(pg_pool_sum, bl, features);
+ encode(pg_sum, bl, features);
+ encode(osd_sum, bl);
if (v >= 2) {
- ::encode(num_pg_by_state, bl);
+ encode(num_pg_by_state, bl);
} else {
uint32_t n = num_pg_by_state.size();
- ::encode(n, bl);
+ encode(n, bl);
for (auto p : num_pg_by_state) {
- ::encode((uint32_t)p.first, bl);
- ::encode(p.second, bl);
- }
- }
- ::encode(num_pg_by_osd, bl);
- ::encode(num_pg_by_pool, bl);
- ::encode(osd_last_seq, bl);
- ::encode(per_pool_sum_delta, bl, features);
- ::encode(per_pool_sum_deltas_stamps, bl);
- ::encode(pg_sum_delta, bl, features);
- ::encode(stamp_delta, bl);
- ::encode(avail_space_by_rule, bl);
+ encode((uint32_t)p.first, bl);
+ encode(p.second, bl);
+ }
+ }
+ encode(num_pg_by_osd, bl);
+ encode(num_pg_by_pool, bl);
+ encode(osd_last_seq, bl);
+ encode(per_pool_sum_delta, bl, features);
+ encode(per_pool_sum_deltas_stamps, bl);
+ encode(pg_sum_delta, bl, features);
+ encode(stamp_delta, bl);
+ encode(avail_space_by_rule, bl);
if (struct_v >= 3) {
- ::encode(purged_snaps, bl);
+ encode(purged_snaps, bl);
}
ENCODE_FINISH(bl);
}
void PGMapDigest::decode(bufferlist::iterator& p)
{
DECODE_START(3, p);
- ::decode(num_pg, p);
- ::decode(num_pg_active, p);
- ::decode(num_pg_unknown, p);
- ::decode(num_osd, p);
- ::decode(pg_pool_sum, p);
- ::decode(pg_sum, p);
- ::decode(osd_sum, p);
+ decode(num_pg, p);
+ decode(num_pg_active, p);
+ decode(num_pg_unknown, p);
+ decode(num_osd, p);
+ decode(pg_pool_sum, p);
+ decode(pg_sum, p);
+ decode(osd_sum, p);
if (struct_v >= 2) {
- ::decode(num_pg_by_state, p);
+ decode(num_pg_by_state, p);
} else {
map<int32_t, int32_t> nps;
- ::decode(nps, p);
+ decode(nps, p);
for (auto i : nps) {
num_pg_by_state[i.first] = i.second;
}
}
- ::decode(num_pg_by_osd, p);
- ::decode(num_pg_by_pool, p);
- ::decode(osd_last_seq, p);
- ::decode(per_pool_sum_delta, p);
- ::decode(per_pool_sum_deltas_stamps, p);
- ::decode(pg_sum_delta, p);
- ::decode(stamp_delta, p);
- ::decode(avail_space_by_rule, p);
+ decode(num_pg_by_osd, p);
+ decode(num_pg_by_pool, p);
+ decode(osd_last_seq, p);
+ decode(per_pool_sum_delta, p);
+ decode(per_pool_sum_deltas_stamps, p);
+ decode(pg_sum_delta, p);
+ decode(stamp_delta, p);
+ decode(avail_space_by_rule, p);
if (struct_v >= 3) {
- ::decode(purged_snaps, p);
+ decode(purged_snaps, p);
}
DECODE_FINISH(p);
}
void PGMap::encode(bufferlist &bl, uint64_t features) const
{
ENCODE_START(7, 7, bl);
- ::encode(version, bl);
- ::encode(pg_stat, bl);
- ::encode(osd_stat, bl);
- ::encode(last_osdmap_epoch, bl);
- ::encode(last_pg_scan, bl);
- ::encode(stamp, bl);
+ encode(version, bl);
+ encode(pg_stat, bl);
+ encode(osd_stat, bl);
+ encode(last_osdmap_epoch, bl);
+ encode(last_pg_scan, bl);
+ encode(stamp, bl);
ENCODE_FINISH(bl);
}
void PGMap::decode(bufferlist::iterator &bl)
{
DECODE_START(7, bl);
- ::decode(version, bl);
- ::decode(pg_stat, bl);
- ::decode(osd_stat, bl);
- ::decode(last_osdmap_epoch, bl);
- ::decode(last_pg_scan, bl);
- ::decode(stamp, bl);
+ decode(version, bl);
+ decode(pg_stat, bl);
+ decode(osd_stat, bl);
+ decode(last_osdmap_epoch, bl);
+ decode(last_pg_scan, bl);
+ decode(stamp, bl);
DECODE_FINISH(bl);
calc_stats();
int32_t up = 0;
int32_t primary = 0;
void encode(bufferlist& bl) const {
- ::encode(acting, bl);
- ::encode(up, bl);
- ::encode(primary, bl);
+ using ceph::encode;
+ encode(acting, bl);
+ encode(up, bl);
+ encode(primary, bl);
}
void decode(bufferlist::iterator& p) {
- ::decode(acting, p);
- ::decode(up, p);
- ::decode(primary, p);
+ using ceph::decode;
+ decode(acting, p);
+ decode(up, p);
+ decode(primary, p);
}
};
mempool::pgmap::unordered_map<int32_t,pg_count> num_pg_by_osd;
ack->last_committed = last_committed;
ack->first_committed = first_committed;
ack->lease_timestamp = ceph_clock_now();
- ::encode(mon->session_map.feature_map, ack->feature_map);
+ encode(mon->session_map.feature_map, ack->feature_map);
lease->get_connection()->send_message(ack);
// (re)set timeout event.
if (ack->feature_map.length()) {
auto p = ack->feature_map.begin();
FeatureMap& t = mon->quorum_feature_map[from];
- ::decode(t, p);
+ decode(t, p);
}
if (acked_lease == mon->get_quorum()) {
// yay!
mon->store->get("health", service_name, bl);
if (bl.length()) {
auto p = bl.begin();
- ::decode(health_checks, p);
+ decode(health_checks, p);
}
}
void encode_health(const health_check_map_t& next,
MonitorDBStore::TransactionRef t) {
bufferlist bl;
- ::encode(next, bl);
+ encode(next, bl);
t->put("health", service_name, bl);
mon->log_health(next, health_checks, t);
}
void encode(bufferlist& bl) const {
ENCODE_START(1, 1, bl);
- ::encode(m, bl);
+ encode(m, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& p) {
DECODE_START(1, p);
- ::decode(m, p);
+ decode(m, p);
DECODE_FINISH(p);
}
void encode(bufferlist &bl) const {
ENCODE_START(1, 1, bl);
- ::encode(bytes_total, bl);
- ::encode(bytes_sst, bl);
- ::encode(bytes_log, bl);
- ::encode(bytes_misc, bl);
- ::encode(last_update, bl);
+ encode(bytes_total, bl);
+ encode(bytes_sst, bl);
+ encode(bytes_log, bl);
+ encode(bytes_misc, bl);
+ encode(last_update, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator &p) {
DECODE_START(1, p);
- ::decode(bytes_total, p);
- ::decode(bytes_sst, p);
- ::decode(bytes_log, p);
- ::decode(bytes_misc, p);
- ::decode(last_update, p);
+ decode(bytes_total, p);
+ decode(bytes_sst, p);
+ decode(bytes_log, p);
+ decode(bytes_misc, p);
+ decode(last_update, p);
DECODE_FINISH(p);
}
void encode(bufferlist &bl) const {
ENCODE_START(3, 1, bl);
- ::encode(fs_stats.byte_total, bl);
- ::encode(fs_stats.byte_used, bl);
- ::encode(fs_stats.byte_avail, bl);
- ::encode(fs_stats.avail_percent, bl);
- ::encode(last_update, bl);
- ::encode(store_stats, bl);
+ encode(fs_stats.byte_total, bl);
+ encode(fs_stats.byte_used, bl);
+ encode(fs_stats.byte_avail, bl);
+ encode(fs_stats.avail_percent, bl);
+ encode(last_update, bl);
+ encode(store_stats, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator &p) {
DECODE_START(1, p);
// we moved from having fields in kb to fields in byte
if (struct_v > 2) {
- ::decode(fs_stats.byte_total, p);
- ::decode(fs_stats.byte_used, p);
- ::decode(fs_stats.byte_avail, p);
+ decode(fs_stats.byte_total, p);
+ decode(fs_stats.byte_used, p);
+ decode(fs_stats.byte_avail, p);
} else {
uint64_t t;
- ::decode(t, p);
+ decode(t, p);
fs_stats.byte_total = t*1024;
- ::decode(t, p);
+ decode(t, p);
fs_stats.byte_used = t*1024;
- ::decode(t, p);
+ decode(t, p);
fs_stats.byte_avail = t*1024;
}
- ::decode(fs_stats.avail_percent, p);
- ::decode(last_update, p);
+ decode(fs_stats.avail_percent, p);
+ decode(last_update, p);
if (struct_v > 1)
- ::decode(store_stats, p);
+ decode(store_stats, p);
DECODE_FINISH(p);
}
void encode(bufferlist& bl) const {
ENCODE_START(1, 1, bl);
- ::encode(prefix_crc, bl);
- ::encode(prefix_keys, bl);
+ encode(prefix_crc, bl);
+ encode(prefix_keys, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& p) {
DECODE_START(1, p);
- ::decode(prefix_crc, p);
- ::decode(prefix_keys, p);
+ decode(prefix_crc, p);
+ decode(prefix_keys, p);
DECODE_FINISH(p);
}
void dump(Formatter *f) const {
};
WRITE_CLASS_ENCODER(ScrubResult)
-static inline ostream& operator<<(ostream& out, const ScrubResult& r) {
+inline ostream& operator<<(ostream& out, const ScrubResult& r) {
return out << "ScrubResult(keys " << r.prefix_keys << " crc " << r.prefix_crc << ")";
}
void encode(bufferlist& bl) const {
ENCODE_START(HEAD_VERSION, COMPAT_VERSION, bl);
- ::encode(features, bl);
+ encode(features, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& p) {
DECODE_START(COMPAT_VERSION, p);
- ::decode(features, p);
+ decode(features, p);
DECODE_FINISH(p);
}
};
return "unknown";
}
-static inline
-mon_feature_t ceph::features::mon::get_feature_by_name(std::string n) {
+inline mon_feature_t ceph::features::mon::get_feature_by_name(std::string n) {
if (n == "kraken") {
return FEATURE_KRAKEN;
return FEATURE_NONE;
}
-static inline ostream& operator<<(ostream& out, const mon_feature_t& f) {
+inline ostream& operator<<(ostream& out, const mon_feature_t& f) {
out << "mon_feature_t(";
f.print(out);
out << ")";