]> git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/managed_lock/Types.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / librbd / managed_lock / Types.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef CEPH_LIBRBD_MANAGED_LOCK_TYPES_H
5 #define CEPH_LIBRBD_MANAGED_LOCK_TYPES_H
6
7 #include "msg/msg_types.h"
8 #include <string>
9
10 namespace librbd {
11 namespace managed_lock {
12
13 struct Locker {
14 entity_name_t entity;
15 std::string cookie;
16 std::string address;
17 uint64_t handle = 0;
18
19 Locker() {
20 }
21 Locker(const entity_name_t& entity, const std::string &cookie,
22 const std::string &address, uint64_t handle)
23 : entity(entity), cookie(cookie), address(address), handle(handle) {
24 }
25
26 inline bool operator==(const Locker &rhs) const {
27 return (entity == rhs.entity &&
28 cookie == rhs.cookie &&
29 address == rhs.address &&
30 handle == rhs.handle);
31 }
32 inline bool operator!=(const Locker &rhs) const {
33 return !(*this == rhs);
34 }
35 };
36
37 enum Mode {
38 EXCLUSIVE,
39 SHARED
40 };
41
42
43 } // namespace managed_lock
44 } // namespace librbd
45
46 #endif // CEPH_LIBRBD_MANAGED_LOCK_TYPES_H