]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Change to common header file not applicable to open-vm-tools.
authorKaty Feng <fkaty@vmware.com>
Thu, 6 Apr 2023 18:27:41 +0000 (11:27 -0700)
committerKaty Feng <fkaty@vmware.com>
Thu, 6 Apr 2023 18:27:41 +0000 (11:27 -0700)
open-vm-tools/lib/include/vmk_exports.h

index 1dbaef99752e29f5eef3d5d15ca5c0d82e4f0441..abd91b988f38478292d5ec0b431864982debb9a3 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2009-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2009-2016,2023 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
 /*
  * vmk_exports.h --
  *
- *     Macros for exporting symbols from vmkernel
+ *      Macros for exporting symbols from vmkernel.
  */
 
 #ifndef _VMK_EXPORTS_H
 #define _VMK_EXPORTS_H
 
 #ifdef VMKERNEL
-#include "vm_basic_defs.h"
+#   include "vm_basic_defs.h"
+
+#   define _VMK_KERNEL_EXPORT(string) asm(                                    \
+   ".pushsection .vmkexports, \"aS\", @progbits"                       "\n\t" \
+   ".string \"" string "\""                                            "\n\t" \
+   ".popsection"                                                              \
+)
+#else
+#   define _VMK_KERNEL_EXPORT(string)
+#endif
 
 /*
  * The following macros allow you to export symbols from vmkernel,
  * VMK_MODULE_NAMESPACE_REQUIRED("myns", "1") tag to see that symbol.
  */
 
-#define VMK_KERNEL_EXPORT_SEC ".vmkexports"
-
-#define VMK_KERNEL_EXPORT(symbol)                                       \
-   asm(".pushsection " VMK_KERNEL_EXPORT_SEC ",\"aS\", @progbits\n"     \
-       "\t.string \"" XSTR(symbol) "\" \n" "\t.popsection\n");
-
-#define VMK_KERNEL_ALIAS(symbol, alias)                                 \
-   asm(".pushsection " VMK_KERNEL_EXPORT_SEC ",\"aS\", @progbits\n"     \
-       "\t.string \"" XSTR(symbol) "!" XSTR(alias) "\" \n"             \
-       "\t.popsection\n");
-
-/* name@namespace:version */
-#define VMK_KERNEL_EXPORT_TO_NAMESPACE(symbol, namespace, version)      \
-   asm(".pushsection " VMK_KERNEL_EXPORT_SEC ",\"aS\", @progbits\n"     \
-       "\t.string \"" XSTR(symbol) "@" namespace ":" version  "\" \n"   \
-       "\t.popsection\n");
+#define VMK_KERNEL_EXPORT(symbol)                                             \
+   _VMK_KERNEL_EXPORT(XSTR(symbol))
 
-/* name!alias@namespace:version */
-#define VMK_KERNEL_ALIAS_TO_NAMESPACE(symbol, alias, namespace, version) \
-   asm(".pushsection " VMK_KERNEL_EXPORT_SEC ",\"aS\", @progbits\n"      \
-       "\t.string \"" XSTR(symbol) "!" XSTR(alias) "@" namespace ":"     \
-       version "\" \n\t.popsection\n");
+#define VMK_KERNEL_ALIAS(symbol, alias)                                       \
+   _VMK_KERNEL_EXPORT(XSTR(symbol) "!" XSTR(alias))
 
-#else /* ! defined VMKERNEL */
-
-/*
- * Empty definitions for kernel exports when built in non-kernel environments. 
- */
-#define VMK_KERNEL_EXPORT(_symbol)
-#define VMK_KERNEL_ALIAS(symbol, alias)
-#define VMK_KERNEL_EXPORT_TO_NAMESPACE(symbol, namespace, version)
-#define VMK_KERNEL_ALIAS_TO_NAMESPACE(symbol, alias, namespace, version)
+#define VMK_KERNEL_EXPORT_TO_NAMESPACE(symbol, namespace, version)            \
+   _VMK_KERNEL_EXPORT(XSTR(symbol) "@" namespace ":" version)
 
-#endif /* defined VMKERNEL */
+#define VMK_KERNEL_ALIAS_TO_NAMESPACE(symbol, alias, namespace, version)      \
+   _VMK_KERNEL_EXPORT(XSTR(symbol) "!" XSTR(alias) "@" namespace ":" version)
 
 #endif /* _VMK_EXPORTS_H */