Revision 1034e9cf
b/hw/virtio/virtio.c | ||
---|---|---|
1087 | 1087 |
return &vq->host_notifier; |
1088 | 1088 |
} |
1089 | 1089 |
|
1090 |
void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name) |
|
1091 |
{ |
|
1092 |
if (vdev->bus_name) { |
|
1093 |
g_free(vdev->bus_name); |
|
1094 |
vdev->bus_name = NULL; |
|
1095 |
} |
|
1096 |
|
|
1097 |
if (bus_name) { |
|
1098 |
vdev->bus_name = g_strdup(bus_name); |
|
1099 |
} |
|
1100 |
} |
|
1101 |
|
|
1090 | 1102 |
static int virtio_device_init(DeviceState *qdev) |
1091 | 1103 |
{ |
1092 | 1104 |
VirtIODevice *vdev = VIRTIO_DEVICE(qdev); |
... | ... | |
1099 | 1111 |
return 0; |
1100 | 1112 |
} |
1101 | 1113 |
|
1114 |
static int virtio_device_exit(DeviceState *qdev) |
|
1115 |
{ |
|
1116 |
VirtIODevice *vdev = VIRTIO_DEVICE(qdev); |
|
1117 |
|
|
1118 |
if (vdev->bus_name) { |
|
1119 |
g_free(vdev->bus_name); |
|
1120 |
vdev->bus_name = NULL; |
|
1121 |
} |
|
1122 |
return 0; |
|
1123 |
} |
|
1124 |
|
|
1102 | 1125 |
static void virtio_device_class_init(ObjectClass *klass, void *data) |
1103 | 1126 |
{ |
1104 | 1127 |
/* Set the default value here. */ |
1105 | 1128 |
DeviceClass *dc = DEVICE_CLASS(klass); |
1106 | 1129 |
dc->init = virtio_device_init; |
1130 |
dc->exit = virtio_device_exit; |
|
1107 | 1131 |
dc->bus_type = TYPE_VIRTIO_BUS; |
1108 | 1132 |
} |
1109 | 1133 |
|
b/include/hw/virtio/virtio.h | ||
---|---|---|
118 | 118 |
uint16_t device_id; |
119 | 119 |
bool vm_running; |
120 | 120 |
VMChangeStateEntry *vmstate; |
121 |
char *bus_name; |
|
121 | 122 |
}; |
122 | 123 |
|
123 | 124 |
typedef struct VirtioDeviceClass { |
... | ... | |
149 | 150 |
uint16_t device_id, size_t config_size); |
150 | 151 |
void virtio_cleanup(VirtIODevice *vdev); |
151 | 152 |
|
153 |
/* Set the child bus name. */ |
|
154 |
void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name); |
|
155 |
|
|
152 | 156 |
VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size, |
153 | 157 |
void (*handle_output)(VirtIODevice *, |
154 | 158 |
VirtQueue *)); |
Also available in: Unified diff