Il 14/12/2012 15:19, Gerd Hoffmann ha scritto:
>   Hi,
> 
>>> ... are you passing a file descriptor for a pipe, a file or a
>>> parallel/serial port?
>>
>> The open function of the file-based backends basically do (1) create
>> file handles and (2) call qemu_chr_open_fd().

Right, and there's the ugliness where you can only specify an output
file, not an input.

>> So of you already have an
>> fd the differences are gone.  Well, almost.  tty has an special ioctl
>> callback to configure line speed.

What about this then:

{ 'union': 'ChardevFileSource',
  'data': {'path': 'str', 'fd': 'str'} }

{ 'type': 'ChardevFile',
  'data': {'*in': 'ChardevFileSource', '*out': 'ChardevFileSource'} }

{ 'enum': 'ChardevPortKind',
  'data': ['serial', 'parallel'] }

{ 'type': 'ChardevPort',
  'data': {'device': 'ChardevFileSource', 'type': 'ChardevPortKind'} }

{ 'type': 'ChardevSpice',
  'data': {'name': 'str', '*debug': 'bool'}}

{ 'type': 'ChardevVC',
  'data': {'*width': 'int', '*height': 'int',
           '*cols': 'int', '*rows': 'int'}}

{ 'type': 'ChardevSocket',
  'data': {'addr': 'SocketAddress', '*server': 'bool',
           '*wait': 'bool', '*nodelay': 'bool', '*telnet': 'bool'} }

{ 'type': 'ChardevUDP',
  'data': {'peer': 'SocketAddress',
           '*localhost': 'str', '*localport': 'str' } }

# For future extensibility...
{ 'ChardevDummy', 'data': {} }

{ 'union': 'ChardevBackend', 'data': {
  'socket': 'ChardevSocket',
  'winpipe': 'String',        # "pipe" for _WIN32 case
  'udp': 'ChardevUDP',
  'file': 'ChardevFile',
  'port': 'ChardevPort',
  'pty': 'ChardevDummy',
  'null': 'ChardevDummy',
  'msmouse': 'ChardevDummy',
  'braille': 'ChardevDummy',
  'stdio': 'ChardevDummy',
  'vc': 'ChardevVC',

  # Solely for HMP usage.
  'legacy': 'str'
}

> Also you might want to pass in a socket fd ...

This is already supported by socket_connect/socket_listen in
qemu-sockets.c (thus by the SocketAddress QAPI union).

Paolo

> So I really think a -chardev
> fd,type={listening-stream-socket,connected-stream-socket,datagram-socket,tty,fd-readwrite,fd-writeonly}
> (+ QMP for that) will be more useful.


> cheers,
>   Gerd
> 


Reply via email to