[libvirt] [PATCH] build: check for virnetprotocol on-the-wire stability

Similar to the recent qemu_protocol-structs addition. * src/virnetprotocol-structs: New file. * src/Makefile.am (%_protocol-structs): Factor body... (PDWTAGS): ...into new helper macro. (virnetprotocol-structs): New rule. (PROTOCOL_STRUCTS): Add virnetprotocol-structs. --- In reply to: https://www.redhat.com/archives/libvir-list/2011-July/msg00602.html src/Makefile.am | 24 +++++++++++++++--------- src/virnetprotocol-structs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 src/virnetprotocol-structs diff --git a/src/Makefile.am b/src/Makefile.am index 39f0cf8..d19d1ca 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -212,18 +212,12 @@ EXTRA_DIST += $(REMOTE_DRIVER_PROTOCOL) \ r1 = (?:/\* \d+ \*/\n)? r2 = /\* <[[:xdigit:]]+> \S+:\d+ \*/ -PROTOCOL_STRUCTS = \ - $(srcdir)/remote_protocol-structs \ - $(srcdir)/qemu_protocol-structs -if WITH_REMOTE -# The .o file that pdwtags parses is created as a side effect of running -# libtool; but from make's perspective we depend on the .lo file. -%_protocol-structs: libvirt_driver_remote_la-%_protocol.lo +PDWTAGS = \ $(AM_V_GEN)if (pdwtags --help) > /dev/null 2>&1; then \ pdwtags --verbose $(<:.lo=.$(OBJEXT)) \ | perl -0777 -n \ -e 'foreach my $$p (split m!\n\n$(r1)$(r2)\n!) {' \ - -e ' if ($$p =~ /^struct (remote|qemu)_/) {' \ + -e ' if ($$p =~ /^struct (remote_|qemu_|virNet)/) {' \ -e ' $$p =~ s!\t*/\*.*?\*/!!sg;' \ -e ' $$p =~ s!\s+\n!\n!sg;' \ -e ' $$p =~ s!\s+$$!!;' \ @@ -250,10 +244,22 @@ if WITH_REMOTE echo 'WARNING: you lack pdwtags; skipping the $@ test' >&2; \ echo 'WARNING: install the dwarves package to get pdwtags' >&2; \ fi + +PROTOCOL_STRUCTS = \ + $(srcdir)/remote_protocol-structs \ + $(srcdir)/qemu_protocol-structs \ + $(srcdir)/virnetprotocol-structs +if WITH_REMOTE +# The .o file that pdwtags parses is created as a side effect of running +# libtool; but from make's perspective we depend on the .lo file. +$(srcdir)/%_protocol-structs: libvirt_driver_remote_la-%_protocol.lo + $(PDWTAGS) +$(srcdir)/virnetprotocol-structs: libvirt_net_rpc_la-virnetprotocol.lo + $(PDWTAGS) else !WITH_REMOTE # These generated files must live in git, because they cannot be re-generated # when configured --without-remote. -$(srcdir)/%_protocol-structs: +$(PROTOCOL_STRUCTS): endif EXTRA_DIST += $(PROTOCOL_STRUCTS) check-local: $(PROTOCOL_STRUCTS) diff --git a/src/virnetprotocol-structs b/src/virnetprotocol-structs new file mode 100644 index 0000000..1ee2c6d --- /dev/null +++ b/src/virnetprotocol-structs @@ -0,0 +1,31 @@ +/* -*- c -*- */ +struct virNetMessageHeader { + u_int prog; + u_int vers; + int proc; + virNetMessageType type; + u_int serial; + virNetMessageStatus status; +}; +struct virNetMessageNonnullDomain { + virNetMessageNonnullString name; + virNetMessageUUID uuid; + int id; +}; +struct virNetMessageNonnullNetwork { + virNetMessageNonnullString name; + virNetMessageUUID uuid; +}; +struct virNetMessageError { + int code; + int domain; + virNetMessageString message; + int level; + virNetMessageDomain dom; + virNetMessageString str1; + virNetMessageString str2; + virNetMessageString str3; + int int1; + int int2; + virNetMessageNetwork net; +}; -- 1.7.4.4

2011/7/13 Eric Blake <eblake@redhat.com>:
Similar to the recent qemu_protocol-structs addition.
* src/virnetprotocol-structs: New file. * src/Makefile.am (%_protocol-structs): Factor body... (PDWTAGS): ...into new helper macro. (virnetprotocol-structs): New rule. (PROTOCOL_STRUCTS): Add virnetprotocol-structs. ---
In reply to: https://www.redhat.com/archives/libvir-list/2011-July/msg00602.html
src/Makefile.am | 24 +++++++++++++++--------- src/virnetprotocol-structs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 src/virnetprotocol-structs
Tested, works, ACK. -- Matthias Bolte http://photron.blogspot.com

On 07/14/2011 09:19 AM, Matthias Bolte wrote:
2011/7/13 Eric Blake <eblake@redhat.com>:
Similar to the recent qemu_protocol-structs addition.
* src/virnetprotocol-structs: New file. * src/Makefile.am (%_protocol-structs): Factor body... (PDWTAGS): ...into new helper macro. (virnetprotocol-structs): New rule. (PROTOCOL_STRUCTS): Add virnetprotocol-structs. ---
In reply to: https://www.redhat.com/archives/libvir-list/2011-July/msg00602.html
src/Makefile.am | 24 +++++++++++++++--------- src/virnetprotocol-structs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 src/virnetprotocol-structs
Tested, works, ACK.
Thanks; pushed. Hmm, on looking further, I wonder if we need to also include enums in the *protocol-structs files. It looks odd seeing virNetMessageType used as a field member with no prior declaration - meaning that if someone botches the enum type, we won't catch that botch. I'll see about a followup patch. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Matthias Bolte