qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] SCSI passthrough: DVD support


From: Laurent Vivier
Subject: Re: [Qemu-devel] [PATCH] SCSI passthrough: DVD support
Date: Sun, 06 Jan 2008 20:22:17 +0100

Le dimanche 06 janvier 2008 à 19:47 +0100, Fabrice Bellard a écrit :
> Can you explain why you use the block layer (block-raw-posix.c) to send
> your low level SCSI commands ? 

only because it uses asynchrones AIO and I don't want to rewrite
block-raw-posix.c for this special case.

> I suggest to remove your patches to

As you want...

> block-raw-posix.c and to implement all the SCSI passthough in
> scsi-generic.c.

and I'll do as you want.

> Regards,
> 
> Fabrice.

Regards,
Laurent

> Laurent Vivier wrote:
> > This patch allows to use SCSI passthrough to read movies from DVD.
> > It has been tested with PowerDVD and XP.
> > 
> > It also introduces some comments in block-raw-posix.c to explain behavior of
> > negative offset and negative nb_sectors.
> > It restores original value of aio_num and aio_threads.
> > 
> > Laurent
> > ---
> >  block-raw-posix.c |    7 +++++--
> >  hw/scsi-generic.c |   14 ++++++++++++--
> >  2 files changed, 17 insertions(+), 4 deletions(-)
> > 
> > Index: qemu/hw/scsi-generic.c
> > ===================================================================
> > --- qemu.orig/hw/scsi-generic.c     2008-01-06 18:43:44.000000000 +0100
> > +++ qemu/hw/scsi-generic.c  2008-01-06 18:55:46.000000000 +0100
> > @@ -44,9 +44,12 @@ do { fprintf(stderr, "scsi-generic: " fm
> >  #include <scsi/sg.h>
> >  #include <scsi/scsi.h>
> >  
> > +#define BLANK 0xa1
> > +#define SEND_KEY 0xa3
> > +#define REPORT_KEY 0xa4
> >  #define LOAD_UNLOAD 0xa6
> > +#define READ_DVD_STRUCTURE 0xad
> >  #define SET_CD_SPEED 0xbb
> > -#define BLANK 0xa1
> >  
> >  #define SCSI_CMD_BUF_SIZE     16
> >  #define SCSI_SENSE_BUF_SIZE 32
> > @@ -166,7 +169,7 @@ static void scsi_command_complete(void *
> >              sense = s->sensebuf[2] & 0x0f;
> >      }
> >  
> > -    DPRINTF("Command complete 0x%p tag=0x%x sense=%d\n", r, r->tag, sense);
> > +    DPRINTF("Command complete %p tag=0x%x sense=%d\n", r, r->tag, sense);
> >      tag = r->tag;
> >      scsi_remove_request(r);
> >      s->completion(s->opaque, SCSI_REASON_DONE, tag, sense);
> > @@ -427,6 +430,12 @@ static int scsi_length(uint8_t *cmd, int
> >      case READ_12:
> >          *len *= blocksize;
> >          break;
> > +  case READ_DVD_STRUCTURE:
> > +  case SEND_KEY:
> > +  case REPORT_KEY:
> > +      *len &= 0xffff;
> > +      break;
> > +
> >      }
> >      return 0;
> >  }
> > @@ -464,6 +473,7 @@ static int is_write(int command)
> >      case MEDIUM_SCAN:
> >      case SEND_VOLUME_TAG:
> >      case WRITE_LONG_2:
> > +    case SEND_KEY:
> >          return 1;
> >      }
> >      return 0;
> > Index: qemu/block-raw-posix.c
> > ===================================================================
> > --- qemu.orig/block-raw-posix.c     2008-01-06 18:43:44.000000000 +0100
> > +++ qemu/block-raw-posix.c  2008-01-06 18:45:38.000000000 +0100
> > @@ -151,6 +151,8 @@ static int raw_pread(BlockDriverState *b
> >      if (ret < 0)
> >          return ret;
> >  
> > +    /* if offset < 0, we don't make lseek() */
> > +
> >      if (offset >= 0 && lseek(s->fd, offset, SEEK_SET) == (off_t)-1) {
> >          ++(s->lseek_err_cnt);
> >          if(s->lseek_err_cnt <= 10) {
> > @@ -276,8 +278,8 @@ void qemu_aio_init(void)
> >             seems to fix the problem. */
> >          struct aioinit ai;
> >          memset(&ai, 0, sizeof(ai));
> > -        ai.aio_threads = 16;
> > -        ai.aio_num = 16;
> > +        ai.aio_threads = 1;
> > +        ai.aio_num = 1;
> >          ai.aio_idle_time = 365 * 100000;
> >          aio_init(&ai);
> >      }
> > @@ -387,6 +389,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, -nb_sectors is a number of bytes */
> >      if (nb_sectors < 0)
> >          acb->aiocb.aio_nbytes = -nb_sectors;
> >      else
> > 
> > 
> > 
> > 
> 
> 
> 
-- 
----------------- address@hidden  ------------------
  "La perfection est atteinte non quand il ne reste rien à
ajouter mais quand il ne reste rien à enlever." Saint Exupéry

Attachment: signature.asc
Description: Ceci est une partie de message numériquement signée


reply via email to

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