1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
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.
16 #ifndef CEPH_MSTATFS_H
17 #define CEPH_MSTATFS_H
19 #include <sys/statvfs.h> /* or <sys/statfs.h> */
20 #include "messages/PaxosServiceMessage.h"
22 class MStatfs : public PaxosServiceMessage {
24 static const int HEAD_VERSION = 2;
25 static const int COMPAT_VERSION = 1;
29 boost::optional<int64_t> data_pool;
31 MStatfs() : PaxosServiceMessage(CEPH_MSG_STATFS, 0, HEAD_VERSION, COMPAT_VERSION) {}
32 MStatfs(const uuid_d& f, ceph_tid_t t, boost::optional<int64_t> _data_pool,
33 version_t v) : PaxosServiceMessage(CEPH_MSG_STATFS, v,
34 HEAD_VERSION, COMPAT_VERSION),
35 fsid(f), data_pool(_data_pool) {
40 ~MStatfs() override {}
43 const char *get_type_name() const override { return "statfs"; }
44 void print(ostream& out) const override {
45 out << "statfs(" << get_tid() << " pool "
46 << (data_pool ? *data_pool : -1) << " v" << version << ")";
49 void encode_payload(uint64_t features) override {
51 ::encode(fsid, payload);
52 ::encode(data_pool, payload);
54 void decode_payload() override {
55 bufferlist::iterator p = payload.begin();
58 if (header.version >= 2) {
59 ::decode(data_pool, p);
61 data_pool = boost::optional<int64_t> ();