]>
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) 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 | ||
16 | #ifndef CEPH_MDENTRYUNLINK_H | |
17 | #define CEPH_MDENTRYUNLINK_H | |
18 | ||
11fdf7f2 TL |
19 | #include <string_view> |
20 | ||
21 | #include "msg/Message.h" | |
22 | ||
23 | class MDentryUnlink : public MessageInstance<MDentryUnlink> { | |
24 | public: | |
25 | friend factory; | |
26 | private: | |
94b18763 | 27 | |
7c673cae FG |
28 | dirfrag_t dirfrag; |
29 | string dn; | |
30 | ||
31 | public: | |
11fdf7f2 TL |
32 | dirfrag_t get_dirfrag() const { return dirfrag; } |
33 | const string& get_dn() const { return dn; } | |
7c673cae FG |
34 | |
35 | bufferlist straybl; | |
11fdf7f2 | 36 | bufferlist snapbl; |
7c673cae | 37 | |
11fdf7f2 | 38 | protected: |
7c673cae | 39 | MDentryUnlink() : |
11fdf7f2 TL |
40 | MessageInstance(MSG_MDS_DENTRYUNLINK) { } |
41 | MDentryUnlink(dirfrag_t df, std::string_view n) : | |
42 | MessageInstance(MSG_MDS_DENTRYUNLINK), | |
7c673cae FG |
43 | dirfrag(df), |
44 | dn(n) {} | |
7c673cae FG |
45 | ~MDentryUnlink() override {} |
46 | ||
47 | public: | |
11fdf7f2 | 48 | std::string_view get_type_name() const override { return "dentry_unlink";} |
7c673cae FG |
49 | void print(ostream& o) const override { |
50 | o << "dentry_unlink(" << dirfrag << " " << dn << ")"; | |
51 | } | |
52 | ||
53 | void decode_payload() override { | |
11fdf7f2 TL |
54 | auto p = payload.cbegin(); |
55 | decode(dirfrag, p); | |
56 | decode(dn, p); | |
57 | decode(straybl, p); | |
7c673cae FG |
58 | } |
59 | void encode_payload(uint64_t features) override { | |
11fdf7f2 TL |
60 | using ceph::encode; |
61 | encode(dirfrag, payload); | |
62 | encode(dn, payload); | |
63 | encode(straybl, payload); | |
7c673cae FG |
64 | } |
65 | }; | |
66 | ||
67 | #endif |