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

[libvirt] [PATCH 00/22] Extend remote generator to generate function bodies too



Richard W.M. Jones suggested [1] that the code that directly deals with the
XDR protocol should be generated. The remote_generate_stubs.pl script
already generates all the headers, just the bodies in the daemon and remote
driver are manually written. But most of the functions just follow simple
patterns. So I extended the generator to exploit this patterns and move
11 kLOC code from manually written to generated code.

During this I came a cross many small variations and problems in the XDR
protocol. For example, NWFilterDefineXML has a flags parameter in the public
API, but it's not transferred in the XDR protocol. Another things is the
variations in the usage of unsigned VS signed types. This comes in two forms.
public API VS XDR procotol and in between different functions. For example,
some functions use int for the flags paramater and some use unsigned int.

This results in quite a lot of special case handling in the generator.

 cfg.mk                              |   10 +-
 daemon/Makefile.am                  |   46 +-
 daemon/qemu_dispatch_args.h         |    2 +-
 daemon/qemu_dispatch_bodies.c       |    6 +
 daemon/qemu_dispatch_prototypes.h   |    2 +-
 daemon/qemu_dispatch_ret.h          |    2 +-
 daemon/qemu_dispatch_table.h        |    2 +-
 daemon/remote.c                     | 5765 +----------------------------------
 daemon/remote_dispatch_args.h       |    2 +-
 daemon/remote_dispatch_bodies.c     | 5933 +++++++++++++++++++++++++++++++++++
 daemon/remote_dispatch_prototypes.h |   80 +-
 daemon/remote_dispatch_ret.h        |    2 +-
 daemon/remote_dispatch_table.h      |  158 +-
 daemon/remote_generate_stubs.pl     |  195 --
 daemon/remote_generator.pl          | 1198 +++++++
 po/POTFILES.in                      |    1 +
 src/Makefile.am                     |   13 +-
 src/remote/qemu_client_bodies.c     |    4 +
 src/remote/qemu_protocol.c          |    2 +-
 src/remote/qemu_protocol.h          |    2 +-
 src/remote/qemu_protocol.x          |    2 +-
 src/remote/remote_client_bodies.c   | 4664 +++++++++++++++++++++++++++
 src/remote/remote_driver.c          | 4907 +----------------------------
 src/remote/remote_protocol.c        |   26 +-
 src/remote/remote_protocol.h        |   26 +-
 src/remote/remote_protocol.x        |   34 +-
 src/remote_protocol-structs         |   26 +-
 27 files changed, 12093 insertions(+), 11017 deletions(-)

[1] https://www.redhat.com/archives/libvir-list/2011-April/msg00884.html

Matthias


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