提交 6769da29 编写于 作者: K Kevin Wolf 提交者: Anthony Liguori

posix-aio-compat: Fix error check

Checking for nbytes < 0 is pointless as long as it's a size_t. If we want to
use negative numbers for error codes, we should use signed types.
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 7078dead
......@@ -117,7 +117,7 @@ static void thread_create(pthread_t *thread, pthread_attr_t *attr,
if (ret) die2(ret, "pthread_create");
}
static size_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb)
static ssize_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb)
{
int ret;
......@@ -136,7 +136,7 @@ static size_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb)
return aiocb->aio_nbytes;
}
static size_t handle_aiocb_flush(struct qemu_paiocb *aiocb)
static ssize_t handle_aiocb_flush(struct qemu_paiocb *aiocb)
{
int ret;
......@@ -176,7 +176,7 @@ qemu_pwritev(int fd, const struct iovec *iov, int nr_iov, off_t offset)
#endif
static size_t handle_aiocb_rw_vector(struct qemu_paiocb *aiocb)
static ssize_t handle_aiocb_rw_vector(struct qemu_paiocb *aiocb)
{
size_t offset = 0;
ssize_t len;
......@@ -199,10 +199,10 @@ static size_t handle_aiocb_rw_vector(struct qemu_paiocb *aiocb)
return len;
}
static size_t handle_aiocb_rw_linear(struct qemu_paiocb *aiocb, char *buf)
static ssize_t handle_aiocb_rw_linear(struct qemu_paiocb *aiocb, char *buf)
{
size_t offset = 0;
size_t len;
ssize_t offset = 0;
ssize_t len;
while (offset < aiocb->aio_nbytes) {
if (aiocb->aio_type & QEMU_AIO_WRITE)
......@@ -230,9 +230,9 @@ static size_t handle_aiocb_rw_linear(struct qemu_paiocb *aiocb, char *buf)
return offset;
}
static size_t handle_aiocb_rw(struct qemu_paiocb *aiocb)
static ssize_t handle_aiocb_rw(struct qemu_paiocb *aiocb)
{
size_t nbytes;
ssize_t nbytes;
char *buf;
if (!(aiocb->aio_type & QEMU_AIO_MISALIGNED)) {
......@@ -308,7 +308,7 @@ static void *aio_thread(void *unused)
while (1) {
struct qemu_paiocb *aiocb;
size_t ret = 0;
ssize_t ret = 0;
qemu_timeval tv;
struct timespec ts;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册