From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHiBA-0005A0-T5 for qemu-devel@nongnu.org; Wed, 23 Jan 2008 11:10:21 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHiB5-00053P-Fz for qemu-devel@nongnu.org; Wed, 23 Jan 2008 11:10:19 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHiB5-000531-1X for qemu-devel@nongnu.org; Wed, 23 Jan 2008 11:10:15 -0500 Received: from ecfrec.frec.bull.fr ([129.183.4.8]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JHiB4-0005YV-HF for qemu-devel@nongnu.org; Wed, 23 Jan 2008 11:10:15 -0500 Received: from localhost (localhost [127.0.0.1]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id A252019D9C5 for ; Wed, 23 Jan 2008 17:09:50 +0100 (CET) Received: from ecfrec.frec.bull.fr ([127.0.0.1]) by localhost (ecfrec.frec.bull.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12887-01 for ; Wed, 23 Jan 2008 17:09:47 +0100 (CET) Received: from ecn002.frec.bull.fr (ecn002.frec.bull.fr [129.183.4.6]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id 6AB7F19D9AE for ; Wed, 23 Jan 2008 17:09:23 +0100 (CET) In-Reply-To: <12011047731303@bull.net> Date: Wed, 23 Jan 2008 17:12:53 +0100 Message-Id: <1201104773738@bull.net> Mime-Version: 1.0 From: Laurent Vivier Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" Subject: [Qemu-devel] [PATCH 1/5] reverse scsi-generic Reply-To: Laurent Vivier , qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org This patch removes modifications in block interface introduced by the=20 scsi-generic implementation, and disables scsi-generic support. Files restored are: block-raw-posix.c revision 1.2 block.c revision 1.52 block.h revision 1.5 block_int.h revision 1.15 Laurent --- block-raw-posix.c | 23 +++-------------------- block.c | 16 ---------------- block.h | 2 -- block_int.h | 4 ---- hw/scsi-generic.c | 3 ++- 5 files changed, 5 insertions(+), 43 deletions(-) Index: qemu/block.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- qemu.orig/block.c 2008-01-23 09:18:17.000000000 +0100 +++ qemu/block.c 2008-01-23 09:19:16.000000000 +0100 @@ -786,11 +786,6 @@ int bdrv_is_read_only(BlockDriverState * return bs->read_only; } =20 -int bdrv_is_sg(BlockDriverState *bs) -{ - return bs->sg; -} - /* XXX: no longer used */ void bdrv_set_change_cb(BlockDriverState *bs, void (*change_cb)(void *opaque), void *opaque) @@ -1399,14 +1394,3 @@ void bdrv_set_locked(BlockDriverState *b drv->bdrv_set_locked(bs, locked); } } - -/* needed for generic scsi interface */ - -int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) -{ - BlockDriver *drv =3D bs->drv; - - if (drv && drv->bdrv_ioctl) - return drv->bdrv_ioctl(bs, req, buf); - return -ENOTSUP; -} Index: qemu/block.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- qemu.orig/block.h 2008-01-23 09:18:17.000000000 +0100 +++ qemu/block.h 2008-01-23 09:19:16.000000000 +0100 @@ -119,7 +119,6 @@ int bdrv_get_type_hint(BlockDriverState=20 int bdrv_get_translation_hint(BlockDriverState *bs); int bdrv_is_removable(BlockDriverState *bs); int bdrv_is_read_only(BlockDriverState *bs); -int bdrv_is_sg(BlockDriverState *bs); int bdrv_is_inserted(BlockDriverState *bs); int bdrv_media_changed(BlockDriverState *bs); int bdrv_is_locked(BlockDriverState *bs); @@ -149,7 +148,6 @@ int bdrv_snapshot_delete(BlockDriverStat int bdrv_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_info); char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn); -int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf); =20 char *get_human_readable_size(char *buf, int buf_size, int64_t size); int path_is_absolute(const char *path); Index: qemu/block_int.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- qemu.orig/block_int.h 2008-01-23 09:18:17.000000000 +0100 +++ qemu/block_int.h 2008-01-23 09:19:16.000000000 +0100 @@ -82,9 +82,6 @@ struct BlockDriver { int (*bdrv_eject)(BlockDriverState *bs, int eject_flag); int (*bdrv_set_locked)(BlockDriverState *bs, int locked); =20 - /* to control generic scsi devices */ - int (*bdrv_ioctl)(BlockDriverState *bs, unsigned long int req, void *b= uf); - BlockDriverAIOCB *free_aiocb; struct BlockDriver *next; }; @@ -96,7 +93,6 @@ struct BlockDriverState { int removable; /* if true, the media can be removed */ int locked; /* if true, the media cannot temporarily be ejected */ int encrypted; /* if true, the media is encrypted */ - int sg; /* if true, the device is a /dev/sg* */ /* event callback when inserting/removing */ void (*change_cb)(void *opaque); void *change_opaque; Index: qemu/block-raw-posix.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- qemu.orig/block-raw-posix.c 2008-01-23 09:18:17.000000000 +0100 +++ qemu/block-raw-posix.c 2008-01-23 09:19:16.000000000 +0100 @@ -151,7 +151,7 @@ static int raw_pread(BlockDriverState *b if (ret < 0) return ret; =20 - if (offset >=3D 0 && lseek(s->fd, offset, SEEK_SET) =3D=3D (off_t)-1) { + if (lseek(s->fd, offset, SEEK_SET) =3D=3D (off_t)-1) { ++(s->lseek_err_cnt); if(s->lseek_err_cnt <=3D 10) { DEBUG_BLOCK_PRINT("raw_pread(%d:%s, %" PRId64 ", %p, %d) [%" P= RId64 @@ -204,7 +204,7 @@ static int raw_pwrite(BlockDriverState * if (ret < 0) return ret; =20 - if (offset >=3D 0 && lseek(s->fd, offset, SEEK_SET) =3D=3D (off_t)-1) { + if (lseek(s->fd, offset, SEEK_SET) =3D=3D (off_t)-1) { ++(s->lseek_err_cnt); if(s->lseek_err_cnt) { DEBUG_BLOCK_PRINT("raw_pwrite(%d:%s, %" PRId64 ", %p, %d) [%" @@ -387,10 +387,7 @@ static RawAIOCB *raw_aio_setup(BlockDriv acb->aiocb.aio_sigevent.sigev_signo =3D aio_sig_num; acb->aiocb.aio_sigevent.sigev_notify =3D SIGEV_SIGNAL; acb->aiocb.aio_buf =3D buf; - if (nb_sectors < 0) - acb->aiocb.aio_nbytes =3D -nb_sectors; - else - acb->aiocb.aio_nbytes =3D nb_sectors * 512; + acb->aiocb.aio_nbytes =3D nb_sectors * 512; acb->aiocb.aio_offset =3D sector_num * 512; acb->next =3D first_aio; first_aio =3D acb; @@ -682,8 +679,6 @@ static int hdev_open(BlockDriverState *b s->fd_open_flags =3D open_flags; /* open will not fail even if no floppy is inserted */ open_flags |=3D O_NONBLOCK; - } else if (strstart(filename, "/dev/sg", NULL)) { - bs->sg =3D 1; } #endif fd =3D open(filename, open_flags, 0644); @@ -863,12 +858,6 @@ static int raw_set_locked(BlockDriverSta return 0; } =20 -static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *bu= f) -{ - BDRVRawState *s =3D bs->opaque; - - return ioctl(s->fd, req, buf); -} #else =20 static int raw_is_inserted(BlockDriverState *bs) @@ -891,10 +880,6 @@ static int raw_set_locked(BlockDriverSta return -ENOTSUP; } =20 -static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *bu= f) -{ - return -ENOTSUP; -} #endif /* !linux */ =20 BlockDriver bdrv_host_device =3D { @@ -921,6 +906,4 @@ BlockDriver bdrv_host_device =3D { .bdrv_media_changed =3D raw_media_changed, .bdrv_eject =3D raw_eject, .bdrv_set_locked =3D raw_set_locked, - /* generic scsi device */ - .bdrv_ioctl =3D raw_ioctl, }; Index: qemu/hw/scsi-generic.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- qemu.orig/hw/scsi-generic.c 2008-01-23 09:18:17.000000000 +0100 +++ qemu/hw/scsi-generic.c 2008-01-23 09:19:16.000000000 +0100 @@ -15,7 +15,8 @@ #include "block.h" #include "scsi-disk.h" =20 -#ifndef __linux__ +//#ifndef __linux__ +#if 1 =20 SCSIDevice *scsi_generic_init(BlockDriverState *bdrv, int tcq, scsi_completionfn completion, void *opaque)