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

Re: [Xen-devel] [PATCH] fix public header hvm/save.h to be compatible with c++



Thanks for your review. Comments addressed, and re-tested.


Including save.h in a C++ application was throwing some errors, as it
was unhappy about the "new" keyword being used (even when wrapped in
an "extern C" block)

This change renames some variables, as well as wraps the function in a
__XEN__ preprocessor directive.

Signed-off-by: Ben Guthro <ben@xxxxxxxxxx>

diff --git a/xen/include/public/arch-x86/hvm/save.h
b/xen/include/public/arch-x86/hvm/save.h
index a82a5ee..1b88c28 100644
--- a/xen/include/public/arch-x86/hvm/save.h
+++ b/xen/include/public/arch-x86/hvm/save.h
@@ -268,19 +268,21 @@ struct hvm_hw_cpu_compat {
     uint32_t error_code;
 };

+#ifdef __XEN__
 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 *new_cpu = h;
+    struct hvm_hw_cpu_compat *old_cpu = 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;
+    new_cpu->error_code = old_cpu->error_code;
+    new_cpu->pending_event = old_cpu->pending_event;
+    new_cpu->tsc = old_cpu->tsc;
+    new_cpu->msr_tsc_aux = 0;

     return 0;
 }
+#endif

 DECLARE_HVM_SAVE_TYPE_COMPAT(CPU, 2, struct hvm_hw_cpu, \
                              struct hvm_hw_cpu_compat, _hvm_hw_fix_cpu);

Attachment: public_headers_cpp_fixes.patch
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.