From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M8V6e-00055D-RU for qemu-devel@nongnu.org; Mon, 25 May 2009 04:00:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M8V6Z-00053L-OI for qemu-devel@nongnu.org; Mon, 25 May 2009 04:00:24 -0400 Received: from [199.232.76.173] (port=56610 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M8V6Z-00053I-IF for qemu-devel@nongnu.org; Mon, 25 May 2009 04:00:19 -0400 Received: from mx20.gnu.org ([199.232.41.8]:41494) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M8V6Y-00062E-UT for qemu-devel@nongnu.org; Mon, 25 May 2009 04:00:19 -0400 Received: from verein.lst.de ([213.95.11.210]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M8V6X-00055W-Tx for qemu-devel@nongnu.org; Mon, 25 May 2009 04:00:18 -0400 Received: from verein.lst.de (localhost [127.0.0.1]) by verein.lst.de (8.12.3/8.12.3/Debian-7.1) with ESMTP id n4P80GIF003080 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Mon, 25 May 2009 10:00:16 +0200 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-6.6) id n4P80GxK003078 for qemu-devel@nongnu.org; Mon, 25 May 2009 10:00:16 +0200 Date: Mon, 25 May 2009 10:00:16 +0200 From: Christoph Hellwig Message-ID: <20090525080016.GD2936@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH 4/4] raw-posix: cleanup ioctl methods List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 Index: qemu/block/raw-posix.c =================================================================== --- qemu.orig/block/raw-posix.c 2009-05-25 09:33:56.617816515 +0200 +++ qemu/block/raw-posix.c 2009-05-25 09:43:54.438946436 +0200 @@ -1037,7 +1037,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; @@ -1045,7 +1045,7 @@ static int raw_ioctl(BlockDriverState *b } #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) { @@ -1087,11 +1087,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) @@ -1099,17 +1094,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 */ #if defined(__linux__) || defined(__FreeBSD__) @@ -1171,9 +1155,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 }; @@ -1266,12 +1252,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) @@ -1351,9 +1331,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__ */ @@ -1465,12 +1445,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__ */