[PATCH] build: also track RPC on-wire enum values

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

 



As long as we guarantee RPC struct layout stability, we might as
well also guarantee RPC enum value constancy.

* src/Makefile.am (r1, r2, PDWTAGS): Adjust rule to pick up named
and anonymous enums.
* src/remote_protocol-structs: Add enum values.
* src/qemu_protocol-structs: Likewise.
* src/virnetprotocol-structs: Likewise.
---
 src/Makefile.am             |   12 ++-
 src/qemu_protocol-structs   |    4 +
 src/remote_protocol-structs |  245 +++++++++++++++++++++++++++++++++++++++++++
 src/virnetprotocol-structs  |   11 ++
 4 files changed, 267 insertions(+), 5 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index d19d1ca..f528860 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -206,18 +206,20 @@ EXTRA_DIST +=  $(REMOTE_DRIVER_PROTOCOL) \
 # With pdwtags 1.8, --verbose output includes separators like these:
 # /* 93 */
 # /* <0> (null):0 */
-# whereas with pdwtags 1.3, they look like this:
+# with the second line omitted for intrinsic types.
+# Whereas with pdwtags 1.3, they look like this:
 # /* <2d2> /usr/include/libio.h:180 */
 # The concatenation of the following regexps matches both cases.
-r1 = (?:/\* \d+ \*/\n)?
-r2 = /\* <[[:xdigit:]]+> \S+:\d+ \*/
+r1 = (?:/\* \d+ \*/)
+r2 = (?:/\* <[[:xdigit:]]+> \S+:\d+ \*/)

 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_|virNet)/) {'	\
+		-e 'foreach my $$p (split m!\n*($(r1)|$(r2))\n!) {'	\
+		-e '  if ($$p =~ /^(struct|enum) (remote_|qemu_|virNet)/ ||' \
+		-e '      $$p =~ /^enum {/) {' \
 		-e '    $$p =~ s!\t*/\*.*?\*/!!sg;'			\
 		-e '    $$p =~ s!\s+\n!\n!sg;'				\
 		-e '    $$p =~ s!\s+$$!!;'				\
diff --git a/src/qemu_protocol-structs b/src/qemu_protocol-structs
index e284b59..0397471 100644
--- a/src/qemu_protocol-structs
+++ b/src/qemu_protocol-structs
@@ -19,3 +19,7 @@ struct qemu_domain_attach_args {
 struct qemu_domain_attach_ret {
         remote_nonnull_domain      dom;
 };
+enum qemu_procedure {
+        QEMU_PROC_MONITOR_COMMAND = 1,
+        QEMU_PROC_DOMAIN_ATTACH = 2,
+};
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index b2de8e9..221562d 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -1,4 +1,12 @@
 /* -*- c -*- */
+enum {
+        VIR_TYPED_PARAM_INT = 1,
+        VIR_TYPED_PARAM_UINT = 2,
+        VIR_TYPED_PARAM_LLONG = 3,
+        VIR_TYPED_PARAM_ULLONG = 4,
+        VIR_TYPED_PARAM_DOUBLE = 5,
+        VIR_TYPED_PARAM_BOOLEAN = 6,
+};
 struct remote_nonnull_domain {
         remote_nonnull_string      name;
         remote_uuid                uuid;
@@ -50,6 +58,11 @@ struct remote_error {
         int                        int2;
         remote_network             net;
 };
+enum remote_auth_type {
+        REMOTE_AUTH_NONE = 0,
+        REMOTE_AUTH_SASL = 1,
+        REMOTE_AUTH_POLKIT = 2,
+};
 struct remote_vcpu_info {
         u_int                      number;
         int                        state;
@@ -1615,3 +1628,235 @@ struct remote_domain_get_control_info_ret {
         u_int                      details;
         uint64_t                   stateTime;
 };
+enum remote_procedure {
+        REMOTE_PROC_OPEN = 1,
+        REMOTE_PROC_CLOSE = 2,
+        REMOTE_PROC_GET_TYPE = 3,
+        REMOTE_PROC_GET_VERSION = 4,
+        REMOTE_PROC_GET_MAX_VCPUS = 5,
+        REMOTE_PROC_NODE_GET_INFO = 6,
+        REMOTE_PROC_GET_CAPABILITIES = 7,
+        REMOTE_PROC_DOMAIN_ATTACH_DEVICE = 8,
+        REMOTE_PROC_DOMAIN_CREATE = 9,
+        REMOTE_PROC_DOMAIN_CREATE_XML = 10,
+        REMOTE_PROC_DOMAIN_DEFINE_XML = 11,
+        REMOTE_PROC_DOMAIN_DESTROY = 12,
+        REMOTE_PROC_DOMAIN_DETACH_DEVICE = 13,
+        REMOTE_PROC_DOMAIN_GET_XML_DESC = 14,
+        REMOTE_PROC_DOMAIN_GET_AUTOSTART = 15,
+        REMOTE_PROC_DOMAIN_GET_INFO = 16,
+        REMOTE_PROC_DOMAIN_GET_MAX_MEMORY = 17,
+        REMOTE_PROC_DOMAIN_GET_MAX_VCPUS = 18,
+        REMOTE_PROC_DOMAIN_GET_OS_TYPE = 19,
+        REMOTE_PROC_DOMAIN_GET_VCPUS = 20,
+        REMOTE_PROC_LIST_DEFINED_DOMAINS = 21,
+        REMOTE_PROC_DOMAIN_LOOKUP_BY_ID = 22,
+        REMOTE_PROC_DOMAIN_LOOKUP_BY_NAME = 23,
+        REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID = 24,
+        REMOTE_PROC_NUM_OF_DEFINED_DOMAINS = 25,
+        REMOTE_PROC_DOMAIN_PIN_VCPU = 26,
+        REMOTE_PROC_DOMAIN_REBOOT = 27,
+        REMOTE_PROC_DOMAIN_RESUME = 28,
+        REMOTE_PROC_DOMAIN_SET_AUTOSTART = 29,
+        REMOTE_PROC_DOMAIN_SET_MAX_MEMORY = 30,
+        REMOTE_PROC_DOMAIN_SET_MEMORY = 31,
+        REMOTE_PROC_DOMAIN_SET_VCPUS = 32,
+        REMOTE_PROC_DOMAIN_SHUTDOWN = 33,
+        REMOTE_PROC_DOMAIN_SUSPEND = 34,
+        REMOTE_PROC_DOMAIN_UNDEFINE = 35,
+        REMOTE_PROC_LIST_DEFINED_NETWORKS = 36,
+        REMOTE_PROC_LIST_DOMAINS = 37,
+        REMOTE_PROC_LIST_NETWORKS = 38,
+        REMOTE_PROC_NETWORK_CREATE = 39,
+        REMOTE_PROC_NETWORK_CREATE_XML = 40,
+        REMOTE_PROC_NETWORK_DEFINE_XML = 41,
+        REMOTE_PROC_NETWORK_DESTROY = 42,
+        REMOTE_PROC_NETWORK_GET_XML_DESC = 43,
+        REMOTE_PROC_NETWORK_GET_AUTOSTART = 44,
+        REMOTE_PROC_NETWORK_GET_BRIDGE_NAME = 45,
+        REMOTE_PROC_NETWORK_LOOKUP_BY_NAME = 46,
+        REMOTE_PROC_NETWORK_LOOKUP_BY_UUID = 47,
+        REMOTE_PROC_NETWORK_SET_AUTOSTART = 48,
+        REMOTE_PROC_NETWORK_UNDEFINE = 49,
+        REMOTE_PROC_NUM_OF_DEFINED_NETWORKS = 50,
+        REMOTE_PROC_NUM_OF_DOMAINS = 51,
+        REMOTE_PROC_NUM_OF_NETWORKS = 52,
+        REMOTE_PROC_DOMAIN_CORE_DUMP = 53,
+        REMOTE_PROC_DOMAIN_RESTORE = 54,
+        REMOTE_PROC_DOMAIN_SAVE = 55,
+        REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE = 56,
+        REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS = 57,
+        REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS = 58,
+        REMOTE_PROC_GET_HOSTNAME = 59,
+        REMOTE_PROC_SUPPORTS_FEATURE = 60,
+        REMOTE_PROC_DOMAIN_MIGRATE_PREPARE = 61,
+        REMOTE_PROC_DOMAIN_MIGRATE_PERFORM = 62,
+        REMOTE_PROC_DOMAIN_MIGRATE_FINISH = 63,
+        REMOTE_PROC_DOMAIN_BLOCK_STATS = 64,
+        REMOTE_PROC_DOMAIN_INTERFACE_STATS = 65,
+        REMOTE_PROC_AUTH_LIST = 66,
+        REMOTE_PROC_AUTH_SASL_INIT = 67,
+        REMOTE_PROC_AUTH_SASL_START = 68,
+        REMOTE_PROC_AUTH_SASL_STEP = 69,
+        REMOTE_PROC_AUTH_POLKIT = 70,
+        REMOTE_PROC_NUM_OF_STORAGE_POOLS = 71,
+        REMOTE_PROC_LIST_STORAGE_POOLS = 72,
+        REMOTE_PROC_NUM_OF_DEFINED_STORAGE_POOLS = 73,
+        REMOTE_PROC_LIST_DEFINED_STORAGE_POOLS = 74,
+        REMOTE_PROC_FIND_STORAGE_POOL_SOURCES = 75,
+        REMOTE_PROC_STORAGE_POOL_CREATE_XML = 76,
+        REMOTE_PROC_STORAGE_POOL_DEFINE_XML = 77,
+        REMOTE_PROC_STORAGE_POOL_CREATE = 78,
+        REMOTE_PROC_STORAGE_POOL_BUILD = 79,
+        REMOTE_PROC_STORAGE_POOL_DESTROY = 80,
+        REMOTE_PROC_STORAGE_POOL_DELETE = 81,
+        REMOTE_PROC_STORAGE_POOL_UNDEFINE = 82,
+        REMOTE_PROC_STORAGE_POOL_REFRESH = 83,
+        REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_NAME = 84,
+        REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_UUID = 85,
+        REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_VOLUME = 86,
+        REMOTE_PROC_STORAGE_POOL_GET_INFO = 87,
+        REMOTE_PROC_STORAGE_POOL_GET_XML_DESC = 88,
+        REMOTE_PROC_STORAGE_POOL_GET_AUTOSTART = 89,
+        REMOTE_PROC_STORAGE_POOL_SET_AUTOSTART = 90,
+        REMOTE_PROC_STORAGE_POOL_NUM_OF_VOLUMES = 91,
+        REMOTE_PROC_STORAGE_POOL_LIST_VOLUMES = 92,
+        REMOTE_PROC_STORAGE_VOL_CREATE_XML = 93,
+        REMOTE_PROC_STORAGE_VOL_DELETE = 94,
+        REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_NAME = 95,
+        REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_KEY = 96,
+        REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_PATH = 97,
+        REMOTE_PROC_STORAGE_VOL_GET_INFO = 98,
+        REMOTE_PROC_STORAGE_VOL_GET_XML_DESC = 99,
+        REMOTE_PROC_STORAGE_VOL_GET_PATH = 100,
+        REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY = 101,
+        REMOTE_PROC_NODE_GET_FREE_MEMORY = 102,
+        REMOTE_PROC_DOMAIN_BLOCK_PEEK = 103,
+        REMOTE_PROC_DOMAIN_MEMORY_PEEK = 104,
+        REMOTE_PROC_DOMAIN_EVENTS_REGISTER = 105,
+        REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER = 106,
+        REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE = 107,
+        REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2 = 108,
+        REMOTE_PROC_DOMAIN_MIGRATE_FINISH2 = 109,
+        REMOTE_PROC_GET_URI = 110,
+        REMOTE_PROC_NODE_NUM_OF_DEVICES = 111,
+        REMOTE_PROC_NODE_LIST_DEVICES = 112,
+        REMOTE_PROC_NODE_DEVICE_LOOKUP_BY_NAME = 113,
+        REMOTE_PROC_NODE_DEVICE_GET_XML_DESC = 114,
+        REMOTE_PROC_NODE_DEVICE_GET_PARENT = 115,
+        REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS = 116,
+        REMOTE_PROC_NODE_DEVICE_LIST_CAPS = 117,
+        REMOTE_PROC_NODE_DEVICE_DETTACH = 118,
+        REMOTE_PROC_NODE_DEVICE_RE_ATTACH = 119,
+        REMOTE_PROC_NODE_DEVICE_RESET = 120,
+        REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL = 121,
+        REMOTE_PROC_NODE_GET_SECURITY_MODEL = 122,
+        REMOTE_PROC_NODE_DEVICE_CREATE_XML = 123,
+        REMOTE_PROC_NODE_DEVICE_DESTROY = 124,
+        REMOTE_PROC_STORAGE_VOL_CREATE_XML_FROM = 125,
+        REMOTE_PROC_NUM_OF_INTERFACES = 126,
+        REMOTE_PROC_LIST_INTERFACES = 127,
+        REMOTE_PROC_INTERFACE_LOOKUP_BY_NAME = 128,
+        REMOTE_PROC_INTERFACE_LOOKUP_BY_MAC_STRING = 129,
+        REMOTE_PROC_INTERFACE_GET_XML_DESC = 130,
+        REMOTE_PROC_INTERFACE_DEFINE_XML = 131,
+        REMOTE_PROC_INTERFACE_UNDEFINE = 132,
+        REMOTE_PROC_INTERFACE_CREATE = 133,
+        REMOTE_PROC_INTERFACE_DESTROY = 134,
+        REMOTE_PROC_DOMAIN_XML_FROM_NATIVE = 135,
+        REMOTE_PROC_DOMAIN_XML_TO_NATIVE = 136,
+        REMOTE_PROC_NUM_OF_DEFINED_INTERFACES = 137,
+        REMOTE_PROC_LIST_DEFINED_INTERFACES = 138,
+        REMOTE_PROC_NUM_OF_SECRETS = 139,
+        REMOTE_PROC_LIST_SECRETS = 140,
+        REMOTE_PROC_SECRET_LOOKUP_BY_UUID = 141,
+        REMOTE_PROC_SECRET_DEFINE_XML = 142,
+        REMOTE_PROC_SECRET_GET_XML_DESC = 143,
+        REMOTE_PROC_SECRET_SET_VALUE = 144,
+        REMOTE_PROC_SECRET_GET_VALUE = 145,
+        REMOTE_PROC_SECRET_UNDEFINE = 146,
+        REMOTE_PROC_SECRET_LOOKUP_BY_USAGE = 147,
+        REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL = 148,
+        REMOTE_PROC_IS_SECURE = 149,
+        REMOTE_PROC_DOMAIN_IS_ACTIVE = 150,
+        REMOTE_PROC_DOMAIN_IS_PERSISTENT = 151,
+        REMOTE_PROC_NETWORK_IS_ACTIVE = 152,
+        REMOTE_PROC_NETWORK_IS_PERSISTENT = 153,
+        REMOTE_PROC_STORAGE_POOL_IS_ACTIVE = 154,
+        REMOTE_PROC_STORAGE_POOL_IS_PERSISTENT = 155,
+        REMOTE_PROC_INTERFACE_IS_ACTIVE = 156,
+        REMOTE_PROC_GET_LIB_VERSION = 157,
+        REMOTE_PROC_CPU_COMPARE = 158,
+        REMOTE_PROC_DOMAIN_MEMORY_STATS = 159,
+        REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS = 160,
+        REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS = 161,
+        REMOTE_PROC_CPU_BASELINE = 162,
+        REMOTE_PROC_DOMAIN_GET_JOB_INFO = 163,
+        REMOTE_PROC_DOMAIN_ABORT_JOB = 164,
+        REMOTE_PROC_STORAGE_VOL_WIPE = 165,
+        REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_DOWNTIME = 166,
+        REMOTE_PROC_DOMAIN_EVENTS_REGISTER_ANY = 167,
+        REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER_ANY = 168,
+        REMOTE_PROC_DOMAIN_EVENT_REBOOT = 169,
+        REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE = 170,
+        REMOTE_PROC_DOMAIN_EVENT_WATCHDOG = 171,
+        REMOTE_PROC_DOMAIN_EVENT_IO_ERROR = 172,
+        REMOTE_PROC_DOMAIN_EVENT_GRAPHICS = 173,
+        REMOTE_PROC_DOMAIN_UPDATE_DEVICE_FLAGS = 174,
+        REMOTE_PROC_NWFILTER_LOOKUP_BY_NAME = 175,
+        REMOTE_PROC_NWFILTER_LOOKUP_BY_UUID = 176,
+        REMOTE_PROC_NWFILTER_GET_XML_DESC = 177,
+        REMOTE_PROC_NUM_OF_NWFILTERS = 178,
+        REMOTE_PROC_LIST_NWFILTERS = 179,
+        REMOTE_PROC_NWFILTER_DEFINE_XML = 180,
+        REMOTE_PROC_NWFILTER_UNDEFINE = 181,
+        REMOTE_PROC_DOMAIN_MANAGED_SAVE = 182,
+        REMOTE_PROC_DOMAIN_HAS_MANAGED_SAVE_IMAGE = 183,
+        REMOTE_PROC_DOMAIN_MANAGED_SAVE_REMOVE = 184,
+        REMOTE_PROC_DOMAIN_SNAPSHOT_CREATE_XML = 185,
+        REMOTE_PROC_DOMAIN_SNAPSHOT_GET_XML_DESC = 186,
+        REMOTE_PROC_DOMAIN_SNAPSHOT_NUM = 187,
+        REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_NAMES = 188,
+        REMOTE_PROC_DOMAIN_SNAPSHOT_LOOKUP_BY_NAME = 189,
+        REMOTE_PROC_DOMAIN_HAS_CURRENT_SNAPSHOT = 190,
+        REMOTE_PROC_DOMAIN_SNAPSHOT_CURRENT = 191,
+        REMOTE_PROC_DOMAIN_REVERT_TO_SNAPSHOT = 192,
+        REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE = 193,
+        REMOTE_PROC_DOMAIN_GET_BLOCK_INFO = 194,
+        REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195,
+        REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196,
+        REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197,
+        REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198,
+        REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199,
+        REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200,
+        REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201,
+        REMOTE_PROC_DOMAIN_IS_UPDATED = 202,
+        REMOTE_PROC_GET_SYSINFO = 203,
+        REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS = 204,
+        REMOTE_PROC_DOMAIN_SET_BLKIO_PARAMETERS = 205,
+        REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS = 206,
+        REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207,
+        REMOTE_PROC_STORAGE_VOL_UPLOAD = 208,
+        REMOTE_PROC_STORAGE_VOL_DOWNLOAD = 209,
+        REMOTE_PROC_DOMAIN_INJECT_NMI = 210,
+        REMOTE_PROC_DOMAIN_SCREENSHOT = 211,
+        REMOTE_PROC_DOMAIN_GET_STATE = 212,
+        REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3 = 213,
+        REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3 = 214,
+        REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3 = 215,
+        REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3 = 216,
+        REMOTE_PROC_DOMAIN_MIGRATE_FINISH3 = 217,
+        REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3 = 218,
+        REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS_FLAGS = 219,
+        REMOTE_PROC_INTERFACE_CHANGE_BEGIN = 220,
+        REMOTE_PROC_INTERFACE_CHANGE_COMMIT = 221,
+        REMOTE_PROC_INTERFACE_CHANGE_ROLLBACK = 222,
+        REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS_FLAGS = 223,
+        REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR = 224,
+        REMOTE_PROC_DOMAIN_PIN_VCPU_FLAGS = 225,
+        REMOTE_PROC_DOMAIN_SEND_KEY = 226,
+        REMOTE_PROC_NODE_GET_CPU_STATS = 227,
+        REMOTE_PROC_NODE_GET_MEMORY_STATS = 228,
+        REMOTE_PROC_DOMAIN_GET_CONTROL_INFO = 229,
+        REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO = 230,
+};
diff --git a/src/virnetprotocol-structs b/src/virnetprotocol-structs
index 1ee2c6d..4d97e9c 100644
--- a/src/virnetprotocol-structs
+++ b/src/virnetprotocol-structs
@@ -1,4 +1,15 @@
 /* -*- c -*- */
+enum virNetMessageType {
+        VIR_NET_CALL = 0,
+        VIR_NET_REPLY = 1,
+        VIR_NET_MESSAGE = 2,
+        VIR_NET_STREAM = 3,
+};
+enum virNetMessageStatus {
+        VIR_NET_OK = 0,
+        VIR_NET_ERROR = 1,
+        VIR_NET_CONTINUE = 2,
+};
 struct virNetMessageHeader {
         u_int                      prog;
         u_int                      vers;
-- 
1.7.4.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]