qapi: Flatten away ChardevPort
Simplifies the schema and the code.
QMP command
{ "execute" : "chardev-add",
"arguments" : { "id" : "ser0",
"backend" : { "type" : "port",
"data" : { "type": "serial",
"device":"/dev/ttyS0"} } } }
becomes
{ "execute" : "chardev-add",
"arguments" : { "id" : "ser0",
"backend" : { "type" : "serial",
"data" : { "device":"/dev/ttyS0"} } } }
Bonus: nicer error messages. "unknown chardev port (1)" becomes
"character device backend type 'parallel' not supported".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1360767256-610-3-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/qapi-schema.json b/qapi-schema.json
index bd289ae..7275b5d 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3095,7 +3095,7 @@
'out' : 'str' } }
##
-# @ChardevPort:
+# @ChardevHostdev:
#
# Configuration info for device chardevs.
#
@@ -3105,11 +3105,7 @@
#
# Since: 1.4
##
-{ 'enum': 'ChardevPortKind', 'data': [ 'serial',
- 'parallel' ] }
-
-{ 'type': 'ChardevPort', 'data': { 'device' : 'str',
- 'type' : 'ChardevPortKind'} }
+{ 'type': 'ChardevHostdev', 'data': { 'device' : 'str' } }
##
# @ChardevSocket:
@@ -3142,7 +3138,8 @@
{ 'type': 'ChardevDummy', 'data': { } }
{ 'union': 'ChardevBackend', 'data': { 'file' : 'ChardevFile',
- 'port' : 'ChardevPort',
+ 'serial' : 'ChardevHostdev',
+ 'parallel': 'ChardevHostdev',
'socket' : 'ChardevSocket',
'pty' : 'ChardevDummy',
'null' : 'ChardevDummy' } }