static void ide_sector_read_cb(void *opaque, int ret)

{

    IDEState *s = opaque;

    int n;



    s->pio_aiocb = NULL;

    s->status &= ~BUSY_STAT;



    if (ret == -ECANCELED) {

        return;

    }

    block_acct_done(bdrv_get_stats(s->bs), &s->acct);

    if (ret != 0) {

        if (ide_handle_rw_error(s, -ret, IDE_RETRY_PIO |

                                IDE_RETRY_READ)) {

            return;

        }

    }



    n = s->nsector;

    if (n > s->req_nb_sectors) {

        n = s->req_nb_sectors;

    }



    /* Allow the guest to read the io_buffer */

    ide_transfer_start(s, s->io_buffer, n * BDRV_SECTOR_SIZE, ide_sector_read);



    ide_set_irq(s->bus);



    ide_set_sector(s, ide_get_sector(s) + n);

    s->nsector -= n;

}

static void ide_sector_read_cb(void *opaque, int ret)

{

    IDEState *s = opaque;

    int n;



    s->pio_aiocb = NULL;

    s->status &= ~BUSY_STAT;



    if (ret == -ECANCELED) {

        return;

    }

    block_acct_done(bdrv_get_stats(s->bs), &s->acct);

    if (ret != 0) {

        if (ide_handle_rw_error(s, -ret, IDE_RETRY_PIO |

                                IDE_RETRY_READ)) {

            return;

        }

    }



    n = s->nsector;

    if (n > s->req_nb_sectors) {

        n = s->req_nb_sectors;

    }



    

    ide_transfer_start(s, s->io_buffer, n * BDRV_SECTOR_SIZE, ide_sector_read);



    ide_set_irq(s->bus);



    ide_set_sector(s, ide_get_sector(s) + n);

    s->nsector -= n;

}

static void FUNC_0(void *VAR_0, int VAR_1)

{

    IDEState *s = VAR_0;

    int VAR_2;



    s->pio_aiocb = NULL;

    s->status &= ~BUSY_STAT;



    if (VAR_1 == -ECANCELED) {

        return;

    }

    block_acct_done(bdrv_get_stats(s->bs), &s->acct);

    if (VAR_1 != 0) {

        if (ide_handle_rw_error(s, -VAR_1, IDE_RETRY_PIO |

                                IDE_RETRY_READ)) {

            return;

        }

    }



    VAR_2 = s->nsector;

    if (VAR_2 > s->req_nb_sectors) {

        VAR_2 = s->req_nb_sectors;

    }



    

    ide_transfer_start(s, s->io_buffer, VAR_2 * BDRV_SECTOR_SIZE, ide_sector_read);



    ide_set_irq(s->bus);



    ide_set_sector(s, ide_get_sector(s) + VAR_2);

    s->nsector -= VAR_2;

}

static void FUNC_0(void *VAR_0, int VAR_1)
{ IDEState *s = VAR_0; int VAR_2; s->pio_aiocb = NULL; s->status &= ~BUSY_STAT; if (VAR_1 == -ECANCELED) { return; } block_acct_done(bdrv_get_stats(s->bs), &s->acct); if (VAR_1 != 0) { if (ide_handle_rw_error(s, -VAR_1, IDE_RETRY_PIO |
IDE_RETRY_READ)) { return; } } VAR_2 = s->nsector; if (VAR_2 > s->req_nb_sectors) { VAR_2 = s->req_nb_sectors; } ide_transfer_start(s, s->io_buffer, VAR_2 * BDRV_SECTOR_SIZE, ide_sector_read); ide_set_irq(s->bus); ide_set_sector(s, ide_get_sector(s) + VAR_2); s->nsector -= VAR_2; }