1 /* 2 * Copyright (c) 2018 Citrix Systems Inc. 3 * 4 * This work is licensed under the terms of the GNU GPL, version 2 or later. 5 * See the COPYING file in the top-level directory. 6 */ 7 8 #ifndef HW_XEN_BACKEND_H 9 #define HW_XEN_BACKEND_H 10 11 #include "hw/xen/xen-bus.h" 12 13 typedef struct XenBackendInstance XenBackendInstance; 14 15 typedef void (*XenBackendDeviceCreate)(XenBackendInstance *backend, 16 QDict *opts, Error **errp); 17 typedef void (*XenBackendDeviceDestroy)(XenBackendInstance *backend, 18 Error **errp); 19 20 typedef struct XenBackendInfo { 21 const char *type; 22 XenBackendDeviceCreate create; 23 XenBackendDeviceDestroy destroy; 24 } XenBackendInfo; 25 26 XenBus *xen_backend_get_bus(XenBackendInstance *backend); 27 const char *xen_backend_get_name(XenBackendInstance *backend); 28 29 void xen_backend_set_device(XenBackendInstance *backend, 30 XenDevice *xendevice); 31 XenDevice *xen_backend_get_device(XenBackendInstance *backend); 32 33 void xen_backend_register(const XenBackendInfo *info); 34 35 void xen_backend_device_create(XenBus *xenbus, const char *type, 36 const char *name, QDict *opts, Error **errp); 37 bool xen_backend_try_device_destroy(XenDevice *xendev, Error **errp); 38 39 #endif /* HW_XEN_BACKEND_H */ 40