All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>,
	Programmingkid <programmingkidx@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	Qemu-block <qemu-block@nongnu.org>,
	qemu-devel qemu-devel <qemu-devel@nongnu.org>,
	Paolo Bonzini <pbonzini@redhat.com>, John Snow <jsnow@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] raw-posix.c: remove raw device access for cdrom
Date: Thu, 02 Jul 2015 14:24:55 +0200	[thread overview]
Message-ID: <55952D97.7040009@redhat.com> (raw)
In-Reply-To: <CAJSP0QX2VOBPx=vGQVsJ+Ci8iw4k+nP9ggjivrX0xD4jaKKXKg@mail.gmail.com>



On 02/07/2015 13:14, Stefan Hajnoczi wrote:
> On Wed, Jul 1, 2015 at 11:13 PM, Programmingkid
> <programmingkidx@gmail.com> wrote:
>> Fix real cdrom access in Mac OS X so it can be used in QEMU.
>> It simply removes the r from a device file's name. This
>> allows for a real cdrom to be accessible to the guest.
>> It has been successfully tested with a Windows XP guest
>> in qemu-system-i386. The qemu-system-ppc emulator doesn't
>> quit anymore, but there is another problem that prevents a
>> real cdrom from working.
>>
>> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
>>
>> ---
>>  block/raw-posix.c |   10 ++++++++++
>>  1 files changed, 10 insertions(+), 0 deletions(-)
>>
>> diff --git a/block/raw-posix.c b/block/raw-posix.c
>> index a967464..3585ed9 100644
>> --- a/block/raw-posix.c
>> +++ b/block/raw-posix.c
>> @@ -2096,6 +2096,16 @@ static int hdev_open(BlockDriverState *bs, QDict
>> *options, int flags,
>>          kernResult = FindEjectableCDMedia( &mediaIterator );
>>          kernResult = GetBSDPath( mediaIterator, bsdPath, sizeof( bsdPath )
>> );
>>
>>
>>
>> +        /*
>> +         * Remove the r from cdrom block device if needed.
>> +         * /dev/rdisk1 would become /dev/disk1.
>> +         * The r means raw access. It doesn't work well.
>> +         */
>> +        int sizeOfString = strlen("/dev/r");
>> +        if (strncmp("/dev/r", bsdPath, sizeOfString) == 0) {
>> +            sprintf(bsdPath, "/dev/%s", bsdPath + sizeOfString);
>> +        }
> 
> Why doesn't raw access "work well"?
> 
> This patch looks like a workaround but you haven't identified the root cause.
> 
> Perhaps because of request alignment requirements?  Typically CD-ROMs
> have 2 KB block size.  You could test this by changing the following
> in block_int.h:
> #define BLOCK_PROBE_BUF_SIZE        512
> 
> In that case you need to fix raw-posix.c alignment detection code for
> Mac OS X.  Look at raw_probe_alignment().

I agree with that, I think we need "s->needs_alignment = true".

So in raw_open_common() change "#ifdef __FreeBSD__" by "#ifdef
CONFIG_BSD" in:

#ifdef __FreeBSD__
    if (S_ISCHR(st.st_mode)) {
        /*
         * The file is a char device (disk), which on FreeBSD isn't behind
         * a pager, so force all requests to be aligned. This is needed
         * so QEMU makes sure all IO operations on the device are aligned
         * to sector size, or else FreeBSD will reject them with EINVAL.
         */
        s->needs_alignment = true;
    }
#endif

Laurent

  reply	other threads:[~2015-07-02 12:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01 22:13 [Qemu-devel] [PATCH] raw-posix.c: remove raw device access for cdrom Programmingkid
2015-07-01 22:32 ` M A
2015-07-02  7:18 ` Paolo Bonzini
2015-07-02  7:39   ` Laurent Vivier
2015-07-02  7:54     ` Paolo Bonzini
2015-07-02 11:14 ` Stefan Hajnoczi
2015-07-02 12:24   ` Laurent Vivier [this message]
2015-07-02 13:47     ` Paolo Bonzini
2015-07-02 13:58       ` Laurent Vivier
2015-07-02 14:03         ` Paolo Bonzini
2015-07-02 14:18           ` Laurent Vivier
2015-07-02 14:20             ` Paolo Bonzini
2015-07-02 14:33               ` Laurent Vivier
2015-07-02 23:19                 ` Programmingkid
2015-07-03  0:46                 ` [Qemu-devel] [PATCH v2] " Programmingkid
2015-07-08 10:31             ` [Qemu-devel] [PATCH] " Kevin Wolf
2015-07-08 10:47               ` Laurent Vivier
2015-07-08 11:01                 ` Kevin Wolf
2015-07-08 12:56                   ` Programmingkid
2015-07-08 13:11                     ` Kevin Wolf
2015-07-08 13:14                       ` Programmingkid
2015-07-08 12:59                   ` Laurent Vivier
     [not found]   ` <33C18758-309D-4A09-8276-31641B63B963@gmail.com>
     [not found]     ` <CAJSP0QWrh0qcX9u9iYVfCJrtgh9w0Aw4dW9jUTQRXhrBoseC2g@mail.gmail.com>
     [not found]       ` <6FE80FDC-996C-45B6-B5F8-F4F16A10F396@gmail.com>
     [not found]         ` <CAJSP0QW9SOLM2+UQW0bV4rr407XWmdNp6VFBaUabx14_iM5xPQ@mail.gmail.com>
     [not found]           ` <A36B6438-BC34-4C2A-B8CA-8EDFB9747AF3@gmail.com>
2015-07-07  8:05             ` Stefan Hajnoczi

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=55952D97.7040009@redhat.com \
    --to=lvivier@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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.