Revision c557e889 hw/scsi-generic.c

b/hw/scsi-generic.c
424 424
    return (buf[9] << 16) | (buf[10] << 8) | buf[11];
425 425
}
426 426

  
427
static void scsi_generic_purge_requests(SCSIGenericState *s)
428
{
429
    SCSIGenericReq *r;
430

  
431
    while (!QTAILQ_EMPTY(&s->qdev.requests)) {
432
        r = DO_UPCAST(SCSIGenericReq, req, QTAILQ_FIRST(&s->qdev.requests));
433
        if (r->req.aiocb) {
434
            bdrv_aio_cancel(r->req.aiocb);
435
        }
436
        scsi_req_dequeue(&r->req);
437
        scsi_req_unref(&r->req);
438
    }
439
}
440

  
441 427
static void scsi_generic_reset(DeviceState *dev)
442 428
{
443 429
    SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev.qdev, dev);
444 430

  
445
    scsi_generic_purge_requests(s);
431
    scsi_device_purge_requests(&s->qdev);
446 432
}
447 433

  
448 434
static void scsi_destroy(SCSIDevice *d)
449 435
{
450 436
    SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, d);
451 437

  
452
    scsi_generic_purge_requests(s);
438
    scsi_device_purge_requests(&s->qdev);
453 439
    blockdev_mark_auto_del(s->qdev.conf.bs);
454 440
}
455 441

  

Also available in: Unified diff