forked from Open-CAS/open-cas-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2_bio_cmpl.conf
49 lines (44 loc) · 1.27 KB
/
2_bio_cmpl.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
#
# Copyright(c) 2012-2021 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 "struct bio b;b.bi_end_io(NULL, 0)" "linux/bio.h"
then
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 $cur_name "2" >> $config_file_path
else
echo $cur_name "X" >> $config_file_path
fi
}
apply() {
add_define "CAS_REFER_BLOCK_CALLBACK(name) \\
name##_callback"
add_define "CAS_BLOCK_CALLBACK_INIT(BIO) \\
{; }"
add_define "CAS_BLOCK_CALLBACK_RETURN(BIO) \\
{ return; }"
case "$1" in
"1")
add_define "CAS_BIO_ENDIO(BIO, BYTES_DONE, ERROR) \\
bio_endio(BIO, ERROR)"
add_define "CAS_DECLARE_BLOCK_CALLBACK(name, BIO, BYTES_DONE, ERROR) \\
void name##_callback(BIO, ERROR)"
add_define "CAS_BLOCK_CALLBACK_ERROR(BIO, ERROR) \\
ERROR" ;;
"2")
add_define "CAS_BIO_ENDIO(BIO, BYTES_DONE, ERROR) \\
({ CAS_BIO_OP_STATUS(BIO) = ERROR; bio_endio(BIO); })"
add_define "CAS_DECLARE_BLOCK_CALLBACK(name, BIO, BYTES_DONE, ERROR) \\
void name##_callback(BIO)"
add_define "CAS_BLOCK_CALLBACK_ERROR(BIO, ERROR) \\
CAS_BIO_OP_STATUS(BIO)" ;;
esac
}
conf_run $@