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