Enable configure script to compile test modules in parallel.

This patch significantly reduces time needed to prepare config file.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2019-07-11 09:21:31 -04:00
parent 13c51041ff
commit 9473cf9795
36 changed files with 355 additions and 261 deletions

62
configure vendored
View File

@ -19,35 +19,55 @@ SCRIPTPATH=`realpath $SCRIPTPATH`
CONFIG_FILES=`ls $SCRIPTPATH/configure.d/*.conf | sort`
FILES_COUNT=`echo $CONFIG_FILES | wc -w`
CONFIG_FILE="config.out"
generate_config() {
rm -f config.out
progress=0
for file in $CONFIG_FILES; do
progress=$((progress+1))
echo -ne "Generating configuration: $progress/$FILES_COUNT\033[0K\r"
CONF="$(/bin/bash $file "check")"
echo "$(basename $file) $CONF" >> config.out
done
echo ""
rm -f ${CONFIG_FILE}
touch ${CONFIG_FILE}
declare -a pid_list
progress=0
# Compile each test module in backgorund
echo "Preparing configuration"
for file in $CONFIG_FILES; do
progress=$((progress+1))
# $1 - Action to be performed
# $2 - File with stored configuration
# $3 - Name of called script (since script is running as subprocess
# it has to be passed explicitly
source $file "check" "${SCRIPTPATH}/${CONFIG_FILE}" "$file" &
pid_list+=($!)
done
# Wait for all compilation processes to finish
for i in "${pid_list[@]}"; do
wait $i &> /dev/null
done
grep "X" ${SCRIPTPATH}/${CONFIG_FILE} &> /dev/null
if [ $? -eq 0 ] ; then
echo "ERROR! Following steps failed while preparing config:"
grep "X" ${SCRIPTPATH}/${CONFIG_FILE} | cut -f1 -d ' '
exit 1
fi
}
generate_header() {
rm -f $SCRIPTPATH/modules/generated_defines.h
progress=0
for file in $CONFIG_FILES; do
progress=$((progress+1))
echo -ne "Configuring OpenCAS: $progress/$FILES_COUNT\033[0K\r"
CONF=$(cat config.out | awk -v file=$(basename $file) '{ if ($1 == file) print $2 }')
/bin/bash $file "apply" "$CONF"
done
echo ""
rm -f $SCRIPTPATH/modules/generated_defines.h
progress=0
for file in $CONFIG_FILES; do
progress=$((progress+1))
echo -ne "Configuring OpenCAS: $progress/$FILES_COUNT\033[0K\r"
CONF=$(cat ${CONFIG_FILE} | awk -v file=$(basename $file) '{ if ($1 == file) print $2 }')
/bin/bash $file "apply" "$CONF" "$file"
done
echo ""
}
if [ -z "$1" ]; then
generate_config
CONFIG_FILE="config.out"
generate_config
else
CONFIG_FILE="$1"
CONFIG_FILE="$1"
fi
generate_header

View File

@ -4,14 +4,17 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "struct bio *b;blk_rq_append_bio(NULL, &b)" "linux/blkdev.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct bio *b;blk_rq_append_bio(NULL, &b)" "linux/blkdev.h"
then
echo "1"
echo $cur_name 1 >> $config_file_path
else
echo "2"
echo $cur_name 2 >> $config_file_path
fi
}

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "lookup_bdev(\"some_path\")" "linux/fs.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "lookup_bdev(\"some_path\")" "linux/fs.h"
then
echo "1"
elif compile_module "lookup_bdev(\"some_path\", 0)" "linux/fs.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "lookup_bdev(\"some_path\", 0)" "linux/fs.h"
then
echo "2"
echo $cur_name "2" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,20 +4,22 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "bio_clone(NULL, 0)" "linux/bio.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "bio_clone(NULL, 0)" "linux/bio.h"
then
echo "1"
elif compile_module "bio_clone_kmalloc(NULL, 0)" "linux/bio.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "bio_clone_kmalloc(NULL, 0)" "linux/bio.h"
then
echo "2"
elif compile_module "bio_clone_fast(NULL, 0, NULL)" "linux/bio.h"
echo $cur_name "2" >> $config_file_path
elif compile_module $cur_name "bio_clone_fast(NULL, 0, NULL)" "linux/bio.h"
then
echo "3"
echo $cur_name "3" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "struct bio b;b.bi_end_io(NULL, 0)" "linux/bio.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct bio b;b.bi_end_io(NULL, 0)" "linux/bio.h"
then
echo "1"
elif compile_module "struct bio b;b.bi_end_io(NULL)" "linux/bio.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "struct bio b;b.bi_end_io(NULL)" "linux/bio.h"
then
echo "2"
echo $cur_name "2" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,22 +4,25 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "bio_op(NULL)" "linux/bio.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "bio_op(NULL)" "linux/bio.h"
then
echo "1"
elif compile_module "REQ_OP_MASK" "linux/blk_types.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "REQ_OP_MASK" "linux/blk_types.h"
then
echo "2"
elif compile_module "REQ_OP_DISCARD" "linux/blk_types.h"
echo $cur_name "2" >> $config_file_path
elif compile_module $cur_name "REQ_OP_DISCARD" "linux/blk_types.h"
then
echo "3"
elif compile_module "REQ_DISCARD" "linux/blk_types.h"
echo $cur_name "3" >> $config_file_path
elif compile_module $cur_name "REQ_DISCARD" "linux/blk_types.h"
then
echo "4"
echo $cur_name "4" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,17 +4,17 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "struct bio b;b.bi_status" "linux/bio.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct bio b;b.bi_status" "linux/bio.h"
then
echo "1"
elif compile_module "struct bio b;b.bi_error" "linux/bio.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "struct bio b;b.bi_error" "linux/bio.h"
then
echo "2"
else
echo "X"
echo $cur_name "2" >> $config_file_path
fi
}

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "struct bio b;b.bi_opf" "linux/bio.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct bio b;b.bi_opf" "linux/bio.h"
then
echo "1"
elif compile_module "struct bio b;b.bi_rw" "linux/bio.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "struct bio b;b.bi_rw" "linux/bio.h"
then
echo "2"
echo $cur_name "2" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "struct bio b;b.bi_iter.bi_size" "linux/bio.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct bio b;b.bi_iter.bi_size" "linux/bio.h"
then
echo "1"
elif compile_module "struct bio b;b.bi_size" "linux/bio.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "struct bio b;b.bi_size" "linux/bio.h"
then
echo "2"
echo $cur_name "2" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "struct bio b;&bio_iovec(&b)" "linux/bio.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct bio b;&bio_iovec(&b)" "linux/bio.h"
then
echo "1"
echo $cur_name "1" >> $config_file_path
else
echo "2"
echo $cur_name "2" >> $config_file_path
fi
}

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "blk_rq_set_block_pc(NULL)" "linux/blkdev.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "blk_rq_set_block_pc(NULL)" "linux/blkdev.h"
then
echo "1"
echo $cur_name "1" >> $config_file_path
else
echo "2"
echo $cur_name "2" >> $config_file_path
fi
}

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "deamonize(\"some_name\", NULL)" "linux/sched.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "deamonize(\"some_name\", NULL)" "linux/sched.h"
then
echo "1"
echo $cur_name "1" >> $config_file_path
else
echo "2"
echo $cur_name "2" >> $config_file_path
fi
}

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "struct dentry dentry;dentry.d_u.d_alias" "linux/dcache.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct dentry dentry;dentry.d_u.d_alias" "linux/dcache.h"
then
echo "1"
elif compile_module "struct dentry dentry;dentry.d_alias" "linux/dcache.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "struct dentry dentry;dentry.d_alias" "linux/dcache.h"
then
echo "2"
echo $cur_name "2" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "struct queue_limits q;q.discard_zeroes_data" "linux/blkdev.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct queue_limits q;q.discard_zeroes_data" "linux/blkdev.h"
then
echo "1"
echo $cur_name "1" >> $config_file_path
else
echo "2"
echo $cur_name "2" >> $config_file_path
fi
}

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "REQ_PREFLUSH" "linux/blk_types.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "REQ_PREFLUSH" "linux/blk_types.h"
then
echo "1"
elif compile_module "REQ_FLUSH" "linux/blk_types.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "REQ_FLUSH" "linux/blk_types.h"
then
echo "2"
echo $cur_name "2" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,23 +4,25 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "generic_start_io_acct(NULL, 0, 0, NULL)" "linux/bio.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "generic_start_io_acct(NULL, 0, 0, NULL)" "linux/bio.h"
then
echo "1"
elif compile_module "generic_start_io_acct(0, 0, NULL)" "linux/bio.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "generic_start_io_acct(0, 0, NULL)" "linux/bio.h"
then
echo "2"
elif compile_module "part_round_stats(1, 1)" "linux/genhd.h"
echo $cur_name "2" >> $config_file_path
elif compile_module $cur_name "part_round_stats(1, 1)" "linux/genhd.h"
then
echo "3"
elif compile_module "part_round_stats(NULL, 1, 1)" "linux/genhd.h"
echo $cur_name "3" >> $config_file_path
elif compile_module $cur_name "part_round_stats(NULL, 1, 1)" "linux/genhd.h"
then
echo "4"
echo $cur_name "4" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "global_zone_page_state(1)" "linux/mm.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "global_zone_page_state(1)" "linux/mm.h"
then
echo "1"
elif compile_module "global_page_state(1)" "linux/mm.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "global_page_state(1)" "linux/mm.h"
then
echo "2"
echo $cur_name "2" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "struct hlist_node list" "linux/types.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct hlist_node list" "linux/types.h"
then
echo "1"
elif compile_module "struct list_head list" "linux/list.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "struct list_head list" "linux/list.h"
then
echo "2"
echo $cur_name "2" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "struct file file;file.f_inode" "linux/fs.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct file file;file.f_inode" "linux/fs.h"
then
echo "1"
elif compile_module "struct file file;file->f_dentry->d_inode" "linux/fs.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "struct file file;file->f_dentry->d_inode" "linux/fs.h"
then
echo "2"
echo $cur_name "2" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "vm_munmap(0, 0)" "linux/mm.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "vm_munmap(0, 0)" "linux/mm.h"
then
echo "1"
elif compile_module "do_munmap(NULL, 0)" "linux/mm.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "do_munmap(NULL, 0)" "linux/mm.h"
then
echo "2"
echo $cur_name "2" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "blk_queue_bounce(NULL, NULL);" "linux/blkdev.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "blk_queue_bounce(NULL, NULL);" "linux/blkdev.h"
then
echo "1"
echo $cur_name "1" >> $config_file_path
else
echo "2"
echo $cur_name "2" >> $config_file_path
fi
}

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "struct request_queue q;q.limits.chunk_sectors" "linux/blkdev.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct request_queue q;q.limits.chunk_sectors" "linux/blkdev.h"
then
echo "1"
echo $cur_name "1" >> $config_file_path
else
echo "2"
echo $cur_name "2" >> $config_file_path
fi
}

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "blk_queue_flag_set(0, NULL)" "linux/blkdev.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "blk_queue_flag_set(0, NULL)" "linux/blkdev.h"
then
echo "1"
echo $cur_name "1" >> $config_file_path
else
echo "2"
echo $cur_name "2" >> $config_file_path
fi
}

View File

@ -4,21 +4,23 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
# RHEL 7.3
check() {
if compile_module "struct queue_limits q;q.limits_aux" "linux/blkdev.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct queue_limits q;q.limits_aux" "linux/blkdev.h"
then
echo "1"
elif compile_module "struct queue_limits q;q.max_write_zeroes_sectors" "linux/blkdev.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "struct queue_limits q;q.max_write_zeroes_sectors" "linux/blkdev.h"
then
echo "2"
elif compile_module "struct queue_limits q;q.max_write_same_sectors" "linux/blkdev.h"
echo $cur_name "2" >> $config_file_path
elif compile_module $cur_name "struct queue_limits q;q.max_write_same_sectors" "linux/blkdev.h"
then
echo "3"
echo $cur_name "3" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "REQ_TYPE_FS" "linux/blkdev.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "REQ_TYPE_FS" "linux/blkdev.h"
then
echo "1"
echo $cur_name "1" >> $config_file_path
else
echo "2"
echo $cur_name "2" >> $config_file_path
fi
}

View File

@ -4,7 +4,7 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
# submit_bio() can be defined in "bio.h" or in "fs.h"
# If it is defind in fs.h, three possibilities are available:
@ -12,20 +12,22 @@
# * it takes two arguments and returns non-void
# * it takse two arguments and is void-type
check() {
if compile_module "submit_bio(NULL)" "linux/bio.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "submit_bio(NULL)" "linux/bio.h"
then
echo "1"
elif compile_module "submit_bio(NULL)" "linux/fs.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "submit_bio(NULL)" "linux/fs.h"
then
echo "2"
elif compile_module "void *t=submit_bio(0, NULL)" "linux/fs.h"
echo $cur_name "2" >> $config_file_path
elif compile_module $cur_name "void *t=submit_bio(0, NULL)" "linux/fs.h"
then
echo "3"
elif compile_module "submit_bio(0, NULL)" "linux/fs.h"
echo $cur_name "4" >> $config_file_path
elif compile_module $cur_name "submit_bio(0, NULL)" "linux/fs.h"
then
echo "4"
echo $cur_name "4" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -1,26 +0,0 @@
#!/bin/bash
#
# Copyright(c) 2012-2019 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
check() {
if compile_module "struct bio b;b.bi_write_hint" "linux/bio.h"
then
echo "1"
else
echo "X"
fi
}
apply() {
case "$1" in
"1")
add_define "CAS_WLTH_SUPPORT \\
1" ;;
esac
}
conf_run $@

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "WRITE" "linux/blk_types.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "WRITE" "linux/blk_types.h"
then
echo "1"
elif compile_module "REQ_WRITE" "linux/blk_types.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "REQ_WRITE" "linux/blk_types.h"
then
echo "2"
echo $cur_name "2" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,22 +4,24 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "WRITE_FUA" "linux/fs.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "WRITE_FUA" "linux/fs.h"
then
if compile_module "BIO_FUA" "linux/bio.h"
if compile_module $cur_name "BIO_FUA" "linux/bio.h"
then
echo "1"
echo $cur_name "1" >> $config_file_path
else
echo "2"
echo $cur_name "2" >> $config_file_path
fi
elif compile_module "REQ_FUA" "linux/blk_types.h"
elif compile_module $cur_name "REQ_FUA" "linux/blk_types.h"
then
echo "3"
echo $cur_name "3" >> $config_file_path
else
echo "4"
echo $cur_name "4" >> $config_file_path
fi
}

28
configure.d/1_wtlh.conf Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
#
# Copyright(c) 2012-2019 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 "struct bio b;b.bi_write_hint" "linux/bio.h"
then
echo $cur_name "1" >> $config_file_path
fi
}
apply() {
case "$1" in
"1")
add_define "CAS_WLTH_SUPPORT \\
1" ;;
*)
exit 1
esac
}
conf_run $@

View File

@ -4,20 +4,22 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "RQF_SOFTBARRIER" "linux/blkdev.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "RQF_SOFTBARRIER" "linux/blkdev.h"
then
echo "1"
elif compile_module "REQ_SOFTBARRIER" "linux/blk_types.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "REQ_SOFTBARRIER" "linux/blk_types.h"
then
echo "2"
elif compile_module "BIO_RW_BARRIER" "linux/fs.h"
echo $cur_name "2" >> $config_file_path
elif compile_module $cur_name "BIO_RW_BARRIER" "linux/fs.h"
then
echo "3"
echo $cur_name "3" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,22 +4,24 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "WRITE_FLUSH_FUA" "linux/fs.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "WRITE_FLUSH_FUA" "linux/fs.h"
then
if compile_module "BIO_FUA" "linux/bio.h"
if compile_module $cur_name "BIO_FUA" "linux/bio.h"
then
echo "1"
echo $cur_name "1" >> $config_file_path
else
echo "2"
echo $cur_name "2" >> $config_file_path
fi
elif compile_module "REQ_PREFLUSH" "linux/blk_types.h"
elif compile_module $cur_name "REQ_PREFLUSH" "linux/blk_types.h"
then
echo "3"
echo $cur_name "3" >> $config_file_path
else
echo "4"
echo $cur_name "4" >> $config_file_path
fi
}

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "blk_make_request(NULL, NULL, 0)" "linux/blkdev.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "blk_make_request(NULL, NULL, 0)" "linux/blkdev.h"
then
echo "1"
echo $cur_name "1" >> $config_file_path
else
echo "2"
echo $cur_name "2" >> $config_file_path
fi
}

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "blk_queue_write_cache(NULL, 0, 0)" "linux/blkdev.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "blk_queue_write_cache(NULL, 0, 0)" "linux/blkdev.h"
then
echo "1"
elif compile_module "struct request_queue rq;rq.flush_flags" "linux/blkdev.h"
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "struct request_queue rq;rq.flush_flags" "linux/blkdev.h"
then
echo "2"
echo $cur_name "2" >> $config_file_path
else
echo "X"
echo $cur_name "X" >> $config_file_path
fi
}

View File

@ -4,22 +4,24 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
. $(dirname $3)/conf_framework
check() {
if compile_module "WRITE_FLUSH" "linux/fs.h"
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "WRITE_FLUSH" "linux/fs.h"
then
if compile_module "BIO_FLUSH" "linux/bio.h"
if compile_module $cur_name "BIO_FLUSH" "linux/bio.h"
then
echo "1"
echo $cur_name "1" >> $config_file_path
else
echo "2"
echo $cur_name "2" >> $config_file_path
fi
elif compile_module "REQ_PREFLUSH" "linux/blk_types.h"
elif compile_module $cur_name "REQ_PREFLUSH" "linux/blk_types.h"
then
echo "3"
echo $cur_name "3" >> $config_file_path
else
echo "4"
echo $cur_name "4" >> $config_file_path
fi
}

View File

@ -6,8 +6,6 @@
SCRIPTPATH=`dirname $0`
SCRIPTPATH=`realpath $SCRIPTPATH`
MODULE_FILE=$SCRIPTPATH/test_mod.c
OBJ_MOD=$SCRIPTPATH/test_mod.o
KERNEL_DIR="${KERNEL_DIR:-/lib/modules/$(uname -r)/build/}"
KERNEL_VER="$(cd $KERNEL_DIR; make kernelversion)"
NPROC=`nproc`
@ -23,48 +21,58 @@ add_function() {
}
compile_module(){
if [ $# -gt 1 ]
if [ $# -gt 2 ]
then
INCLUDE="#include <$2>"
INCLUDE="#include <$3>"
else
INCLUDE=""
fi
config_file=$1
test_module_dir=$SCRIPTPATH/configure.d/${config_file}_dir
test_module_file=$test_module_dir/test_mod.c
test_module_obj=$test_module_dir/test_mod.o
mkdir -p $test_module_dir
cp -f $SCRIPTPATH/configure.d/Makefile $test_module_dir
############# TEST MODULE #############
cat > $MODULE_FILE <<- EOF
cat > $test_module_file <<- EOF
#include <linux/module.h>
#include <linux/kernel.h>
$INCLUDE
int init_module(void) {
$1;
$2;
return 0;
}
void cleanup_module(void) {};
EOF
#######################################
make -C $SCRIPTPATH KERNEL_DIR=${KERNEL_DIR} &> /dev/null
make -C $test_module_dir KERNEL_DIR=${KERNEL_DIR} &> /dev/null
local ret=$?
if [ $ret -eq 0 ]; then
make -C $SCRIPTPATH clean &> /dev/null
fi
rm -Rf $test_module_dir
return $ret
}
kernel_not_supp_fail() {
echo "Current kernel is not supported!"
rm $DEFINE_FILE
exit 1
echo "Current kernel is not supported!"
rm $DEFINE_FILE
exit 1
}
# $1 - name of function to be called
# $2 - path to file with valid configs
# $3 - name of processed template file
conf_run() {
case "$1" in
"check") check ;;
"apply") apply $2 ;;
esac
case "$1" in
"check") check $2 $3;;
"apply") apply $2 ;;
esac
}
IFS='?'