From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- src/cls/lock/cls_lock_ops.h | 245 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 src/cls/lock/cls_lock_ops.h (limited to 'src/cls/lock/cls_lock_ops.h') diff --git a/src/cls/lock/cls_lock_ops.h b/src/cls/lock/cls_lock_ops.h new file mode 100644 index 000000000..4de050f18 --- /dev/null +++ b/src/cls/lock/cls_lock_ops.h @@ -0,0 +1,245 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_CLS_LOCK_OPS_H +#define CEPH_CLS_LOCK_OPS_H + +#include "include/types.h" +#include "include/utime.h" +#include "cls/lock/cls_lock_types.h" + +struct cls_lock_lock_op +{ + std::string name; + ClsLockType type; + std::string cookie; + std::string tag; + std::string description; + utime_t duration; + uint8_t flags; + + cls_lock_lock_op() : type(ClsLockType::NONE), flags(0) {} + + void encode(ceph::buffer::list &bl) const { + ENCODE_START(1, 1, bl); + encode(name, bl); + uint8_t t = (uint8_t)type; + encode(t, bl); + encode(cookie, bl); + encode(tag, bl); + encode(description, bl); + encode(duration, bl); + encode(flags, bl); + ENCODE_FINISH(bl); + } + void decode(ceph::buffer::list::const_iterator &bl) { + DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl); + decode(name, bl); + uint8_t t; + decode(t, bl); + type = (ClsLockType)t; + decode(cookie, bl); + decode(tag, bl); + decode(description, bl); + decode(duration, bl); + decode(flags, bl); + DECODE_FINISH(bl); + } + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); +}; +WRITE_CLASS_ENCODER(cls_lock_lock_op) + +struct cls_lock_unlock_op +{ + std::string name; + std::string cookie; + + cls_lock_unlock_op() {} + + void encode(ceph::buffer::list &bl) const { + ENCODE_START(1, 1, bl); + encode(name, bl); + encode(cookie, bl); + ENCODE_FINISH(bl); + } + void decode(ceph::buffer::list::const_iterator &bl) { + DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl); + decode(name, bl); + decode(cookie, bl); + DECODE_FINISH(bl); + } + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); +}; +WRITE_CLASS_ENCODER(cls_lock_unlock_op) + +struct cls_lock_break_op +{ + std::string name; + entity_name_t locker; + std::string cookie; + + cls_lock_break_op() {} + + void encode(ceph::buffer::list &bl) const { + ENCODE_START(1, 1, bl); + encode(name, bl); + encode(locker, bl); + encode(cookie, bl); + ENCODE_FINISH(bl); + } + void decode(ceph::buffer::list::const_iterator &bl) { + DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl); + decode(name, bl); + decode(locker, bl); + decode(cookie, bl); + DECODE_FINISH(bl); + } + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); +}; +WRITE_CLASS_ENCODER(cls_lock_break_op) + +struct cls_lock_get_info_op +{ + std::string name; + + cls_lock_get_info_op() {} + + void encode(ceph::buffer::list &bl) const { + ENCODE_START(1, 1, bl); + encode(name, bl); + ENCODE_FINISH(bl); + } + void decode(ceph::buffer::list::const_iterator &bl) { + DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl); + decode(name, bl); + DECODE_FINISH(bl); + } + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); +}; +WRITE_CLASS_ENCODER(cls_lock_get_info_op) + +struct cls_lock_get_info_reply +{ + std::map lockers; + ClsLockType lock_type; + std::string tag; + + cls_lock_get_info_reply() : lock_type(ClsLockType::NONE) {} + + void encode(ceph::buffer::list &bl, uint64_t features) const { + ENCODE_START(1, 1, bl); + encode(lockers, bl, features); + uint8_t t = (uint8_t)lock_type; + encode(t, bl); + encode(tag, bl); + ENCODE_FINISH(bl); + } + void decode(ceph::buffer::list::const_iterator &bl) { + DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl); + decode(lockers, bl); + uint8_t t; + decode(t, bl); + lock_type = (ClsLockType)t; + decode(tag, bl); + DECODE_FINISH(bl); + } + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); +}; +WRITE_CLASS_ENCODER_FEATURES(cls_lock_get_info_reply) + +struct cls_lock_list_locks_reply +{ + std::list locks; + + cls_lock_list_locks_reply() {} + + void encode(ceph::buffer::list &bl) const { + ENCODE_START(1, 1, bl); + encode(locks, bl); + ENCODE_FINISH(bl); + } + void decode(ceph::buffer::list::const_iterator &bl) { + DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl); + decode(locks, bl); + DECODE_FINISH(bl); + } + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); +}; +WRITE_CLASS_ENCODER(cls_lock_list_locks_reply) + +struct cls_lock_assert_op +{ + std::string name; + ClsLockType type; + std::string cookie; + std::string tag; + + cls_lock_assert_op() : type(ClsLockType::NONE) {} + + void encode(ceph::buffer::list &bl) const { + ENCODE_START(1, 1, bl); + encode(name, bl); + uint8_t t = (uint8_t)type; + encode(t, bl); + encode(cookie, bl); + encode(tag, bl); + ENCODE_FINISH(bl); + } + void decode(ceph::buffer::list::const_iterator &bl) { + DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl); + decode(name, bl); + uint8_t t; + decode(t, bl); + type = (ClsLockType)t; + decode(cookie, bl); + decode(tag, bl); + DECODE_FINISH(bl); + } + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); +}; +WRITE_CLASS_ENCODER(cls_lock_assert_op) + +struct cls_lock_set_cookie_op +{ + std::string name; + ClsLockType type; + std::string cookie; + std::string tag; + std::string new_cookie; + + cls_lock_set_cookie_op() : type(ClsLockType::NONE) {} + + void encode(ceph::buffer::list &bl) const { + ENCODE_START(1, 1, bl); + encode(name, bl); + uint8_t t = (uint8_t)type; + encode(t, bl); + encode(cookie, bl); + encode(tag, bl); + encode(new_cookie, bl); + ENCODE_FINISH(bl); + } + void decode(ceph::buffer::list::const_iterator &bl) { + DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl); + decode(name, bl); + uint8_t t; + decode(t, bl); + type = (ClsLockType)t; + decode(cookie, bl); + decode(tag, bl); + decode(new_cookie, bl); + DECODE_FINISH(bl); + } + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); +}; +WRITE_CLASS_ENCODER(cls_lock_set_cookie_op) + +#endif -- cgit v1.2.3