open-cas-linux/configure.d/1_alloc_disk.conf
Krzysztof Majzerowicz-Jaszcz 12ddca1cf3 OpenCAS Linux kernel 5.15 adaptation
This patch adapts OpenCAS Linux to compile and work with kernel v5.15

Commit id's from the kernel affecting OpenCAS:

commit 0e0ccdecb3cff95a350b4364e7ebbaa754d0e47d
    block: remove bdget_disk

commit 9c2b9dbafc067e173db30c4fd0636392d27944e8
    block: remove alloc_disk and alloc_disk_node

commit a8698707a1835be3abd12a3b28079a80999f8dee
    block: move bd_mutex to struct gendisk

commit 2cece3778475abc855084d897a3cf61249798ad9
    scsi: scsi_ioctl: Remove scsi_req_init()

commit 2f4731dcd0bb73379fbb9e3eb07ae7324125caef
    block: remove bdput

commit 14cf1dbb55bb07427babee425fd2a8a9300737cc
    block: remove bdgrab

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2022-06-09 08:49:32 +02:00

76 lines
1.4 KiB
Bash

#!/bin/bash
#
# Copyright(c) 2012-2022 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 "blk_mq_alloc_disk(NULL, NULL);" "linux/blk-mq.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 int cas_alloc_mq_disk(struct gendisk **gd, struct request_queue **queue,
struct blk_mq_tag_set *tag_set)
{
*gd = blk_mq_alloc_disk(tag_set, NULL);
if (!(*gd))
return -ENOMEM;
*queue = (*gd)->queue;
return 0;
}"
add_function "
static inline void cas_cleanup_mq_disk(struct casdsk_exp_obj *exp_obj)
{
blk_cleanup_disk(exp_obj->gd);
}"
;;
"2")
add_function "
static inline int cas_alloc_mq_disk(struct gendisk **gd, struct request_queue **queue,
struct blk_mq_tag_set *tag_set)
{
*gd = alloc_disk(1);
if (!(*gd))
return -ENOMEM;
*queue = blk_mq_init_queue(tag_set);
if (IS_ERR_OR_NULL(*queue)) {
put_disk(*gd);
return -ENOMEM;
}
(*gd)->queue = *queue;
return 0;
}"
add_function "
static inline void cas_cleanup_mq_disk(struct casdsk_exp_obj *exp_obj){
blk_cleanup_queue(exp_obj->queue);
put_disk(exp_obj->gd);
}"
;;
*)
exit 1
esac
}
conf_run $@