]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MStatfs.h
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / messages / MStatfs.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
16 #ifndef CEPH_MSTATFS_H
17 #define CEPH_MSTATFS_H
18
19 #include <optional>
20 #include <sys/statvfs.h> /* or <sys/statfs.h> */
21 #include "messages/PaxosServiceMessage.h"
22
23 class MStatfs final : public PaxosServiceMessage {
24 private:
25 static constexpr int HEAD_VERSION = 2;
26 static constexpr int COMPAT_VERSION = 1;
27
28 public:
29 uuid_d fsid;
30 std::optional<int64_t> data_pool;
31
32 MStatfs() : PaxosServiceMessage{CEPH_MSG_STATFS, 0, HEAD_VERSION, COMPAT_VERSION} {}
33 MStatfs(const uuid_d& f, ceph_tid_t t, std::optional<int64_t> _data_pool,
34 version_t v)
35 : PaxosServiceMessage{CEPH_MSG_STATFS, v, HEAD_VERSION, COMPAT_VERSION},
36 fsid(f), data_pool(_data_pool) {
37 set_tid(t);
38 }
39
40 private:
41 ~MStatfs() final {}
42
43 public:
44 std::string_view get_type_name() const override { return "statfs"; }
45 void print(std::ostream& out) const override {
46 out << "statfs(" << get_tid() << " pool "
47 << (data_pool ? *data_pool : -1) << " v" << version << ")";
48 }
49
50 void encode_payload(uint64_t features) override {
51 using ceph::encode;
52 paxos_encode();
53 encode(fsid, payload);
54 encode(data_pool, payload);
55 }
56 void decode_payload() override {
57 using ceph::decode;
58 auto p = payload.cbegin();
59 paxos_decode(p);
60 decode(fsid, p);
61 if (header.version >= 2) {
62 decode(data_pool, p);
63 } else {
64 data_pool = std::optional<int64_t> ();
65 }
66 }
67 private:
68 template<class T, typename... Args>
69 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
70 };
71
72 #endif