qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] raw-posix.c: remove raw device access for cdrom
@ 2015-07-01 22:13 Programmingkid
  2015-07-01 22:32 ` M A
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Programmingkid @ 2015-07-01 22:13 UTC (permalink / raw)
  To: Stefan Hajnoczi, Peter Maydell, Paolo Bonzini
  Cc: Kevin Wolf, Laurent Vivier, John Snow, qemu-devel qemu-devel,
	Qemu-block

[-- Attachment #1: Type: text/plain, Size: 1445 bytes --]

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);
+        }
+
         if ( bsdPath[ 0 ] != '\0' ) {
             strcat(bsdPath,"s0");
             /* some CDs don't have a partition 0 */
-- 
1.7.5.4


[-- Attachment #2: Type: text/html, Size: 7306 bytes --]

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2015-07-08 13:14 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).