aboutsummaryrefslogtreecommitdiff
path: root/hw/block/xen-block.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/block/xen-block.c')
-rw-r--r--hw/block/xen-block.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
index 8e78b6a034..d27a2865bc 100644
--- a/hw/block/xen-block.c
+++ b/hw/block/xen-block.c
@@ -13,6 +13,14 @@
#include "hw/xen/xen-block.h"
#include "trace.h"
+static char *xen_block_get_name(XenDevice *xendev, Error **errp)
+{
+ XenBlockDevice *blockdev = XEN_BLOCK_DEVICE(xendev);
+ XenBlockVdev *vdev = &blockdev->props.vdev;
+
+ return g_strdup_printf("%lu", vdev->number);
+}
+
static void xen_block_unrealize(XenDevice *xendev, Error **errp)
{
XenBlockDevice *blockdev = XEN_BLOCK_DEVICE(xendev);
@@ -262,6 +270,7 @@ static void xen_block_class_init(ObjectClass *class, void *data)
DeviceClass *dev_class = DEVICE_CLASS(class);
XenDeviceClass *xendev_class = XEN_DEVICE_CLASS(class);
+ xendev_class->get_name = xen_block_get_name;
xendev_class->realize = xen_block_realize;
xendev_class->unrealize = xen_block_unrealize;