From: VMware, Inc <> Date: Mon, 20 Sep 2010 17:50:34 +0000 (-0700) Subject: Hide VMCI symbols and only export that are needed. X-Git-Tag: stable-8.6.0~44 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ed2a3d6b0f5cdb8a6637020df823f2b33be56f07;p=thirdparty%2Fopen-vm-tools.git Hide VMCI symbols and only export that are needed. Hiding all the VMCI symbols by default and only exporting the ones that are needed. Also changed few usage of private symbols in vsock with public ones. I mostly tried to export all the symbols that were exported for linux. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/modules/linux/shared/vmci_kernel_if.h b/open-vm-tools/modules/linux/shared/vmci_kernel_if.h index 74e443368..81534fe90 100644 --- a/open-vm-tools/modules/linux/shared/vmci_kernel_if.h +++ b/open-vm-tools/modules/linux/shared/vmci_kernel_if.h @@ -75,6 +75,14 @@ /* Platform specific type definitions. */ +#if defined(linux) && !defined(VMKERNEL) +# define VMCI_EXPORT_SYMBOL(_symbol) EXPORT_SYMBOL(_symbol); +#elif defined(__APPLE__) +# define VMCI_EXPORT_SYMBOL(_symbol) __attribute__((visibility("default"))) +#else +# define VMCI_EXPORT_SYMBOL(_symbol) +#endif + #if defined(VMKERNEL) typedef SP_SpinLock VMCILock; typedef SP_IRQL VMCILockFlags; diff --git a/open-vm-tools/modules/linux/vmci/vmciDatagram.c b/open-vm-tools/modules/linux/vmci/vmciDatagram.c index 1174453f7..54e74c321 100644 --- a/open-vm-tools/modules/linux/vmci/vmciDatagram.c +++ b/open-vm-tools/modules/linux/vmci/vmciDatagram.c @@ -409,6 +409,7 @@ DatagramHandleUniqueLockedAnyCid(VMCIHandle handle) // IN *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIDatagramCreateHndInt) int VMCIDatagramCreateHndInt(VMCIId resourceID, // IN: uint32 flags, // IN: @@ -515,10 +516,7 @@ VMCIDatagramCreateHndInt(VMCIId resourceID, // IN: *----------------------------------------------------------------------------- */ -#ifdef __linux__ -EXPORT_SYMBOL(VMCIDatagram_CreateHnd); -#endif - +VMCI_EXPORT_SYMBOL(VMCIDatagram_CreateHnd) int VMCIDatagram_CreateHnd(VMCIId resourceID, // IN: uint32 flags, // IN: @@ -548,10 +546,7 @@ VMCIDatagram_CreateHnd(VMCIId resourceID, // IN: *----------------------------------------------------------------------------- */ -#ifdef __linux__ -EXPORT_SYMBOL(VMCIDatagram_CreateHndPriv); -#endif - +VMCI_EXPORT_SYMBOL(VMCIDatagram_CreateHndPriv) int VMCIDatagram_CreateHndPriv(VMCIId resourceID, // IN: uint32 flags, // IN: @@ -582,6 +577,7 @@ VMCIDatagram_CreateHndPriv(VMCIId resourceID, // IN: *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIDatagramCreateHndPriv) int VMCIDatagramCreateHndPriv(VMCIId resourceID, // IN: uint32 flags, // IN: @@ -610,6 +606,7 @@ VMCIDatagramCreateHndPriv(VMCIId resourceID, // IN: *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIDatagramDestroyHndInt) int VMCIDatagramDestroyHndInt(VMCIHandle handle) // IN { @@ -667,10 +664,7 @@ VMCIDatagramDestroyHndInt(VMCIHandle handle) // IN *----------------------------------------------------------------------------- */ -#ifdef __linux__ -EXPORT_SYMBOL(VMCIDatagram_DestroyHnd); -#endif - +VMCI_EXPORT_SYMBOL(VMCIDatagram_DestroyHnd) int VMCIDatagram_DestroyHnd(VMCIHandle handle) // IN { @@ -694,10 +688,7 @@ VMCIDatagram_DestroyHnd(VMCIHandle handle) // IN *----------------------------------------------------------------------------- */ -#ifdef __linux__ -EXPORT_SYMBOL(VMCIDatagram_Send); -#endif - +VMCI_EXPORT_SYMBOL(VMCIDatagram_Send) int VMCIDatagram_Send(VMCIDatagram *msg) // IN { diff --git a/open-vm-tools/modules/linux/vmci/vmciEvent.c b/open-vm-tools/modules/linux/vmci/vmciEvent.c index 1932c1399..f6bf5cf6f 100644 --- a/open-vm-tools/modules/linux/vmci/vmciEvent.c +++ b/open-vm-tools/modules/linux/vmci/vmciEvent.c @@ -642,6 +642,7 @@ VMCIEventUnregisterSubscription(VMCIId subID) // IN *---------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIEventSubscribe) int VMCIEventSubscribe(VMCI_Event event, // IN uint32 flags, // IN @@ -691,10 +692,7 @@ VMCIEventSubscribe(VMCI_Event event, // IN *---------------------------------------------------------------------- */ -#if defined(__linux__) -EXPORT_SYMBOL(VMCIEvent_Subscribe); -#endif - +VMCI_EXPORT_SYMBOL(VMCIEvent_Subscribe) int VMCIEvent_Subscribe(VMCI_Event event, // IN uint32 flags, // IN @@ -725,6 +723,7 @@ VMCIEvent_Subscribe(VMCI_Event event, // IN *---------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIEventUnsubscribe) int VMCIEventUnsubscribe(VMCIId subID) // IN { @@ -763,10 +762,7 @@ VMCIEventUnsubscribe(VMCIId subID) // IN *---------------------------------------------------------------------- */ -#if defined(__linux__) -EXPORT_SYMBOL(VMCIEvent_Unsubscribe); -#endif - +VMCI_EXPORT_SYMBOL(VMCIEvent_Unsubscribe) int VMCIEvent_Unsubscribe(VMCIId subID) // IN { diff --git a/open-vm-tools/modules/linux/vmci/vmciGuestDs.c b/open-vm-tools/modules/linux/vmci/vmciGuestDs.c index 46942d5c0..62ce12750 100644 --- a/open-vm-tools/modules/linux/vmci/vmciGuestDs.c +++ b/open-vm-tools/modules/linux/vmci/vmciGuestDs.c @@ -84,10 +84,7 @@ static int VMCIDsRecvCB(void *clientData, struct VMCIDatagram *msg); *------------------------------------------------------------------------- */ -#ifdef __linux__ -EXPORT_SYMBOL(VMCIDs_Lookup); -#endif - +VMCI_EXPORT_SYMBOL(VMCIDs_Lookup) int VMCIDs_Lookup(const char *name, // IN VMCIHandle *out) // diff --git a/open-vm-tools/modules/linux/vmci/vmciNotifications.c b/open-vm-tools/modules/linux/vmci/vmciNotifications.c index 90f9b7990..fdbbd56cc 100644 --- a/open-vm-tools/modules/linux/vmci/vmciNotifications.c +++ b/open-vm-tools/modules/linux/vmci/vmciNotifications.c @@ -951,6 +951,7 @@ VMCI_ScanNotificationBitmap(uint8 *bitmap) // IN *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIDoorbell_Create) int VMCIDoorbell_Create(VMCIHandle *handle, // IN uint32 flags, // IN @@ -969,10 +970,6 @@ VMCIDoorbell_Create(VMCIHandle *handle, // IN notifyCB, clientData); } -#if defined(__linux__) -EXPORT_SYMBOL(VMCIDoorbell_Create); -#endif - /* *----------------------------------------------------------------------------- @@ -992,6 +989,7 @@ EXPORT_SYMBOL(VMCIDoorbell_Create); *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIDoorbell_Destroy) int VMCIDoorbell_Destroy(VMCIHandle handle) // IN { @@ -1001,10 +999,6 @@ VMCIDoorbell_Destroy(VMCIHandle handle) // IN return VMCINotificationUnregister(handle, TRUE); } -#if defined(__linux__) -EXPORT_SYMBOL(VMCIDoorbell_Destroy); -#endif - /* *----------------------------------------------------------------------------- @@ -1023,6 +1017,7 @@ EXPORT_SYMBOL(VMCIDoorbell_Destroy); *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIDoorbell_Notify) int VMCIDoorbell_Notify(VMCIHandle handle, // IN VMCIPrivilegeFlags privFlags) // IN: Unused in guest @@ -1048,9 +1043,6 @@ VMCIDoorbell_Notify(VMCIHandle handle, // IN return result; } -#if defined(__linux__) -EXPORT_SYMBOL(VMCIDoorbell_Notify); -#endif #else // defined(SOLARIS) || defined(__APPLE__) @@ -1071,9 +1063,10 @@ EXPORT_SYMBOL(VMCIDoorbell_Notify); *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIDoorbell_Create) int VMCIDoorbell_Create(VMCIHandle *handle, // IN - uint32 flags, // IN + uint32 flags, // I VMCIPrivilegeFlags privFlags, // IN VMCICallback notifyCB, // IN void *clientData) // IN @@ -1082,6 +1075,7 @@ VMCIDoorbell_Create(VMCIHandle *handle, // IN } +VMCI_EXPORT_SYMBOL(VMCIDoorbell_Destroy) int VMCIDoorbell_Destroy(VMCIHandle handle) // IN { @@ -1089,6 +1083,7 @@ VMCIDoorbell_Destroy(VMCIHandle handle) // IN } +VMCI_EXPORT_SYMBOL(VMCIDoorbell_Notify) int VMCIDoorbell_Notify(VMCIHandle handle, // IN VMCIPrivilegeFlags privFlags) // IN diff --git a/open-vm-tools/modules/linux/vmci/vmciQPair.c b/open-vm-tools/modules/linux/vmci/vmciQPair.c index 0a7845f93..e4ba9e4de 100644 --- a/open-vm-tools/modules/linux/vmci/vmciQPair.c +++ b/open-vm-tools/modules/linux/vmci/vmciQPair.c @@ -123,6 +123,7 @@ struct VMCIQPair { *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_Alloc) int VMCIQPair_Alloc(VMCIQPair **qpair, // OUT VMCIHandle *handle, // OUT @@ -186,6 +187,7 @@ VMCIQPair_Alloc(VMCIQPair **qpair, // OUT *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_Detach) int VMCIQPair_Detach(VMCIQPair **qpair) // IN/OUT { @@ -220,11 +222,6 @@ VMCIQPair_Detach(VMCIQPair **qpair) // IN/OUT } -#if defined __linux__ && !defined VMKERNEL -EXPORT_SYMBOL(VMCIQPair_Alloc); -EXPORT_SYMBOL(VMCIQPair_Detach); -#endif - /* * "Windows blocking call." * @@ -304,6 +301,7 @@ VMCIQPairUnlock(const VMCIQPair *qpair) // IN *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_Init) void VMCIQPair_Init(VMCIQPair *qpair) { @@ -337,6 +335,7 @@ VMCIQPair_Init(VMCIQPair *qpair) *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_GetProduceIndexes) int VMCIQPair_GetProduceIndexes(const VMCIQPair *qpair, // IN uint64 *producerTail, // OUT @@ -382,6 +381,7 @@ VMCIQPair_GetProduceIndexes(const VMCIQPair *qpair, // IN *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_GetConsumeIndexes) int VMCIQPair_GetConsumeIndexes(const VMCIQPair *qpair, // IN uint64 *consumerTail, // OUT @@ -408,12 +408,6 @@ VMCIQPair_GetConsumeIndexes(const VMCIQPair *qpair, // IN return VMCI_SUCCESS; } -#if defined __linux__ && !defined VMKERNEL -EXPORT_SYMBOL(VMCIQPair_Init); -EXPORT_SYMBOL(VMCIQPair_GetProduceIndexes); -EXPORT_SYMBOL(VMCIQPair_GetConsumeIndexes); -#endif - /* *----------------------------------------------------------------------------- @@ -435,6 +429,7 @@ EXPORT_SYMBOL(VMCIQPair_GetConsumeIndexes); *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_ProduceFreeSpace) int64 VMCIQPair_ProduceFreeSpace(const VMCIQPair *qpair) // IN { @@ -477,6 +472,7 @@ VMCIQPair_ProduceFreeSpace(const VMCIQPair *qpair) // IN *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_ConsumeFreeSpace) int64 VMCIQPair_ConsumeFreeSpace(const VMCIQPair *qpair) // IN { @@ -519,6 +515,7 @@ VMCIQPair_ConsumeFreeSpace(const VMCIQPair *qpair) // IN *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_ProduceBufReady) int64 VMCIQPair_ProduceBufReady(const VMCIQPair *qpair) // IN { @@ -560,6 +557,7 @@ VMCIQPair_ProduceBufReady(const VMCIQPair *qpair) // IN *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_ConsumeBufReady) int64 VMCIQPair_ConsumeBufReady(const VMCIQPair *qpair) // IN { @@ -580,13 +578,6 @@ VMCIQPair_ConsumeBufReady(const VMCIQPair *qpair) // IN return result; } -#if defined __linux__ && !defined VMKERNEL -EXPORT_SYMBOL(VMCIQPair_ProduceFreeSpace); -EXPORT_SYMBOL(VMCIQPair_ConsumeFreeSpace); -EXPORT_SYMBOL(VMCIQPair_ProduceBufReady); -EXPORT_SYMBOL(VMCIQPair_ConsumeBufReady); -#endif - /* *----------------------------------------------------------------------------- @@ -772,6 +763,7 @@ DequeueLocked(VMCIQueue *produceQ, // IN *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_Enqueue) ssize_t VMCIQPair_Enqueue(VMCIQPair *qpair, // IN const void *buf, // IN @@ -815,6 +807,7 @@ VMCIQPair_Enqueue(VMCIQPair *qpair, // IN *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_Dequeue) ssize_t VMCIQPair_Dequeue(VMCIQPair *qpair, // IN void *buf, // IN @@ -860,6 +853,7 @@ VMCIQPair_Dequeue(VMCIQPair *qpair, // IN *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_Peek) ssize_t VMCIQPair_Peek(VMCIQPair *qpair, // IN void *buf, // IN @@ -886,12 +880,6 @@ VMCIQPair_Peek(VMCIQPair *qpair, // IN return result; } -#if defined __linux__ && !defined VMKERNEL -EXPORT_SYMBOL(VMCIQPair_Enqueue); -EXPORT_SYMBOL(VMCIQPair_Dequeue); -EXPORT_SYMBOL(VMCIQPair_Peek); -#endif - #if defined (SOLARIS) || (defined(__APPLE__) && !defined (VMX86_TOOLS)) || \ (defined(__linux__) && defined(__KERNEL__)) || \ @@ -914,6 +902,7 @@ EXPORT_SYMBOL(VMCIQPair_Peek); *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_EnqueueV) ssize_t VMCIQPair_EnqueueV(VMCIQPair *qpair, // IN void *iov, // IN @@ -957,6 +946,7 @@ VMCIQPair_EnqueueV(VMCIQPair *qpair, // IN *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_DequeueV) ssize_t VMCIQPair_DequeueV(VMCIQPair *qpair, // IN void *iov, // IN @@ -1002,6 +992,7 @@ VMCIQPair_DequeueV(VMCIQPair *qpair, // IN *----------------------------------------------------------------------------- */ +VMCI_EXPORT_SYMBOL(VMCIQPair_PeekV) ssize_t VMCIQPair_PeekV(VMCIQPair *qpair, // IN void *iov, // IN @@ -1028,11 +1019,5 @@ VMCIQPair_PeekV(VMCIQPair *qpair, // IN return result; } -#if defined __linux__ && !defined VMKERNEL -EXPORT_SYMBOL(VMCIQPair_EnqueueV); -EXPORT_SYMBOL(VMCIQPair_DequeueV); -EXPORT_SYMBOL(VMCIQPair_PeekV); -#endif - #endif /* Systems that support struct iovec */ diff --git a/open-vm-tools/modules/linux/vmci/vmciUtil.c b/open-vm-tools/modules/linux/vmci/vmciUtil.c index 7fb8d7c6d..6c5dfb307 100644 --- a/open-vm-tools/modules/linux/vmci/vmciUtil.c +++ b/open-vm-tools/modules/linux/vmci/vmciUtil.c @@ -233,10 +233,7 @@ VMCIUtil_CheckHostCapabilities(void) *----------------------------------------------------------------------------- */ -#ifdef __linux__ -EXPORT_SYMBOL(VMCI_GetContextID); -#endif - +VMCI_EXPORT_SYMBOL(VMCI_GetContextID) VMCIId VMCI_GetContextID(void) { @@ -302,10 +299,7 @@ VMCI_CheckHostCapabilities(void) *---------------------------------------------------------------------- */ -#ifdef __linux__ -EXPORT_SYMBOL(VMCI_Version); -#endif - +VMCI_EXPORT_SYMBOL(VMCI_Version) uint32 VMCI_Version() { @@ -366,10 +360,7 @@ VMCI_InInterrupt() *---------------------------------------------------------------------- */ -#ifdef __linux__ -EXPORT_SYMBOL(VMCI_DeviceGet); -#endif - +VMCI_EXPORT_SYMBOL(VMCI_DeviceGet) Bool VMCI_DeviceGet(void) { @@ -393,10 +384,7 @@ VMCI_DeviceGet(void) *---------------------------------------------------------------------- */ -#ifdef __linux__ -EXPORT_SYMBOL(VMCI_DeviceRelease); -#endif - +VMCI_EXPORT_SYMBOL(VMCI_DeviceRelease) void VMCI_DeviceRelease(void) { @@ -562,10 +550,7 @@ VMCI_ReadDatagramsFromPort(VMCIIoHandle ioHandle, // IN *---------------------------------------------------------------------- */ -#ifdef __linux__ -EXPORT_SYMBOL(VMCIContext_GetPrivFlags); -#endif - +VMCI_EXPORT_SYMBOL(VMCIContext_GetPrivFlags) VMCIPrivilegeFlags VMCIContext_GetPrivFlags(VMCIId contextID) // IN { @@ -589,10 +574,7 @@ VMCIContext_GetPrivFlags(VMCIId contextID) // IN *---------------------------------------------------------------------- */ -#ifdef __linux__ -EXPORT_SYMBOL(VMCI_ContextID2HostVmID); -#endif - +VMCI_EXPORT_SYMBOL(VMCI_ContextID2HostVmID) int VMCI_ContextID2HostVmID(VMCIId contextID, // IN void *hostVmID, // OUT