From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtEAC-00082m-8I for qemu-devel@nongnu.org; Thu, 10 Jan 2013 04:11:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtEAA-0005wn-So for qemu-devel@nongnu.org; Thu, 10 Jan 2013 04:11:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57724) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtEAA-0005wh-JY for qemu-devel@nongnu.org; Thu, 10 Jan 2013 04:11:02 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0A9B18p023177 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 10 Jan 2013 04:11:02 -0500 Message-ID: <50EE85A3.7070708@redhat.com> Date: Thu, 10 Jan 2013 10:10:59 +0100 From: Gerd Hoffmann MIME-Version: 1.0 References: <1357566928-25361-1-git-send-email-kraxel@redhat.com> <1357566928-25361-7-git-send-email-kraxel@redhat.com> <50EDB300.1030601@redhat.com> In-Reply-To: <50EDB300.1030601@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 06/11] chardev: add file chardev support to chardev-add (qmp) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org On 01/09/13 19:12, Eric Blake wrote: > On 01/07/2013 06:55 AM, Gerd Hoffmann wrote: >> Add support for file chardevs. Output file is mandatory, input >> file is optional. Both file names and file descriptor passing is >> supported. >> >> Signed-off-by: Gerd Hoffmann --- >> qapi-schema.json | 9 +++++- qemu-char.c | 77 >> +++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files >> changed, 84 insertions(+), 2 deletions(-) >> >> diff --git a/qapi-schema.json b/qapi-schema.json index >> e3f0d44..8904d36 100644 --- a/qapi-schema.json +++ >> b/qapi-schema.json @@ -3030,9 +3030,16 @@ # # Since: 1.4 ## +{ >> 'union': 'ChardevFileSource', 'data': { 'path' : 'str', + >> 'fd' : 'str' } } + +{ 'type': 'ChardevFile', 'data': { '*in' : >> 'ChardevFileSource', + 'out' : >> 'ChardevFileSource' } } + { 'type': 'ChardevDummy', 'data': { } >> } >> >> -{ 'union': 'ChardevBackend', 'data': { 'null' : 'ChardevDummy' } >> } +{ 'union': 'ChardevBackend', 'data': { 'file' : >> 'ChardevFile', + 'null' : >> 'ChardevDummy' } } >> >> { 'command': 'chardev-add', 'data': {'id' : 'str', 'backend' >> : 'ChardevBackend' } } > > An example in qmp-commands.hx would be helpful; am I correct that > an example would be: > > -> { "execute" : "chardev-add", "arguments" : { "id" : "foo", > "backend" : { "type" : "file", "data" : { "in" : { "type" : "fd", > "data" : "namedfd" }, "out" : { "type" : "path", "data" : > "/path/to/file" } } } } } <- { "return": {} } > > where namedfd was previously given via 'getfd'? Yes. > Do we need the complexity of supporting fd passing explicitly? > 'getfd' is less than ideal compared to 'add-fd', and for 'add-fd', > we would pass via "path":"/dev/fdset/nnn". That is, why do we need > to bend over backwards to support an alternate syntax for fd > passing in a new command, when we can already use existing commands > to get fd passing for free? Oh, didn't know that. Was just following what SocketAddress does and what Paolo suggested. It isn't needed indeed. cheers, Gerd