Revision 221f715d block-raw-posix.c
b/block-raw-posix.c | ||
---|---|---|
1209 | 1209 |
|
1210 | 1210 |
return ioctl(s->fd, req, buf); |
1211 | 1211 |
} |
1212 |
|
|
1213 |
static BlockDriverAIOCB *raw_aio_ioctl(BlockDriverState *bs, |
|
1214 |
unsigned long int req, void *buf, |
|
1215 |
BlockDriverCompletionFunc *cb, void *opaque) |
|
1216 |
{ |
|
1217 |
RawAIOCB *acb; |
|
1218 |
|
|
1219 |
acb = raw_aio_setup(bs, 0, buf, 0, cb, opaque); |
|
1220 |
if (!acb) |
|
1221 |
return NULL; |
|
1222 |
|
|
1223 |
acb->aiocb.aio_ioctl_cmd = req; |
|
1224 |
if (qemu_paio_ioctl(&acb->aiocb) < 0) { |
|
1225 |
raw_aio_remove(acb); |
|
1226 |
return NULL; |
|
1227 |
} |
|
1228 |
|
|
1229 |
return &acb->common; |
|
1230 |
} |
|
1231 |
|
|
1212 | 1232 |
#elif defined(__FreeBSD__) |
1213 | 1233 |
|
1214 | 1234 |
static int fd_open(BlockDriverState *bs) |
... | ... | |
1349 | 1369 |
{ |
1350 | 1370 |
return -ENOTSUP; |
1351 | 1371 |
} |
1352 |
#endif /* !linux && !FreeBSD */ |
|
1353 |
|
|
1354 |
static int raw_sg_send_command(BlockDriverState *bs, void *buf, int count) |
|
1355 |
{ |
|
1356 |
return raw_pwrite(bs, -1, buf, count); |
|
1357 |
} |
|
1358 |
|
|
1359 |
static int raw_sg_recv_response(BlockDriverState *bs, void *buf, int count) |
|
1360 |
{ |
|
1361 |
return raw_pread(bs, -1, buf, count); |
|
1362 |
} |
|
1363 |
|
|
1364 |
static BlockDriverAIOCB *raw_sg_aio_read(BlockDriverState *bs, |
|
1365 |
void *buf, int count, |
|
1366 |
BlockDriverCompletionFunc *cb, |
|
1367 |
void *opaque) |
|
1368 |
{ |
|
1369 |
return raw_aio_read(bs, 0, buf, -(int64_t)count, cb, opaque); |
|
1370 |
} |
|
1371 | 1372 |
|
1372 |
static BlockDriverAIOCB *raw_sg_aio_write(BlockDriverState *bs, |
|
1373 |
void *buf, int count, |
|
1374 |
BlockDriverCompletionFunc *cb, |
|
1375 |
void *opaque) |
|
1373 |
static BlockDriverAIOCB *raw_aio_ioctl(BlockDriverState *bs, |
|
1374 |
unsigned long int req, void *buf, |
|
1375 |
BlockDriverCompletionFunc *cb, void *opaque) |
|
1376 | 1376 |
{ |
1377 |
return raw_aio_write(bs, 0, buf, -(int64_t)count, cb, opaque);
|
|
1377 |
return -ENOTSUP;
|
|
1378 | 1378 |
} |
1379 |
#endif /* !linux && !FreeBSD */ |
|
1379 | 1380 |
|
1380 | 1381 |
BlockDriver bdrv_host_device = { |
1381 | 1382 |
.format_name = "host_device", |
... | ... | |
1402 | 1403 |
.bdrv_set_locked = raw_set_locked, |
1403 | 1404 |
/* generic scsi device */ |
1404 | 1405 |
.bdrv_ioctl = raw_ioctl, |
1405 |
.bdrv_sg_send_command = raw_sg_send_command, |
|
1406 |
.bdrv_sg_recv_response = raw_sg_recv_response, |
|
1407 |
.bdrv_sg_aio_read = raw_sg_aio_read, |
|
1408 |
.bdrv_sg_aio_write = raw_sg_aio_write, |
|
1406 |
.bdrv_aio_ioctl = raw_aio_ioctl, |
|
1409 | 1407 |
}; |
Also available in: Unified diff