static int cd_read_sector(IDEState *s, int lba, uint8_t *buf, int sector_size)

{

    int ret;



    switch(sector_size) {

    case 2048:

        block_acct_start(blk_get_stats(s->blk), &s->acct,

                         4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

        ret = blk_read(s->blk, (int64_t)lba << 2, buf, 4);

        block_acct_done(blk_get_stats(s->blk), &s->acct);

        break;

    case 2352:

        block_acct_start(blk_get_stats(s->blk), &s->acct,

                         4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

        ret = blk_read(s->blk, (int64_t)lba << 2, buf + 16, 4);

        block_acct_done(blk_get_stats(s->blk), &s->acct);

        if (ret < 0)

            return ret;

        cd_data_to_raw(buf, lba);

        break;

    default:

        ret = -EIO;

        break;

    }

    return ret;

}

static int cd_read_sector(IDEState *s, int lba, uint8_t *buf, int sector_size)

{

    int ret;



    switch(sector_size) {

    case 2048:

        block_acct_start(blk_get_stats(s->blk), &s->acct,

                         4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

        ret = blk_read(s->blk, (int64_t)lba << 2, buf, 4);

        block_acct_done(blk_get_stats(s->blk), &s->acct);

        break;

    case 2352:

        block_acct_start(blk_get_stats(s->blk), &s->acct,

                         4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

        ret = blk_read(s->blk, (int64_t)lba << 2, buf + 16, 4);

        block_acct_done(blk_get_stats(s->blk), &s->acct);

        if (ret < 0)

            return ret;

        cd_data_to_raw(buf, lba);

        break;

    default:

        ret = -EIO;

        break;

    }

    return ret;

}

        block_acct_start(blk_get_stats(s->blk), &s->acct,                          4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);         block_acct_done(blk_get_stats(s->blk), &s->acct);         block_acct_start(blk_get_stats(s->blk), &s->acct,                          4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);         block_acct_done(blk_get_stats(s->blk), &s->acct);         if (ret < 0)             return ret;         cd_data_to_raw(buf, lba);         ret = -EIO;         break;
static int FUNC_0(IDEState *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3)

{

    int VAR_4;



    switch(VAR_3) {

    case 2048:

        block_acct_start(blk_get_stats(VAR_0->blk), &VAR_0->acct,

                         4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

        VAR_4 = blk_read(VAR_0->blk, (int64_t)VAR_1 << 2, VAR_2, 4);

        block_acct_done(blk_get_stats(VAR_0->blk), &VAR_0->acct);

        break;

    case 2352:

        block_acct_start(blk_get_stats(VAR_0->blk), &VAR_0->acct,

                         4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

        VAR_4 = blk_read(VAR_0->blk, (int64_t)VAR_1 << 2, VAR_2 + 16, 4);

        block_acct_done(blk_get_stats(VAR_0->blk), &VAR_0->acct);

        if (VAR_4 < 0)

            return VAR_4;

        cd_data_to_raw(VAR_2, VAR_1);

        break;

    default:

        VAR_4 = -EIO;

        break;

    }

    return VAR_4;

}

static int FUNC_0(IDEState *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3)
{ int VAR_4; switch(VAR_3) { case 2048:
block_acct_start(blk_get_stats(VAR_0->blk), &VAR_0->acct,
4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ); VAR_4 = blk_read(VAR_0->blk, (int64_t)VAR_1 << 2, VAR_2, 4); block_acct_done(blk_get_stats(VAR_0->blk), &VAR_0->acct); break; case 2352:
block_acct_start(blk_get_stats(VAR_0->blk), &VAR_0->acct,
4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ); VAR_4 = blk_read(VAR_0->blk, (int64_t)VAR_1 << 2, VAR_2 + 16, 4); block_acct_done(blk_get_stats(VAR_0->blk), &VAR_0->acct); if (VAR_4 < 0)
return VAR_4; cd_data_to_raw(VAR_2, VAR_1); break; default:
VAR_4 = -EIO; break; } return VAR_4; }