bdev: make spdk_bdev_io_valid() return bool
Swap the meaning of the return value to match the name of the function. Change-Id: I89dc09e3b309a06586adf2ab750092f06077ffd9 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/372859 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
b4511e39fd
commit
8f823b93cf
@ -739,26 +739,26 @@ spdk_bdev_has_write_cache(const struct spdk_bdev *bdev)
|
||||
return bdev->write_cache;
|
||||
}
|
||||
|
||||
static int
|
||||
static bool
|
||||
spdk_bdev_io_valid(struct spdk_bdev *bdev, uint64_t offset, uint64_t nbytes)
|
||||
{
|
||||
/* Return failure if nbytes is not a multiple of bdev->blocklen */
|
||||
if (nbytes % bdev->blocklen) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return failure if offset + nbytes is less than offset; indicates there
|
||||
* has been an overflow and hence the offset has been wrapped around */
|
||||
if (offset + nbytes < offset) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return failure if offset + nbytes exceeds the size of the bdev */
|
||||
if (offset + nbytes > bdev->blockcnt * bdev->blocklen) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
@ -771,7 +771,7 @@ spdk_bdev_read(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
||||
struct spdk_bdev_channel *channel = spdk_io_channel_get_ctx(ch);
|
||||
int rc;
|
||||
|
||||
if (spdk_bdev_io_valid(bdev, offset, nbytes) != 0) {
|
||||
if (!spdk_bdev_io_valid(bdev, offset, nbytes)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -811,7 +811,7 @@ spdk_bdev_readv(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
||||
struct spdk_bdev_channel *channel = spdk_io_channel_get_ctx(ch);
|
||||
int rc;
|
||||
|
||||
if (spdk_bdev_io_valid(bdev, offset, nbytes) != 0) {
|
||||
if (!spdk_bdev_io_valid(bdev, offset, nbytes)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -852,7 +852,7 @@ spdk_bdev_write(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
||||
return -EBADF;
|
||||
}
|
||||
|
||||
if (spdk_bdev_io_valid(bdev, offset, nbytes) != 0) {
|
||||
if (!spdk_bdev_io_valid(bdev, offset, nbytes)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -896,7 +896,7 @@ spdk_bdev_writev(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
||||
return -EBADF;
|
||||
}
|
||||
|
||||
if (spdk_bdev_io_valid(bdev, offset, len) != 0) {
|
||||
if (!spdk_bdev_io_valid(bdev, offset, len)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -937,7 +937,7 @@ spdk_bdev_unmap(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
||||
return -EBADF;
|
||||
}
|
||||
|
||||
if (spdk_bdev_io_valid(bdev, offset, nbytes) != 0) {
|
||||
if (!spdk_bdev_io_valid(bdev, offset, nbytes)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user