configure/module_mutex: adapt to kernel 5.12

The module_mutex is internal to the module loader since kernel
commit 922f2a7c.

Signed-off-by: Gal Hammer <gal.hammer@huawei.com>
Signed-off-by: Shai Fultheim <shai.fultheim@huawei.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Gal Hammer 2022-01-30 10:58:27 +02:00 committed by Robert Baldyga
parent b263dec467
commit fea5e72d8c
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,32 @@
#!/bin/bash
#
# Copyright(c) 2022 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
. $(dirname $3)/conf_framework
check() {
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "mutex_lock(&module_mutex);" "linux/module.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 "MODULE_MUTEX_SUPPORTED 1" ;;
"2")
;;
*)
exit 1
esac
}
conf_run $@

View File

@ -46,7 +46,7 @@ MODULE_PARM_DESC(seq_cut_off_mb,
ocf_ctx_t cas_ctx;
struct casdsk_functions_mapper casdisk_functions;
#ifdef SYMBOL_LOOKUP_SUPPORTED
#if defined(SYMBOL_LOOKUP_SUPPORTED) && defined(MODULE_MUTEX_SUPPORTED)
struct exported_symbol {
char *name;
@ -83,7 +83,9 @@ int static cas_find_symbol(void *data, const char *namebuf,
int static cas_casdisk_lookup_funtions(void)
{
#ifdef MODULE_MUTEX_SUPPORTED
mutex_lock(&module_mutex);
#endif
cas_lookup_symbol(casdsk_disk_detach);
cas_lookup_symbol(casdsk_exp_obj_destroy);
cas_lookup_symbol(casdsk_exp_obj_create);
@ -105,7 +107,9 @@ int static cas_casdisk_lookup_funtions(void)
cas_lookup_symbol(casdsk_disk_open);
cas_lookup_symbol(casdsk_disk_clear_pt);
cas_lookup_symbol(casdsk_exp_obj_get_gendisk);
#ifdef MODULE_MUTEX_SUPPORTED
mutex_unlock(&module_mutex);
#endif
return 0;
}