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

@ -0,0 +1,31 @@
#!/bin/bash
#
# Copyright(c) 2012-2020 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. $(dirname $3)/conf_framework
check() {
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "kallsyms_on_each_symbol(NULL, NULL)" "linux/fs.h"
then
echo $cur_name "1" >> $config_file_path
else
echo $cur_name "2" >> $config_file_path
fi
}
apply() {
case "$1" in
"1")
add_define "SYMBOL_LOOKUP_SUPPORTED 1" ;;
"2")
;;
*)
exit 1
esac
}
conf_run $@

View File

@ -51,6 +51,8 @@ bool in_upgrade;
ocf_ctx_t cas_ctx; ocf_ctx_t cas_ctx;
struct casdsk_functions_mapper casdisk_functions; struct casdsk_functions_mapper casdisk_functions;
#ifdef SYMBOL_LOOKUP_SUPPORTED
struct exported_symbol { struct exported_symbol {
char *name; char *name;
unsigned long addr; unsigned long addr;
@ -74,6 +76,16 @@ int static cas_find_symbol(void *data, const char *namebuf,
return -EINVAL; \ 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) int static cas_casdisk_lookup_funtions(void)
{ {
mutex_lock(&module_mutex); mutex_lock(&module_mutex);