]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | ||
f67539c2 | 18 | #include "messages/MMDSOp.h" |
7c673cae | 19 | |
f67539c2 | 20 | class MMDSOpenInoReply final : public MMDSOp { |
11fdf7f2 | 21 | public: |
f67539c2 TL |
22 | static constexpr int HEAD_VERSION = 1; |
23 | static constexpr int COMPAT_VERSION = 1; | |
7c673cae | 24 | inodeno_t ino; |
f67539c2 | 25 | std::vector<inode_backpointer_t> ancestors; |
7c673cae FG |
26 | mds_rank_t hint; |
27 | int32_t error; | |
28 | ||
11fdf7f2 | 29 | protected: |
f67539c2 | 30 | MMDSOpenInoReply() : MMDSOp{MSG_MDS_OPENINOREPLY, HEAD_VERSION, COMPAT_VERSION}, error(0) {} |
7c673cae | 31 | MMDSOpenInoReply(ceph_tid_t t, inodeno_t i, mds_rank_t h=MDS_RANK_NONE, int e=0) : |
f67539c2 | 32 | MMDSOp{MSG_MDS_OPENINOREPLY, HEAD_VERSION, COMPAT_VERSION}, ino(i), hint(h), error(e) { |
7c673cae FG |
33 | header.tid = t; |
34 | } | |
35 | ||
11fdf7f2 TL |
36 | |
37 | public: | |
38 | std::string_view get_type_name() const override { return "openinoreply"; } | |
f67539c2 | 39 | void print(std::ostream &out) const override { |
7c673cae FG |
40 | out << "openinoreply(" << header.tid << " " |
41 | << ino << " " << hint << " " << ancestors << ")"; | |
42 | } | |
43 | ||
44 | void encode_payload(uint64_t features) override { | |
11fdf7f2 TL |
45 | using ceph::encode; |
46 | encode(ino, payload); | |
47 | encode(ancestors, payload); | |
48 | encode(hint, payload); | |
49 | encode(error, payload); | |
7c673cae FG |
50 | } |
51 | void decode_payload() override { | |
f67539c2 | 52 | using ceph::decode; |
11fdf7f2 TL |
53 | auto p = payload.cbegin(); |
54 | decode(ino, p); | |
55 | decode(ancestors, p); | |
56 | decode(hint, p); | |
57 | decode(error, p); | |
7c673cae | 58 | } |
9f95a23c TL |
59 | private: |
60 | template<class T, typename... Args> | |
61 | friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); | |
20effc67 TL |
62 | template<class T, typename... Args> |
63 | friend MURef<T> crimson::make_message(Args&&... args); | |
7c673cae FG |
64 | }; |
65 | ||
66 | #endif |