[libvirt] [PATCH] xen_xs: name xendConfigVersion magic numbers
Eric Blake
eblake at redhat.com
Wed Feb 1 23:28:37 UTC 2012
On 01/31/2012 10:08 AM, Philipp Hahn wrote:
> libvirt supports 4 different versions of the user-land XenD daemon. When
> queried the daemon just returns its generation number, which is hard to
> match to the version of the Xen tools.
>
> Replace the magic generation numbers by named macro definitions to
> improve code readability.
>
> Signed-off-by: Philipp Hahn <hahn at univention.de>
> ---
> .../0013-improve-getting-xen-vcpu-counts.patch | 2 +-
> .../0014-improve-setting-xen-vcpu-counts.patch | 6 +-
> docs/api_extension/0015-remove-dead-xen-code.patch | 2 +-
> src/xen/xen_driver.c | 14 ++--
> src/xen/xend_internal.c | 70 ++++++++++----------
> src/xenxs/xen_sxpr.c | 24 ++++----
> src/xenxs/xen_sxpr.h | 5 ++
> src/xenxs/xen_xm.c | 14 ++--
> src/xenxs/xenxs_private.h | 7 +-
> 9 files changed, 75 insertions(+), 69 deletions(-)
>
> +++ b/src/xenxs/xen_sxpr.h
> @@ -32,6 +32,11 @@
> # include "domain_conf.h"
> # include "sexpr.h"
>
> +#define XEND_CONFIG_VERSION_3_0_2 1
> +#define XEND_CONFIG_VERSION_3_0_3 2
> +#define XEND_CONFIG_VERSION_3_0_4 3
> +#define XEND_CONFIG_VERSION_3_1_0 4
This fails 'make syntax-check' if you have cppi installed, due to
inconsistent indentation. Also, I would have done this as an enum
rather than as #defines (it's slightly easier to debug enums in gdb).
The rest of the patch looks like valid mechanical conversions; I don't
know if you missed any, but under the assumption that you got them all,
ACK. I'm pushing with this squashed in:
diff --git i/src/xenxs/xen_sxpr.h w/src/xenxs/xen_sxpr.h
index 4f96d2b..0c8875d 100644
--- i/src/xenxs/xen_sxpr.h
+++ w/src/xenxs/xen_sxpr.h
@@ -1,8 +1,8 @@
/*
* xen_sxpr.h: Xen SEXPR parsing functions
*
+ * Copyright (C) 2006-2008, 2010, 2012 Red Hat, Inc.
* Copyright (C) 2011 Univention GmbH
- * Copyright (C) 2006-2008, 2010 Red Hat, Inc.
* Copyright (C) 2005,2006
*
* This library is free software; you can redistribute it and/or
@@ -32,10 +32,12 @@
# include "domain_conf.h"
# include "sexpr.h"
-#define XEND_CONFIG_VERSION_3_0_2 1
-#define XEND_CONFIG_VERSION_3_0_3 2
-#define XEND_CONFIG_VERSION_3_0_4 3
-#define XEND_CONFIG_VERSION_3_1_0 4
+typedef enum {
+ XEND_CONFIG_VERSION_3_0_2 = 1,
+ XEND_CONFIG_VERSION_3_0_3 = 2,
+ XEND_CONFIG_VERSION_3_0_4 = 3,
+ XEND_CONFIG_VERSION_3_1_0 = 4,
+} xenConfigVersionEnum;
/* helper functions to get the dom id from a sexpr */
int xenGetDomIdFromSxprString(const char *sexpr, int xendConfigVersion);
--
Eric Blake eblake at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120201/392b5977/attachment-0001.sig>
More information about the libvir-list
mailing list