open-cas-linux/configure.d/1_bio_alloc.conf
Krzysztof Majzerowicz-Jaszcz f0af7cb52d Open CAS Linux kernel 5.18 support
This patch introduces the support for 5.18 kernel.

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2022-10-24 09:53:01 +00:00

44 lines
980 B
Bash

#!/bin/bash
#
# Copyright(c) 2012-2022 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
. $(dirname $3)/conf_framework.sh
check() {
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "void *t=bio_alloc(0,0);" "linux/bio.h"
then
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "void *t=bio_alloc(NULL,0,0,0);" "linux/bio.h"
then
echo $cur_name "2" >> $config_file_path
else
echo $cur_name "X" >> $config_file_path
fi
}
apply() {
case "$1" in
"1")
add_function "static inline struct bio *cas_bio_alloc(struct block_device *bdev, gfp_t gfp_mask, unsigned short num_vecs)
{
(void)bdev;
return bio_alloc(gfp_mask, num_vecs);
}" ;;
"2")
add_function "static inline struct bio *cas_bio_alloc(struct block_device *bdev, gfp_t gfp_mask, unsigned short num_vecs)
{
BUG_ON(!bdev);
return bio_alloc(bdev, num_vecs, 0, gfp_mask);
}" ;;
*)
exit 1
esac
}
conf_run $@