|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] libxc, libxenstore: make the headers C++-friendly
Made #including xenctrl.h, xenstore.h and a few other
frequently used headers safe to use with C++: added
extern "C" statements, renamed variables named with
C++ keywords ('new', 'private'), updated dependendt
code.
Signed-off-by: Razvan Cojocaru <rzvncj@xxxxxxxxx>
diff -r 4b476378fc35 -r 93e5f6cf98d2 tools/blktap2/drivers/tapdisk-vbd.c
--- a/tools/blktap2/drivers/tapdisk-vbd.c Mon Jan 21 17:03:10 2013 +0000
+++ b/tools/blktap2/drivers/tapdisk-vbd.c Tue Jan 22 18:43:45 2013 +0200
@@ -1684,7 +1684,7 @@ tapdisk_vbd_check_ring_message(td_vbd_t
if (!vbd->ring.sring)
return -EINVAL;
- switch (vbd->ring.sring->private.tapif_user.msg) {
+ switch (vbd->ring.sring->rprivate.tapif_user.msg) {
case 0:
return 0;
diff -r 4b476378fc35 -r 93e5f6cf98d2 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Mon Jan 21 17:03:10 2013 +0000
+++ b/tools/libxc/xenctrl.h Tue Jan 22 18:43:45 2013 +0200
@@ -26,6 +26,10 @@
#ifndef XENCTRL_H
#define XENCTRL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Tell the Xen public headers we are a user-space tools build. */
#ifndef __XEN_TOOLS__
#define __XEN_TOOLS__ 1
@@ -114,6 +118,15 @@ typedef struct xc_interface_core xc_inte
typedef struct xc_interface_core xc_evtchn;
typedef struct xc_interface_core xc_gnttab;
typedef struct xc_interface_core xc_gntshr;
+
+enum xc_error_code {
+ XC_ERROR_NONE = 0,
+ XC_INTERNAL_ERROR = 1,
+ XC_INVALID_KERNEL = 2,
+ XC_INVALID_PARAM = 3,
+ XC_OUT_OF_MEMORY = 4,
+ /* new codes need to be added to xc_error_level_to_desc too */
+};
typedef enum xc_error_code xc_error_code;
@@ -1618,16 +1631,6 @@ int xc_hvm_inject_trap(
* LOGGING AND ERROR REPORTING
*/
-
-enum xc_error_code {
- XC_ERROR_NONE = 0,
- XC_INTERNAL_ERROR = 1,
- XC_INVALID_KERNEL = 2,
- XC_INVALID_PARAM = 3,
- XC_OUT_OF_MEMORY = 4,
- /* new codes need to be added to xc_error_level_to_desc too */
-};
-
#define XC_MAX_ERROR_MSG_LEN 1024
typedef struct xc_error {
enum xc_error_code code;
@@ -2236,4 +2239,8 @@ int xc_compression_uncompress_page(xc_in
unsigned long compbuf_size,
unsigned long *compbuf_pos, char *dest);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* XENCTRL_H */
diff -r 4b476378fc35 -r 93e5f6cf98d2 tools/xenstore/xenstore.h
--- a/tools/xenstore/xenstore.h Mon Jan 21 17:03:10 2013 +0000
+++ b/tools/xenstore/xenstore.h Tue Jan 22 18:43:45 2013 +0200
@@ -20,6 +20,10 @@
#ifndef XENSTORE_H
#define XENSTORE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <xenstore_lib.h>
#define XBT_NULL 0
@@ -244,6 +248,11 @@ char *xs_debug_command(struct xs_handle
void *data, unsigned int len);
int xs_suspend_evtchn_port(int domid);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* XENSTORE_H */
/*
diff -r 4b476378fc35 -r 93e5f6cf98d2 xen/include/public/arch-x86/hvm/save.h
--- a/xen/include/public/arch-x86/hvm/save.h Mon Jan 21 17:03:10 2013 +0000
+++ b/xen/include/public/arch-x86/hvm/save.h Tue Jan 22 18:43:45 2013 +0200
@@ -269,15 +269,15 @@ struct hvm_hw_cpu_compat {
};
static inline int _hvm_hw_fix_cpu(void *h) {
- struct hvm_hw_cpu *new=h;
- struct hvm_hw_cpu_compat *old=h;
+ struct hvm_hw_cpu *newcpu=(struct hvm_hw_cpu *)h;
+ struct hvm_hw_cpu_compat *old=(struct hvm_hw_cpu_compat *)h;
/* If we copy from the end backwards, we should
* be able to do the modification in-place */
- new->error_code=old->error_code;
- new->pending_event=old->pending_event;
- new->tsc=old->tsc;
- new->msr_tsc_aux=0;
+ newcpu->error_code=old->error_code;
+ newcpu->pending_event=old->pending_event;
+ newcpu->tsc=old->tsc;
+ newcpu->msr_tsc_aux=0;
return 0;
}
diff -r 4b476378fc35 -r 93e5f6cf98d2 xen/include/public/hvm/save.h
--- a/xen/include/public/hvm/save.h Mon Jan 21 17:03:10 2013 +0000
+++ b/xen/include/public/hvm/save.h Tue Jan 22 18:43:45 2013 +0200
@@ -28,6 +28,10 @@
#ifndef __XEN_PUBLIC_HVM_SAVE_H__
#define __XEN_PUBLIC_HVM_SAVE_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* Structures in this header *must* have the same layout in 32bit
* and 64bit environments: this means that all fields must be explicitly
@@ -108,4 +112,8 @@ DECLARE_HVM_SAVE_TYPE(END, 0, struct hvm
#error "unsupported architecture"
#endif
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __XEN_PUBLIC_HVM_SAVE_H__ */
diff -r 4b476378fc35 -r 93e5f6cf98d2 xen/include/public/io/ring.h
--- a/xen/include/public/io/ring.h Mon Jan 21 17:03:10 2013 +0000
+++ b/xen/include/public/io/ring.h Tue Jan 22 18:43:45 2013 +0200
@@ -111,7 +111,7 @@ struct __name##_sring {
uint8_t msg; \
} tapif_user; \
uint8_t pvt_pad[4]; \
- } private; \
+ } rprivate; \
uint8_t __pad[44]; \
union __name##_sring_entry ring[1]; /* variable-length */ \
}; \
@@ -156,7 +156,7 @@ typedef struct __name##_back_ring __name
#define SHARED_RING_INIT(_s) do { \
(_s)->req_prod = (_s)->rsp_prod = 0; \
(_s)->req_event = (_s)->rsp_event = 1; \
- (void)memset((_s)->private.pvt_pad, 0, sizeof((_s)->private.pvt_pad)); \
+ (void)memset((_s)->rprivate.pvt_pad, 0, sizeof((_s)->rprivate.pvt_pad)); \
(void)memset((_s)->__pad, 0, sizeof((_s)->__pad)); \
} while(0)
diff -r 4b476378fc35 -r 93e5f6cf98d2 xen/include/public/mem_event.h
--- a/xen/include/public/mem_event.h Mon Jan 21 17:03:10 2013 +0000
+++ b/xen/include/public/mem_event.h Tue Jan 22 18:43:45 2013 +0200
@@ -27,6 +27,10 @@
#ifndef _XEN_PUBLIC_MEM_EVENT_H
#define _XEN_PUBLIC_MEM_EVENT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "xen.h"
#include "io/ring.h"
@@ -69,6 +73,10 @@ typedef struct mem_event_st {
DEFINE_RING_TYPES(mem_event, mem_event_request_t, mem_event_response_t);
+#ifdef __cplusplus
+}
+#endif
+
#endif
/*
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |