57 lines
1.2 KiB
Bash
57 lines
1.2 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Copyright(c) 2012-2021 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 "blk_make_request(NULL, NULL, 0)" "linux/blkdev.h"
|
|
then
|
|
echo $cur_name "1" >> $config_file_path
|
|
else
|
|
echo $cur_name "2" >> $config_file_path
|
|
fi
|
|
}
|
|
|
|
apply() {
|
|
case "$1" in
|
|
"1")
|
|
add_function "
|
|
static inline struct request *cas_blk_make_request(struct request_queue *q,
|
|
struct bio *bio, gfp_t gfp_mask)
|
|
{
|
|
return blk_make_request(q, bio, gfp_mask);
|
|
}" ;;
|
|
"2")
|
|
add_function "
|
|
static inline struct request *cas_blk_make_request(struct request_queue *q,
|
|
struct bio *bio, gfp_t gfp_mask)
|
|
{
|
|
struct request *rq = blk_get_request(q, bio_data_dir(bio), gfp_mask);
|
|
if (IS_ERR(rq))
|
|
return rq;
|
|
cas_blk_rq_set_block_pc(rq);
|
|
rq->q = q;
|
|
for_each_bio(bio) {
|
|
struct bio *bounce_bio = bio;
|
|
int ret;
|
|
cas_blk_queue_bounce(q, &bounce_bio);
|
|
ret = cas_blk_rq_append_bio(rq, bounce_bio);
|
|
if (unlikely(ret)) {
|
|
blk_put_request(rq);
|
|
return ERR_PTR(ret);
|
|
}
|
|
}
|
|
return rq;
|
|
}" ;;
|
|
*)
|
|
exit 1
|
|
esac
|
|
}
|
|
|
|
conf_run $@
|