2 * Copyright (c) 2018 Citrix Systems Inc.
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.
8 #ifndef HW_XEN_BACKEND_H
9 #define HW_XEN_BACKEND_H
11 #include "hw/xen/xen-bus.h"
13 typedef struct XenBackendInstance XenBackendInstance
;
15 typedef void (*XenBackendDeviceCreate
)(XenBackendInstance
*backend
,
16 QDict
*opts
, Error
**errp
);
17 typedef void (*XenBackendDeviceDestroy
)(XenBackendInstance
*backend
,
20 typedef struct XenBackendInfo
{
22 XenBackendDeviceCreate create
;
23 XenBackendDeviceDestroy destroy
;
26 XenBus
*xen_backend_get_bus(XenBackendInstance
*backend
);
27 const char *xen_backend_get_name(XenBackendInstance
*backend
);
29 void xen_backend_set_device(XenBackendInstance
*backend
,
30 XenDevice
*xendevice
);
31 XenDevice
*xen_backend_get_device(XenBackendInstance
*backend
);
33 void xen_backend_register(const XenBackendInfo
*info
);
34 const char **xen_backend_get_types(unsigned int *nr
);
36 bool xen_backend_exists(const char *type
, const char *name
);
37 void xen_backend_device_create(XenBus
*xenbus
, const char *type
,
38 const char *name
, QDict
*opts
, Error
**errp
);
39 bool xen_backend_try_device_destroy(XenDevice
*xendev
, Error
**errp
);
41 #endif /* HW_XEN_BACKEND_H */