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.
This commit is contained in:
Eric Blake 2011-07-13 09:35:03 -06:00
parent f209333996
commit 3fbc761552
2 changed files with 46 additions and 9 deletions

View File

@ -212,18 +212,12 @@ EXTRA_DIST += $(REMOTE_DRIVER_PROTOCOL) \
r1 = (?:/\* \d+ \*/\n)? r1 = (?:/\* \d+ \*/\n)?
r2 = /\* <[[:xdigit:]]+> \S+:\d+ \*/ r2 = /\* <[[:xdigit:]]+> \S+:\d+ \*/
PROTOCOL_STRUCTS = \ PDWTAGS = \
$(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
$(AM_V_GEN)if (pdwtags --help) > /dev/null 2>&1; then \ $(AM_V_GEN)if (pdwtags --help) > /dev/null 2>&1; then \
pdwtags --verbose $(<:.lo=.$(OBJEXT)) \ pdwtags --verbose $(<:.lo=.$(OBJEXT)) \
| perl -0777 -n \ | perl -0777 -n \
-e 'foreach my $$p (split m!\n\n$(r1)$(r2)\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!\t*/\*.*?\*/!!sg;' \
-e ' $$p =~ s!\s+\n!\n!sg;' \ -e ' $$p =~ s!\s+\n!\n!sg;' \
-e ' $$p =~ s!\s+$$!!;' \ -e ' $$p =~ s!\s+$$!!;' \
@ -250,10 +244,22 @@ if WITH_REMOTE
echo 'WARNING: you lack pdwtags; skipping the $@ test' >&2; \ echo 'WARNING: you lack pdwtags; skipping the $@ test' >&2; \
echo 'WARNING: install the dwarves package to get pdwtags' >&2; \ echo 'WARNING: install the dwarves package to get pdwtags' >&2; \
fi 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 else !WITH_REMOTE
# These generated files must live in git, because they cannot be re-generated # These generated files must live in git, because they cannot be re-generated
# when configured --without-remote. # when configured --without-remote.
$(srcdir)/%_protocol-structs: $(PROTOCOL_STRUCTS):
endif endif
EXTRA_DIST += $(PROTOCOL_STRUCTS) EXTRA_DIST += $(PROTOCOL_STRUCTS)
check-local: $(PROTOCOL_STRUCTS) check-local: $(PROTOCOL_STRUCTS)

View File

@ -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;
};