1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_LIBRBD_EXCLUSIVE_LOCK_PRE_ACQUIRE_REQUEST_H
5 #define CEPH_LIBRBD_EXCLUSIVE_LOCK_PRE_ACQUIRE_REQUEST_H
7 #include "include/int_types.h"
8 #include "include/buffer.h"
9 #include "librbd/ImageCtx.h"
10 #include "msg/msg_types.h"
17 namespace exclusive_lock {
19 template <typename ImageCtxT = ImageCtx>
20 class PreAcquireRequest {
22 static PreAcquireRequest* create(ImageCtxT &image_ctx, Context *on_finish);
48 PreAcquireRequest(ImageCtxT &image_ctx, Context *on_finish);
50 ImageCtxT &m_image_ctx;
55 void send_prepare_lock();
56 void handle_prepare_lock(int r);
58 void send_flush_notifies();
59 void handle_flush_notifies(int r);
63 void save_result(int result) {
64 if (m_error_result == 0 && result < 0) {
65 m_error_result = result;
70 } // namespace exclusive_lock
73 extern template class librbd::exclusive_lock::PreAcquireRequest<librbd::ImageCtx>;
75 #endif // CEPH_LIBRBD_EXCLUSIVE_LOCK_ACQUIRE_REQUEST_H