Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MClientSnap.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) 2004-2006 Sage Weil <sage@newdream.net>
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_MCLIENTSNAP_H
16 #define CEPH_MCLIENTSNAP_H
17
18 #include "msg/Message.h"
19
20 struct MClientSnap : public Message {
21   ceph_mds_snap_head head;
22   bufferlist bl;
23   
24   // (for split only)
25   vector<inodeno_t> split_inos;
26   vector<inodeno_t> split_realms;
27
28   MClientSnap(int o=0) : 
29     Message(CEPH_MSG_CLIENT_SNAP) {
30     memset(&head, 0, sizeof(head));
31     head.op = o;
32   }
33 private:
34   ~MClientSnap() override {}
35
36 public:  
37   const char *get_type_name() const override { return "client_snap"; }
38   void print(ostream& out) const override {
39     out << "client_snap(" << ceph_snap_op_name(head.op);
40     if (head.split)
41       out << " split=" << inodeno_t(head.split);
42     out << " tracelen=" << bl.length();
43     out << ")";
44   }
45
46   void encode_payload(uint64_t features) override {
47     head.num_split_inos = split_inos.size();
48     head.num_split_realms = split_realms.size();
49     head.trace_len = bl.length();
50     ::encode(head, payload);
51     ::encode_nohead(split_inos, payload);
52     ::encode_nohead(split_realms, payload);
53     ::encode_nohead(bl, payload);
54   }
55   void decode_payload() override {
56     bufferlist::iterator p = payload.begin();
57     ::decode(head, p);
58     ::decode_nohead(head.num_split_inos, split_inos, p);
59     ::decode_nohead(head.num_split_realms, split_realms, p);
60     ::decode_nohead(head.trace_len, bl, p);
61     assert(p.end());
62   }
63
64 };
65
66 #endif