open-cas-linux/configure.d/1_alloc_disk.conf
Rafal Stefanowski 91f5d497ef copyright/license: Add missing file extensions
Proper file extensions help 'copyright header checker' find files
that should contain copyright info. Extensions also clearly indicate
file type, and help to fit in with the file naming convention.

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2022-09-07 15:23:11 +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.sh
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 $@