xref: /openbmc/qemu/include/scsi/pr-manager.h (revision 1a7c00bb)
1 #ifndef PR_MANAGER_H
2 #define PR_MANAGER_H
3 
4 #include "qom/object.h"
5 #include "qapi/visitor.h"
6 #include "qom/object_interfaces.h"
7 #include "block/aio.h"
8 #include "qemu/coroutine.h"
9 
10 #define TYPE_PR_MANAGER "pr-manager"
11 
12 #define PR_MANAGER_CLASS(klass) \
13      OBJECT_CLASS_CHECK(PRManagerClass, (klass), TYPE_PR_MANAGER)
14 #define PR_MANAGER_GET_CLASS(obj) \
15      OBJECT_GET_CLASS(PRManagerClass, (obj), TYPE_PR_MANAGER)
16 #define PR_MANAGER(obj) \
17      OBJECT_CHECK(PRManager, (obj), TYPE_PR_MANAGER)
18 
19 struct sg_io_hdr;
20 
21 typedef struct PRManager {
22     /* <private> */
23     Object parent;
24 } PRManager;
25 
26 /**
27  * PRManagerClass:
28  * @parent_class: the base class
29  * @run: callback invoked in thread pool context
30  */
31 typedef struct PRManagerClass {
32     /* <private> */
33     ObjectClass parent_class;
34 
35     /* <public> */
36     int (*run)(PRManager *pr_mgr, int fd, struct sg_io_hdr *hdr);
37     bool (*is_connected)(PRManager *pr_mgr);
38 } PRManagerClass;
39 
40 bool pr_manager_is_connected(PRManager *pr_mgr);
41 int coroutine_fn pr_manager_execute(PRManager *pr_mgr, AioContext *ctx, int fd,
42                                     struct sg_io_hdr *hdr);
43 
44 PRManager *pr_manager_lookup(const char *id, Error **errp);
45 
46 #endif
47