From 9df2ea9c27c39dbb4617f0ba76b275a497642356 Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Tue, 3 Oct 2017 09:00:33 +0200 Subject: [PATCH] vhost: rename new/destroy_dev() to start/stop_dev() Previous names were highly misleading. Change-Id: I30256da35da4b916f39982be134fa7128e81c914 Signed-off-by: Dariusz Stojaczyk Reviewed-on: https://review.gerrithub.io/381074 Tested-by: SPDK Automated Test System Reviewed-by: Pawel Wodkowski Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp --- lib/vhost/vhost.c | 16 ++++++++-------- lib/vhost/vhost_blk.c | 8 ++++---- lib/vhost/vhost_internal.h | 4 ++-- lib/vhost/vhost_scsi.c | 12 ++++++------ 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index a63b745bc..fb89a8e92 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -67,13 +67,13 @@ struct spdk_vhost_dev_event_ctx { }; static int new_connection(int vid); -static int new_device(int vid); -static void destroy_device(int vid); +static int start_device(int vid); +static void stop_device(int vid); static void destroy_connection(int vid); const struct vhost_device_ops g_spdk_vhost_ops = { - .new_device = new_device, - .destroy_device = destroy_device, + .new_device = start_device, + .destroy_device = stop_device, .new_connection = new_connection, .destroy_connection = destroy_connection, }; @@ -672,7 +672,7 @@ spdk_vhost_event_async_send(unsigned vdev_id, spdk_vhost_event_fn cb_fn, void *a } static void -destroy_device(int vid) +stop_device(int vid) { struct spdk_vhost_dev *vdev; struct rte_vhost_vring *q; @@ -693,7 +693,7 @@ destroy_device(int vid) return; } - rc = spdk_vhost_event_send(vdev, vdev->backend->destroy_device, 3, "destroy device"); + rc = spdk_vhost_event_send(vdev, vdev->backend->stop_device, 3, "stop device"); if (rc != 0) { SPDK_ERRLOG("Couldn't stop device with vid %d.\n", vid); pthread_mutex_unlock(&g_spdk_vhost_mutex); @@ -712,7 +712,7 @@ destroy_device(int vid) } static int -new_device(int vid) +start_device(int vid) { struct spdk_vhost_dev *vdev; int rc = -1; @@ -766,7 +766,7 @@ new_device(int vid) } vdev->lcore = spdk_vhost_allocate_reactor(vdev->cpumask); - rc = spdk_vhost_event_send(vdev, vdev->backend->new_device, 3, "new device"); + rc = spdk_vhost_event_send(vdev, vdev->backend->start_device, 3, "start device"); if (rc != 0) { free(vdev->mem); spdk_vhost_free_reactor(vdev->lcore); diff --git a/lib/vhost/vhost_blk.c b/lib/vhost/vhost_blk.c index 917926b3d..a9dd2c1b4 100644 --- a/lib/vhost/vhost_blk.c +++ b/lib/vhost/vhost_blk.c @@ -484,7 +484,7 @@ alloc_task_pool(struct spdk_vhost_blk_dev *bvdev) * */ static int -new_device(struct spdk_vhost_dev *vdev, void *event_ctx) +spdk_vhost_blk_start(struct spdk_vhost_dev *vdev, void *event_ctx) { struct spdk_vhost_blk_dev *bvdev; int rc = 0; @@ -556,7 +556,7 @@ destroy_device_poller_cb(void *arg) } static int -destroy_device(struct spdk_vhost_dev *vdev, void *event_ctx) +spdk_vhost_blk_stop(struct spdk_vhost_dev *vdev, void *event_ctx) { struct spdk_vhost_blk_dev *bvdev; struct spdk_vhost_dev_destroy_ctx *destroy_ctx; @@ -620,8 +620,8 @@ static const struct spdk_vhost_dev_backend vhost_blk_device_backend = { .disabled_features = SPDK_VHOST_DISABLED_FEATURES | (1ULL << VIRTIO_BLK_F_GEOMETRY) | (1ULL << VIRTIO_BLK_F_RO) | (1ULL << VIRTIO_BLK_F_FLUSH) | (1ULL << VIRTIO_BLK_F_CONFIG_WCE) | (1ULL << VIRTIO_BLK_F_BARRIER) | (1ULL << VIRTIO_BLK_F_SCSI), - .new_device = new_device, - .destroy_device = destroy_device, + .start_device = spdk_vhost_blk_start, + .stop_device = spdk_vhost_blk_stop, .dump_config_json = spdk_vhost_blk_dump_config_json, .vhost_remove_controller = spdk_vhost_blk_destroy, }; diff --git a/lib/vhost/vhost_internal.h b/lib/vhost/vhost_internal.h index 7ebef07aa..111b98c77 100644 --- a/lib/vhost/vhost_internal.h +++ b/lib/vhost/vhost_internal.h @@ -95,8 +95,8 @@ struct spdk_vhost_dev_backend { * within an arbitrary limit of 3 seconds, these * callbacks will time out. */ - spdk_vhost_event_fn new_device; - spdk_vhost_event_fn destroy_device; + spdk_vhost_event_fn start_device; + spdk_vhost_event_fn stop_device; void (*dump_config_json)(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w); int (*vhost_remove_controller)(struct spdk_vhost_dev *vdev); diff --git a/lib/vhost/vhost_scsi.c b/lib/vhost/vhost_scsi.c index e2be921c2..8d9215f21 100644 --- a/lib/vhost/vhost_scsi.c +++ b/lib/vhost/vhost_scsi.c @@ -99,15 +99,15 @@ struct spdk_vhost_scsi_task { struct rte_vhost_vring *vq; }; -static int new_device(struct spdk_vhost_dev *, void *); -static int destroy_device(struct spdk_vhost_dev *, void *); +static int spdk_vhost_scsi_start(struct spdk_vhost_dev *, void *); +static int spdk_vhost_scsi_stop(struct spdk_vhost_dev *, void *); static void spdk_vhost_scsi_config_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w); const struct spdk_vhost_dev_backend spdk_vhost_scsi_device_backend = { .virtio_features = SPDK_VHOST_SCSI_FEATURES, .disabled_features = SPDK_VHOST_SCSI_DISABLED_FEATURES, - .new_device = new_device, - .destroy_device = destroy_device, + .start_device = spdk_vhost_scsi_start, + .stop_device = spdk_vhost_scsi_stop, .dump_config_json = spdk_vhost_scsi_config_json, .vhost_remove_controller = spdk_vhost_scsi_dev_remove, }; @@ -967,7 +967,7 @@ alloc_task_pool(struct spdk_vhost_scsi_dev *svdev) * and then allocated to a specific data core. */ static int -new_device(struct spdk_vhost_dev *vdev, void *event_ctx) +spdk_vhost_scsi_start(struct spdk_vhost_dev *vdev, void *event_ctx) { struct spdk_vhost_scsi_dev *svdev; uint32_t i; @@ -1038,7 +1038,7 @@ destroy_device_poller_cb(void *arg) } static int -destroy_device(struct spdk_vhost_dev *vdev, void *event_ctx) +spdk_vhost_scsi_stop(struct spdk_vhost_dev *vdev, void *event_ctx) { struct spdk_vhost_scsi_dev *svdev; struct spdk_vhost_dev_destroy_ctx *destroy_ctx;