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