Rename and move fd related helper functions to fd.c.
Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Ieccdd778348e8709ca4ef6cdf4f58f40021638db
This commit is contained in:
parent
1a9974ed1d
commit
edbed73064
@ -42,7 +42,6 @@
|
|||||||
#include <rte_malloc.h>
|
#include <rte_malloc.h>
|
||||||
#include <rte_lcore.h>
|
#include <rte_lcore.h>
|
||||||
|
|
||||||
#include "spdk/file.h"
|
|
||||||
#include "spdk/nvme.h"
|
#include "spdk/nvme.h"
|
||||||
#include "spdk/pci.h"
|
#include "spdk/pci.h"
|
||||||
#include "spdk/string.h"
|
#include "spdk/string.h"
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include <rte_malloc.h>
|
#include <rte_malloc.h>
|
||||||
#include <rte_lcore.h>
|
#include <rte_lcore.h>
|
||||||
|
|
||||||
#include "spdk/file.h"
|
#include "spdk/fd.h"
|
||||||
#include "spdk/nvme.h"
|
#include "spdk/nvme.h"
|
||||||
#include "spdk/pci.h"
|
#include "spdk/pci.h"
|
||||||
#include "spdk/string.h"
|
#include "spdk/string.h"
|
||||||
@ -310,14 +310,14 @@ register_aio_file(const char *path)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
size = spdk_file_get_size(fd);
|
size = spdk_fd_get_size(fd);
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
fprintf(stderr, "Could not determine size of AIO device %s\n", path);
|
fprintf(stderr, "Could not determine size of AIO device %s\n", path);
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
blklen = spdk_dev_get_blocklen(fd);
|
blklen = spdk_fd_get_blocklen(fd);
|
||||||
if (blklen == 0) {
|
if (blklen == 0) {
|
||||||
fprintf(stderr, "Could not determine block size of AIO device %s\n", path);
|
fprintf(stderr, "Could not determine block size of AIO device %s\n", path);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
* OS filesystem utility functions
|
* OS filesystem utility functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SPDK_FILE_H
|
#ifndef SPDK_FD_H
|
||||||
#define SPDK_FILE_H
|
#define SPDK_FD_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -44,8 +44,8 @@ extern "C" {
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
uint64_t spdk_file_get_size(int fd);
|
uint64_t spdk_fd_get_size(int fd);
|
||||||
uint32_t spdk_dev_get_blocklen(int fd);
|
uint32_t spdk_fd_get_blocklen(int fd);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#include "spdk/bdev.h"
|
#include "spdk/bdev.h"
|
||||||
#include "spdk/conf.h"
|
#include "spdk/conf.h"
|
||||||
#include "spdk/file.h"
|
#include "spdk/fd.h"
|
||||||
#include "spdk/log.h"
|
#include "spdk/log.h"
|
||||||
|
|
||||||
static int g_blockdev_count = 0;
|
static int g_blockdev_count = 0;
|
||||||
@ -321,7 +321,7 @@ create_aio_disk(char *fname)
|
|||||||
goto error_return;
|
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.
|
fdisk->queue_depth = 128; // TODO: where do we get the queue depth from.
|
||||||
|
|
||||||
TAILQ_INIT(&fdisk->sync_completion_list);
|
TAILQ_INIT(&fdisk->sync_completion_list);
|
||||||
@ -331,7 +331,7 @@ create_aio_disk(char *fname)
|
|||||||
|
|
||||||
fdisk->disk.need_aligned_buffer = 1;
|
fdisk->disk.need_aligned_buffer = 1;
|
||||||
fdisk->disk.write_cache = 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.blockcnt = fdisk->size / fdisk->disk.blocklen;
|
||||||
fdisk->disk.ctxt = fdisk;
|
fdisk->disk.ctxt = fdisk;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
|
|||||||
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
||||||
|
|
||||||
CFLAGS += $(DPDK_INC)
|
CFLAGS += $(DPDK_INC)
|
||||||
C_SRCS = file.c string.c pci.c
|
C_SRCS = fd.c string.c pci.c
|
||||||
LIBNAME = util
|
LIBNAME = util
|
||||||
|
|
||||||
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk
|
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "spdk/file.h"
|
#include "spdk/fd.h"
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -64,7 +64,7 @@ dev_get_size(int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
spdk_dev_get_blocklen(int fd)
|
spdk_fd_get_blocklen(int fd)
|
||||||
{
|
{
|
||||||
#if defined(DKIOCGETBLOCKSIZE) /* FreeBSD */
|
#if defined(DKIOCGETBLOCKSIZE) /* FreeBSD */
|
||||||
uint32_t blocklen;
|
uint32_t blocklen;
|
||||||
@ -85,7 +85,7 @@ spdk_dev_get_blocklen(int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
spdk_file_get_size(int fd)
|
spdk_fd_get_size(int fd)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
@ -42,7 +42,7 @@
|
|||||||
#include <rte_malloc.h>
|
#include <rte_malloc.h>
|
||||||
#include <rte_lcore.h>
|
#include <rte_lcore.h>
|
||||||
|
|
||||||
#include "spdk/file.h"
|
#include "spdk/fd.h"
|
||||||
#include "spdk/nvme.h"
|
#include "spdk/nvme.h"
|
||||||
#include "spdk/pci.h"
|
#include "spdk/pci.h"
|
||||||
#include "spdk/string.h"
|
#include "spdk/string.h"
|
||||||
@ -205,14 +205,14 @@ register_aio_file(const char *path)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
size = spdk_file_get_size(fd);
|
size = spdk_fd_get_size(fd);
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
fprintf(stderr, "Could not determine size of AIO device %s\n", path);
|
fprintf(stderr, "Could not determine size of AIO device %s\n", path);
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
blklen = spdk_dev_get_blocklen(fd);
|
blklen = spdk_fd_get_blocklen(fd);
|
||||||
if (blklen == 0) {
|
if (blklen == 0) {
|
||||||
fprintf(stderr, "Could not determine block size of AIO device %s\n", path);
|
fprintf(stderr, "Could not determine block size of AIO device %s\n", path);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
#include <rte_malloc.h>
|
#include <rte_malloc.h>
|
||||||
#include <rte_lcore.h>
|
#include <rte_lcore.h>
|
||||||
|
|
||||||
#include "spdk/file.h"
|
|
||||||
#include "spdk/nvme.h"
|
#include "spdk/nvme.h"
|
||||||
#include "spdk/pci.h"
|
#include "spdk/pci.h"
|
||||||
#include "spdk/string.h"
|
#include "spdk/string.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user