diff options
author | thegeorg <thegeorg@yandex-team.com> | 2023-07-18 14:04:56 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2023-07-18 14:04:56 +0300 |
commit | e6faf2d02c5150afa1653e6232678b23b68fe534 (patch) | |
tree | 1c4c68662b38947880e788869399acd1a202d106 /contrib/libs/ibdrv/symbols.cpp | |
parent | 8c8a4c1d7d49f7f55e2d3b30f638b53b7c890273 (diff) | |
download | ydb-e6faf2d02c5150afa1653e6232678b23b68fe534.tar.gz |
Allow using ibdrv interface in opensource apps
Diffstat (limited to 'contrib/libs/ibdrv/symbols.cpp')
-rw-r--r-- | contrib/libs/ibdrv/symbols.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/contrib/libs/ibdrv/symbols.cpp b/contrib/libs/ibdrv/symbols.cpp new file mode 100644 index 0000000000..87bda96e9d --- /dev/null +++ b/contrib/libs/ibdrv/symbols.cpp @@ -0,0 +1,51 @@ +#include "symbols.h" + +#include <util/generic/singleton.h> +#include <util/generic/utility.h> +#include <util/system/dynlib.h> + +#define LOADSYM(name, type) {name = (TId<type>::R*)L->SymOptional(#name);} + +const TInfinibandSymbols* IBSym() { + struct TSymbols: TInfinibandSymbols { + TSymbols() { + L.Reset(new TDynamicLibrary("/usr/lib/libibverbs.so")); + + DOVERBS(LOADSYM) + } + + THolder<TDynamicLibrary> L; + }; + + return SingletonWithPriority<TSymbols, 100>(); +} + +const TRdmaSymbols* RDSym() { + struct TSymbols: TRdmaSymbols { + TSymbols() { + L.Reset(new TDynamicLibrary("/usr/lib/librdmacm.so")); + + DORDMA(LOADSYM) + } + + THolder<TDynamicLibrary> L; + }; + + return SingletonWithPriority<TSymbols, 100>(); +} + +const TMlx5Symbols* M5Sym() { + struct TSymbols: TMlx5Symbols { + TSymbols() { + L.Reset(new TDynamicLibrary("/usr/lib/libmlx5.so")); + + DOMLX5(LOADSYM) + } + + THolder<TDynamicLibrary> L; + }; + + return SingletonWithPriority<TSymbols, 100>(); +} + +#undef LOADSYM |