]>
git.proxmox.com Git - ceph.git/blob - ceph/src/crimson/os/seastore/onode.cc
a8b925b7014884cd657c69485ba6a9a399949298
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
5 #include "include/encoding.h"
7 namespace crimson::os::seastore
{
9 size_t Onode::size() const
11 return ceph::encoded_sizeof(*this);
14 void Onode::encode(void* buffer
, size_t len
)
16 struct [[gnu::packed
]] encoded_t
{
18 uint8_t struct_compat
;
23 auto p
= reinterpret_cast<encoded_t
*>(buffer
);
24 assert(std::numeric_limits
<uint16_t>::max() >= size());
25 assert(len
>= size());
28 p
->struct_len
= sizeof(encoded_t
) + payload
.size();
29 p
->len
= payload
.size();
30 std::memcpy(p
->data
, payload
.data(), payload
.size());
33 bool operator==(const Onode
& lhs
, const Onode
& rhs
)
35 return lhs
.get() == rhs
.get();
38 std::ostream
& operator<<(std::ostream
&out
, const Onode
&rhs
)
40 return out
<< rhs
.get();