configure: more deseralization & cleanup

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
This commit is contained in:
Michal Rakowski 2019-09-09 16:08:58 +02:00
parent a904a5bf66
commit 0f2ea7ade7
7 changed files with 23 additions and 8 deletions

2
configure vendored
View File

@ -64,8 +64,6 @@ generate_header() {
source $file "apply" "$CONF" "$file" source $file "apply" "$CONF" "$file"
done done
wait
for file in $SECOND; do for file in $SECOND; do
CONF=$(cat ${CONFIG_FILE} | grep $(basename $file) | cut -d' ' -f2) CONF=$(cat ${CONFIG_FILE} | grep $(basename $file) | cut -d' ' -f2)
source $file "apply" "$CONF" "$file" source $file "apply" "$CONF" "$file"

View File

@ -15,7 +15,12 @@ check() {
elif compile_module $cur_name "struct bio b;b.bi_error" "linux/bio.h" elif compile_module $cur_name "struct bio b;b.bi_error" "linux/bio.h"
then then
echo $cur_name "2" >> $config_file_path echo $cur_name "2" >> $config_file_path
fi elif compile_module $cur_name "bio_endio(NULL, 0)" "linux/bio.h"
then
echo $cur_name "3" >> $config_file_path
else
echo $cur_name "X" >> $config_file_path
fi
} }
apply() { apply() {
@ -26,6 +31,10 @@ apply() {
"2") "2")
add_define "CAS_BIO_OP_STATUS(bio) \\ add_define "CAS_BIO_OP_STATUS(bio) \\
bio->bi_error" ;; bio->bi_error" ;;
"3")
# If bio_endio is available, we do not need to provide our own status accessors.
# This case-switch prevents false errors during executing 'configure' script.
return 0 ;;
*) *)
exit 1 exit 1
esac esac

View File

@ -12,6 +12,8 @@ check() {
if compile_module $cur_name "struct bio b;b.bi_write_hint" "linux/bio.h" if compile_module $cur_name "struct bio b;b.bi_write_hint" "linux/bio.h"
then then
echo $cur_name "1" >> $config_file_path echo $cur_name "1" >> $config_file_path
else
echo $cur_name "2" >> $config_file_path
fi fi
} }
@ -20,6 +22,8 @@ apply() {
"1") "1")
add_define "CAS_WLTH_SUPPORT \\ add_define "CAS_WLTH_SUPPORT \\
1" ;; 1" ;;
"2")
return 0 ;;
*) *)
exit 1 exit 1
esac esac

View File

@ -31,7 +31,7 @@ apply() {
"2") "2")
add_define "CAS_CHECK_BARRIER(bio) \\ add_define "CAS_CHECK_BARRIER(bio) \\
((CAS_BIO_OP_FLAGS(bio) & REQ_SOFTBARRIER) != 0)" ;; ((CAS_BIO_OP_FLAGS(bio) & REQ_SOFTBARRIER) != 0)" ;;
"3") "3")
add_define "CAS_CHECK_BARRIER(bio) \\ add_define "CAS_CHECK_BARRIER(bio) \\
(bio_rw_flagged((bio), BIO_RW_BARRIER))" ;; (bio_rw_flagged((bio), BIO_RW_BARRIER))" ;;
*) *)

View File

@ -22,17 +22,17 @@ check() {
echo $cur_name "3" >> $config_file_path echo $cur_name "3" >> $config_file_path
else else
echo $cur_name "4" >> $config_file_path echo $cur_name "4" >> $config_file_path
fi fi
} }
apply() { apply() {
case "$1" in case "$1" in
"1") "1")
add_define "CAS_WRITE_FLUSH_FUA \\ add_define "CAS_WRITE_FLUSH_FUA \\
WRITE_FLUSH_FUA" WRITE_FLUSH_FUA"
add_define "CAS_IS_WRITE_FLUSH_FUA(flags) \\ add_define "CAS_IS_WRITE_FLUSH_FUA(flags) \\
((BIO_FUA | BIO_FLUSH) == ((flags) & (BIO_FUA | BIO_FLUSH)))" ;; ((BIO_FUA | BIO_FLUSH) == ((flags) & (BIO_FUA | BIO_FLUSH)))" ;;
"2") "2")
add_define "CAS_WRITE_FLUSH_FUA \\ add_define "CAS_WRITE_FLUSH_FUA \\
WRITE_FLUSH_FUA" WRITE_FLUSH_FUA"
add_define "CAS_IS_WRITE_FLUSH_FUA(flags) \\ add_define "CAS_IS_WRITE_FLUSH_FUA(flags) \\

View File

@ -73,10 +73,14 @@ kernel_not_supp_fail() {
# $2 - path to file with valid configs # $2 - path to file with valid configs
# $3 - name of processed template file # $3 - name of processed template file
conf_run() { conf_run() {
local OLD_IFS=$IFS
IFS='?'
case "$1" in case "$1" in
"check") check $2 $3;; "check") check $2 $3;;
"apply") apply $2 ;; "apply") apply $2 ;;
esac esac
IFS=$OLD_IFS
} }
IFS='?'