Commit 63ec93db2178c8caaecd546e640f2fa2296c0a5a

Authored by Christoph Hellwig
Committed by Christoph Hellwig
1 parent 508c7cb3

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>
Showing 1 changed file with 8 additions and 34 deletions
block/raw-posix.c
@@ -1060,7 +1060,7 @@ static int fd_open(BlockDriverState *bs) @@ -1060,7 +1060,7 @@ static int fd_open(BlockDriverState *bs)
1060 return 0; 1060 return 0;
1061 } 1061 }
1062 1062
1063 -static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) 1063 +static int hdev_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
1064 { 1064 {
1065 BDRVRawState *s = bs->opaque; 1065 BDRVRawState *s = bs->opaque;
1066 1066
@@ -1068,7 +1068,7 @@ static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) @@ -1068,7 +1068,7 @@ static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
1068 } 1068 }
1069 1069
1070 #ifdef CONFIG_AIO 1070 #ifdef CONFIG_AIO
1071 -static BlockDriverAIOCB *raw_aio_ioctl(BlockDriverState *bs, 1071 +static BlockDriverAIOCB *hdev_aio_ioctl(BlockDriverState *bs,
1072 unsigned long int req, void *buf, 1072 unsigned long int req, void *buf,
1073 BlockDriverCompletionFunc *cb, void *opaque) 1073 BlockDriverCompletionFunc *cb, void *opaque)
1074 { 1074 {
@@ -1110,11 +1110,6 @@ static int fd_open(BlockDriverState *bs) @@ -1110,11 +1110,6 @@ static int fd_open(BlockDriverState *bs)
1110 return 0; 1110 return 0;
1111 return -EIO; 1111 return -EIO;
1112 } 1112 }
1113 -  
1114 -static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)  
1115 -{  
1116 - return -ENOTSUP;  
1117 -}  
1118 #else /* !linux && !FreeBSD */ 1113 #else /* !linux && !FreeBSD */
1119 1114
1120 static int fd_open(BlockDriverState *bs) 1115 static int fd_open(BlockDriverState *bs)
@@ -1122,17 +1117,6 @@ static int fd_open(BlockDriverState *bs) @@ -1122,17 +1117,6 @@ static int fd_open(BlockDriverState *bs)
1122 return 0; 1117 return 0;
1123 } 1118 }
1124 1119
1125 -static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)  
1126 -{  
1127 - return -ENOTSUP;  
1128 -}  
1129 -  
1130 -static BlockDriverAIOCB *raw_aio_ioctl(BlockDriverState *bs,  
1131 - unsigned long int req, void *buf,  
1132 - BlockDriverCompletionFunc *cb, void *opaque)  
1133 -{  
1134 - return NULL;  
1135 -}  
1136 #endif /* !linux && !FreeBSD */ 1120 #endif /* !linux && !FreeBSD */
1137 1121
1138 static int hdev_create(const char *filename, QEMUOptionParameter *options) 1122 static int hdev_create(const char *filename, QEMUOptionParameter *options)
@@ -1184,9 +1168,11 @@ static BlockDriver bdrv_host_device = { @@ -1184,9 +1168,11 @@ static BlockDriver bdrv_host_device = {
1184 .bdrv_getlength = raw_getlength, 1168 .bdrv_getlength = raw_getlength,
1185 1169
1186 /* generic scsi device */ 1170 /* generic scsi device */
1187 - .bdrv_ioctl = raw_ioctl, 1171 +#ifdef __linux__
  1172 + .bdrv_ioctl = hdev_ioctl,
1188 #ifdef CONFIG_AIO 1173 #ifdef CONFIG_AIO
1189 - .bdrv_aio_ioctl = raw_aio_ioctl, 1174 + .bdrv_aio_ioctl = hdev_aio_ioctl,
  1175 +#endif
1190 #endif 1176 #endif
1191 }; 1177 };
1192 1178
@@ -1286,12 +1272,6 @@ static BlockDriver bdrv_host_floppy = { @@ -1286,12 +1272,6 @@ static BlockDriver bdrv_host_floppy = {
1286 .bdrv_is_inserted = floppy_is_inserted, 1272 .bdrv_is_inserted = floppy_is_inserted,
1287 .bdrv_media_changed = floppy_media_changed, 1273 .bdrv_media_changed = floppy_media_changed,
1288 .bdrv_eject = floppy_eject, 1274 .bdrv_eject = floppy_eject,
1289 -  
1290 - /* generic scsi device */  
1291 - .bdrv_ioctl = raw_ioctl,  
1292 -#ifdef CONFIG_AIO  
1293 - .bdrv_aio_ioctl = raw_aio_ioctl,  
1294 -#endif  
1295 }; 1275 };
1296 1276
1297 static int cdrom_open(BlockDriverState *bs, const char *filename, int flags) 1277 static int cdrom_open(BlockDriverState *bs, const char *filename, int flags)
@@ -1377,9 +1357,9 @@ static BlockDriver bdrv_host_cdrom = { @@ -1377,9 +1357,9 @@ static BlockDriver bdrv_host_cdrom = {
1377 .bdrv_set_locked = cdrom_set_locked, 1357 .bdrv_set_locked = cdrom_set_locked,
1378 1358
1379 /* generic scsi device */ 1359 /* generic scsi device */
1380 - .bdrv_ioctl = raw_ioctl, 1360 + .bdrv_ioctl = hdev_ioctl,
1381 #ifdef CONFIG_AIO 1361 #ifdef CONFIG_AIO
1382 - .bdrv_aio_ioctl = raw_aio_ioctl, 1362 + .bdrv_aio_ioctl = hdev_aio_ioctl,
1383 #endif 1363 #endif
1384 }; 1364 };
1385 #endif /* __linux__ */ 1365 #endif /* __linux__ */
@@ -1498,12 +1478,6 @@ static BlockDriver bdrv_host_cdrom = { @@ -1498,12 +1478,6 @@ static BlockDriver bdrv_host_cdrom = {
1498 .bdrv_is_inserted = cdrom_is_inserted, 1478 .bdrv_is_inserted = cdrom_is_inserted,
1499 .bdrv_eject = cdrom_eject, 1479 .bdrv_eject = cdrom_eject,
1500 .bdrv_set_locked = cdrom_set_locked, 1480 .bdrv_set_locked = cdrom_set_locked,
1501 -  
1502 - /* generic scsi device */  
1503 - .bdrv_ioctl = raw_ioctl,  
1504 -#ifdef CONFIG_AIO  
1505 - .bdrv_aio_ioctl = raw_aio_ioctl,  
1506 -#endif  
1507 }; 1481 };
1508 #endif /* __FreeBSD__ */ 1482 #endif /* __FreeBSD__ */
1509 1483