Use default kernel export mechanism when symbol lookup is not available

Since kernel 5.7 kallsyms_on_each_symbol() is not available.
NOTE: This affects ability to perform upgrade in flight on kernels 5.7+.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2020-12-12 11:32:40 +01:00
parent 0596597f61
commit 1810010093
2 changed files with 43 additions and 0 deletions

View File

@@ -51,6 +51,8 @@ bool in_upgrade;
ocf_ctx_t cas_ctx;
struct casdsk_functions_mapper casdisk_functions;
#ifdef SYMBOL_LOOKUP_SUPPORTED
struct exported_symbol {
char *name;
unsigned long addr;
@@ -74,6 +76,16 @@ int static cas_find_symbol(void *data, const char *namebuf,
return -EINVAL; \
})
#else
#include "../cas_disk/cas_disk.h"
#include "../cas_disk/exp_obj.h"
#define cas_lookup_symbol(f) ({ \
casdisk_functions.f = (void *)f; \
})
#endif
int static cas_casdisk_lookup_funtions(void)
{
mutex_lock(&module_mutex);