1 #ifndef CEPH_CLS_LOCK_OPS_H
2 #define CEPH_CLS_LOCK_OPS_H
4 #include "include/types.h"
5 #include "include/utime.h"
6 #include "cls/lock/cls_lock_types.h"
8 struct cls_lock_lock_op
18 cls_lock_lock_op() : type(LOCK_NONE), flags(0) {}
20 void encode(bufferlist &bl) const {
21 ENCODE_START(1, 1, bl);
23 uint8_t t = (uint8_t)type;
27 ::encode(description, bl);
28 ::encode(duration, bl);
32 void decode(bufferlist::iterator &bl) {
33 DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
37 type = (ClsLockType)t;
40 ::decode(description, bl);
41 ::decode(duration, bl);
45 void dump(Formatter *f) const;
46 static void generate_test_instances(list<cls_lock_lock_op*>& o);
48 WRITE_CLASS_ENCODER(cls_lock_lock_op)
50 struct cls_lock_unlock_op
55 cls_lock_unlock_op() {}
57 void encode(bufferlist &bl) const {
58 ENCODE_START(1, 1, bl);
63 void decode(bufferlist::iterator &bl) {
64 DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
69 void dump(Formatter *f) const;
70 static void generate_test_instances(list<cls_lock_unlock_op*>& o);
72 WRITE_CLASS_ENCODER(cls_lock_unlock_op)
74 struct cls_lock_break_op
80 cls_lock_break_op() {}
82 void encode(bufferlist &bl) const {
83 ENCODE_START(1, 1, bl);
89 void decode(bufferlist::iterator &bl) {
90 DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
96 void dump(Formatter *f) const;
97 static void generate_test_instances(list<cls_lock_break_op*>& o);
99 WRITE_CLASS_ENCODER(cls_lock_break_op)
101 struct cls_lock_get_info_op
105 cls_lock_get_info_op() {}
107 void encode(bufferlist &bl) const {
108 ENCODE_START(1, 1, bl);
112 void decode(bufferlist::iterator &bl) {
113 DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
117 void dump(Formatter *f) const;
118 static void generate_test_instances(list<cls_lock_get_info_op*>& o);
120 WRITE_CLASS_ENCODER(cls_lock_get_info_op)
122 struct cls_lock_get_info_reply
124 map<rados::cls::lock::locker_id_t, rados::cls::lock::locker_info_t> lockers;
125 ClsLockType lock_type;
128 cls_lock_get_info_reply() : lock_type(LOCK_NONE) {}
130 void encode(bufferlist &bl, uint64_t features) const {
131 ENCODE_START(1, 1, bl);
132 ::encode(lockers, bl, features);
133 uint8_t t = (uint8_t)lock_type;
138 void decode(bufferlist::iterator &bl) {
139 DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
140 ::decode(lockers, bl);
143 lock_type = (ClsLockType)t;
147 void dump(Formatter *f) const;
148 static void generate_test_instances(list<cls_lock_get_info_reply*>& o);
150 WRITE_CLASS_ENCODER_FEATURES(cls_lock_get_info_reply)
152 struct cls_lock_list_locks_reply
156 cls_lock_list_locks_reply() {}
158 void encode(bufferlist &bl) const {
159 ENCODE_START(1, 1, bl);
163 void decode(bufferlist::iterator &bl) {
164 DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
168 void dump(Formatter *f) const;
169 static void generate_test_instances(list<cls_lock_list_locks_reply*>& o);
171 WRITE_CLASS_ENCODER(cls_lock_list_locks_reply)
173 struct cls_lock_assert_op
180 cls_lock_assert_op() : type(LOCK_NONE) {}
182 void encode(bufferlist &bl) const {
183 ENCODE_START(1, 1, bl);
185 uint8_t t = (uint8_t)type;
187 ::encode(cookie, bl);
191 void decode(bufferlist::iterator &bl) {
192 DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
196 type = (ClsLockType)t;
197 ::decode(cookie, bl);
201 void dump(Formatter *f) const;
202 static void generate_test_instances(list<cls_lock_assert_op*>& o);
204 WRITE_CLASS_ENCODER(cls_lock_assert_op)
206 struct cls_lock_set_cookie_op
214 cls_lock_set_cookie_op() : type(LOCK_NONE) {}
216 void encode(bufferlist &bl) const {
217 ENCODE_START(1, 1, bl);
219 uint8_t t = (uint8_t)type;
221 ::encode(cookie, bl);
223 ::encode(new_cookie, bl);
226 void decode(bufferlist::iterator &bl) {
227 DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
231 type = (ClsLockType)t;
232 ::decode(cookie, bl);
234 ::decode(new_cookie, bl);
237 void dump(Formatter *f) const;
238 static void generate_test_instances(list<cls_lock_set_cookie_op*>& o);
240 WRITE_CLASS_ENCODER(cls_lock_set_cookie_op)