diff --git a/configure.d/1_kallsyms_on_each_symbol.conf b/configure.d/1_kallsyms_on_each_symbol.conf new file mode 100644 index 0000000..c4e3384 --- /dev/null +++ b/configure.d/1_kallsyms_on_each_symbol.conf @@ -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 $@ diff --git a/modules/cas_cache/main.c b/modules/cas_cache/main.c index b9850e5..af539f3 100644 --- a/modules/cas_cache/main.c +++ b/modules/cas_cache/main.c @@ -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);