[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom |
Date: |
Thu, 2 Jul 2015 09:18:31 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 |
On 02/07/2015 00:13, Programmingkid 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 <address@hidden
> <mailto:address@hidden>>
>
> ---
> 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);
> + }
I think you can just remove the strcat in here:
if ( bsdPathAsCFString ) {
size_t devPathLength;
strcpy( bsdPath, _PATH_DEV );
strcat( bsdPath, "r" );
devPathLength = strlen( bsdPath );
if ( CFStringGetCString( bsdPathAsCFString, bsdPath +
devPathLength, maxPathSize - devPathLength, kCFStringEncodingASCII ) ) {
kernResult = KERN_SUCCESS;
}
CFRelease( bsdPathAsCFString );
So it's still a one-line change. What are the other consequences of
removing the "r"?
Paolo
> if ( bsdPath[ 0 ] != '\0' ) {
> strcat(bsdPath,"s0");
> /* some CDs don't have a partition 0 */
> --
> 1.7.5.4
>
- [Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom, Programmingkid, 2015/07/01
- Re: [Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom, M A, 2015/07/01
- Re: [Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom,
Paolo Bonzini <=
- Re: [Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom, Stefan Hajnoczi, 2015/07/02
- Re: [Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom, Laurent Vivier, 2015/07/02
- Re: [Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom, Paolo Bonzini, 2015/07/02
- Re: [Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom, Laurent Vivier, 2015/07/02
- Re: [Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom, Paolo Bonzini, 2015/07/02
- Re: [Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom, Laurent Vivier, 2015/07/02
- Re: [Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom, Paolo Bonzini, 2015/07/02
- Re: [Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom, Laurent Vivier, 2015/07/02