From ec63516af5efdd0c1d3f57de7d4792fc386bfc07 Mon Sep 17 00:00:00 2001 From: Wojciech Malikowski Date: Mon, 23 Sep 2019 05:34:58 -0400 Subject: [PATCH] lib/bdev: Move some bdev.c static functions to internal header Some internal bdev.c static function will be shared with new zoned bdev module. Change-Id: Ifbb8bf443f67b2daf97858b15d474ecce98a9efb Signed-off-by: Wojciech Malikowski Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469100 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Maciej Szwed --- lib/bdev/bdev.c | 8 ++++--- lib/bdev/bdev_internal.h | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 lib/bdev/bdev_internal.h diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index a76c94cf2..06f079eef 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -52,6 +52,8 @@ #include "spdk_internal/log.h" #include "spdk/string.h" +#include "bdev_internal.h" + #ifdef SPDK_CONFIG_VTUNE #include "ittnotify.h" #include "ittnotify_types.h" @@ -1278,7 +1280,7 @@ spdk_bdev_finish(spdk_bdev_fini_cb cb_fn, void *cb_arg) _spdk_bdev_finish_unregister_bdevs_iter(NULL, 0); } -static struct spdk_bdev_io * +struct spdk_bdev_io * spdk_bdev_get_io(struct spdk_bdev_channel *channel) { struct spdk_bdev_mgmt_channel *ch = channel->shared_resource->mgmt_ch; @@ -1855,7 +1857,7 @@ _spdk_bdev_io_submit(void *ctx) bdev_io->internal.in_submit_request = false; } -static void +void spdk_bdev_io_submit(struct spdk_bdev_io *bdev_io) { struct spdk_bdev *bdev = bdev_io->bdev; @@ -1896,7 +1898,7 @@ spdk_bdev_io_submit_reset(struct spdk_bdev_io *bdev_io) bdev_io->internal.in_submit_request = false; } -static void +void spdk_bdev_io_init(struct spdk_bdev_io *bdev_io, struct spdk_bdev *bdev, void *cb_arg, spdk_bdev_io_completion_cb cb) diff --git a/lib/bdev/bdev_internal.h b/lib/bdev/bdev_internal.h new file mode 100644 index 000000000..d35cb0888 --- /dev/null +++ b/lib/bdev/bdev_internal.h @@ -0,0 +1,50 @@ +/*- + * BSD LICENSE + * + * Copyright (c) Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SPDK_BDEV_INTERNAL_H +#define SPDK_BDEV_INTERNAL_H + +#include "spdk/bdev.h" + +struct spdk_bdev; +struct spdk_bdev_io; +struct spdk_bdev_channel; + +struct spdk_bdev_io *spdk_bdev_get_io(struct spdk_bdev_channel *channel); + +void spdk_bdev_io_init(struct spdk_bdev_io *bdev_io, struct spdk_bdev *bdev, void *cb_arg, + spdk_bdev_io_completion_cb cb); + +void spdk_bdev_io_submit(struct spdk_bdev_io *bdev_io); + +#endif /* SPDK_BDEV_INTERNAL_H */