qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, crosa@redhat.com
Subject: [Qemu-devel] marking SCM_RIGHTS qapi commands [was: [PATCH] tests/qmp-test: Add generic, basic test of query commands]
Date: Fri, 11 Aug 2017 09:48:32 -0500	[thread overview]
Message-ID: <d96352cf-3c43-b453-7f09-5576e8863205@redhat.com> (raw)
In-Reply-To: <87shgy4gl8.fsf@dusky.pond.sub.org>

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

On 08/11/2017 04:08 AM, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
> 
>> On 08/10/2017 01:30 PM, Markus Armbruster wrote:
>>> A command is a query if it has no side effect and yields a result.
>>> Such commands are typically named query-FOO, but there are exceptions.
>>>
>>> The basic idea is to find candidates with query-qmp-schema, filter out
>>> the ones that aren't queries with an explicit blacklist, and test the
>>> remaining ones against a QEMU with no special arguments.
>>>
>>> The current blacklist is just add-fd.
>>
>> I guess this is because it has no mandatory parameters.  Hmm - I wonder
>> if introspection should flag WHICH commands require an fd over SCM
>> rights (I guess just add-fd)
> 
> Actually, add-fd and getfd.

> 
> An obvious alternative is of course adding another optional member to
> the command object, say a flag "takes file descriptors via SCM_RIGHTS".
> Do we need to express the number of file descriptors it takes?  The
> underlying infrastructure supports several (TCP_MAX_FDS in
> char-socket.c), but the existing commands take just one.

Yeah, I was definitely leaning towards an additional annotation - maybe
where the .json file has:

{ 'command': 'add-fd', 'data': {'*fdset-id': 'int', '*opaque': 'str'},
  'fds': 1, 'returns': 'AddfdInfo' }

where the new 'fds' is what designates that the command expects to
consume 1 fd by SCM_RIGHTS (defaults to 0 when not present, and could be
larger than one if a command is ever designed to take multiple fds in
one go - although I find SCM_RIGHTS tricky enough with 1 fd that passing
multiple is probably not necessary, so maybe false/true is better than
int).  The introspection output would similarly expose the same optional
member for each command object, repeating what was present in the .json
file.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

  reply	other threads:[~2017-08-11 14:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-10 18:30 [Qemu-devel] [PATCH] tests/qmp-test: Add generic, basic test of query commands Markus Armbruster
2017-08-10 18:47 ` Eric Blake
2017-08-11  9:08   ` Markus Armbruster
2017-08-11 14:48     ` Eric Blake [this message]
2017-09-01 13:55     ` Thomas Huth
2017-09-01 14:33       ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d96352cf-3c43-b453-7f09-5576e8863205@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=crosa@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).