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 typedef struct PRManager PRManager; 13 typedef struct PRManagerClass PRManagerClass; 14 DECLARE_OBJ_CHECKERS(PRManager, PRManagerClass, 15 PR_MANAGER, TYPE_PR_MANAGER) 16 17 struct sg_io_hdr; 18 19 struct PRManager { 20 /* <private> */ 21 Object parent; 22 }; 23 24 /** 25 * PRManagerClass: 26 * @parent_class: the base class 27 * @run: callback invoked in thread pool context 28 */ 29 struct PRManagerClass { 30 /* <private> */ 31 ObjectClass parent_class; 32 33 /* <public> */ 34 int (*run)(PRManager *pr_mgr, int fd, struct sg_io_hdr *hdr); 35 bool (*is_connected)(PRManager *pr_mgr); 36 }; 37 38 bool pr_manager_is_connected(PRManager *pr_mgr); 39 int coroutine_fn pr_manager_execute(PRManager *pr_mgr, AioContext *ctx, int fd, 40 struct sg_io_hdr *hdr); 41 42 PRManager *pr_manager_lookup(const char *id, Error **errp); 43 44 #endif 45