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) 2014 Red Hat
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 #include "kstore_types.h"
16 #include "common/Formatter.h"
17 #include "include/stringify.h"
21 void kstore_cnode_t::encode(bufferlist& bl) const
23 ENCODE_START(1, 1, bl);
28 void kstore_cnode_t::decode(bufferlist::iterator& p)
35 void kstore_cnode_t::dump(Formatter *f) const
37 f->dump_unsigned("bits", bits);
40 void kstore_cnode_t::generate_test_instances(list<kstore_cnode_t*>& o)
42 o.push_back(new kstore_cnode_t());
43 o.push_back(new kstore_cnode_t(0));
44 o.push_back(new kstore_cnode_t(123));
50 void kstore_onode_t::encode(bufferlist& bl) const
52 ENCODE_START(1, 1, bl);
56 ::encode(omap_head, bl);
57 ::encode(stripe_size, bl);
58 ::encode(expected_object_size, bl);
59 ::encode(expected_write_size, bl);
60 ::encode(alloc_hint_flags, bl);
64 void kstore_onode_t::decode(bufferlist::iterator& p)
70 ::decode(omap_head, p);
71 ::decode(stripe_size, p);
72 ::decode(expected_object_size, p);
73 ::decode(expected_write_size, p);
74 ::decode(alloc_hint_flags, p);
78 void kstore_onode_t::dump(Formatter *f) const
80 f->dump_unsigned("nid", nid);
81 f->dump_unsigned("size", size);
82 f->open_object_section("attrs");
83 for (map<string,bufferptr>::const_iterator p = attrs.begin();
84 p != attrs.end(); ++p) {
85 f->open_object_section("attr");
86 f->dump_string("name", p->first);
87 f->dump_unsigned("len", p->second.length());
91 f->dump_unsigned("omap_head", omap_head);
92 f->dump_unsigned("stripe_size", stripe_size);
93 f->dump_unsigned("expected_object_size", expected_object_size);
94 f->dump_unsigned("expected_write_size", expected_write_size);
95 f->dump_unsigned("alloc_hint_flags", alloc_hint_flags);
98 void kstore_onode_t::generate_test_instances(list<kstore_onode_t*>& o)
100 o.push_back(new kstore_onode_t());