mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
vhost-user: fully use new backend/frontend naming
Slave/master nomenclature was replaced with backend/frontend in commit
1fc19b6527
("vhost-user: Adopt new backend naming")
This patch replaces all remaining uses of master and slave in the
codebase.
Signed-off-by: Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org>
Message-Id: <20230613080849.2115347-1-manos.pitsidianakis@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
535a3d9a32
commit
f8ed3648b5
12 changed files with 74 additions and 72 deletions
|
@ -124,13 +124,13 @@ typedef enum VhostUserRequest {
|
|||
VHOST_USER_MAX
|
||||
} VhostUserRequest;
|
||||
|
||||
typedef enum VhostUserSlaveRequest {
|
||||
typedef enum VhostUserBackendRequest {
|
||||
VHOST_USER_BACKEND_NONE = 0,
|
||||
VHOST_USER_BACKEND_IOTLB_MSG = 1,
|
||||
VHOST_USER_BACKEND_CONFIG_CHANGE_MSG = 2,
|
||||
VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG = 3,
|
||||
VHOST_USER_BACKEND_MAX
|
||||
} VhostUserSlaveRequest;
|
||||
} VhostUserBackendRequest;
|
||||
|
||||
typedef struct VhostUserMemoryRegion {
|
||||
uint64_t guest_phys_addr;
|
||||
|
@ -245,8 +245,8 @@ struct vhost_user {
|
|||
struct vhost_dev *dev;
|
||||
/* Shared between vhost devs of the same virtio device */
|
||||
VhostUserState *user;
|
||||
QIOChannel *slave_ioc;
|
||||
GSource *slave_src;
|
||||
QIOChannel *backend_ioc;
|
||||
GSource *backend_src;
|
||||
NotifierWithReturn postcopy_notifier;
|
||||
struct PostCopyFD postcopy_fd;
|
||||
uint64_t postcopy_client_bases[VHOST_USER_MAX_RAM_SLOTS];
|
||||
|
@ -1495,7 +1495,7 @@ static int vhost_user_reset_device(struct vhost_dev *dev)
|
|||
return vhost_user_write(dev, &msg, NULL, 0);
|
||||
}
|
||||
|
||||
static int vhost_user_slave_handle_config_change(struct vhost_dev *dev)
|
||||
static int vhost_user_backend_handle_config_change(struct vhost_dev *dev)
|
||||
{
|
||||
if (!dev->config_ops || !dev->config_ops->vhost_dev_config_notifier) {
|
||||
return -ENOSYS;
|
||||
|
@ -1532,7 +1532,7 @@ static VhostUserHostNotifier *fetch_or_create_notifier(VhostUserState *u,
|
|||
return n;
|
||||
}
|
||||
|
||||
static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev,
|
||||
static int vhost_user_backend_handle_vring_host_notifier(struct vhost_dev *dev,
|
||||
VhostUserVringArea *area,
|
||||
int fd)
|
||||
{
|
||||
|
@ -1594,16 +1594,16 @@ static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void close_slave_channel(struct vhost_user *u)
|
||||
static void close_backend_channel(struct vhost_user *u)
|
||||
{
|
||||
g_source_destroy(u->slave_src);
|
||||
g_source_unref(u->slave_src);
|
||||
u->slave_src = NULL;
|
||||
object_unref(OBJECT(u->slave_ioc));
|
||||
u->slave_ioc = NULL;
|
||||
g_source_destroy(u->backend_src);
|
||||
g_source_unref(u->backend_src);
|
||||
u->backend_src = NULL;
|
||||
object_unref(OBJECT(u->backend_ioc));
|
||||
u->backend_ioc = NULL;
|
||||
}
|
||||
|
||||
static gboolean slave_read(QIOChannel *ioc, GIOCondition condition,
|
||||
static gboolean backend_read(QIOChannel *ioc, GIOCondition condition,
|
||||
gpointer opaque)
|
||||
{
|
||||
struct vhost_dev *dev = opaque;
|
||||
|
@ -1645,10 +1645,10 @@ static gboolean slave_read(QIOChannel *ioc, GIOCondition condition,
|
|||
ret = vhost_backend_handle_iotlb_msg(dev, &payload.iotlb);
|
||||
break;
|
||||
case VHOST_USER_BACKEND_CONFIG_CHANGE_MSG:
|
||||
ret = vhost_user_slave_handle_config_change(dev);
|
||||
ret = vhost_user_backend_handle_config_change(dev);
|
||||
break;
|
||||
case VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG:
|
||||
ret = vhost_user_slave_handle_vring_host_notifier(dev, &payload.area,
|
||||
ret = vhost_user_backend_handle_vring_host_notifier(dev, &payload.area,
|
||||
fd ? fd[0] : -1);
|
||||
break;
|
||||
default:
|
||||
|
@ -1684,7 +1684,7 @@ static gboolean slave_read(QIOChannel *ioc, GIOCondition condition,
|
|||
goto fdcleanup;
|
||||
|
||||
err:
|
||||
close_slave_channel(u);
|
||||
close_backend_channel(u);
|
||||
rc = G_SOURCE_REMOVE;
|
||||
|
||||
fdcleanup:
|
||||
|
@ -1696,7 +1696,7 @@ fdcleanup:
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int vhost_setup_slave_channel(struct vhost_dev *dev)
|
||||
static int vhost_setup_backend_channel(struct vhost_dev *dev)
|
||||
{
|
||||
VhostUserMsg msg = {
|
||||
.hdr.request = VHOST_USER_SET_BACKEND_REQ_FD,
|
||||
|
@ -1725,10 +1725,10 @@ static int vhost_setup_slave_channel(struct vhost_dev *dev)
|
|||
error_report_err(local_err);
|
||||
return -ECONNREFUSED;
|
||||
}
|
||||
u->slave_ioc = ioc;
|
||||
u->slave_src = qio_channel_add_watch_source(u->slave_ioc,
|
||||
u->backend_ioc = ioc;
|
||||
u->backend_src = qio_channel_add_watch_source(u->backend_ioc,
|
||||
G_IO_IN | G_IO_HUP,
|
||||
slave_read, dev, NULL, NULL);
|
||||
backend_read, dev, NULL, NULL);
|
||||
|
||||
if (reply_supported) {
|
||||
msg.hdr.flags |= VHOST_USER_NEED_REPLY_MASK;
|
||||
|
@ -1746,7 +1746,7 @@ static int vhost_setup_slave_channel(struct vhost_dev *dev)
|
|||
out:
|
||||
close(sv[1]);
|
||||
if (ret) {
|
||||
close_slave_channel(u);
|
||||
close_backend_channel(u);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -2072,7 +2072,7 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,
|
|||
virtio_has_feature(dev->protocol_features,
|
||||
VHOST_USER_PROTOCOL_F_REPLY_ACK))) {
|
||||
error_setg(errp, "IOMMU support requires reply-ack and "
|
||||
"slave-req protocol features.");
|
||||
"backend-req protocol features.");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -2108,7 +2108,7 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,
|
|||
}
|
||||
|
||||
if (dev->vq_index == 0) {
|
||||
err = vhost_setup_slave_channel(dev);
|
||||
err = vhost_setup_backend_channel(dev);
|
||||
if (err < 0) {
|
||||
error_setg_errno(errp, EPROTO, "vhost_backend_init failed");
|
||||
return -EPROTO;
|
||||
|
@ -2138,8 +2138,8 @@ static int vhost_user_backend_cleanup(struct vhost_dev *dev)
|
|||
close(u->postcopy_fd.fd);
|
||||
u->postcopy_fd.handler = NULL;
|
||||
}
|
||||
if (u->slave_ioc) {
|
||||
close_slave_channel(u);
|
||||
if (u->backend_ioc) {
|
||||
close_backend_channel(u);
|
||||
}
|
||||
g_free(u->region_rb);
|
||||
u->region_rb = NULL;
|
||||
|
@ -2235,7 +2235,7 @@ static int vhost_user_net_set_mtu(struct vhost_dev *dev, uint16_t mtu)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* If reply_ack supported, slave has to ack specified MTU is valid */
|
||||
/* If reply_ack supported, backend has to ack specified MTU is valid */
|
||||
if (reply_supported) {
|
||||
return process_message_reply(dev, &msg);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue