}
#endif /* !linux */
+static int raw_sg_send_command(BlockDriverState *bs, void *buf, int count)
+{
+ return raw_pwrite(bs, -1, buf, count);
+}
+
+static int raw_sg_recv_response(BlockDriverState *bs, void *buf, int count)
+{
+ return raw_pread(bs, -1, buf, count);
+}
+
+static BlockDriverAIOCB *raw_sg_aio_read(BlockDriverState *bs,
+ void *buf, int count,
+ BlockDriverCompletionFunc *cb,
+ void *opaque)
+{
+ return raw_aio_read(bs, 0, buf, -(int64_t)count, cb, opaque);
+}
+
+static BlockDriverAIOCB *raw_sg_aio_write(BlockDriverState *bs,
+ void *buf, int count,
+ BlockDriverCompletionFunc *cb,
+ void *opaque)
+{
+ return raw_aio_write(bs, 0, buf, -(int64_t)count, cb, opaque);
+}
+
BlockDriver bdrv_host_device = {
.format_name = "host_device",
.instance_size = sizeof(BDRVRawState),
.bdrv_set_locked = raw_set_locked,
/* generic scsi device */
.bdrv_ioctl = raw_ioctl,
+ .bdrv_sg_send_command = raw_sg_send_command,
+ .bdrv_sg_recv_response = raw_sg_recv_response,
+ .bdrv_sg_aio_read = raw_sg_aio_read,
+ .bdrv_sg_aio_write = raw_sg_aio_write,
};
int bdrv_sg_send_command(BlockDriverState *bs, void *buf, int count)
{
- return bdrv_pwrite(bs, -1, buf, count);
+ return bs->drv->bdrv_sg_send_command(bs, buf, count);
}
int bdrv_sg_recv_response(BlockDriverState *bs, void *buf, int count)
{
- return bdrv_pread(bs, -1, buf, count);
+ return bs->drv->bdrv_sg_recv_response(bs, buf, count);
}
BlockDriverAIOCB *bdrv_sg_aio_read(BlockDriverState *bs, void *buf, int count,
BlockDriverCompletionFunc *cb, void *opaque)
{
- return bdrv_aio_read(bs, 0, buf, -(int64_t)count, cb, opaque);
+ return bs->drv->bdrv_sg_aio_read(bs, buf, count, cb, opaque);
}
BlockDriverAIOCB *bdrv_sg_aio_write(BlockDriverState *bs, void *buf, int count,
BlockDriverCompletionFunc *cb, void *opaque)
{
- return bdrv_aio_write(bs, 0, buf, -(int64_t)count, cb, opaque);
+ return bs->drv->bdrv_sg_aio_write(bs, buf, count, cb, opaque);
}
/* to control generic scsi devices */
int (*bdrv_ioctl)(BlockDriverState *bs, unsigned long int req, void *buf);
+ int (*bdrv_sg_send_command)(BlockDriverState *bs, void *buf, int count);
+ int (*bdrv_sg_recv_response)(BlockDriverState *bs, void *buf, int count);
+ BlockDriverAIOCB *(*bdrv_sg_aio_read)(BlockDriverState *bs,
+ void *buf, int count,
+ BlockDriverCompletionFunc *cb,
+ void *opaque);
+ BlockDriverAIOCB *(*bdrv_sg_aio_write)(BlockDriverState *bs,
+ void *buf, int count,
+ BlockDriverCompletionFunc *cb,
+ void *opaque);
BlockDriverAIOCB *free_aiocb;
struct BlockDriver *next;