Files
@ d6b9b2ac5869
Branch filter:
Location: vmkdrivers/BLD/build/HEADERS/vmkapi-current-all-public-bincomp/vmkernel64/release/base/vmkapi_module_int.h
d6b9b2ac5869
9.6 KiB
text/x-chdr
ESXi-5.5-U2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
/* **********************************************************
* Copyright 2008 - 2009 VMware, Inc. All rights reserved.
* **********************************************************/
/*
* @VMKAPIMOD_LICENSE@
*/
/*
* Module internal macros, defines, etc.
*
* Do not directly include or use the interfaces
* provided in this header; only use those provided by
* vmkapi_module.h.
*/
/** \cond nodoc */
#ifndef _VMKAPI_MODULE_INT_H_
#define _VMKAPI_MODULE_INT_H_
/** \cond never */
#ifndef VMK_HEADER_INCLUDED_FROM_VMKAPI_H
#error This vmkapi file should never be included directly but only via vmkapi.h
#endif
/** \endcond never */
/*
* Internal macro-machinery for parameter handling
*/
#define __vmk_ModuleParamType_int 1
#define __vmk_ModuleParamType_int_array 2
#define __vmk_ModuleParamType_uint 3
#define __vmk_ModuleParamType_uint_array 4
#define __vmk_ModuleParamType_long 5
#define __vmk_ModuleParamType_long_array 6
#define __vmk_ModuleParamType_ulong 7
#define __vmk_ModuleParamType_ulong_array 8
#define __vmk_ModuleParamType_short 9
#define __vmk_ModuleParamType_short_array 10
#define __vmk_ModuleParamType_ushort 11
#define __vmk_ModuleParamType_ushort_array 12
#define __vmk_ModuleParamType_string 13
#define __vmk_ModuleParamType_charp 14
#define __vmk_ModuleParamType_bool 15
#define __vmk_ModuleParamType_byte 16
#define VMK_PARAM(type) VMK_PARAM_##type = __vmk_ModuleParamType_##type
typedef enum {
VMK_PARAM(int),
VMK_PARAM(int_array),
VMK_PARAM(uint),
VMK_PARAM(uint_array),
VMK_PARAM(long),
VMK_PARAM(long_array),
VMK_PARAM(ulong),
VMK_PARAM(ulong_array),
VMK_PARAM(short),
VMK_PARAM(short_array),
VMK_PARAM(ushort),
VMK_PARAM(ushort_array),
VMK_PARAM(string),
VMK_PARAM(charp),
VMK_PARAM(bool),
VMK_PARAM(byte)
} vmk_ModuleParamType;
struct vmk_ModuleParam {
const char *name;
vmk_ModuleParamType type;
union {
void *arg;
struct {
char *arg;
int maxlen;
} string;
struct {
void *arg;
int maxlen;
int *nump;
} array;
} param;
};
#define VMK_PARAM_SEC ".vmkmodparam"
#define VMK_MODINFO_SEC ".vmkmodinfo"
/*
* License tag for third party modules.
*/
#define __VMK_MODULE_LICENSE_THIRD_PARTY "ThirdParty"
/*
* Add a string to modinfo without a corresponding symbol (i.e.
* informational only)
*/
#define __VMK_MODINFO_STAMP(string) \
asm(".pushsection " VMK_MODINFO_SEC ",\"a\", @progbits\n" \
"\t.string \"" string "\" \n" \
"\t.popsection\n")
/*
* Named parameter
*/
#define __VMK_MODPARAM_NAME(name, type) \
__VMK_MODINFO_STAMP("param_" #name ":" type)
/*
* Description of named paramter. Note: can not use stamp method as
* 'desc' may have embedded newlines which the asm calls expands...
*/
#define __VMK_MODPARAM_DESC(name, desc) \
const char __module_desc_##name[] \
__attribute__((section(VMK_MODINFO_SEC))) \
= "param_desc_" #name "=" desc
/* Required attributes for variables in VMK_PARAM_SEC */
#define __VMK_MODPARAM_ATTRS \
__attribute__ (( __section__(VMK_PARAM_SEC) )) \
__attribute__ (( __used__ )) \
__attribute__ (( aligned(sizeof(void*)) ))
/* Basic type */
#define __VMK_MODPARAM_NAMED(__name, __var, __type) \
static char __vmk_param_str_##__name[] = #__name; \
static struct vmk_ModuleParam const __param_##__name \
__VMK_MODPARAM_ATTRS \
= { \
.name = __vmk_param_str_##__name, \
.type = __vmk_ModuleParamType_##__type, \
.param.arg = &__var, \
}; \
__VMK_MODPARAM_NAME(__name, #__type)
/* Array */
#define __VMK_MODPARAM_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define __VMK_MODPARAM_ARRAY_NAMED(__name, __array, __type, __nump) \
static char __vmk_param_str_##__name[] = #__name; \
static struct vmk_ModuleParam const __param_##__name \
__VMK_MODPARAM_ATTRS \
= { \
.name = __vmk_param_str_##__name, \
.type = __vmk_ModuleParamType_##__type##_array, \
.param.array.arg = __array, \
.param.array.maxlen = __VMK_MODPARAM_ARRAY_SIZE(__array), \
.param.array.nump = __nump, \
}; \
__VMK_MODPARAM_NAME(__name, "array of " #__type)
/* String */
#define __VMK_MODPARAM_STRING_NAMED(__name, __string, __max) \
static char __vmk_param_str_##__name[] = #__name; \
static struct vmk_ModuleParam const __param_##__name \
__VMK_MODPARAM_ATTRS \
= { \
.name = __vmk_param_str_##__name, \
.type = __vmk_ModuleParamType_string, \
.param.string.arg = __string, \
.param.string.maxlen = __max, \
}; \
__VMK_MODPARAM_NAME(__name, "string")
/*
* Version Information
*/
#define VMK_VERSION_INFO_SYM __vmk_versionInfo_str
#define VMK_VERSION_INFO_TAG "version="
#define VMK_VERSION_INFO_TAG_LEN (sizeof(VMK_VERSION_INFO_TAG)-1)
#define __VMK_VERSION_INFO(__string) \
const static char VMK_VERSION_INFO_SYM[] \
__attribute__((used)) \
__attribute__((section(VMK_MODINFO_SEC))) = VMK_VERSION_INFO_TAG __string
/*
* License Information
*/
#define VMK_LICENSE_INFO_SYM __vmk_licenseInfo_str
#define VMK_LICENSE_INFO_TAG "license="
#define VMK_LICENSE_INFO_TAG_LEN (sizeof(VMK_LICENSE_INFO_TAG)-1)
#define __VMK_LICENSE_INFO(__string) \
const static char VMK_LICENSE_INFO_SYM[] \
__attribute__((used)) \
__attribute__((section(VMK_MODINFO_SEC))) = VMK_LICENSE_INFO_TAG __string
/*
* Symbol Exports
*/
#define VMK_EXPORT_SYMBOL_SEC ".vmksymbolexports"
struct vmk_ExportSymbol {
char *name;
enum {
VMK_EXPORT_SYMBOL_DEFAULT,
/* Direct export means don't ever create a trampoline for this symbol. */
VMK_EXPORT_SYMBOL_DIRECT,
} exportType;
};
#define __VMK_EXPORT_SYMBOL_ATTRS \
__attribute__ (( __section__(VMK_EXPORT_SYMBOL_SEC) )) \
__attribute__ (( __used__ )) \
__attribute__ (( aligned(sizeof(void*)) ))
#define __VMK_MODULE_EXPORT_SYMBOL(__symname) \
static char __vmk_symbol_str_##__symname[] = #__symname; \
static struct vmk_ExportSymbol const __vmk_symbol_##__symname \
__VMK_EXPORT_SYMBOL_ATTRS \
= { \
.name = __vmk_symbol_str_##__symname, \
.exportType = VMK_EXPORT_SYMBOL_DEFAULT, \
};
#define __VMK_MODULE_EXPORT_SYMBOL_DIRECT(__symname) \
static char __vmk_symbol_str_##__symname[] = #__symname; \
static struct vmk_ExportSymbol const __vmk_symbol_##__symname \
__VMK_EXPORT_SYMBOL_ATTRS \
= { \
.name = __vmk_symbol_str_##__symname, \
.exportType = VMK_EXPORT_SYMBOL_DIRECT, \
};
/*
* Aliases
*/
#define VMK_EXPORT_ALIAS_SEC ".vmksymbolaliases"
/*
* Note that VMK_MODULE_EXPORT_ALIAS() sets the name and alias the
* same; we assume this condition is a direct external alias and that
* 'name' is exported by another module.
*/
struct vmk_ExportSymbolAlias {
char *name;
char *alias;
};
#define __VMK_EXPORT_ALIAS_ATTRS \
__attribute__ (( __section__(VMK_EXPORT_ALIAS_SEC) )) \
__attribute__ (( __used__ )) \
__attribute__ (( aligned(sizeof(void*)) ))
#define __VMK_MODULE_EXPORT_SYMBOL_ALIASED(__symname, __alias) \
static char __vmk_symbol_str_##__symname##__alias[] = #__symname; \
static char __vmk_symbol_str_##__alias[] = #__alias; \
static struct vmk_ExportSymbolAlias const \
__vmk_symbol_##__symname##__alias \
__VMK_EXPORT_ALIAS_ATTRS \
= { \
.name = __vmk_symbol_str_##__symname##__alias, \
.alias = __vmk_symbol_str_##__alias, \
};
/*
* Name-spaces
*/
#define VMK_NAMESPACE_SEC ".vmkrequiredns"
#define __VMK_NAMESPACE_REQUIRED(__ns, __version) \
asm(".pushsection " VMK_NAMESPACE_SEC ",\"aS\", @progbits\n" \
"\t.string \"" __ns VMK_NS_VER_SEPARATOR_STRING \
__version "\" \n" \
"\t.popsection\n"); \
__VMK_MODINFO_STAMP("nsRequired=" __ns \
VMK_NS_VER_SEPARATOR_STRING __version)
#define VMK_NAMESPACE_PROVIDES_SYM __vmk_nsProvides_str
#define VMK_NAMESPACE_PROVIDES_TAG "nsProvides="
#define VMK_NAMESPACE_PROVIDES_TAG_LEN (sizeof(VMK_NAMESPACE_PROVIDES_TAG)-1)
#define __VMK_NAMESPACE_PROVIDES(__ns, __version) \
const static char VMK_NAMESPACE_PROVIDES_SYM[] \
__attribute__((used)) \
__attribute__((section(VMK_MODINFO_SEC))) = \
VMK_NAMESPACE_PROVIDES_TAG __ns \
VMK_NS_VER_SEPARATOR_STRING __version;
#endif /* _VMKAPI_MODULE_INT_H_ */
/** \endcond nodoc */
|