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_MCLIENTLEASE_H
17 #define CEPH_MCLIENTLEASE_H
19 #include "msg/Message.h"
21 struct MClientLease : public Message {
22 struct ceph_mds_lease h;
25 int get_action() const { return h.action; }
26 ceph_seq_t get_seq() const { return h.seq; }
27 int get_mask() const { return h.mask; }
28 inodeno_t get_ino() const { return inodeno_t(h.ino); }
29 snapid_t get_first() const { return snapid_t(h.first); }
30 snapid_t get_last() const { return snapid_t(h.last); }
32 MClientLease() : Message(CEPH_MSG_CLIENT_LEASE) {}
33 MClientLease(int ac, ceph_seq_t seq, int m, uint64_t i, uint64_t sf, uint64_t sl) :
34 Message(CEPH_MSG_CLIENT_LEASE) {
43 MClientLease(int ac, ceph_seq_t seq, int m, uint64_t i, uint64_t sf, uint64_t sl, const string& d) :
44 Message(CEPH_MSG_CLIENT_LEASE),
55 ~MClientLease() override {}
58 const char *get_type_name() const override { return "client_lease"; }
59 void print(ostream& out) const override {
60 out << "client_lease(a=" << ceph_lease_op_name(get_action())
61 << " seq " << get_seq()
62 << " mask " << get_mask();
63 out << " " << get_ino();
64 if (h.last != CEPH_NOSNAP)
65 out << " [" << snapid_t(h.first) << "," << snapid_t(h.last) << "]";
71 void decode_payload() override {
72 bufferlist::iterator p = payload.begin();
76 void encode_payload(uint64_t features) override {
78 ::encode(dname, payload);