|
@@ -1229,9 +1229,7 @@ static int hdev_get_max_segments(int fd, struct stat *st)
|
|
|
ret = -errno;
|
|
|
goto out;
|
|
|
}
|
|
|
- do {
|
|
|
- ret = read(sysfd, buf, sizeof(buf) - 1);
|
|
|
- } while (ret == -1 && errno == EINTR);
|
|
|
+ ret = RETRY_ON_EINTR(read(sysfd, buf, sizeof(buf) - 1));
|
|
|
if (ret < 0) {
|
|
|
ret = -errno;
|
|
|
goto out;
|
|
@@ -1379,9 +1377,9 @@ static int handle_aiocb_ioctl(void *opaque)
|
|
|
RawPosixAIOData *aiocb = opaque;
|
|
|
int ret;
|
|
|
|
|
|
- do {
|
|
|
- ret = ioctl(aiocb->aio_fildes, aiocb->ioctl.cmd, aiocb->ioctl.buf);
|
|
|
- } while (ret == -1 && errno == EINTR);
|
|
|
+ ret = RETRY_ON_EINTR(
|
|
|
+ ioctl(aiocb->aio_fildes, aiocb->ioctl.cmd, aiocb->ioctl.buf)
|
|
|
+ );
|
|
|
if (ret == -1) {
|
|
|
return -errno;
|
|
|
}
|
|
@@ -1463,18 +1461,17 @@ static ssize_t handle_aiocb_rw_vector(RawPosixAIOData *aiocb)
|
|
|
{
|
|
|
ssize_t len;
|
|
|
|
|
|
- do {
|
|
|
- if (aiocb->aio_type & QEMU_AIO_WRITE)
|
|
|
- len = qemu_pwritev(aiocb->aio_fildes,
|
|
|
- aiocb->io.iov,
|
|
|
- aiocb->io.niov,
|
|
|
- aiocb->aio_offset);
|
|
|
- else
|
|
|
- len = qemu_preadv(aiocb->aio_fildes,
|
|
|
- aiocb->io.iov,
|
|
|
- aiocb->io.niov,
|
|
|
- aiocb->aio_offset);
|
|
|
- } while (len == -1 && errno == EINTR);
|
|
|
+ len = RETRY_ON_EINTR(
|
|
|
+ (aiocb->aio_type & QEMU_AIO_WRITE) ?
|
|
|
+ qemu_pwritev(aiocb->aio_fildes,
|
|
|
+ aiocb->io.iov,
|
|
|
+ aiocb->io.niov,
|
|
|
+ aiocb->aio_offset) :
|
|
|
+ qemu_preadv(aiocb->aio_fildes,
|
|
|
+ aiocb->io.iov,
|
|
|
+ aiocb->io.niov,
|
|
|
+ aiocb->aio_offset)
|
|
|
+ );
|
|
|
|
|
|
if (len == -1) {
|
|
|
return -errno;
|
|
@@ -1899,9 +1896,7 @@ static int allocate_first_block(int fd, size_t max_size)
|
|
|
buf = qemu_memalign(max_align, write_size);
|
|
|
memset(buf, 0, write_size);
|
|
|
|
|
|
- do {
|
|
|
- n = pwrite(fd, buf, write_size, 0);
|
|
|
- } while (n == -1 && errno == EINTR);
|
|
|
+ n = RETRY_ON_EINTR(pwrite(fd, buf, write_size, 0));
|
|
|
|
|
|
ret = (n == -1) ? -errno : 0;
|
|
|
|