From: Anthony Liguori <anthony@codemonkey.ws>
To: Naphtali Sprei <nsprei@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block: read-only: open cdrom as read-only when using monitor's change command
Date: Mon, 03 May 2010 13:05:58 -0500 [thread overview]
Message-ID: <4BDF1086.7030606@codemonkey.ws> (raw)
In-Reply-To: <1272213037-30327-1-git-send-email-nsprei@redhat.com>
On 04/25/2010 11:30 AM, Naphtali Sprei wrote:
> Current code of monitor command: 'change', used to open file for read-write
> uncoditionally. Change to open it as read-only for CDROM, and read-write for all others.
>
> Signed-off-by: Naphtali Sprei<nsprei@redhat.com>
>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
> monitor.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index c25d551..df5a15d 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1083,6 +1083,7 @@ static int do_change_block(Monitor *mon, const char *device,
> {
> BlockDriverState *bs;
> BlockDriver *drv = NULL;
> + int bdrv_flags;
>
> bs = bdrv_find(device);
> if (!bs) {
> @@ -1099,7 +1100,8 @@ static int do_change_block(Monitor *mon, const char *device,
> if (eject_device(mon, bs, 0)< 0) {
> return -1;
> }
> - if (bdrv_open(bs, filename, BDRV_O_RDWR, drv)< 0) {
> + bdrv_flags = bdrv_get_type_hint(bs) == BDRV_TYPE_CDROM ? 0 : BDRV_O_RDWR;
> + if (bdrv_open(bs, filename, bdrv_flags, drv)< 0) {
> qerror_report(QERR_OPEN_FILE_FAILED, filename);
> return -1;
> }
>
prev parent reply other threads:[~2010-05-03 18:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-25 16:30 [Qemu-devel] [PATCH] block: read-only: open cdrom as read-only when using monitor's change command Naphtali Sprei
2010-05-03 18:05 ` Anthony Liguori [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=4BDF1086.7030606@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=nsprei@redhat.com \
--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 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).