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.
15 #ifndef CEPH_MDATAPING_H
16 #define CEPH_MDATAPING_H
18 #include "msg/Message.h"
19 #include "messages/MPing.h"
20 #include "include/encoding.h"
26 struct xio_reg_mem
{};
29 typedef void (*mdata_hook_func
)(struct xio_reg_mem
*mp
);
31 class MDataPing
: public Message
{
35 static const int HEAD_VERSION
= 1;
36 static const int COMPAT_VERSION
= 1;
40 mdata_hook_func mdata_hook
;
41 struct xio_reg_mem mp
;
45 : Message(MSG_DATA_PING
, HEAD_VERSION
, COMPAT_VERSION
),
50 struct xio_reg_mem
*get_mp()
55 void set_rdma_hook(mdata_hook_func hook
)
67 const std::list
<buffer::ptr
>& buffers
= data
.buffers();
68 list
<bufferptr
>::const_iterator pb
;
69 for (pb
= buffers
.begin(); pb
!= buffers
.end(); ++pb
) {
70 free((void*) pb
->c_str());
76 void decode_payload() override
{
77 bufferlist::iterator p
= payload
.begin();
81 void encode_payload(uint64_t features
) override
{
82 ::encode(tag
, payload
);
83 ::encode(counter
, payload
);
86 const char *get_type_name() const override
{ return "data_ping"; }
88 void print(ostream
& out
) const override
{
89 out
<< get_type_name() << " " << tag
<< " " << counter
;
93 #endif /* CEPH_MDATAPING_H */