Received: from eggs.gnu.org ([2001:4830:134:3::10]:46643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2OoE-0005DU-Oh for qemu-devel@nongnu.org; Fri, 27 Nov 2015 14:35:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2OoA-0001IE-My for qemu-devel@nongnu.org; Fri, 27 Nov 2015 14:35:54 -0500 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: <5656892E.9020908@redhat.com> Date: Fri, 27 Nov 2015 14:35:46 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <2BF45FF0-31E6-4901-B4B5-90FF3D672C70@gmail.com> References: <5656892E.9020908@redhat.com> Subject: Re: [Qemu-devel] [PATCH v9] block/raw-posix.c: Make physical devices usable in QEMU under Mac OS X host List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Kevin Wolf , qemu-devel qemu-devel , Qemu-block On Nov 25, 2015, at 11:23 PM, Eric Blake wrote: > On 11/25/2015 09:10 PM, Programmingkid wrote: >> Mac OS X can be picky when it comes to allowing the user >> to use physical devices in QEMU. Most mounted volumes >> appear to be off limits to QEMU. If an issue is detected, >> a message is displayed showing the user how to unmount a >> volume. >>=20 >> Signed-off-by: John Arbuckle >>=20 >> --- >> Added DVD support - real DVD media can now be used in QEMU! >> Changed name of FindEjectableCDMedia to FindEjectableOpticalMedia. >> Added mediaType parameter to FindEjectableOpticalMedia() for media = indentification. >> Removed unneeded FindEjectableCDMedia() prototype. >> FindEjectableOpticalMedia() now searches for both DVD's and CD's. >>=20 >=20 >> +++ b/block/raw-posix.c >> @@ -42,9 +42,9 @@ >> #include >> #include >> #include >> -//#include >> +#include >> #include >> -#endif >> +#endif /* (__APPLE__) && (__MACH__) */ >>=20 >=20 > I don't know if my review of v8 crossed your posting of this patch, = but > I suggested that this hunk belongs in its own patch. It is now a related change that the code in the patch depends on. >=20 >> #ifdef __sun__ >> #define _POSIX_PTHREAD_SEMANTICS 1 >> @@ -1975,32 +1975,44 @@ BlockDriver bdrv_file =3D { >> /* host device */ >>=20 >> #if defined(__APPLE__) && defined(__MACH__) >> -static kern_return_t FindEjectableCDMedia( io_iterator_t = *mediaIterator ); >> static kern_return_t GetBSDPath(io_iterator_t mediaIterator, char = *bsdPath, >> CFIndex maxPathSize, int flags); >> -kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator ) >> +static kern_return_t FindEjectableOpticalMedia(io_iterator_t = *mediaIterator, >> + char = *mediaType) >=20 > Unusual indentation; more typical is: >=20 > | static kern_return_t FindEjectableOpticalMedia(io_iterator_t > *mediaIterator, > | char *mediatType) I agree. I wanted the second long to be right justified with the 80 = character line count. >=20 >=20 >> + int index; >> + for (index =3D 0; index < ARRAY_SIZE(matching_array); index++) { >> + classesToMatch =3D IOServiceMatching(matching_array[index]); >> + if (classesToMatch =3D=3D NULL) { >> + printf("IOServiceMatching returned a NULL = dictionary.\n"); >=20 > Leftover debugging? It is actually how the function was originally written. It probably = needs to be improved. Should I replace printf() with error_report()? >=20 >> + } else { >> + CFDictionarySetValue(classesToMatch, = CFSTR(kIOMediaEjectableKey), >=20 > Missing indentation. Fixed in the next patch. >=20 >> + = kCFBooleanTrue); >> + } >> + kernResult =3D IOServiceGetMatchingServices(masterPort, = classesToMatch, >> + = mediaIterator); >=20 > More unusual indentation. Fixed in the next patch.=20 >=20 >> + if (KERN_SUCCESS !=3D kernResult) { >> + printf("IOServiceGetMatchingServices returned %d\n", = kernResult); >> + } >>=20 >> + /* If you found a match, leave the loop */ >> + if (*mediaIterator !=3D 0) { >> + DPRINTF("Matching using %s\n", matching_array[index]); >> + snprintf(mediaType, strlen(matching_array[index])+1, = "%s", >=20 > Spaces around binary '+'. What's wrong with no spaces around the plus sign? >=20 >> + /* if a working partition on the device was not found */ >> + if (partition_found =3D=3D false) { >> + error_setg(errp, "Error: Failed to find a working partition = on " >> + = "disc!\n"); >=20 > and I already pointed out on v8 that this is not the correct usage of > error_setg(). So, here's hoping v10 addresses the comments here and > elsewhere. Kevin Wolf wanted it this way. What would you do instead? >=20 > --=20 > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org >=20 Thank you very much for reviewing my patches.=