Commit d5dffc05 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

bdev: replace off_t offsets with uint64_t



off_t is problematic for use as a file/block offset: it is signed, and
on 32-bit platforms, it can be 32 bits (depending on the settings of
_FILE_OFFSET_BITS and _LARGEFILE_SOURCE).

The blockdev layer already uses uint64_t to represent offsets; replace
the blockdev module uses of off_t in internal functions with uint64_t
to match.

Change-Id: I77a2e594572c56f1cd8a7a080f985ea5b27c35f3
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent aa5c7d54
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ blockdev_aio_close(struct file_disk *disk)

static int64_t
blockdev_aio_read(struct file_disk *fdisk, struct spdk_io_channel *ch,
		  struct blockdev_aio_task *aio_task, void *buf, uint64_t nbytes, off_t offset)
		  struct blockdev_aio_task *aio_task, void *buf, uint64_t nbytes, uint64_t offset)
{
	struct iocb *iocb = &aio_task->iocb;
	struct blockdev_aio_io_channel *aio_ch = spdk_io_channel_get_ctx(ch);
@@ -129,7 +129,7 @@ blockdev_aio_read(struct file_disk *fdisk, struct spdk_io_channel *ch,
static int64_t
blockdev_aio_writev(struct file_disk *fdisk, struct spdk_io_channel *ch,
		    struct blockdev_aio_task *aio_task,
		    struct iovec *iov, int iovcnt, size_t len, off_t offset)
		    struct iovec *iov, int iovcnt, size_t len, uint64_t offset)
{
	struct iocb *iocb = &aio_task->iocb;
	struct blockdev_aio_io_channel *aio_ch = spdk_io_channel_get_ctx(ch);
+2 −2
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ blockdev_malloc_destruct(struct spdk_bdev *bdev)
static int64_t
blockdev_malloc_read(struct malloc_disk *mdisk, struct spdk_io_channel *ch,
		     struct copy_task *copy_req,
		     void *buf, uint64_t nbytes, off_t offset)
		     void *buf, uint64_t nbytes, uint64_t offset)
{
	SPDK_TRACELOG(SPDK_TRACE_MALLOC, "read %lu bytes from offset %#lx to %p\n",
		      nbytes, offset, buf);
@@ -135,7 +135,7 @@ blockdev_malloc_read(struct malloc_disk *mdisk, struct spdk_io_channel *ch,
static int64_t
blockdev_malloc_writev(struct malloc_disk *mdisk, struct spdk_io_channel *ch,
		       struct copy_task *copy_req,
		       struct iovec *iov, int iovcnt, size_t len, off_t offset)
		       struct iovec *iov, int iovcnt, size_t len, uint64_t offset)
{
	if ((iovcnt != 1) || (iov->iov_len != len))
		return -1;
+2 −2
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ SPDK_BDEV_MODULE_REGISTER(nvme_library_init, NULL, blockdev_nvme_get_spdk_runnin
static int64_t
blockdev_nvme_read(struct nvme_blockdev *nbdev, struct spdk_io_channel *ch,
		   struct nvme_blockio *bio,
		   void *buf, uint64_t nbytes, off_t offset)
		   void *buf, uint64_t nbytes, uint64_t offset)
{
	struct nvme_io_channel *nvme_ch = spdk_io_channel_get_ctx(ch);
	int64_t rc;
@@ -157,7 +157,7 @@ blockdev_nvme_read(struct nvme_blockdev *nbdev, struct spdk_io_channel *ch,
static int64_t
blockdev_nvme_writev(struct nvme_blockdev *nbdev, struct spdk_io_channel *ch,
		     struct nvme_blockio *bio,
		     struct iovec *iov, int iovcnt, size_t len, off_t offset)
		     struct iovec *iov, int iovcnt, size_t len, uint64_t offset)
{
	struct nvme_io_channel *nvme_ch = spdk_io_channel_get_ctx(ch);
	int64_t rc;