From edbed73064c2ee721272f2d06a042471613b0a83 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Wed, 14 Sep 2016 08:47:21 -0700 Subject: [PATCH] Rename and move fd related helper functions to fd.c. Signed-off-by: Jim Harris Change-Id: Ieccdd778348e8709ca4ef6cdf4f58f40021638db --- examples/nvme/arbitration/arbitration.c | 1 - examples/nvme/perf/perf.c | 6 +++--- include/spdk/{file.h => fd.h} | 8 ++++---- lib/bdev/aio/blockdev_aio.c | 6 +++--- lib/util/Makefile | 2 +- lib/util/{file.c => fd.c} | 6 +++--- test/lib/nvme/overhead/overhead.c | 6 +++--- test/lib/nvme/reset/reset.c | 1 - 8 files changed, 17 insertions(+), 19 deletions(-) rename include/spdk/{file.h => fd.h} (93%) rename lib/util/{file.c => fd.c} (97%) diff --git a/examples/nvme/arbitration/arbitration.c b/examples/nvme/arbitration/arbitration.c index f665968e6..9f7377d05 100644 --- a/examples/nvme/arbitration/arbitration.c +++ b/examples/nvme/arbitration/arbitration.c @@ -42,7 +42,6 @@ #include #include -#include "spdk/file.h" #include "spdk/nvme.h" #include "spdk/pci.h" #include "spdk/string.h" diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index fbdc73dab..cabbc1007 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -42,7 +42,7 @@ #include #include -#include "spdk/file.h" +#include "spdk/fd.h" #include "spdk/nvme.h" #include "spdk/pci.h" #include "spdk/string.h" @@ -310,14 +310,14 @@ register_aio_file(const char *path) return -1; } - size = spdk_file_get_size(fd); + size = spdk_fd_get_size(fd); if (size == 0) { fprintf(stderr, "Could not determine size of AIO device %s\n", path); close(fd); return -1; } - blklen = spdk_dev_get_blocklen(fd); + blklen = spdk_fd_get_blocklen(fd); if (blklen == 0) { fprintf(stderr, "Could not determine block size of AIO device %s\n", path); close(fd); diff --git a/include/spdk/file.h b/include/spdk/fd.h similarity index 93% rename from include/spdk/file.h rename to include/spdk/fd.h index 1edfae146..41bdf1b34 100644 --- a/include/spdk/file.h +++ b/include/spdk/fd.h @@ -35,8 +35,8 @@ * OS filesystem utility functions */ -#ifndef SPDK_FILE_H -#define SPDK_FILE_H +#ifndef SPDK_FD_H +#define SPDK_FD_H #ifdef __cplusplus extern "C" { @@ -44,8 +44,8 @@ extern "C" { #include -uint64_t spdk_file_get_size(int fd); -uint32_t spdk_dev_get_blocklen(int fd); +uint64_t spdk_fd_get_size(int fd); +uint32_t spdk_fd_get_blocklen(int fd); #ifdef __cplusplus } diff --git a/lib/bdev/aio/blockdev_aio.c b/lib/bdev/aio/blockdev_aio.c index 4f2251a7a..3e815ea00 100644 --- a/lib/bdev/aio/blockdev_aio.c +++ b/lib/bdev/aio/blockdev_aio.c @@ -43,7 +43,7 @@ #include "spdk/bdev.h" #include "spdk/conf.h" -#include "spdk/file.h" +#include "spdk/fd.h" #include "spdk/log.h" static int g_blockdev_count = 0; @@ -321,7 +321,7 @@ create_aio_disk(char *fname) goto error_return; } - fdisk->size = spdk_file_get_size(fdisk->fd); + fdisk->size = spdk_fd_get_size(fdisk->fd); fdisk->queue_depth = 128; // TODO: where do we get the queue depth from. TAILQ_INIT(&fdisk->sync_completion_list); @@ -331,7 +331,7 @@ create_aio_disk(char *fname) fdisk->disk.need_aligned_buffer = 1; fdisk->disk.write_cache = 1; - fdisk->disk.blocklen = spdk_dev_get_blocklen(fdisk->fd); + fdisk->disk.blocklen = spdk_fd_get_blocklen(fdisk->fd); fdisk->disk.blockcnt = fdisk->size / fdisk->disk.blocklen; fdisk->disk.ctxt = fdisk; diff --git a/lib/util/Makefile b/lib/util/Makefile index a3275fa8b..8474619ca 100644 --- a/lib/util/Makefile +++ b/lib/util/Makefile @@ -35,7 +35,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..) include $(SPDK_ROOT_DIR)/mk/spdk.common.mk CFLAGS += $(DPDK_INC) -C_SRCS = file.c string.c pci.c +C_SRCS = fd.c string.c pci.c LIBNAME = util include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk diff --git a/lib/util/file.c b/lib/util/fd.c similarity index 97% rename from lib/util/file.c rename to lib/util/fd.c index 1a754c192..fac11676b 100644 --- a/lib/util/file.c +++ b/lib/util/fd.c @@ -31,7 +31,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "spdk/file.h" +#include "spdk/fd.h" #include #include @@ -64,7 +64,7 @@ dev_get_size(int fd) } uint32_t -spdk_dev_get_blocklen(int fd) +spdk_fd_get_blocklen(int fd) { #if defined(DKIOCGETBLOCKSIZE) /* FreeBSD */ uint32_t blocklen; @@ -85,7 +85,7 @@ spdk_dev_get_blocklen(int fd) } uint64_t -spdk_file_get_size(int fd) +spdk_fd_get_size(int fd) { struct stat st; diff --git a/test/lib/nvme/overhead/overhead.c b/test/lib/nvme/overhead/overhead.c index 6938b882b..91ab23464 100644 --- a/test/lib/nvme/overhead/overhead.c +++ b/test/lib/nvme/overhead/overhead.c @@ -42,7 +42,7 @@ #include #include -#include "spdk/file.h" +#include "spdk/fd.h" #include "spdk/nvme.h" #include "spdk/pci.h" #include "spdk/string.h" @@ -205,14 +205,14 @@ register_aio_file(const char *path) return -1; } - size = spdk_file_get_size(fd); + size = spdk_fd_get_size(fd); if (size == 0) { fprintf(stderr, "Could not determine size of AIO device %s\n", path); close(fd); return -1; } - blklen = spdk_dev_get_blocklen(fd); + blklen = spdk_fd_get_blocklen(fd); if (blklen == 0) { fprintf(stderr, "Could not determine block size of AIO device %s\n", path); close(fd); diff --git a/test/lib/nvme/reset/reset.c b/test/lib/nvme/reset/reset.c index f288c45f2..b969d2e1c 100644 --- a/test/lib/nvme/reset/reset.c +++ b/test/lib/nvme/reset/reset.c @@ -42,7 +42,6 @@ #include #include -#include "spdk/file.h" #include "spdk/nvme.h" #include "spdk/pci.h" #include "spdk/string.h"