Revision 1e5b9d2f

b/block/raw-posix-aio.h
26 26

  
27 27

  
28 28
/* posix-aio-compat.c - thread pool based implementation */
29
void *paio_init(void);
30
BlockDriverAIOCB *paio_submit(BlockDriverState *bs, void *aio_ctx, int fd,
29
int paio_init(void);
30
BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd,
31 31
        int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
32 32
        BlockDriverCompletionFunc *cb, void *opaque, int type);
33 33
BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd,
b/block/raw-posix.c
107 107
    int type;
108 108
    unsigned int lseek_err_cnt;
109 109
    int open_flags;
110
    void *aio_ctx;
111 110
#if defined(__linux__)
112 111
    /* linux floppy specific */
113 112
    int64_t fd_open_time;
......
117 116
#endif
118 117
#ifdef CONFIG_LINUX_AIO
119 118
    int use_aio;
119
    void *aio_ctx;
120 120
#endif
121 121
    uint8_t* aligned_buf;
122 122
} BDRVRawState;
......
185 185
    } else
186 186
#endif
187 187
    {
188
        s->aio_ctx = paio_init();
189
        if (!s->aio_ctx) {
188
        if (paio_init() < 0) {
190 189
            goto out_free_buf;
191 190
        }
192 191
#ifdef CONFIG_LINUX_AIO
......
558 557
        }
559 558
    }
560 559

  
561
    return paio_submit(bs, s->aio_ctx, s->fd, sector_num, qiov, nb_sectors,
560
    return paio_submit(bs, s->fd, sector_num, qiov, nb_sectors,
562 561
                       cb, opaque, type);
563 562
}
564 563

  
......
586 585
    if (fd_open(bs) < 0)
587 586
        return NULL;
588 587

  
589
    return paio_submit(bs, s->aio_ctx, s->fd, 0, NULL, 0,
590
    		       cb, opaque, QEMU_AIO_FLUSH);
588
    return paio_submit(bs, s->fd, 0, NULL, 0, cb, opaque, QEMU_AIO_FLUSH);
591 589
}
592 590

  
593 591
static void raw_close(BlockDriverState *bs)
b/posix-aio-compat.c
556 556
    .cancel             = paio_cancel,
557 557
};
558 558

  
559
BlockDriverAIOCB *paio_submit(BlockDriverState *bs, void *aio_ctx, int fd,
559
BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd,
560 560
        int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
561 561
        BlockDriverCompletionFunc *cb, void *opaque, int type)
562 562
{
......
607 607
    return &acb->common;
608 608
}
609 609

  
610
void *paio_init(void)
610
int paio_init(void)
611 611
{
612 612
    struct sigaction act;
613 613
    PosixAioState *s;
......
615 615
    int ret;
616 616

  
617 617
    if (posix_aio_state)
618
        return posix_aio_state;
618
        return 0;
619 619

  
620 620
    s = qemu_malloc(sizeof(PosixAioState));
621 621

  
......
627 627
    s->first_aio = NULL;
628 628
    if (pipe(fds) == -1) {
629 629
        fprintf(stderr, "failed to create pipe\n");
630
        return NULL;
630
        return -1;
631 631
    }
632 632

  
633 633
    s->rfd = fds[0];
......
650 650
    QTAILQ_INIT(&request_list);
651 651

  
652 652
    posix_aio_state = s;
653

  
654
    return posix_aio_state;
653
    return 0;
655 654
}

Also available in: Unified diff