[libvirt] [PATCH] Unify int types handling in protocol files

Martin Kletzander mkletzan at redhat.com
Sun Jan 10 09:40:47 UTC 2016


On Sun, Jan 10, 2016 at 02:49:52AM +0300, Roman Bogorodskiy wrote:
>From: Jasper Lievisse Adriaanse <jasper at openbsd.org>
>
>Some of the protocol files already include handing of the missing int
>types such as xdr_uint64_t, some don't. To fix it everywhere, move out
>of the appropriate defines to internal.h and include it whenever needed.
>

Almost what I meant.  I don't think XDR-related definitions should be in
internal.h, it would then be defined everywhere.  Also, protocols don't
need anything from internal.h, so it doesn't make much sense to me.  I
would put it in a separate file.

>Signed-off-by: Roman Bogorodskiy <bogorodskiy at gmail.com>
>---
> src/admin/admin_protocol.x     |  2 ++
> src/internal.h                 | 19 +++++++++++++++++++
> src/lxc/lxc_monitor_protocol.x | 19 +------------------
> src/remote/remote_protocol.x   | 19 -------------------
> src/rpc/virnetprotocol.x       | 19 -------------------
> 5 files changed, 22 insertions(+), 56 deletions(-)
>
>diff --git a/src/admin/admin_protocol.x b/src/admin/admin_protocol.x
>index 878983d..2b25d9a 100644
>--- a/src/admin/admin_protocol.x
>+++ b/src/admin/admin_protocol.x
>@@ -22,6 +22,8 @@
>  * Author: Martin Kletzander <mkletzan at redhat.com>
>  */
>
>+%#include "internal.h"
>+
> /*----- Data types. -----*/
>
> /* Length of long, but not unbounded, strings.
>diff --git a/src/internal.h b/src/internal.h
>index db26fb0..037332d 100644
>--- a/src/internal.h
>+++ b/src/internal.h
>@@ -517,4 +517,23 @@ enum {
>     EXIT_ENOENT = 127, /* Could not find program to exec */
> };
>
>+/* cygwin's xdr implementation defines xdr_u_int64_t instead of xdr_uint64_t
>+ * and lacks IXDR_PUT_INT32 and IXDR_GET_INT32
>+ */
>+# ifdef HAVE_XDR_U_INT64_T
>+#  define xdr_uint64_t xdr_u_int64_t
>+# endif
>+# ifndef IXDR_PUT_INT32
>+#  define IXDR_PUT_INT32 IXDR_PUT_LONG
>+# endif
>+# ifndef IXDR_GET_INT32
>+#  define IXDR_GET_INT32 IXDR_GET_LONG
>+# endif
>+# ifndef IXDR_PUT_U_INT32
>+#  define IXDR_PUT_U_INT32 IXDR_PUT_U_LONG
>+# endif
>+# ifndef IXDR_GET_U_INT32
>+#  define IXDR_GET_U_INT32 IXDR_GET_U_LONG
>+# endif
>+
> #endif                          /* __VIR_INTERNAL_H__ */
>diff --git a/src/lxc/lxc_monitor_protocol.x b/src/lxc/lxc_monitor_protocol.x
>index 205d7c2..f4dae2e 100644
>--- a/src/lxc/lxc_monitor_protocol.x
>+++ b/src/lxc/lxc_monitor_protocol.x
>@@ -4,24 +4,7 @@
>  * the libvirt_lxc helper program.
>  */
>
>-/* cygwin's xdr implementation defines xdr_u_int64_t instead of xdr_uint64_t
>- * and lacks IXDR_PUT_INT32 and IXDR_GET_INT32
>- */
>-%#ifdef HAVE_XDR_U_INT64_T
>-%# define xdr_uint64_t xdr_u_int64_t
>-%#endif
>-%#ifndef IXDR_PUT_INT32
>-%# define IXDR_PUT_INT32 IXDR_PUT_LONG
>-%#endif
>-%#ifndef IXDR_GET_INT32
>-%# define IXDR_GET_INT32 IXDR_GET_LONG
>-%#endif
>-%#ifndef IXDR_PUT_U_INT32
>-%# define IXDR_PUT_U_INT32 IXDR_PUT_U_LONG
>-%#endif
>-%#ifndef IXDR_GET_U_INT32
>-%# define IXDR_GET_U_INT32 IXDR_GET_U_LONG
>-%#endif
>+%#include "internal.h"
>
> enum virLXCMonitorExitStatus {
>     VIR_LXC_MONITOR_EXIT_STATUS_ERROR,
>diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
>index 80f4a8b..89268c0 100644
>--- a/src/remote/remote_protocol.x
>+++ b/src/remote/remote_protocol.x
>@@ -40,25 +40,6 @@
> %#include "internal.h"
> %#include <arpa/inet.h>
>
>-/* cygwin's xdr implementation defines xdr_u_int64_t instead of xdr_uint64_t
>- * and lacks IXDR_PUT_INT32 and IXDR_GET_INT32
>- */
>-%#ifdef HAVE_XDR_U_INT64_T
>-%# define xdr_uint64_t xdr_u_int64_t
>-%#endif
>-%#ifndef IXDR_PUT_INT32
>-%# define IXDR_PUT_INT32 IXDR_PUT_LONG
>-%#endif
>-%#ifndef IXDR_GET_INT32
>-%# define IXDR_GET_INT32 IXDR_GET_LONG
>-%#endif
>-%#ifndef IXDR_PUT_U_INT32
>-%# define IXDR_PUT_U_INT32 IXDR_PUT_U_LONG
>-%#endif
>-%#ifndef IXDR_GET_U_INT32
>-%# define IXDR_GET_U_INT32 IXDR_GET_U_LONG
>-%#endif
>-
> /*----- Data types. -----*/
>
> /* Length of long, but not unbounded, strings.
>diff --git a/src/rpc/virnetprotocol.x b/src/rpc/virnetprotocol.x
>index 7b6f753..d61a7ab 100644
>--- a/src/rpc/virnetprotocol.x
>+++ b/src/rpc/virnetprotocol.x
>@@ -23,25 +23,6 @@
> %#include "internal.h"
> %#include <arpa/inet.h>
>
>-/* cygwin's xdr implementation defines xdr_u_int64_t instead of xdr_uint64_t
>- * and lacks IXDR_PUT_INT32 and IXDR_GET_INT32
>- */
>-%#ifdef HAVE_XDR_U_INT64_T
>-%# define xdr_uint64_t xdr_u_int64_t
>-%#endif
>-%#ifndef IXDR_PUT_INT32
>-%# define IXDR_PUT_INT32 IXDR_PUT_LONG
>-%#endif
>-%#ifndef IXDR_GET_INT32
>-%# define IXDR_GET_INT32 IXDR_GET_LONG
>-%#endif
>-%#ifndef IXDR_PUT_U_INT32
>-%# define IXDR_PUT_U_INT32 IXDR_PUT_U_LONG
>-%#endif
>-%#ifndef IXDR_GET_U_INT32
>-%# define IXDR_GET_U_INT32 IXDR_GET_U_LONG
>-%#endif
>-
> /*----- Data types. -----*/
>
> /* Initial message size.
>--
>2.4.6
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160110/f598749d/attachment-0001.sig>


More information about the libvir-list mailing list