[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [UNIKRAFT PATCH v2 5/7] lib/ukblkdev: API refactoring: `uk_blkdev_queue_configure()`



Hi Simon,

Looks good to me.

Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@xxxxxxxxx>

On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer <simon.kuenzer@xxxxxxxxx> wrote:
For API consistency reasons, this patch renames `uk_blkdev_queue_setup()` to
`uk_blkdev_queue_configure()`. This is done to be inline with
lib/uknetdev. Additionally and as counterpart for queue configuration, we
rename `uk_blkdev_release()` to `uk_blkdev_unconfigure()`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 lib/ukblkdev/blkdev.c                 | 16 ++++++++--------
 lib/ukblkdev/exportsyms.uk            |  2 +-
 lib/ukblkdev/include/uk/blkdev.h      | 10 +++++-----
 lib/ukblkdev/include/uk/blkdev_core.h |  6 +++---
 plat/drivers/virtio/virtio_blk.c      |  4 ++--
 plat/xen/drivers/blk/blkfront.c       |  4 ++--
 6 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/lib/ukblkdev/blkdev.c b/lib/ukblkdev/blkdev.c
index fc5038ba2..9cafa0c42 100644
--- a/lib/ukblkdev/blkdev.c
+++ b/lib/ukblkdev/blkdev.c
@@ -82,7 +82,7 @@ int uk_blkdev_drv_register(struct uk_blkdev *dev, struct uk_alloc *a,
        UK_ASSERT(dev->dev_ops);
        UK_ASSERT(dev->dev_ops->dev_configure);
        UK_ASSERT(dev->dev_ops->dev_start);
-       UK_ASSERT(dev->dev_ops->queue_setup);
+       UK_ASSERT(dev->dev_ops->queue_configure);
        UK_ASSERT(dev->dev_ops->get_info);
        UK_ASSERT(dev->dev_ops->queue_get_info);
        UK_ASSERT(dev->submit_one);
@@ -313,7 +313,7 @@ int uk_blkdev_queue_configure(struct uk_blkdev *dev, uint16_t queue_id,
        UK_ASSERT(dev);
        UK_ASSERT(dev->_data);
        UK_ASSERT(dev->dev_ops);
-       UK_ASSERT(dev->dev_ops->queue_setup);
+       UK_ASSERT(dev->dev_ops->queue_configure);
        UK_ASSERT(dev->finish_reqs);
        UK_ASSERT(queue_id < CONFIG_LIBUKBLKDEV_MAXNBQUEUES);
        UK_ASSERT(queue_conf);
@@ -339,7 +339,7 @@ int uk_blkdev_queue_configure(struct uk_blkdev *dev, uint16_t queue_id,
        if (err)
                goto err_out;

-       dev->_queue[queue_id] = dev->dev_ops->queue_setup(dev, queue_id,
+       dev->_queue[queue_id] = dev->dev_ops->queue_configure(dev, queue_id,
                        nb_desc,
                        queue_conf);
        if (PTRISERR(dev->_queue[queue_id])) {
@@ -493,21 +493,21 @@ int uk_blkdev_stop(struct uk_blkdev *dev)
        return rc;
 }

-int uk_blkdev_queue_release(struct uk_blkdev *dev, uint16_t queue_id)
+int uk_blkdev_queue_unconfigure(struct uk_blkdev *dev, uint16_t queue_id)
 {
        int rc = 0;

        UK_ASSERT(dev != NULL);
        UK_ASSERT(dev->_data);
        UK_ASSERT(dev->dev_ops);
-       UK_ASSERT(dev->dev_ops->queue_release);
+       UK_ASSERT(dev->dev_ops->queue_unconfigure);
        UK_ASSERT(queue_id < CONFIG_LIBUKBLKDEV_MAXNBQUEUES);
        UK_ASSERT(dev->_data->state == UK_BLKDEV_CONFIGURED);
        UK_ASSERT(!PTRISERR(dev->_queue[queue_id]));

-       rc = dev->dev_ops->queue_release(dev, dev->_queue[queue_id]);
+       rc = dev->dev_ops->queue_unconfigure(dev, dev->_queue[queue_id]);
        if (rc)
-               uk_pr_err("Failed to release blkdev%"PRIu16"-q%"PRIu16": %d\n",
+               uk_pr_err("Failed to unconfigure blkdev%"PRIu16"-q%"PRIu16": %d\n",
                                dev->_data->id, queue_id, rc);
        else {
 #if CONFIG_LIBUKBLKDEV_DISPATCHERTHREADS
@@ -515,7 +515,7 @@ int uk_blkdev_queue_release(struct uk_blkdev *dev, uint16_t queue_id)
                        _destroy_event_handler(
                                        &dev->_data->queue_handler[queue_id]);
 #endif
-               uk_pr_info("Released blkdev%"PRIu16"-q%"PRIu16"\n",
+               uk_pr_info("Unconfigured blkdev%"PRIu16"-q%"PRIu16"\n",
                                dev->_data->id, queue_id);
                dev->_queue[queue_id] = NULL;
        }
diff --git a/lib/ukblkdev/exportsyms.uk b/lib/ukblkdev/exportsyms.uk
index f3be6c51d..dd93e3940 100644
--- a/lib/ukblkdev/exportsyms.uk
+++ b/lib/ukblkdev/exportsyms.uk
@@ -13,6 +13,6 @@ uk_blkdev_queue_submit_one
 uk_blkdev_queue_finish_reqs
 uk_blkdev_sync_io
 uk_blkdev_stop
-uk_blkdev_queue_release
+uk_blkdev_queue_unconfigure
 uk_blkdev_drv_unregister
 uk_blkdev_unconfigure
diff --git a/lib/ukblkdev/include/uk/blkdev.h b/lib/ukblkdev/include/uk/blkdev.h
index abc228d9c..56b95c88c 100644
--- a/lib/ukblkdev/include/uk/blkdev.h
+++ b/lib/ukblkdev/include/uk/blkdev.h
@@ -51,7 +51,7 @@
  * The functions exported by the Unikraft BLK API to setup a device
  * designated by its ID must be invoked in the following order:
  *      - uk_blkdev_configure()
- *      - uk_blkdev_queue_setup()
+ *      - uk_blkdev_queue_configure()
  *      - uk_blkdev_start()
  *
  * There are 4 states in which a block device can be found:
@@ -197,7 +197,7 @@ int uk_blkdev_queue_get_info(struct uk_blkdev *dev, uint16_t queue_id,
  *     to retrieve limitations.
  * @param queue_conf
  *     The pointer to the configuration data to be used for the queue.
- *     This can be shared across multiple queue setups.
+ *     This can be shared across multiple queue configurations.
  * @return
  *     - 0: Success, receive queue correctly set up.
  *     - <0: Unable to allocate and set up the ring descriptors.
@@ -496,12 +496,12 @@ int uk_blkdev_stop(struct uk_blkdev *dev);
  * @param queue_id
  *     The index of the queue to release.
  *     The value must be in range [0, nb_queue -1] previously supplied
- *     to uk_blkdev_configure()
- *     @return
+ *     to uk_blkdev_queue_configure()
+ * @return
  *     - 0: Success
  *     - (<0): on error returned by driver
  */
-int uk_blkdev_queue_release(struct uk_blkdev *dev, uint16_t queue_id);
+int uk_blkdev_queue_unconfigure(struct uk_blkdev *dev, uint16_t queue_id);

 /**
  * Close a stopped Unikraft block device.
diff --git a/lib/ukblkdev/include/uk/blkdev_core.h b/lib/ukblkdev/include/uk/blkdev_core.h
index 56632c7f5..11a642c40 100644
--- a/lib/ukblkdev/include/uk/blkdev_core.h
+++ b/lib/ukblkdev/include/uk/blkdev_core.h
@@ -207,7 +207,7 @@ typedef int (*uk_blkdev_queue_finish_reqs_t)(struct uk_blkdev *dev,
 typedef int (*uk_blkdev_stop_t)(struct uk_blkdev *dev);

 /** Driver callback type to release a queue of an Unikraft block device. */
-typedef int (*uk_blkdev_queue_release_t)(struct uk_blkdev *dev,
+typedef int (*uk_blkdev_queue_unconfigure_t)(struct uk_blkdev *dev,
                struct uk_blkdev_queue *queue);

 /** Driver callback type to unconfigure an Unikraft block device. */
@@ -217,12 +217,12 @@ struct uk_blkdev_ops {
        uk_blkdev_get_info_t                            get_info;
        uk_blkdev_configure_t                           dev_configure;
        uk_blkdev_queue_get_info_t                      queue_get_info;
-       uk_blkdev_queue_configure_t                     queue_setup;
+       uk_blkdev_queue_configure_t                     queue_configure;
        uk_blkdev_start_t                               dev_start;
        uk_blkdev_stop_t                                dev_stop;
        uk_blkdev_queue_intr_enable_t                   queue_intr_enable;
        uk_blkdev_queue_intr_disable_t                  queue_intr_disable;
-       uk_blkdev_queue_release_t                       queue_release;
+       uk_blkdev_queue_unconfigure_t                   queue_unconfigure;
        uk_blkdev_unconfigure_t                         dev_unconfigure;
 };

diff --git a/plat/drivers/virtio/virtio_blk.c b/plat/drivers/virtio/virtio_blk.c
index 262355b49..dac8eb389 100644
--- a/plat/drivers/virtio/virtio_blk.c
+++ b/plat/drivers/virtio/virtio_blk.c
@@ -861,12 +861,12 @@ static const struct uk_blkdev_ops virtio_blkdev_ops = {
                .get_info = virtio_blkdev_get_info,
                .dev_configure = virtio_blkdev_configure,
                .queue_get_info = virtio_blkdev_queue_info_get,
-               .queue_setup = virtio_blkdev_queue_setup,
+               .queue_configure = virtio_blkdev_queue_setup,
                .queue_intr_enable = virtio_blkdev_queue_intr_enable,
                .dev_start = virtio_blkdev_start,
                .dev_stop = virtio_blkdev_stop,
                .queue_intr_disable = virtio_blkdev_queue_intr_disable,
-               .queue_release = virtio_blkdev_queue_release,
+               .queue_unconfigure = virtio_blkdev_queue_release,
                .dev_unconfigure = virtio_blkdev_unconfigure,
 };

diff --git a/plat/xen/drivers/blk/blkfront.c b/plat/xen/drivers/blk/blkfront.c
index 60b634665..a41373409 100644
--- a/plat/xen/drivers/blk/blkfront.c
+++ b/plat/xen/drivers/blk/blkfront.c
@@ -891,8 +891,8 @@ static const struct uk_blkdev_ops blkfront_ops = {
        .get_info = blkfront_get_info,
        .dev_configure = blkfront_configure,
        .queue_get_info = blkfront_queue_get_info,
-       .queue_setup = blkfront_queue_setup,
-       .queue_release = blkfront_queue_release,
+       .queue_configure = blkfront_queue_setup,
+       .queue_unconfigure = blkfront_queue_release,
        .dev_start = blkfront_start,
        .dev_stop = blkfront_stop,
        .dev_unconfigure = blkfront_unconfigure,
--
2.20.1

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.