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(bdrv_get_stats(s->bs), &s->acct,

                         4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

        ret = bdrv_read(s->bs, (int64_t)lba << 2, buf, 4);

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

        break;

    case 2352:

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

                         4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

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

        block_acct_done(bdrv_get_stats(s->bs), &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(bdrv_get_stats(s->bs), &s->acct,

                         4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

        ret = bdrv_read(s->bs, (int64_t)lba << 2, buf, 4);

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

        break;

    case 2352:

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

                         4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

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

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

        if (ret < 0)

            return ret;

        cd_data_to_raw(buf, lba);

        break;

    default:

        ret = -EIO;

        break;

    }

    return ret;

}

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(bdrv_get_stats(VAR_0->bs), &VAR_0->acct,

                         4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

        VAR_4 = bdrv_read(VAR_0->bs, (int64_t)VAR_1 << 2, VAR_2, 4);

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

        break;

    case 2352:

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

                         4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);

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

        block_acct_done(bdrv_get_stats(VAR_0->bs), &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(bdrv_get_stats(VAR_0->bs), &VAR_0->acct,
4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ); VAR_4 = bdrv_read(VAR_0->bs, (int64_t)VAR_1 << 2, VAR_2, 4); block_acct_done(bdrv_get_stats(VAR_0->bs), &VAR_0->acct); break; case 2352:
block_acct_start(bdrv_get_stats(VAR_0->bs), &VAR_0->acct,
4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ); VAR_4 = bdrv_read(VAR_0->bs, (int64_t)VAR_1 << 2, VAR_2 + 16, 4); block_acct_done(bdrv_get_stats(VAR_0->bs), &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; }