xref: /openbmc/qemu/include/scsi/pr-manager.h (revision 438c78da)
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 
9 #define TYPE_PR_MANAGER "pr-manager"
10 
11 #define PR_MANAGER_CLASS(klass) \
12      OBJECT_CLASS_CHECK(PRManagerClass, (klass), TYPE_PR_MANAGER)
13 #define PR_MANAGER_GET_CLASS(obj) \
14      OBJECT_GET_CLASS(PRManagerClass, (obj), TYPE_PR_MANAGER)
15 #define PR_MANAGER(obj) \
16      OBJECT_CHECK(PRManager, (obj), TYPE_PR_MANAGER)
17 
18 struct sg_io_hdr;
19 
20 typedef struct PRManager {
21     /* <private> */
22     Object parent;
23 } PRManager;
24 
25 /**
26  * PRManagerClass:
27  * @parent_class: the base class
28  * @run: callback invoked in thread pool context
29  */
30 typedef struct PRManagerClass {
31     /* <private> */
32     ObjectClass parent_class;
33 
34     /* <public> */
35     int (*run)(PRManager *pr_mgr, int fd, struct sg_io_hdr *hdr);
36     bool (*is_connected)(PRManager *pr_mgr);
37 } PRManagerClass;
38 
39 bool pr_manager_is_connected(PRManager *pr_mgr);
40 BlockAIOCB *pr_manager_execute(PRManager *pr_mgr,
41                                AioContext *ctx, int fd,
42                                struct sg_io_hdr *hdr,
43                                BlockCompletionFunc *complete,
44                                void *opaque);
45 
46 PRManager *pr_manager_lookup(const char *id, Error **errp);
47 
48 #endif
49