All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] SCSI passthrough: DVD support
Date: Sun, 06 Jan 2008 19:47:51 +0100	[thread overview]
Message-ID: <47812257.5030408@bellard.org> (raw)
In-Reply-To: <E1JBZrc-0004os-8g@frecb07144>

Can you explain why you use the block layer (block-raw-posix.c) to send
your low level SCSI commands ? I suggest to remove your patches to
block-raw-posix.c and to implement all the SCSI passthough in
scsi-generic.c.

Regards,

Fabrice.

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
> 
> 
> 
> 

  reply	other threads:[~2008-01-06 18:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-06 18:04 [Qemu-devel] [PATCH] SCSI passthrough: DVD support Laurent Vivier
2008-01-06 18:47 ` Fabrice Bellard [this message]
2008-01-06 19:22   ` Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47812257.5030408@bellard.org \
    --to=fabrice@bellard.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.