aboutsummaryrefslogtreecommitdiff
path: root/include/block/nbd.h
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2019-01-17 13:36:43 -0600
committerEric Blake <eblake@redhat.com>2019-01-21 15:49:51 -0600
commit9d26dfcbab62746b3e66ec7784d75c13ff499669 (patch)
tree58e26385549842611bcc298ccd0e7dec6abfe8fa /include/block/nbd.h
parent7596bbb390838359e4789996f349bda0cad56b0e (diff)
downloadqemu-9d26dfcbab62746b3e66ec7784d75c13ff499669.zip
qemu-9d26dfcbab62746b3e66ec7784d75c13ff499669.tar.gz
qemu-9d26dfcbab62746b3e66ec7784d75c13ff499669.tar.bz2
nbd/server: Favor [u]int64_t over off_t
Although our compile-time environment is set up so that we always support long files with 64-bit off_t, we have no guarantee whether off_t is the same type as int64_t. This requires casts when printing values, and prevents us from directly using qemu_strtoi64() (which will be done in the next patch). Let's just flip to uint64_t where possible, and stick to int64_t for detecting failure of blk_getlength(); we also keep the assertions added in the previous patch that the resulting values fit in 63 bits. The overflow check in nbd_co_receive_request() was already sane (request->from is validated to fit in 63 bits, and request->len is 32 bits, so the addition can't overflow 64 bits), but rewrite it in a form easier to recognize as a typical overflow check. Rename the variable 'description' to keep line lengths reasonable. Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20190117193658.16413-7-eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Diffstat (limited to 'include/block/nbd.h')
-rw-r--r--include/block/nbd.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/block/nbd.h b/include/block/nbd.h
index 1971b55..24be957 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -294,8 +294,8 @@ int nbd_errno_to_system_errno(int err);
typedef struct NBDExport NBDExport;
typedef struct NBDClient NBDClient;
-NBDExport *nbd_export_new(BlockDriverState *bs, off_t dev_offset, off_t size,
- const char *name, const char *description,
+NBDExport *nbd_export_new(BlockDriverState *bs, uint64_t dev_offset,
+ uint64_t size, const char *name, const char *desc,
const char *bitmap, uint16_t nbdflags,
void (*close)(NBDExport *), bool writethrough,
BlockBackend *on_eject_blk, Error **errp);