qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Ronnie Sahlberg <ronniesahlberg@gmail.com>
Subject: Re: [Qemu-devel] Curious about relaxation of bdrv_is_sg() for scsi-generic
Date: Mon, 15 Apr 2013 15:08:17 +0200	[thread overview]
Message-ID: <516BFBC1.4000701@redhat.com> (raw)
In-Reply-To: <87y5ckx8xs.fsf@blackfin.pond.sub.org>

Il 15/04/2013 14:41, Markus Armbruster ha scritto:
> Commit 9839245 "ISCSI: Add SCSI passthrough via scsi-generic to
> libiscsi" contains this hunk:
> 
> diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
> index d856d23..8d51060 100644
> --- a/hw/scsi-generic.c
> +++ b/hw/scsi-generic.c
> @@ -400,12 +400,6 @@ static int scsi_generic_initfn(SCSIDevice *s)
>          return -1;
>      }
>  
> -    /* check we are really using a /dev/sg* file */
> -    if (!bdrv_is_sg(s->conf.bs)) {
> -        error_report("not /dev/sg*");
> -        return -1;
> -    }
> -
>      if (bdrv_get_on_error(s->conf.bs, 0) != BLOCK_ERR_STOP_ENOSPC) {
>          error_report("Device doesn't support drive option werror");
>          return -1;
> 
> Why could we relax the "must be sg" requirement here?  I know it's been
> a while...

It's for two reasons.

First, and related to this patch, because an iscsi://foo/bar device now
can be used for scsi-generic too.  Then you can use libiscsi to connect
to a tape or media changer.

Second, simply because it was an artificial restriction.  You can use
scsi-generic with disks or CD-ROMs, and it is much simpler to use
/dev/sda or /dev/sr0 than to figure out what is the matching /dev/sgN
character device.

The important test is not on the path.  It is done a few lines below:

    if (bdrv_ioctl(s->conf.bs, SG_GET_VERSION_NUM, &sg_version) < 0) {
        error_report("scsi generic interface not supported");
        return -1;
    }

Paolo

      reply	other threads:[~2013-04-15 13:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15 12:41 [Qemu-devel] Curious about relaxation of bdrv_is_sg() for scsi-generic Markus Armbruster
2013-04-15 13:08 ` Paolo Bonzini [this message]

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=516BFBC1.4000701@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ronniesahlberg@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).