vhost: use consistent naming for backend handlers
Most of handlers start from simply .vhost_, except for these four, starting from .vhost_backend_. Let's rename them to be consistent. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Based-on: <20260206095258.894504-1-vsementsov@yandex-team.ru> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20260420202032.714884-3-vsementsov@yandex-team.ru>
Vladimir Sementsov-Ogievskiy committed
Apr 20, 2026 at 23:20 UTC
83a2e2ecc108b44e2a49ec44d2ff0150dac984a2
5 files changed
+25
-26
hw/virtio/vhost-backend.c
+3
-3
@@ -358,9 +358,9 @@ static void vhost_kernel_set_iotlb_callback(struct vhost_dev *dev,
358
359
const VhostOps kernel_ops = {
360
.backend_type = VHOST_BACKEND_TYPE_KERNEL,
361
- .vhost_backend_init = vhost_kernel_init,
362
- .vhost_backend_cleanup = vhost_kernel_cleanup,
363
- .vhost_backend_memslots_limit = vhost_kernel_memslots_limit,
361
+ .vhost_init = vhost_kernel_init,
362
+ .vhost_cleanup = vhost_kernel_cleanup,
363
+ .vhost_memslots_limit = vhost_kernel_memslots_limit,
364
.vhost_net_set_backend = vhost_kernel_net_set_backend,
365
.vhost_scsi_set_endpoint = vhost_kernel_scsi_set_endpoint,
366
.vhost_scsi_clear_endpoint = vhost_kernel_scsi_clear_endpoint,
hw/virtio/vhost-user.c
+4
-4
@@ -3115,10 +3115,10 @@ void vhost_user_qmp_status(struct vhost_dev *dev, VirtioStatus *status)
3115
3116
const VhostOps user_ops = {
3117
.backend_type = VHOST_BACKEND_TYPE_USER,
3118
- .vhost_backend_init = vhost_user_backend_init,
3119
- .vhost_backend_cleanup = vhost_user_backend_cleanup,
3120
- .vhost_backend_memslots_limit = vhost_user_memslots_limit,
3121
- .vhost_backend_no_private_memslots = vhost_user_no_private_memslots,
3118
+ .vhost_init = vhost_user_backend_init,
3119
+ .vhost_cleanup = vhost_user_backend_cleanup,
3120
+ .vhost_memslots_limit = vhost_user_memslots_limit,
3121
+ .vhost_no_private_memslots = vhost_user_no_private_memslots,
3122
.vhost_set_log_base = vhost_user_set_log_base,
3123
.vhost_set_mem_table = vhost_user_set_mem_table,
3124
.vhost_set_vring_addr = vhost_user_set_vring_addr,
hw/virtio/vhost-vdpa.c
+3
-3
@@ -1590,8 +1590,8 @@ static bool vhost_vdpa_force_iommu(struct vhost_dev *dev)
1590
1591
const VhostOps vdpa_ops = {
1592
.backend_type = VHOST_BACKEND_TYPE_VDPA,
1593
- .vhost_backend_init = vhost_vdpa_init,
1594
- .vhost_backend_cleanup = vhost_vdpa_cleanup,
1593
+ .vhost_init = vhost_vdpa_init,
1594
+ .vhost_cleanup = vhost_vdpa_cleanup,
1595
.vhost_set_log_base = vhost_vdpa_set_log_base,
1596
.vhost_set_vring_addr = vhost_vdpa_set_vring_addr,
1597
.vhost_set_vring_num = vhost_vdpa_set_vring_num,
@@ -1602,7 +1602,7 @@ const VhostOps vdpa_ops = {
1602
.vhost_get_features = vhost_vdpa_get_features,
1603
.vhost_set_owner = vhost_vdpa_set_owner,
1604
.vhost_set_vring_endian = NULL,
1605
- .vhost_backend_memslots_limit = vhost_vdpa_memslots_limit,
1605
+ .vhost_memslots_limit = vhost_vdpa_memslots_limit,
1606
.vhost_set_mem_table = vhost_vdpa_set_mem_table,
1607
.vhost_set_features = vhost_vdpa_set_features,
1608
.vhost_reset_device = vhost_vdpa_reset_device,
hw/virtio/vhost.c
+7
-7
@@ -58,7 +58,7 @@ unsigned int vhost_get_max_memslots(void)
58
struct vhost_dev *hdev;
59
60
QLIST_FOREACH(hdev, &vhost_devices, entry) {
61
- max = MIN(max, hdev->vhost_ops->vhost_backend_memslots_limit(hdev));
61
+ max = MIN(max, hdev->vhost_ops->vhost_memslots_limit(hdev));
62
}
63
return max;
64
}
@@ -69,7 +69,7 @@ unsigned int vhost_get_free_memslots(void)
69
struct vhost_dev *hdev;
70
71
QLIST_FOREACH(hdev, &vhost_devices, entry) {
72
- unsigned int r = hdev->vhost_ops->vhost_backend_memslots_limit(hdev);
72
+ unsigned int r = hdev->vhost_ops->vhost_memslots_limit(hdev);
73
unsigned int cur_free = r - hdev->mem->nregions;
74
75
if (unlikely(r < hdev->mem->nregions)) {
@@ -664,8 +664,8 @@ static bool vhost_section(struct vhost_dev *dev, MemoryRegionSection *section)
664
*/
665
if ((memory_region_get_fd(section->mr) < 0 ||
666
!qemu_ram_is_shared(section->mr->ram_block)) &&
667
- dev->vhost_ops->vhost_backend_no_private_memslots &&
668
- dev->vhost_ops->vhost_backend_no_private_memslots(dev)) {
667
+ dev->vhost_ops->vhost_no_private_memslots &&
668
+ dev->vhost_ops->vhost_no_private_memslots(dev)) {
669
trace_vhost_reject_section(mr->name, 2);
670
return false;
671
}
@@ -1674,7 +1674,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
1674
r = vhost_set_backend_type(hdev, backend_type);
1675
assert(r >= 0);
1676
1677
- r = hdev->vhost_ops->vhost_backend_init(hdev, opaque, errp);
1677
+ r = hdev->vhost_ops->vhost_init(hdev, opaque, errp);
1678
if (r < 0) {
1679
goto fail;
1680
}
@@ -1691,7 +1691,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
1691
goto fail;
1692
}
1693
1694
- limit = hdev->vhost_ops->vhost_backend_memslots_limit(hdev);
1694
+ limit = hdev->vhost_ops->vhost_memslots_limit(hdev);
1695
if (limit < MEMORY_DEVICES_SAFE_MAX_MEMSLOTS &&
1696
memory_devices_memslot_auto_decision_active()) {
1697
error_setg(errp, "some memory device (like virtio-mem)"
@@ -1809,7 +1809,7 @@ void vhost_dev_cleanup(struct vhost_dev *hdev)
1809
g_free(hdev->mem);
1810
g_free(hdev->mem_sections);
1811
if (hdev->vhost_ops) {
1812
- hdev->vhost_ops->vhost_backend_cleanup(hdev);
1812
+ hdev->vhost_ops->vhost_cleanup(hdev);
1813
}
1814
assert(!hdev->log);
1815
include/hw/virtio/vhost-backend.h
+8
-9
@@ -51,10 +51,9 @@ struct vhost_scsi_target;
51
struct vhost_iotlb_msg;
52
struct vhost_virtqueue;
53
54
-typedef int (*vhost_backend_init)(struct vhost_dev *dev, void *opaque,
55
- Error **errp);
56
-typedef int (*vhost_backend_cleanup)(struct vhost_dev *dev);
57
-typedef int (*vhost_backend_memslots_limit)(struct vhost_dev *dev);
54
+typedef int (*vhost_init)(struct vhost_dev *dev, void *opaque, Error **errp);
55
+typedef int (*vhost_cleanup)(struct vhost_dev *dev);
56
+typedef int (*vhost_memslots_limit)(struct vhost_dev *dev);
57
58
typedef int (*vhost_net_set_backend_op)(struct vhost_dev *dev,
59
struct vhost_vring_file *file);
@@ -131,7 +130,7 @@ typedef int (*vhost_crypto_create_session_op)(struct vhost_dev *dev,
130
typedef int (*vhost_crypto_close_session_op)(struct vhost_dev *dev,
131
uint64_t session_id);
132
134
-typedef bool (*vhost_backend_no_private_memslots_op)(struct vhost_dev *dev);
133
+typedef bool (*vhost_no_private_memslots_op)(struct vhost_dev *dev);
134
135
typedef int (*vhost_get_inflight_fd_op)(struct vhost_dev *dev,
136
uint16_t queue_size,
@@ -166,10 +165,10 @@ typedef int (*vhost_check_device_state_op)(struct vhost_dev *dev, Error **errp);
165
166
typedef struct VhostOps {
167
VhostBackendType backend_type;
169
- vhost_backend_init vhost_backend_init;
170
- vhost_backend_cleanup vhost_backend_cleanup;
171
- vhost_backend_memslots_limit vhost_backend_memslots_limit;
172
- vhost_backend_no_private_memslots_op vhost_backend_no_private_memslots;
168
+ vhost_init vhost_init;
169
+ vhost_cleanup vhost_cleanup;
170
+ vhost_memslots_limit vhost_memslots_limit;
171
+ vhost_no_private_memslots_op vhost_no_private_memslots;
172
vhost_net_set_backend_op vhost_net_set_backend;
173
vhost_net_set_mtu_op vhost_net_set_mtu;
174
vhost_scsi_set_endpoint_op vhost_scsi_set_endpoint;