Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / tools / rbd_ggate / Request.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_RBD_GGATE_REQUEST_H
5 #define CEPH_RBD_GGATE_REQUEST_H
6
7 #include "ggate_drv.h"
8
9 namespace rbd {
10 namespace ggate {
11
12 struct Request {
13   enum Command {
14     Unknown = 0,
15     Write = 1,
16     Read = 2,
17     Flush = 3,
18     Discard = 4,
19   };
20
21   ggate_drv_req_t req;
22   bufferlist bl;
23
24   Request(ggate_drv_req_t req) : req(req) {
25   }
26
27   uint64_t get_id() {
28     return ggate_drv_req_id(req);
29   }
30
31   Command get_cmd() {
32     return static_cast<Command>(ggate_drv_req_cmd(req));
33   }
34
35   size_t get_length() {
36     return ggate_drv_req_length(req);
37   }
38
39   uint64_t get_offset() {
40     return ggate_drv_req_offset(req);
41   }
42
43   uint64_t get_error() {
44     return ggate_drv_req_error(req);
45   }
46
47   void set_error(int error) {
48     ggate_drv_req_set_error(req, error);
49   }
50 };
51
52 } // namespace ggate
53 } // namespace rbd
54
55 #endif // CEPH_RBD_GGATE_REQUEST_H