Skip to content

Commit

Permalink
msg: pass features explicitly into message encoders
Browse files Browse the repository at this point in the history
Avoid using the connection reference; pass it in explicitly instead.  This
will make ceph-dencoder's life a bit easier.

Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
Sage Weil committed Jan 30, 2012
1 parent de2ec7c commit 7999876
Show file tree
Hide file tree
Showing 104 changed files with 164 additions and 111 deletions.
2 changes: 1 addition & 1 deletion src/messages/MAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct MAuth : public PaxosServiceMessage {
else
monmap_epoch = 0;
}
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
paxos_encode();
::encode(protocol, payload);
::encode(auth_payload, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MAuthReply.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct MAuthReply : public Message {
::decode(result_bl, p);
::decode(result_msg, p);
}
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(protocol, payload);
::encode(result, payload);
::encode(global_id, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MCacheExpire.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class MCacheExpire : public Message {
::decode(realms, p);
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(from, payload);
::encode(realms, payload);
}
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MClientCapRelease.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MClientCapRelease : public Message {
::decode(head, p);
::decode_nohead(head.num, caps, p);
}
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
head.num = caps.size();
::encode(head, payload);
::encode_nohead(caps, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MClientCaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class MClientCaps : public Message {
if (header.version >= 2)
::decode(flockbl, p);
}
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
head.snap_trace_len = snapbl.length();
head.xattr_len = xattrbl.length();
::encode(head, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MClientLease.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct MClientLease : public Message {
::decode(h, p);
::decode(dname, p);
}
virtual void encode_payload(CephContext *cct) {
virtual void encode_payload(CephContext *cct, uint64_t features) {
::encode(h, payload);
::encode(dname, payload);
}
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MClientReconnect.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class MClientReconnect : public Message {
realms.push_back(r);
}

void encode_payload(CephContext *cct) {
if (connection->has_feature(CEPH_FEATURE_FLOCK)) {
void encode_payload(CephContext *cct, uint64_t features) {
// new protocol
header.version = 2;
::encode(caps, data);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MClientReply.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class MClientReply : public Message {
::decode(snapbl, p);
assert(p.end());
}
virtual void encode_payload(CephContext *cct) {
virtual void encode_payload(CephContext *cct, uint64_t features) {
::encode(head, payload);
::encode(trace_bl, payload);
::encode(extra_bl, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MClientRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class MClientRequest : public Message {
::decode_nohead(head.num_releases, releases, p);
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
head.num_releases = releases.size();
::encode(head, payload);
::encode(path, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MClientRequestForward.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class MClientRequestForward : public Message {
<< ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(dest_mds, payload);
::encode(num_fwd, payload);
::encode(client_must_resend, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MClientSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class MClientSession : public Message {
bufferlist::iterator p = payload.begin();
::decode(head, p);
}
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(head, payload);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MClientSnap.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct MClientSnap : public Message {
out << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
head.num_split_inos = split_inos.size();
head.num_split_realms = split_realms.size();
head.trace_len = bl.length();
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MCommand : public Message {
o << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(fsid, payload);
::encode(cmd, payload);
}
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MCommandReply.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MCommandReply : public Message {
o << "command_reply(tid " << get_tid() << ": " << r << " " << rs << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(r, payload);
::encode(rs, payload);
}
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MDentryLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MDentryLink : public Message {
::decode(is_primary, p);
::decode(bl, p);
}
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(dirfrag, payload);
::encode(dn, payload);
::encode(is_primary, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MDentryUnlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MDentryUnlink : public Message {
::decode(dn, p);
::decode(straybl, p);
}
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(dirfrag, payload);
::encode(dn, payload);
::encode(straybl, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MDirUpdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class MDirUpdate : public Message {
::decode(path, p);
}

virtual void encode_payload(CephContext *cct) {
virtual void encode_payload(CephContext *cct, uint64_t features) {
::encode(from_mds, payload);
::encode(dirfrag, payload);
::encode(dir_rep, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MDiscover.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class MDiscover : public Message {
::decode(want_base_dir, p);
::decode(want_xlocked, p);
}
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(base_ino, payload);
::encode(base_dir_frag, payload);
::encode(snapid, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MDiscoverReply.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class MDiscoverReply : public Message {
if (header.version >= 2)
::decode(wanted_ino, p);
}
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
header.version = 2;
::encode(base_ino, payload);
::encode(base_dir_frag, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MExportCaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MExportCaps : public Message {
o << "export_caps(" << ino << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(ino, payload);
::encode(cap_bl, payload);
::encode(client_map, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MExportCapsAck.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MExportCapsAck : public Message {
o << "export_caps_ack(" << ino << ")";
}

virtual void encode_payload(CephContext *cct) {
virtual void encode_payload(CephContext *cct, uint64_t features) {
::encode(ino, payload);
}
virtual void decode_payload(CephContext *cct) {
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MExportDir.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MExportDir : public Message {
bounds.push_back(df);
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(dirfrag, payload);
::encode(bounds, payload);
::encode(export_data, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MExportDirAck.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MExportDirAck : public Message {
bufferlist::iterator p = payload.begin();
::decode(dirfrag, p);
}
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(dirfrag, payload);
}

Expand Down
2 changes: 1 addition & 1 deletion src/messages/MExportDirCancel.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MExportDirCancel : public Message {
o << "export_cancel(" << dirfrag << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(dirfrag, payload);
}
void decode_payload(CephContext *cct) {
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MExportDirDiscover.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class MExportDirDiscover : public Message {
::decode(path, p);
}

virtual void encode_payload(CephContext *cct) {
virtual void encode_payload(CephContext *cct, uint64_t features) {
::encode(from, payload);
::encode(dirfrag, payload);
::encode(path, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MExportDirDiscoverAck.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MExportDirDiscoverAck : public Message {
::decode(dirfrag, p);
::decode(success, p);
}
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(dirfrag, payload);
::encode(success, payload);
}
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MExportDirFinish.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MExportDirFinish : public Message {
o << "export_finish(" << dirfrag << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(dirfrag, payload);
}
void decode_payload(CephContext *cct) {
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MExportDirNotify.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class MExportDirNotify : public Message {
bounds.push_back(*i);
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(base, payload);
::encode(ack, payload);
::encode(old_auth, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MExportDirNotifyAck.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MExportDirNotifyAck : public Message {
o << "export_notify_ack(" << dirfrag << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(dirfrag, payload);
}
void decode_payload(CephContext *cct) {
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MExportDirPrep.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class MExportDirPrep : public Message {
::decode(bystanders, p);
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(dirfrag, payload);
::encode(basedir, payload);
::encode(bounds, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MExportDirPrepAck.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MExportDirPrepAck : public Message {
bufferlist::iterator p = payload.begin();
::decode(dirfrag, p);
}
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(dirfrag, payload);
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/messages/MForward.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ struct MForward : public Message {
}

public:
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(tid, payload);
::encode(client, payload);
::encode(client_caps, payload);
encode_message(cct, msg, payload);
encode_message(cct, msg, features, payload);
}

void decode_payload(CephContext *cct) {
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MGenericMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MGenericMessage : public Message {
const char *get_type_name() { return tname; }

void decode_payload(CephContext *cct) { }
void encode_payload(CephContext *cct) { }
void encode_payload(CephContext *cct, uint64_t features) { }
};

#endif
2 changes: 1 addition & 1 deletion src/messages/MGetPoolStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MGetPoolStats : public PaxosServiceMessage {
out << "getpoolstats(" << get_tid() << " " << pools << " v" << version << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
paxos_encode();
::encode(fsid, payload);
::encode(pools, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MGetPoolStatsReply.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MGetPoolStatsReply : public PaxosServiceMessage {
out << "getpoolstatsreply(" << get_tid() << " v" << version << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
paxos_encode();
::encode(fsid, payload);
::encode(pool_stats, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MHeartbeat.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MHeartbeat : public Message {
public:
const char *get_type_name() { return "HB"; }

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(load, payload);
::encode(beat, payload);
::encode(import_map, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MInodeFileCaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MInodeFileCaps : public Message {
out << "inode_file_caps(" << ino << " " << ccap_string(caps) << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(ino, payload);
::encode(caps, payload);
}
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MLock.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class MLock : public Message {
::decode(object_info, p);
::decode(lockdata, p);
}
virtual void encode_payload(CephContext *cct) {
virtual void encode_payload(CephContext *cct, uint64_t features) {
::encode(asker, payload);
::encode(action, payload);
::encode(reqid, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class MLog : public PaxosServiceMessage {
out << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
paxos_encode();
::encode(fsid, payload);
::encode(entries, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MLogAck.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MLogAck : public Message {
out << "log(last " << last << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(fsid, payload);
::encode(last, payload);
}
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MMDSBeacon.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class MMDSBeacon : public PaxosServiceMessage {
<< " seq " << seq << " v" << version << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
header.version = 2;
paxos_encode();
::encode(fsid, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MMDSCacheRejoin.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class MMDSCacheRejoin : public Message {
}

// -- encoding --
void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(op, payload);
::encode(strong_inodes, payload);
::encode(inode_base, payload);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/MMDSFindIno.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct MMDSFindIno : public Message {
out << "findino(" << tid << " " << ino << ")";
}

void encode_payload(CephContext *cct) {
void encode_payload(CephContext *cct, uint64_t features) {
::encode(tid, payload);
::encode(ino, payload);
}
Expand Down
Loading

0 comments on commit 7999876

Please sign in to comment.