]>
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_MDSOPENINO_H | |
16 | #define CEPH_MDSOPENINO_H | |
17 | ||
f67539c2 | 18 | #include "messages/MMDSOp.h" |
7c673cae | 19 | |
f67539c2 TL |
20 | class MMDSOpenIno final : public MMDSOp { |
21 | static constexpr int HEAD_VERSION = 1; | |
22 | static constexpr int COMPAT_VERSION = 1; | |
11fdf7f2 | 23 | public: |
7c673cae | 24 | inodeno_t ino; |
f67539c2 | 25 | std::vector<inode_backpointer_t> ancestors; |
7c673cae | 26 | |
11fdf7f2 | 27 | protected: |
f67539c2 TL |
28 | MMDSOpenIno() : MMDSOp{MSG_MDS_OPENINO, HEAD_VERSION, COMPAT_VERSION} {} |
29 | MMDSOpenIno(ceph_tid_t t, inodeno_t i, std::vector<inode_backpointer_t>* pa) : | |
30 | MMDSOp{MSG_MDS_OPENINO, HEAD_VERSION, COMPAT_VERSION}, ino(i) { | |
7c673cae FG |
31 | header.tid = t; |
32 | if (pa) | |
33 | ancestors = *pa; | |
34 | } | |
f67539c2 | 35 | ~MMDSOpenIno() final {} |
7c673cae | 36 | |
11fdf7f2 TL |
37 | public: |
38 | std::string_view get_type_name() const override { return "openino"; } | |
f67539c2 | 39 | void print(std::ostream &out) const override { |
7c673cae FG |
40 | out << "openino(" << header.tid << " " << ino << " " << ancestors << ")"; |
41 | } | |
42 | ||
43 | void encode_payload(uint64_t features) override { | |
11fdf7f2 TL |
44 | using ceph::encode; |
45 | encode(ino, payload); | |
46 | encode(ancestors, payload); | |
7c673cae FG |
47 | } |
48 | void decode_payload() override { | |
f67539c2 | 49 | using ceph::decode; |
11fdf7f2 TL |
50 | auto p = payload.cbegin(); |
51 | decode(ino, p); | |
52 | decode(ancestors, p); | |
7c673cae | 53 | } |
9f95a23c TL |
54 | private: |
55 | template<class T, typename... Args> | |
56 | friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); | |
7c673cae FG |
57 | }; |
58 | ||
59 | #endif |