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 private:
23 static constexpr int HEAD_VERSION = 2;
24 static constexpr int COMPAT_VERSION = 1;
25 public:
26
27 struct ceph_mds_cap_release head;
28 vector<ceph_mds_cap_item> caps;
29
30 // The message receiver must wait for this OSD epoch
31 // before actioning this cap release.
32 epoch_t osd_epoch_barrier;
33
34 MClientCapRelease() :
35 Message{CEPH_MSG_CLIENT_CAPRELEASE, HEAD_VERSION, COMPAT_VERSION},
36 osd_epoch_barrier(0)
37 {
38 memset(&head, 0, sizeof(head));
39 }
40 private:
41 ~MClientCapRelease() override {}
42
43 public:
44 std::string_view get_type_name() const override { return "client_cap_release";}
45 void print(ostream& out) const override {
46 out << "client_cap_release(" << caps.size() << ")";
47 }
48
49 void decode_payload() override {
50 auto p = payload.cbegin();
51 decode(head, p);
52 decode_nohead(head.num, caps, p);
53 if (header.version >= 2) {
54 decode(osd_epoch_barrier, p);
55 }
56 }
57 void encode_payload(uint64_t features) override {
58 using ceph::encode;
59 head.num = caps.size();
(1) Event overrun-buffer-val: |
Overrunning struct type ceph_mds_cap_release of 4 bytes by passing it to a function which accesses it at byte offset 7. [details] |
60 encode(head, payload);
61 encode_nohead(caps, payload);
62 encode(osd_epoch_barrier, payload);
63 }
64 };
65
66 #endif
67