All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: ronnie sahlberg <ronniesahlberg@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	libvir-list@redhat.com, qemu-devel@nongnu.org,
	Kevin Shanahan <kmshanah@disenchant.net>
Subject: Re: [Qemu-devel] [PATCH] block: Set cdrom device read only flag
Date: Tue, 07 Aug 2012 13:54:50 +0200	[thread overview]
Message-ID: <87fw7ynchh.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: CAN05THQnNEp9f10NHoKJF4fW7H5R++L0kR-3LBgCo0if4N4RnA@mail.gmail.com

ronnie sahlberg <ronniesahlberg@gmail.com> writes:

> Since pretty much every cdrom drive use scsi today,  shouldnt the
> readonly/writeable flag for MMC devices rather
> be done down in the hw/scsi* code rather than the generic block code?

There are two separate things that can be read-only: device models and
BlockDriverStates.  -drive's parameter readonly applies to the top
BlockDriverState.  Some device models default their read-only-ness to
their BlockDriverState's.

Examples:

* Device models ide-cd and scsi-cd are always read-only.  They don't
  care whether the BlockDriverState that backs them is.

* Device model ide-hd is always read-write.  It fails initialization
  when its BlockDriverState is read-only.

* Device model scsi-hd supports both read-only and read-write.  It's
  read-only iff its BlockDriverState is.

* -drive if={ide,scsi},media=cdrom implies readonly=on, and creates an
   {ide,scsi}-cd device.

* -drive if={ide,scsi},media=disk creates an {ide,scsi}-hd device
   (media=disk is the default).

* -drive without readonly=on fails when the image isn't writable.

> If/when/ever I get enough time I would like to port the writeable
> dvd+r emulation I wrote for STGT to qemu.
>
>
> In STGT, MMC/DVD devices can be either read-only or read-write.
> If the filesize for the backing file is >0 bytes, it is assumed the
> file is an iso image and that the file is a read-only iso image.
> If filesize is ==0, then the file is opened read-write and is treated
> as a "blank dvd+r disk that the initiator can write/burn to"

I doubt keying on the backing file size is a good idea, too obscure.
Why would keying on the BlockDriverState's read-only-ness not work?

  reply	other threads:[~2012-08-07 11:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-02  1:32 [Qemu-devel] [PATCH] block: Set cdrom device read only flag Kevin Shanahan
2012-08-02  2:16 ` Kevin Shanahan
2012-08-02  5:19   ` Kevin Shanahan
2012-08-02  7:20     ` Kevin Shanahan
2012-08-06 10:07       ` Kevin Wolf
2012-08-07  8:47         ` Markus Armbruster
2012-08-07  9:46           ` ronnie sahlberg
2012-08-07 11:54             ` Markus Armbruster [this message]
2012-08-09  8:42           ` Kevin Wolf
2012-08-12  2:48             ` Kevin Shanahan
2012-08-13  7:54               ` Kevin Wolf
2012-08-13 11:57                 ` Markus Armbruster
2012-08-13 13:20                   ` Kevin Wolf
2012-09-20  8:22                 ` Kevin Wolf

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=87fw7ynchh.fsf@blackfin.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=kmshanah@disenchant.net \
    --cc=kwolf@redhat.com \
    --cc=libvir-list@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 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.