1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #ifndef CEPH_MPOOLOPREPLY_H
16 #define CEPH_MPOOLOPREPLY_H
18 #include "common/errno.h"
20 class MPoolOpReply : public PaxosServiceMessage {
25 bufferlist response_data;
27 MPoolOpReply() : PaxosServiceMessage(CEPH_MSG_POOLOP_REPLY, 0)
29 MPoolOpReply( uuid_d& f, ceph_tid_t t, int rc, int e, version_t v) :
30 PaxosServiceMessage(CEPH_MSG_POOLOP_REPLY, v),
36 MPoolOpReply( uuid_d& f, ceph_tid_t t, int rc, int e, version_t v,
38 PaxosServiceMessage(CEPH_MSG_POOLOP_REPLY, v),
44 response_data.claim(*blp);
47 const char *get_type_name() const override { return "poolopreply"; }
49 void print(ostream& out) const override {
50 out << "pool_op_reply(tid " << get_tid()
51 << " " << cpp_strerror(-replyCode)
52 << " v" << version << ")";
55 void encode_payload(uint64_t features) override {
57 ::encode(fsid, payload);
58 ::encode(replyCode, payload);
59 ::encode(epoch, payload);
60 if (response_data.length()) {
61 ::encode(true, payload);
62 ::encode(response_data, payload);
64 ::encode(false, payload);
66 void decode_payload() override {
67 bufferlist::iterator p = payload.begin();
70 ::decode(replyCode, p);
72 bool has_response_data;
73 ::decode(has_response_data, p);
74 if (has_response_data) {
75 ::decode(response_data, p);