Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MMDSOpenInoReply.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4  * Ceph - scalable distributed file system
5  *
6  * Copyright (C) 2011 New Dream Network
7  *
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.
12  *
13  */
14
15 #ifndef CEPH_MDSOPENINOREPLY_H
16 #define CEPH_MDSOPENINOREPLY_H
17
18 #include "msg/Message.h"
19
20 struct MMDSOpenInoReply : public Message {
21   inodeno_t ino;
22   vector<inode_backpointer_t> ancestors;
23   mds_rank_t hint;
24   int32_t error;
25
26   MMDSOpenInoReply() : Message(MSG_MDS_OPENINOREPLY), error(0) {}
27   MMDSOpenInoReply(ceph_tid_t t, inodeno_t i, mds_rank_t h=MDS_RANK_NONE, int e=0) :
28     Message(MSG_MDS_OPENINOREPLY), ino(i), hint(h), error(e) {
29     header.tid = t;
30   }
31
32   const char *get_type_name() const override { return "openinoreply"; }
33   void print(ostream &out) const override {
34     out << "openinoreply(" << header.tid << " "
35         << ino << " " << hint << " " << ancestors << ")";
36   }
37
38   void encode_payload(uint64_t features) override {
39     ::encode(ino, payload);
40     ::encode(ancestors, payload);
41     ::encode(hint, payload);
42     ::encode(error, payload);
43   }
44   void decode_payload() override {
45     bufferlist::iterator p = payload.begin();
46     ::decode(ino, p);
47     ::decode(ancestors, p);
48     ::decode(hint, p);
49     ::decode(error, p);
50   }
51 };
52
53 #endif