Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MClientCapRelease.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_MCLIENTCAPRELEASE_H
16 #define CEPH_MCLIENTCAPRELEASE_H
17
18 #include "msg/Message.h"
19
20
21 class MClientCapRelease : public Message {
22   static const int HEAD_VERSION = 2;
23   static const int COMPAT_VERSION = 1;
24  public:
25   struct ceph_mds_cap_release head;
26   vector<ceph_mds_cap_item> caps;
27
28   // The message receiver must wait for this OSD epoch
29   // before actioning this cap release.
30   epoch_t osd_epoch_barrier;
31
32   MClientCapRelease() : 
33     Message(CEPH_MSG_CLIENT_CAPRELEASE, HEAD_VERSION, COMPAT_VERSION),
34     osd_epoch_barrier(0)
35   {
36     memset(&head, 0, sizeof(head));
37   }
38 private:
39   ~MClientCapRelease() override {}
40
41 public:
42   const char *get_type_name() const override { return "client_cap_release";}
43   void print(ostream& out) const override {
44     out << "client_cap_release(" << caps.size() << ")";
45   }
46   
47   void decode_payload() override {
48     bufferlist::iterator p = payload.begin();
49     ::decode(head, p);
50     ::decode_nohead(head.num, caps, p);
51     if (header.version >= 2) {
52       ::decode(osd_epoch_barrier, p);
53     }
54   }
55   void encode_payload(uint64_t features) override {
56     head.num = caps.size();
57     ::encode(head, payload);
58     ::encode_nohead(caps, payload);
59     ::encode(osd_epoch_barrier, payload);
60   }
61 };
62
63 #endif