Received: from eggs.gnu.org ([2001:4830:134:3::10]:59232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCotr-0006ox-Bx for qemu-devel@nongnu.org; Wed, 08 Jul 2015 08:56:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCoti-00018B-Ab for qemu-devel@nongnu.org; Wed, 08 Jul 2015 08:56:31 -0400 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: <20150708110140.GF4117@noname.redhat.com> Date: Wed, 8 Jul 2015 08:56:18 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: References: <55952D97.7040009@redhat.com> <559540F6.9090800@redhat.com> <55954384.9010906@redhat.com> <559544C4.4050809@redhat.com> <55954836.3060700@redhat.com> <20150708103125.GE4117@noname.redhat.com> <559CFFDD.3000704@redhat.com> <20150708110140.GF4117@noname.redhat.com> Subject: Re: [Qemu-devel] [PATCH] raw-posix.c: remove raw device access for cdrom List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Laurent Vivier , Peter Maydell , Qemu-block , Stefan Hajnoczi , qemu-devel qemu-devel , Paolo Bonzini , John Snow On Jul 8, 2015, at 7:01 AM, Kevin Wolf wrote: > Am 08.07.2015 um 12:47 hat Laurent Vivier geschrieben: >>=20 >>=20 >> On 08/07/2015 12:31, Kevin Wolf wrote: >>> Am 02.07.2015 um 16:18 hat Laurent Vivier geschrieben: >>>>=20 >>>>=20 >>>> On 02/07/2015 16:03, Paolo Bonzini wrote: >>>>>=20 >>>>>=20 >>>>> On 02/07/2015 15:58, Laurent Vivier wrote: >>>>>> Since any /dev entry can be treated as a raw disk image, it is = worth >>>>>> noting which devices can be accessed when and how. /dev/rdisk = nodes are >>>>>> character-special devices, but are "raw" in the BSD sense and = force >>>>>> block-aligned I/O. They are closer to the physical disk than the = buffer >>>>>> cache. /dev/disk nodes, on the other hand, are buffered = block-special >>>>>> devices and are used primarily by the kernel's filesystem code. >>>>>=20 >>>>> So the right thing to do would not be just to set need_alignment, = but to >>>>> probe it like we do on Linux for BDRV_O_NO_CACHE. >>>>>=20 >>>>> I'm okay with doing the simple thing, but it needs a comment for = non-BSDers. >>>>=20 >>>> So, what we have to do, in our case, for MacOS X cdrom, is = something like: >>>>=20 >>>> ... GetBSDPath ... >>>> ... >>>> if (flags & BDRV_O_NOCACHE) { >>>> strcat(bsdPath, "r"); >>>> } >>>> ... >>>=20 >>> I would avoid such magic. What we could do is rejecting /dev/rdisk = nodes >>> without BDRV_O_NOCACHE. >>=20 >> It's not how it works... >>=20 >> Look in hdev_open(). >>=20 >> If user provides /dev/cdrom on the command line, in the case of MacOS = X, >> QEMU searches for a cdrom drive in the system and set filename to >> /dev/rdiskX according to the result. >=20 > Oh, we're already playing such games... I guess you're right then. >=20 > It even seems to be not only for '/dev/cdrom', but for everything > starting with this string. Does anyone know what's the reason for = that? >=20 > Also, I guess before doing strcat() on bsdPath, we should check the > buffer length... By buffer, do you mean the bsdPath variable?=