break;
case GPCMD_SEEK:
{
- int lba;
- int64_t total_sectors;
+ unsigned int lba;
+ uint64_t total_sectors;
bdrv_get_geometry(s->bs, &total_sectors);
total_sectors >>= 2;
- if (total_sectors <= 0) {
+ if (total_sectors == 0) {
ide_atapi_cmd_error(s, SENSE_NOT_READY,
ASC_MEDIUM_NOT_PRESENT);
break;
case GPCMD_READ_TOC_PMA_ATIP:
{
int format, msf, start_track, len;
- int64_t total_sectors;
+ uint64_t total_sectors;
bdrv_get_geometry(s->bs, &total_sectors);
total_sectors >>= 2;
- if (total_sectors <= 0) {
+ if (total_sectors == 0) {
ide_atapi_cmd_error(s, SENSE_NOT_READY,
ASC_MEDIUM_NOT_PRESENT);
break;
break;
case GPCMD_READ_CDVD_CAPACITY:
{
- int64_t total_sectors;
+ uint64_t total_sectors;
bdrv_get_geometry(s->bs, &total_sectors);
total_sectors >>= 2;
- if (total_sectors <= 0) {
+ if (total_sectors == 0) {
ide_atapi_cmd_error(s, SENSE_NOT_READY,
ASC_MEDIUM_NOT_PRESENT);
break;
int media = packet[1];
int layer = packet[6];
int format = packet[2];
- int64_t total_sectors;
+ uint64_t total_sectors;
if (media != 0 || layer != 0)
{
case 0:
bdrv_get_geometry(s->bs, &total_sectors);
total_sectors >>= 2;
+ if (total_sectors == 0) {
+ ide_atapi_cmd_error(s, SENSE_NOT_READY,
+ ASC_MEDIUM_NOT_PRESENT);
+ break;
+ }
memset(buf, 0, 2052);
break;
case GPCMD_GET_CONFIGURATION:
{
- int64_t total_sectors;
+ uint64_t total_sectors;
/* only feature 0 is supported */
if (packet[2] != 0 || packet[3] != 0) {
static void cdrom_change_cb(void *opaque)
{
IDEState *s = opaque;
- int64_t nb_sectors;
+ uint64_t nb_sectors;
/* XXX: send interrupt too */
bdrv_get_geometry(s->bs, &nb_sectors);
IDEState *s;
static int drive_serial = 1;
int i, cylinders, heads, secs, translation, lba_detected = 0;
- int64_t nb_sectors;
+ uint64_t nb_sectors;
for(i = 0; i < 2; i++) {
s = ide_state + i;