qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/5] reverse scsi-generic


From: Laurent Vivier
Subject: [Qemu-devel] [PATCH 1/5] reverse scsi-generic
Date: Wed, 23 Jan 2008 17:12:53 +0100

This patch removes modifications in block interface introduced by the 
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
===================================================================
--- 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;
 }
 
-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 = bs->drv;
-
-    if (drv && drv->bdrv_ioctl)
-        return drv->bdrv_ioctl(bs, req, buf);
-    return -ENOTSUP;
-}
Index: qemu/block.h
===================================================================
--- 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 
 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);
 
 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
===================================================================
--- 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);
 
-    /* to control generic scsi devices */
-    int (*bdrv_ioctl)(BlockDriverState *bs, unsigned long int req, void *buf);
-
     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
===================================================================
--- 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;
 
-    if (offset >= 0 && lseek(s->fd, offset, SEEK_SET) == (off_t)-1) {
+    if (lseek(s->fd, offset, SEEK_SET) == (off_t)-1) {
         ++(s->lseek_err_cnt);
         if(s->lseek_err_cnt <= 10) {
             DEBUG_BLOCK_PRINT("raw_pread(%d:%s, %" PRId64 ", %p, %d) [%" PRId64
@@ -204,7 +204,7 @@ static int raw_pwrite(BlockDriverState *
     if (ret < 0)
         return ret;
 
-    if (offset >= 0 && lseek(s->fd, offset, SEEK_SET) == (off_t)-1) {
+    if (lseek(s->fd, offset, SEEK_SET) == (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 = aio_sig_num;
     acb->aiocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
     acb->aiocb.aio_buf = buf;
-    if (nb_sectors < 0)
-        acb->aiocb.aio_nbytes = -nb_sectors;
-    else
-        acb->aiocb.aio_nbytes = nb_sectors * 512;
+    acb->aiocb.aio_nbytes = nb_sectors * 512;
     acb->aiocb.aio_offset = sector_num * 512;
     acb->next = first_aio;
     first_aio = acb;
@@ -682,8 +679,6 @@ static int hdev_open(BlockDriverState *b
         s->fd_open_flags = open_flags;
         /* open will not fail even if no floppy is inserted */
         open_flags |= O_NONBLOCK;
-    } else if (strstart(filename, "/dev/sg", NULL)) {
-        bs->sg = 1;
     }
 #endif
     fd = open(filename, open_flags, 0644);
@@ -863,12 +858,6 @@ static int raw_set_locked(BlockDriverSta
     return 0;
 }
 
-static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
-{
-    BDRVRawState *s = bs->opaque;
-
-    return ioctl(s->fd, req, buf);
-}
 #else
 
 static int raw_is_inserted(BlockDriverState *bs)
@@ -891,10 +880,6 @@ static int raw_set_locked(BlockDriverSta
     return -ENOTSUP;
 }
 
-static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
-{
-    return -ENOTSUP;
-}
 #endif /* !linux */
 
 BlockDriver bdrv_host_device = {
@@ -921,6 +906,4 @@ BlockDriver bdrv_host_device = {
     .bdrv_media_changed = raw_media_changed,
     .bdrv_eject = raw_eject,
     .bdrv_set_locked = raw_set_locked,
-    /* generic scsi device */
-    .bdrv_ioctl = raw_ioctl,
 };
Index: qemu/hw/scsi-generic.c
===================================================================
--- 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"
 
-#ifndef __linux__
+//#ifndef __linux__
+#if 1
 
 SCSIDevice *scsi_generic_init(BlockDriverState *bdrv, int tcq,
                               scsi_completionfn completion, void *opaque)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]