aboutsummaryrefslogtreecommitdiffstats
path: root/block/raw-posix.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-06-15 14:04:34 +0200
committerChristoph Hellwig <hch@brick.lst.de>2009-06-15 14:04:34 +0200
commit63ec93db2178c8caaecd546e640f2fa2296c0a5a (patch)
treec29e92cd52ff7f8231e901a92ec10b93a15d7d65 /block/raw-posix.c
parent508c7cb3fa666f0c4723946869f318ec7751ecbd (diff)
raw-posix: cleanup ioctl methods
Rename raw_ioctl and raw_aio_ioctl to hdev_ioctl and hdev_aio_ioctl as they are only used for the host device. Also only add them to the method table for the cases where we need them (generic hdev if linux and linux CDROM) instead of declaring stubs and always add them. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'block/raw-posix.c')
-rw-r--r--block/raw-posix.c42
1 files changed, 8 insertions, 34 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 5e65da00a..50323485f 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1060,7 +1060,7 @@ static int fd_open(BlockDriverState *bs)
return 0;
}
-static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
+static int hdev_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
{
BDRVRawState *s = bs->opaque;
@@ -1068,7 +1068,7 @@ static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
}
#ifdef CONFIG_AIO
-static BlockDriverAIOCB *raw_aio_ioctl(BlockDriverState *bs,
+static BlockDriverAIOCB *hdev_aio_ioctl(BlockDriverState *bs,
unsigned long int req, void *buf,
BlockDriverCompletionFunc *cb, void *opaque)
{
@@ -1110,11 +1110,6 @@ static int fd_open(BlockDriverState *bs)
return 0;
return -EIO;
}
-
-static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
-{
- return -ENOTSUP;
-}
#else /* !linux && !FreeBSD */
static int fd_open(BlockDriverState *bs)
@@ -1122,17 +1117,6 @@ static int fd_open(BlockDriverState *bs)
return 0;
}
-static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
-{
- return -ENOTSUP;
-}
-
-static BlockDriverAIOCB *raw_aio_ioctl(BlockDriverState *bs,
- unsigned long int req, void *buf,
- BlockDriverCompletionFunc *cb, void *opaque)
-{
- return NULL;
-}
#endif /* !linux && !FreeBSD */
static int hdev_create(const char *filename, QEMUOptionParameter *options)
@@ -1184,9 +1168,11 @@ static BlockDriver bdrv_host_device = {
.bdrv_getlength = raw_getlength,
/* generic scsi device */
- .bdrv_ioctl = raw_ioctl,
+#ifdef __linux__
+ .bdrv_ioctl = hdev_ioctl,
#ifdef CONFIG_AIO
- .bdrv_aio_ioctl = raw_aio_ioctl,
+ .bdrv_aio_ioctl = hdev_aio_ioctl,
+#endif
#endif
};
@@ -1286,12 +1272,6 @@ static BlockDriver bdrv_host_floppy = {
.bdrv_is_inserted = floppy_is_inserted,
.bdrv_media_changed = floppy_media_changed,
.bdrv_eject = floppy_eject,
-
- /* generic scsi device */
- .bdrv_ioctl = raw_ioctl,
-#ifdef CONFIG_AIO
- .bdrv_aio_ioctl = raw_aio_ioctl,
-#endif
};
static int cdrom_open(BlockDriverState *bs, const char *filename, int flags)
@@ -1377,9 +1357,9 @@ static BlockDriver bdrv_host_cdrom = {
.bdrv_set_locked = cdrom_set_locked,
/* generic scsi device */
- .bdrv_ioctl = raw_ioctl,
+ .bdrv_ioctl = hdev_ioctl,
#ifdef CONFIG_AIO
- .bdrv_aio_ioctl = raw_aio_ioctl,
+ .bdrv_aio_ioctl = hdev_aio_ioctl,
#endif
};
#endif /* __linux__ */
@@ -1498,12 +1478,6 @@ static BlockDriver bdrv_host_cdrom = {
.bdrv_is_inserted = cdrom_is_inserted,
.bdrv_eject = cdrom_eject,
.bdrv_set_locked = cdrom_set_locked,
-
- /* generic scsi device */
- .bdrv_ioctl = raw_ioctl,
-#ifdef CONFIG_AIO
- .bdrv_aio_ioctl = raw_aio_ioctl,
-#endif
};
#endif /* __FreeBSD__ */