void ide_sector_write(IDEState *s)

{

    int64_t sector_num;

    int n;



    s->status = READY_STAT | SEEK_STAT | BUSY_STAT;

    sector_num = ide_get_sector(s);

#if defined(DEBUG_IDE)

    printf("sector=%" PRId64 "\n", sector_num);

#endif

    n = s->nsector;

    if (n > s->req_nb_sectors) {

        n = s->req_nb_sectors;

    }



    if (!ide_sect_range_ok(s, sector_num, n)) {

        ide_rw_error(s);

        return;

    }



    s->iov.iov_base = s->io_buffer;

    s->iov.iov_len  = n * BDRV_SECTOR_SIZE;

    qemu_iovec_init_external(&s->qiov, &s->iov, 1);



    block_acct_start(bdrv_get_stats(s->bs), &s->acct,

                     n * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

    s->pio_aiocb = bdrv_aio_writev(s->bs, sector_num, &s->qiov, n,

                                   ide_sector_write_cb, s);

}

void ide_sector_write(IDEState *s)

{

    int64_t sector_num;

    int n;



    s->status = READY_STAT | SEEK_STAT | BUSY_STAT;

    sector_num = ide_get_sector(s);

#if defined(DEBUG_IDE)

    printf("sector=%" PRId64 "\n", sector_num);

#endif

    n = s->nsector;

    if (n > s->req_nb_sectors) {

        n = s->req_nb_sectors;

    }



    if (!ide_sect_range_ok(s, sector_num, n)) {

        ide_rw_error(s);

        return;

    }



    s->iov.iov_base = s->io_buffer;

    s->iov.iov_len  = n * BDRV_SECTOR_SIZE;

    qemu_iovec_init_external(&s->qiov, &s->iov, 1);



    block_acct_start(bdrv_get_stats(s->bs), &s->acct,

                     n * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

    s->pio_aiocb = bdrv_aio_writev(s->bs, sector_num, &s->qiov, n,

                                   ide_sector_write_cb, s);

}

void FUNC_0(IDEState *VAR_0)

{

    int64_t sector_num;

    int VAR_1;



    VAR_0->status = READY_STAT | SEEK_STAT | BUSY_STAT;

    sector_num = ide_get_sector(VAR_0);

#if defined(DEBUG_IDE)

    printf("sector=%" PRId64 "\VAR_1", sector_num);

#endif

    VAR_1 = VAR_0->nsector;

    if (VAR_1 > VAR_0->req_nb_sectors) {

        VAR_1 = VAR_0->req_nb_sectors;

    }



    if (!ide_sect_range_ok(VAR_0, sector_num, VAR_1)) {

        ide_rw_error(VAR_0);

        return;

    }



    VAR_0->iov.iov_base = VAR_0->io_buffer;

    VAR_0->iov.iov_len  = VAR_1 * BDRV_SECTOR_SIZE;

    qemu_iovec_init_external(&VAR_0->qiov, &VAR_0->iov, 1);



    block_acct_start(bdrv_get_stats(VAR_0->bs), &VAR_0->acct,

                     VAR_1 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

    VAR_0->pio_aiocb = bdrv_aio_writev(VAR_0->bs, sector_num, &VAR_0->qiov, VAR_1,

                                   ide_sector_write_cb, VAR_0);

}

void FUNC_0(IDEState *VAR_0)
{ int64_t sector_num; int VAR_1; VAR_0->status = READY_STAT | SEEK_STAT | BUSY_STAT; sector_num = ide_get_sector(VAR_0); #if defined(DEBUG_IDE)
printf("sector=%" PRId64 "\VAR_1", sector_num); #endif
VAR_1 = VAR_0->nsector; if (VAR_1 > VAR_0->req_nb_sectors) { VAR_1 = VAR_0->req_nb_sectors; } if (!ide_sect_range_ok(VAR_0, sector_num, VAR_1)) { ide_rw_error(VAR_0); return; } VAR_0->iov.iov_base = VAR_0->io_buffer; VAR_0->iov.iov_len  = VAR_1 * BDRV_SECTOR_SIZE; qemu_iovec_init_external(&VAR_0->qiov, &VAR_0->iov, 1); block_acct_start(bdrv_get_stats(VAR_0->bs), &VAR_0->acct,
VAR_1 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ); VAR_0->pio_aiocb = bdrv_aio_writev(VAR_0->bs, sector_num, &VAR_0->qiov, VAR_1,
ide_sector_write_cb, VAR_0); }