]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Make headers C++-friendly
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:05 +0000 (11:23 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:05 +0000 (11:23 -0700)
Add `extern "C"` blocks to various header files.

27 files changed:
open-vm-tools/lib/include/backdoor_def.h
open-vm-tools/lib/include/clamped.h
open-vm-tools/lib/include/cpuid_info.h
open-vm-tools/lib/include/loglevel_defs.h
open-vm-tools/lib/include/mul64.h
open-vm-tools/lib/include/vm_basic_asm.h
open-vm-tools/lib/include/vm_basic_asm_x86.h
open-vm-tools/lib/include/vm_basic_math.h
open-vm-tools/lib/include/vm_ctype.h
open-vm-tools/lib/include/vm_procps.h
open-vm-tools/lib/include/vm_tools_version.h
open-vm-tools/lib/include/vmci_defs.h
open-vm-tools/lib/include/vmci_sockets.h
open-vm-tools/lib/include/x86cpuid.h
open-vm-tools/modules/linux/shared/vmciKernelAPI1.h
open-vm-tools/modules/linux/shared/vmciKernelAPI2.h
open-vm-tools/modules/linux/shared/vmci_call_defs.h
open-vm-tools/modules/linux/shared/vmci_defs.h
open-vm-tools/modules/linux/shared/vmci_infrastructure.h
open-vm-tools/modules/linux/shared/vmci_iocontrols.h
open-vm-tools/modules/linux/shared/vmci_kernel_if.h
open-vm-tools/modules/linux/vmci/shared/vmciQueue.h
open-vm-tools/modules/linux/vmci/shared/vmci_handle_array.h
open-vm-tools/modules/linux/vsock/linux/vmci_sockets_int.h
open-vm-tools/modules/shared/vmmemctl/balloon_def.h
open-vm-tools/modules/shared/vmxnet/eth_public.h
open-vm-tools/modules/shared/vmxnet/vmxnet2_def.h

index 3ff664e81b7be69b8d781d5346f48c9192916f8b..0fd4682b6ace4d02c367dedd513b0b2f12c1b821 100644 (file)
 #define INCLUDE_ALLOW_VMKERNEL
 #include "includeCheck.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
 /*
  * If you want to add a new low-level backdoor call for a guest userland
  * application, please consider using the GuestRpc mechanism instead. --hpreg
@@ -323,4 +328,8 @@ Backdoor_CmdRequiresFullyValidVCPU(unsigned cmd)
 #endif
 
 
+#if defined __cplusplus
+}
 #endif
+
+#endif // _BACKDOOR_DEF_H_
index 4261f28c40a7d89c513a4674ed6df22035fe4886..9686a2206a29d13425e9d1fd09820bb8a32283f7 100644 (file)
 #include "vm_basic_types.h"
 #include "vm_assert.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
 
 /*
  *-----------------------------------------------------------------------------
@@ -341,4 +345,9 @@ Clamped_URoundUpBits32(uint32 *out,  // OUT
    return TRUE;
 }
 
+
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // ifndef _CLAMPED_H_
index 845b7ac8da166c1388cbb7e3ec81728a78a8642a..6029b541e7194dc8528602d63792fb84c7314305 100644 (file)
 #include "vm_basic_asm.h"
 #include "x86cpuid_asm.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
 
 typedef struct CPUID0 {
    int numEntries;
@@ -92,4 +96,9 @@ CPUIDSummary_RegsFromCpuid0(CPUID0* id0In,
    return id0Out;
 }
 
+
+#if defined __cplusplus
+} // extern "C"
 #endif
+
+#endif // _CPUID_INFO_H
index f95d58ec05a8268ee6597dfa15ba08f1330aa1b5..99833662b647b8458c0b3d7e18a3f9f356ddc3b5 100644 (file)
 #include "vm_basic_types.h"
 #include "vm_basic_defs.h"
 
+#if defined __cplusplus
+#define LOGLEVEL_EXTERN_C_BEGIN extern "C" {
+#define LOGLEVEL_EXTERN_C_END }
+#else
+#define LOGLEVEL_EXTERN_C_BEGIN
+#define LOGLEVEL_EXTERN_C_END
+#endif
+
+LOGLEVEL_EXTERN_C_BEGIN
+
 
 /*
  * CPP variable name hacks
  */
 
 #define LOGLEVEL_EXTENSION_DECLARE(list) \
-       VMX86_EXTERN_DATA const int8 *logLevelPtr; \
-        VMX86_EXTERN_DATA int LOGLEVEL_EXTOFFSET(LOGLEVEL_EXTENSION); \
-        enum { list(LOGLEVEL_MODULEVAR) }
+       LOGLEVEL_EXTERN_C_BEGIN \
+   VMX86_EXTERN_DATA const int8 *logLevelPtr; \
+   VMX86_EXTERN_DATA int LOGLEVEL_EXTOFFSET(LOGLEVEL_EXTENSION); \
+   LOGLEVEL_EXTERN_C_END \
+   enum { list(LOGLEVEL_MODULEVAR) }
 
 
 #ifdef VMX86_LOG
@@ -138,4 +150,6 @@ int LogLevel_Set(const char *extension, const char *module, int val);
 #endif
 
 
+LOGLEVEL_EXTERN_C_END
+
 #endif /* _LOGLEVEL_DEFS_H_ */
index 13be4032fee2cf20435c37c7756f1e6b8296f901..c4db18afa8a15517296416ba52618d74eeb315a8 100644 (file)
 
 #include "vm_basic_asm.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
 #ifdef MUL64_NO_ASM
 /*
  *-----------------------------------------------------------------------------
@@ -139,5 +144,10 @@ Muls64x32s64(int64 multiplicand, uint32 multiplier, uint32 shift)
 }
 #endif
 
+
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // _MUL64_NOASM_H_
 
index 72bcc98ce3f92ba751f344ac8acae95710e60a54..6173616c386060eb77218d656120ff11873e75ea 100644 (file)
 #include "mul64.h"
 #endif
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
 /*
  * Locate most and least significant bit set functions. Use our own name
  * space to avoid namespace collisions. The new names follow a pattern,
@@ -1275,5 +1280,10 @@ RoundUpPow2_32(uint32 value)
 #endif
 }
 
+
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // _VM_BASIC_ASM_H_
 
index ff42ccbe85e822a337a8a92efb37b82cf8593157..324db535b374407a77a6818368e596b24d43b61d 100644 (file)
 #define INCLUDE_ALLOW_VMCORE
 #include "includeCheck.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
 #ifdef VM_X86_64
 /*
  * The gcc inline asm uses the "A" constraint which differs in 32 & 64
@@ -559,4 +564,9 @@ Muls64x32s64(int64 multiplicand, uint32 multiplier, uint32 shift)
 #pragma warning(default: 4035)
 #endif
 
+
+#if defined __cplusplus
+} // extern "C"
 #endif
+
+#endif // _VM_BASIC_ASM_X86_H_
index d2c22003662e696225e282086b87d146a6ac9458..6828ae0cebf3f031b2aad5351f8c6c5d804c1db0 100644 (file)
 #include "vm_basic_types.h" // For INLINE.
 #include "vm_basic_asm.h"   // For Div64...
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
 
 static INLINE uint32
 RatioOf(uint32 numer1, uint32 numer2, uint32 denom)
@@ -178,4 +182,8 @@ RotateRight64(uint64 value, uint8 shift)
 #endif // if !defined(_WIN32) && !defined(_WIN64)
 
 
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // ifndef _VM_BASIC_MATH_H_
index 473fd31f87c6d4b7f409826f565595c425493a32..1f01f8fa9a1fd1f9c8f27557706f1189c6a98504 100644 (file)
 
 #include <ctype.h>
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
 /*
  * On Windows platform, ctype.h functions are implemented via table lookup,
  * and a negative index is unsafe.  See bug 83950.
@@ -69,4 +74,9 @@ static __inline int CType_IsBlank(int c) { return c == ' ' || c == '\t'; }
 
 #endif /* _WIN32 */
 
+
+#if defined __cplusplus
+}
 #endif
+
+#endif // _VM_CTYPE_H_
index 73c771942aed6272f6aed55ecad7f6b167e2ca36..c031948892976e80a61e418659b216f1ab1e8363 100644 (file)
 #ifndef _VM_PROCPS_H_
 #define _VM_PROCPS_H_
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
 /*
  * The getstat() function below makes use of restricted pointers (added in C99)
  * and the 'jiff' type.
@@ -73,4 +77,8 @@ extern void getstat(jiff *restrict cuse, jiff *restrict cice,
                     unsigned int *restrict processes);
 extern void meminfo(void);
 
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // ifndef _VM_PROCPS_H_
index 81aa345495211439d0f3082161d743c008771d19..8d4b69dda9440afb8740237d404fc4e525df3053 100644 (file)
 
 #ifndef RC_INVOKED
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
 typedef uint32 ToolsVersion;
 typedef enum {
   TOOLS_TYPE_UNSET = -1,
@@ -87,8 +91,13 @@ TOOLS_VERSION_UINT_TO_COMPONENTS(const ToolsVersion toolsVersion,   // IN
    comps->minor = (toolsVersion >> 5) & 0x1f;
    comps->base  = toolsVersion & 0x1f;
 }
+
+#if defined __cplusplus
+} // extern "C"
 #endif
 
+#endif // RC_INVOKED
+
 /*
  * Reserve the highest possible Tools version for Tools whose lifecycle isn't
  * to be managed by VMware's platform.
index 0df1de4214b2adc6d0bf92ebaa17e2d7ff67a969..9ea646b7ed1758804c0a03a8c6a87a29c17be613 100644 (file)
 #include "vm_atomic.h"
 #include "vm_assert.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
 /* Register offsets. */
 #define VMCI_STATUS_ADDR      0x00
 #define VMCI_CONTROL_ADDR     0x04
@@ -905,4 +909,8 @@ typedef struct {
 typedef VMCIFilterList VMCIProtoFilters[VMCI_FP_MAX];
 typedef VMCIProtoFilters VMCIFilters[VMCI_FD_MAX];
 
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // _VMCI_DEF_H_
index 71aafd456f322793e4e793cb390936f7e35944e2..1b144ba0050c23cbe77b6f68b6098e5abfdc180f 100644 (file)
 #endif // linux && !VMKERNEL
 #endif
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
 /**
  * \brief Option name for STREAM socket buffer size.
  *
@@ -857,5 +862,9 @@ struct uuid_2_cid {
 #endif // _WIN32
 
 
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // _VMCI_SOCKETS_H_
 
index e6bbacb5cd869ca6c1b689251c88f764cd7d2020..cee56817516511d5cc3d459660619b985ea47767 100644 (file)
 #include "x86vendor.h"
 #include "vm_assert.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
 /*
  * The linux kernel's ptrace.h stupidly defines the bare
  * EAX/EBX/ECX/EDX, which wrecks havoc with our preprocessor tricks.
@@ -2046,4 +2051,9 @@ CPUID_SupportsMsrPlatformInfo(CpuidVendor vendor, uint32 version)
 #pragma warning (pop)
 #endif
 
+
+#if defined __cplusplus
+} // extern "C"
 #endif
+
+#endif // _X86CPUID_H_
index dc5281802ab7906a6485326e52e18644c4ee1a6b..6aa11bce0e44f8ad56d96e07c12dc823b4b91f22 100644 (file)
 #include "vmci_defs.h"
 #include "vmci_call_defs.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
 
 /* VMCI module namespace on vmkernel. */
 
@@ -197,5 +201,9 @@ typedef ssize_t (VMCIQPair_DequeueVFct)(VMCIQPair *qpair, void *, size_t, int);
 typedef ssize_t (VMCIQPair_PeekVFct)(VMCIQPair *qpair, void *, size_t, int);
 
 
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif /* !__VMCI_KERNELAPI_1_H__ */
 
index e7cb1f9acea78990f09640f9190eef15b06eb374..f0a7ec119255163e1667cb73bc279c79d032bffb 100644 (file)
 #define INCLUDE_ALLOW_VMKERNEL
 #include "includeCheck.h"
 
-
 #include "vmciKernelAPI1.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
 
 /* Define version 2. */
 
@@ -61,4 +64,8 @@ typedef int (VMCIDoorbell_DestroyFct)(VMCIHandle);
 typedef int (VMCIDoorbell_NotifyFct)(VMCIHandle, VMCIPrivilegeFlags);
 
 
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif /* !__VMCI_KERNELAPI_2_H__ */
index 77be59f49fcfeb2b79d4a9feb9ce4c51544cc337..db2496c3f26ef56638f1a92a2616982b9a788e2f 100644 (file)
 #include "vm_basic_types.h"
 #include "vmci_defs.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
 /*
  * All structs here are an integral size of their largest member, ie. a struct 
  * with at least one 8-byte member will have a size that is an integral of 8.
@@ -310,4 +315,9 @@ typedef struct VMCIQueuePairDetachMsg {
    VMCIHandle    handle;
 } VMCIQueuePairDetachMsg;
 
+
+#if defined __cplusplus
+} // extern "C"
 #endif
+
+#endif // _VMCI_CALL_DEFS_H_
index fe8dc4f7fbc3926347480179f5ef80c15a21a2b3..e959e4ba196554590e749afec71ec3ea5c0ac663 100644 (file)
 #include "vm_atomic.h"
 #include "vm_assert.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
 /* Register offsets. */
 #define VMCI_STATUS_ADDR      0x00
 #define VMCI_CONTROL_ADDR     0x04
@@ -905,4 +909,8 @@ typedef struct {
 typedef VMCIFilterList VMCIProtoFilters[VMCI_FP_MAX];
 typedef VMCIProtoFilters VMCIFilters[VMCI_FD_MAX];
 
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // _VMCI_DEF_H_
index 099b52681e0bada6dba6af8684eefdd6342faa42..2d3f28070f3667abb8b12089d0c507a785f973a8 100644 (file)
 #include "vmware.h"
 #include "vmci_defs.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
 typedef enum {
    VMCIOBJ_VMX_VM = 10,
    VMCIOBJ_CONTEXT,
@@ -148,4 +153,9 @@ VMCI_HashId(VMCIId id,      // IN
    return hash & (size - 1);
 }
 
+
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // _VMCI_INFRASTRUCTURE_H_
index f00ea6909573353f5d28fe7b15e060f8a30bec3b..d5891a6675f47f1673587361242d5905e2051a04 100644 (file)
 #include "vmciKernelAPI.h"
 #endif // _WIN32 && WINNT_DDK
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
 
 /*
  *-----------------------------------------------------------------------------
@@ -750,4 +754,9 @@ enum VMCrossTalkSockOpt {
 /* Clean up helper macros */
 #undef IOCTLCMD
 
+
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // ifndef _VMCI_IOCONTROLS_H_
index 964cbd57f4efedde9dd5f5b4f341c35797a54fe5..a6feffe03c11f836c7279a37c36b7378a1de8f16 100644 (file)
 #  include "dbllnklst.h"
 #endif
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
 /* Flags for specifying memory type. */
 #define VMCI_MEMORY_NORMAL   0x0
 #define VMCI_MEMORY_ATOMIC   0x1
@@ -459,4 +464,9 @@ Bool VMCI_HostPersonalityActive(void);
 #  define VMCIList_First(_l) (VMCIList_Empty(_l)?NULL:(_l)->next)
 #endif
 
+
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // _VMCI_KERNEL_IF_H_
index eb2faa7cc44ccf15bb44027c914e4eb8d61f7130..067ac6d4433cfcfc666555d4e129377e15007ddf 100644 (file)
 #  include "util_copy_dist.h"
 #endif
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
 
 /*
  * VMCIQueue
@@ -202,5 +206,9 @@ VMCIMemcpyFromQueueVLocal(void *dest,              // IN/OUT: iovec
 #endif /* Does the O/S support iovec? */
 
 
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif /* !_VMCI_QUEUE_H_ */
 
index 13a46f5da49624af45ceaa2a102276b3148946cc..3a78778d69342a57f119ed4aadd955c8b90f28b0 100644 (file)
 #include "vm_libc.h"
 #endif // VMKERNEL
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
 #define VMCI_HANDLE_ARRAY_DEFAULT_SIZE 4
 
 typedef struct VMCIHandleArray {
@@ -364,4 +369,9 @@ VMCIHandleArray_GetHandles(VMCIHandleArray *array) // IN
    }
 }
 
+
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // _VMCI_HANDLE_ARRAY_H_
index 91654c349bfd7b5eed3bee0908e6e84e58b766cb..1c3a99e689a136e8e0fa81844acf01fce5e51415 100644 (file)
 #ifndef _VMCI_SOCKETS_INT_H_
 #define _VMCI_SOCKETS_INT_H_
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
 
 #if defined(_WIN32)
 #  if defined(NT_INCLUDED)
@@ -57,5 +61,9 @@
 #endif // _WIN32
 
 
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // _VMCI_SOCKETS_INT_H_
 
index 5600114a598a00cc8966cb9d9d5cc1c1cf44f549..df4234de1087a59a41ba604f3f80d952e944ec89 100644 (file)
 #include "vm_basic_defs.h"
 #include "vm_assert.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
 /*
  * constants
  */
@@ -307,4 +312,9 @@ MY_ASSERTS(BALLOON_BATCH_SIZE,
            ASSERT_ON_COMPILE(sizeof(BalloonBatchPage) == PAGE_SIZE);
 )
 
+
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif  /* _BALLOON_DEF_H */
index 767ea14ba4097ba4a7a4a0ef6e129bfe682e0acf..256098909832e88790b9ffaf0c022232227e63b3 100644 (file)
 
 #include "vm_basic_defs.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
+
 #define ETH_LADRF_LEN      2
 #define ETH_ADDR_LENGTH    6
 
@@ -1241,4 +1246,9 @@ Eth_IsFrameHeaderComplete(const Eth_Header *eh,
    return FALSE;
 }
 
+
+#if defined __cplusplus
+} // extern "C"
+#endif
+
 #endif // _ETH_PUBLIC_H_
index 84387b74bdc687c1ad0ef2a35471673f7a2faa13..382b4476e8ed55fe56aad486bd097b737a66a208 100644 (file)
 #include "net_sg.h"
 #include "vmxnet_def.h"
 
+#if defined __cplusplus
+extern "C" {
+#endif
+
 
 /*
  * Magic number that identifies this version of the vmxnet protocol.
@@ -417,5 +421,8 @@ Vmxnet2_GetRxEntry(Vmxnet2_RxRingInfo *ri, unsigned int idx)
 
 #endif /* defined VMX86_VMX || defined VMKERNEL */
 
+#if defined __cplusplus
+} // extern "C"
 #endif
 
+#endif // _VMXNET2_DEF_H_