On 02/07/2015 16:20, Paolo Bonzini wrote:
>
>
> On 02/07/2015 16:18, Laurent Vivier wrote:
>>>> I'm okay with doing the simple thing, but it needs a comment for
>>>> non-BSDers.
>> So, what we have to do, in our case, for MacOS X cdrom, is something like:
>>
>> ... GetBSDPath ...
>> ...
>> if (flags & BDRV_O_NOCACHE) {
>> strcat(bsdPath, "r");
>> }
>> ...
>>
>> ?
>
> Well, what to do with Mac OS X CD-ROM is another story... Raw access
> "seems not do work well" according to John, so we may have a comment
> there explaining why we're not adding the "r".
I think it doesn't work well because they need to be aligned, and
NOCACHE implies that (with BDRV_O_NOCACHE code will be self explicit :) )
raw_open_common()
if ((bs->open_flags & BDRV_O_NOCACHE) != 0) {
s->needs_alignment = true;
}
and needs_alignment allows to probe alignment (raw_probe_alignment())
> A FIXME comment saying "we should probe for alignment here" would be
> placed where you check S_ISCHR and set need_alignment to true.
It is another case,
in the previous case (MacOS cdrom), user provides "-cdrom /dev/cdrom"
and QEMU extracts /dev/rdiskX (or now /dev/diskX) from the system DB.
In the FreeBSD case, user provides /dev/diskX or /dev/rdiskX, and QEMU
must know if it needs alignment or not. I don't think we need more
comment here.
Laurent