qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] fw_cfg: insert string blobs via qemu cmdline


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] fw_cfg: insert string blobs via qemu cmdline
Date: Mon, 28 Sep 2015 14:00:05 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

On 09/28/2015 01:51 PM, Gabriel L. Somlo wrote:
> On Mon, Sep 28, 2015 at 01:46:33PM -0600, Eric Blake wrote:
>> On 09/28/2015 07:30 AM, Laszlo Ersek wrote:
>>
>>>>  
>>>> +Small enough items may be provided directly as strings on the command
>>>> +line, using the syntax:
>>>> +
>>>> +    -fw_cfg [name=]<item_name>,content=<string>
>>>> +
>>>
>>> Please consider spelling out that these blobs will NOT be NUL-terminated
>>> when viewed on the guest. (It kinda follows from all the other fw_cfg
>>> things, but once we leave host-side files for qemu command line strings,
>>> it might become non-obvious to users.)
>>
>> Or else GUARANTEE that it will be NUL-terminated (and the only way to
>> get blobs that are not NUL terminated is to use files rather than content=).
> 
> I went with the first suggestion (leave out the trailing '\0' from the
> blob payload, and say so in docs/specs/fw_cfg.txt) in v2 of the patch.
> 
> Do you feel strongly about including the \0 ? Otherwise, we're already
> there :)

I don't know what users are more likely to want to push through. A
trailing NUL implies a binary file (as text files cannot contain \0),
but even without a trailing NUL, a file is not a text file (per the
POSIX definition) unless it is either empty or ends in a newline.  Use
of content=... is unlikely to have users remembering to place a newline
there if examples don't suggest it.  And I don't know if guests are
expecting text data from these blobs, or are okay with binary blobs.

That's a long-winded way of stating that omitting the NUL is fine by me,
as long as you document it, and as long as you are catering to the most
common user usage of the feature.

Either that, or it's my way of dreaming about alternative 3: guarantee a
trailing newline (rather than NUL), so that 'content="abc"' on the
command line results in the 4-byte blob "abc\n" in the guest.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]