From d460d393745faa0d072a6ced939c37c7fa3a4c3b Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Tue, 9 Aug 2022 19:39:55 +0200 Subject: [PATCH 1/3] configure: Fix coding style Signed-off-by: Robert Baldyga --- configure.d/conf_framework | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.d/conf_framework b/configure.d/conf_framework index f5eab0e..b1a6000 100644 --- a/configure.d/conf_framework +++ b/configure.d/conf_framework @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -52,7 +52,7 @@ compile_module(){ return 0; } void cleanup_module(void) {}; - MODULE_LICENSE("GPL"); + MODULE_LICENSE("GPL"); EOF ####################################### From 51dc893fc1ac0c6f4c594248ba4c80582f12ba70 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Tue, 9 Aug 2022 19:41:52 +0200 Subject: [PATCH 2/3] configure: Don't append semicolon by default This allows to pass not only C code, but also preprocessor directives. Signed-off-by: Robert Baldyga --- configure.d/1_bd_part_count.conf | 4 ++-- configure.d/1_bdev_lookup.conf | 8 ++++---- configure.d/1_bio_clone.conf | 8 ++++---- configure.d/1_bio_dev.conf | 8 ++++---- configure.d/1_bio_discard.conf | 10 +++++----- configure.d/1_bio_err.conf | 8 ++++---- configure.d/1_bio_flags.conf | 6 +++--- configure.d/1_bio_iter.conf | 6 +++--- configure.d/1_blk_end_req.conf | 6 +++--- configure.d/1_dentry.conf | 6 +++--- configure.d/1_flush_flag.conf | 8 ++++---- configure.d/1_global_page_state.conf | 6 +++--- configure.d/1_hlist.conf | 6 +++--- configure.d/1_inode.conf | 6 +++--- configure.d/1_queue_limits.conf | 8 ++++---- configure.d/1_submit_bio.conf | 10 +++++----- configure.d/1_write_flag.conf | 6 +++--- configure.d/2_bio_barrier.conf | 8 ++++---- configure.d/2_bio_cmpl.conf | 6 +++--- configure.d/2_generic_acct.conf | 12 ++++++------ configure.d/2_queue_write.conf | 6 +++--- configure.d/conf_framework | 2 +- 22 files changed, 77 insertions(+), 77 deletions(-) diff --git a/configure.d/1_bd_part_count.conf b/configure.d/1_bd_part_count.conf index 0986b23..edea2aa 100644 --- a/configure.d/1_bd_part_count.conf +++ b/configure.d/1_bd_part_count.conf @@ -9,10 +9,10 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "struct gendisk *disk = NULL; struct xarray xa; xa = disk->part_tbl" "linux/genhd.h" + if compile_module $cur_name "struct gendisk *disk = NULL; struct xarray xa; xa = disk->part_tbl;" "linux/genhd.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "struct gendisk *disk = NULL; struct disk_part_tbl *ptbl; ptbl = disk->part_tbl" "linux/genhd.h" + elif compile_module $cur_name "struct gendisk *disk = NULL; struct disk_part_tbl *ptbl; ptbl = disk->part_tbl;" "linux/genhd.h" then echo $cur_name "2" >> $config_file_path else diff --git a/configure.d/1_bdev_lookup.conf b/configure.d/1_bdev_lookup.conf index 6ee643a..1867e43 100644 --- a/configure.d/1_bdev_lookup.conf +++ b/configure.d/1_bdev_lookup.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,13 +9,13 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "dev_t dev; lookup_bdev(\"some_path\", &dev)" "linux/blkdev.h" + if compile_module $cur_name "dev_t dev; lookup_bdev(\"some_path\", &dev);" "linux/blkdev.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "lookup_bdev(\"some_path\")" "linux/fs.h" "linux/blkdev.h" + elif compile_module $cur_name "lookup_bdev(\"some_path\");" "linux/fs.h" "linux/blkdev.h" then echo $cur_name "2" >> $config_file_path - elif compile_module $cur_name "lookup_bdev(\"some_path\", 0)" "linux/fs.h" "linux/blkdev.h" + elif compile_module $cur_name "lookup_bdev(\"some_path\", 0);" "linux/fs.h" "linux/blkdev.h" then echo $cur_name "3" >> $config_file_path else diff --git a/configure.d/1_bio_clone.conf b/configure.d/1_bio_clone.conf index edc9d72..d91e296 100644 --- a/configure.d/1_bio_clone.conf +++ b/configure.d/1_bio_clone.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,13 +9,13 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "bio_clone(NULL, 0)" "linux/bio.h" + if compile_module $cur_name "bio_clone(NULL, 0);" "linux/bio.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "bio_clone_kmalloc(NULL, 0)" "linux/bio.h" + elif compile_module $cur_name "bio_clone_kmalloc(NULL, 0);" "linux/bio.h" then echo $cur_name "2" >> $config_file_path - elif compile_module $cur_name "bio_clone_fast(NULL, 0, NULL)" "linux/bio.h" + elif compile_module $cur_name "bio_clone_fast(NULL, 0, NULL);" "linux/bio.h" then echo $cur_name "3" >> $config_file_path else diff --git a/configure.d/1_bio_dev.conf b/configure.d/1_bio_dev.conf index 4d69a20..380de33 100644 --- a/configure.d/1_bio_dev.conf +++ b/configure.d/1_bio_dev.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,13 +9,13 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "struct bio b = {}; bio_dev(&b); b.bi_bdev = NULL" "linux/bio.h" "linux/genhd.h" + if compile_module $cur_name "struct bio b = {}; bio_dev(&b); b.bi_bdev = NULL;" "linux/bio.h" "linux/genhd.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "struct bio b = {}; bio_dev(&b); b.bi_disk = NULL" "linux/bio.h" + elif compile_module $cur_name "struct bio b = {}; bio_dev(&b); b.bi_disk = NULL;" "linux/bio.h" then echo $cur_name "2" >> $config_file_path - elif compile_module $cur_name "struct bio b; b.bi_bdev = NULL" "linux/bio.h" + elif compile_module $cur_name "struct bio b; b.bi_bdev = NULL;" "linux/bio.h" then echo $cur_name "3" >> $config_file_path else diff --git a/configure.d/1_bio_discard.conf b/configure.d/1_bio_discard.conf index 17267df..53a4b0f 100644 --- a/configure.d/1_bio_discard.conf +++ b/configure.d/1_bio_discard.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,16 +9,16 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "bio_op(NULL)" "linux/bio.h" + if compile_module $cur_name "bio_op(NULL);" "linux/bio.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "REQ_OP_MASK" "linux/blk_types.h" + elif compile_module $cur_name "REQ_OP_MASK;" "linux/blk_types.h" then echo $cur_name "2" >> $config_file_path - elif compile_module $cur_name "REQ_OP_DISCARD" "linux/blk_types.h" + elif compile_module $cur_name "REQ_OP_DISCARD;" "linux/blk_types.h" then echo $cur_name "3" >> $config_file_path - elif compile_module $cur_name "REQ_DISCARD" "linux/blk_types.h" + elif compile_module $cur_name "REQ_DISCARD;" "linux/blk_types.h" then echo $cur_name "4" >> $config_file_path else diff --git a/configure.d/1_bio_err.conf b/configure.d/1_bio_err.conf index 46202ed..e650073 100644 --- a/configure.d/1_bio_err.conf +++ b/configure.d/1_bio_err.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,13 +9,13 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "struct bio b;b.bi_status" "linux/bio.h" + if compile_module $cur_name "struct bio b; b.bi_status;" "linux/bio.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "struct bio b;b.bi_error" "linux/bio.h" + elif compile_module $cur_name "struct bio b; b.bi_error;" "linux/bio.h" then echo $cur_name "2" >> $config_file_path - elif compile_module $cur_name "bio_endio(NULL, 0)" "linux/bio.h" + elif compile_module $cur_name "bio_endio(NULL, 0);" "linux/bio.h" then echo $cur_name "3" >> $config_file_path else diff --git a/configure.d/1_bio_flags.conf b/configure.d/1_bio_flags.conf index e99a943..5330b24 100644 --- a/configure.d/1_bio_flags.conf +++ b/configure.d/1_bio_flags.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,10 +9,10 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "struct bio b;b.bi_opf" "linux/bio.h" + if compile_module $cur_name "struct bio b; b.bi_opf;" "linux/bio.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "struct bio b;b.bi_rw" "linux/bio.h" + elif compile_module $cur_name "struct bio b; b.bi_rw;" "linux/bio.h" then echo $cur_name "2" >> $config_file_path else diff --git a/configure.d/1_bio_iter.conf b/configure.d/1_bio_iter.conf index 54a3332..de230ec 100644 --- a/configure.d/1_bio_iter.conf +++ b/configure.d/1_bio_iter.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,10 +9,10 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "struct bio b;b.bi_iter.bi_size" "linux/bio.h" + if compile_module $cur_name "struct bio b; b.bi_iter.bi_size;" "linux/bio.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "struct bio b;b.bi_size" "linux/bio.h" + elif compile_module $cur_name "struct bio b; b.bi_size;" "linux/bio.h" then echo $cur_name "2" >> $config_file_path else diff --git a/configure.d/1_blk_end_req.conf b/configure.d/1_blk_end_req.conf index f955d54..367edf2 100644 --- a/configure.d/1_blk_end_req.conf +++ b/configure.d/1_blk_end_req.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,10 +9,10 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "blk_mq_end_request(NULL, 0)" "linux/blk-mq.h" + if compile_module $cur_name "blk_mq_end_request(NULL, 0);" "linux/blk-mq.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "blk_end_request_all(NULL, 0)" "linux/blkdev.h" + elif compile_module $cur_name "blk_end_request_all(NULL, 0);" "linux/blkdev.h" then echo $cur_name "2" >> $config_file_path else diff --git a/configure.d/1_dentry.conf b/configure.d/1_dentry.conf index 57f6240..45054c7 100644 --- a/configure.d/1_dentry.conf +++ b/configure.d/1_dentry.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,10 +9,10 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "struct dentry dentry;dentry.d_u.d_alias" "linux/dcache.h" + if compile_module $cur_name "struct dentry dentry; dentry.d_u.d_alias;" "linux/dcache.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "struct dentry dentry;dentry.d_alias" "linux/dcache.h" + elif compile_module $cur_name "struct dentry dentry; dentry.d_alias;" "linux/dcache.h" then echo $cur_name "2" >> $config_file_path else diff --git a/configure.d/1_flush_flag.conf b/configure.d/1_flush_flag.conf index 497b8d6..3b50844 100644 --- a/configure.d/1_flush_flag.conf +++ b/configure.d/1_flush_flag.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,13 +9,13 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "BIO_FLUSH" "linux/bio.h" + if compile_module $cur_name "BIO_FLUSH;" "linux/bio.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "REQ_FLUSH" "linux/blk_types.h" + elif compile_module $cur_name "REQ_FLUSH;" "linux/blk_types.h" then echo $cur_name "2" >> $config_file_path - elif compile_module $cur_name "REQ_PREFLUSH" "linux/blk_types.h" + elif compile_module $cur_name "REQ_PREFLUSH;" "linux/blk_types.h" then echo $cur_name "3" >> $config_file_path else diff --git a/configure.d/1_global_page_state.conf b/configure.d/1_global_page_state.conf index 8739c87..0d7de85 100644 --- a/configure.d/1_global_page_state.conf +++ b/configure.d/1_global_page_state.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,10 +9,10 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "global_zone_page_state(1)" "linux/mm.h" + if compile_module $cur_name "global_zone_page_state(1);" "linux/mm.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "global_page_state(1)" "linux/mm.h" + elif compile_module $cur_name "global_page_state(1);" "linux/mm.h" then echo $cur_name "2" >> $config_file_path else diff --git a/configure.d/1_hlist.conf b/configure.d/1_hlist.conf index f6e8837..24a2d87 100644 --- a/configure.d/1_hlist.conf +++ b/configure.d/1_hlist.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,10 +9,10 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "struct hlist_node list" "linux/types.h" + if compile_module $cur_name "struct hlist_node list;" "linux/types.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "struct list_head list" "linux/list.h" + elif compile_module $cur_name "struct list_head list;" "linux/list.h" then echo $cur_name "2" >> $config_file_path else diff --git a/configure.d/1_inode.conf b/configure.d/1_inode.conf index ed0dd1e..e119adb 100644 --- a/configure.d/1_inode.conf +++ b/configure.d/1_inode.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,10 +9,10 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "struct file file;file.f_inode" "linux/fs.h" + if compile_module $cur_name "struct file file; file.f_inode;" "linux/fs.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "struct file file;file->f_dentry->d_inode" "linux/fs.h" + elif compile_module $cur_name "struct file file; file->f_dentry->d_inode;" "linux/fs.h" then echo $cur_name "2" >> $config_file_path else diff --git a/configure.d/1_queue_limits.conf b/configure.d/1_queue_limits.conf index b276645..de59a93 100644 --- a/configure.d/1_queue_limits.conf +++ b/configure.d/1_queue_limits.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -10,13 +10,13 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "struct queue_limits q;q.limits_aux" "linux/blkdev.h" + if compile_module $cur_name "struct queue_limits q; q.limits_aux;" "linux/blkdev.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "struct queue_limits q;q.max_write_zeroes_sectors" "linux/blkdev.h" + elif compile_module $cur_name "struct queue_limits q; q.max_write_zeroes_sectors;" "linux/blkdev.h" then echo $cur_name "2" >> $config_file_path - elif compile_module $cur_name "struct queue_limits q;q.max_write_same_sectors" "linux/blkdev.h" + elif compile_module $cur_name "struct queue_limits q; q.max_write_same_sectors;" "linux/blkdev.h" then echo $cur_name "3" >> $config_file_path else diff --git a/configure.d/1_submit_bio.conf b/configure.d/1_submit_bio.conf index f3f07d3..54627bc 100644 --- a/configure.d/1_submit_bio.conf +++ b/configure.d/1_submit_bio.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -14,16 +14,16 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "submit_bio(NULL)" "linux/bio.h" + if compile_module $cur_name "submit_bio(NULL);" "linux/bio.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "submit_bio(NULL)" "linux/fs.h" + elif compile_module $cur_name "submit_bio(NULL);" "linux/fs.h" then echo $cur_name "2" >> $config_file_path - elif compile_module $cur_name "void *t=submit_bio(0, NULL)" "linux/fs.h" + elif compile_module $cur_name "void *t=submit_bio(0, NULL);" "linux/fs.h" then echo $cur_name "4" >> $config_file_path - elif compile_module $cur_name "submit_bio(0, NULL)" "linux/fs.h" + elif compile_module $cur_name "submit_bio(0, NULL);" "linux/fs.h" then echo $cur_name "4" >> $config_file_path else diff --git a/configure.d/1_write_flag.conf b/configure.d/1_write_flag.conf index cd64f25..383ae91 100644 --- a/configure.d/1_write_flag.conf +++ b/configure.d/1_write_flag.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,10 +9,10 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "WRITE" "linux/blk_types.h" + if compile_module $cur_name "WRITE;" "linux/blk_types.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "REQ_WRITE" "linux/blk_types.h" + elif compile_module $cur_name "REQ_WRITE;" "linux/blk_types.h" then echo $cur_name "2" >> $config_file_path else diff --git a/configure.d/2_bio_barrier.conf b/configure.d/2_bio_barrier.conf index cf01ae5..c800ec1 100644 --- a/configure.d/2_bio_barrier.conf +++ b/configure.d/2_bio_barrier.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,13 +9,13 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "RQF_SOFTBARRIER" "linux/blkdev.h" + if compile_module $cur_name "RQF_SOFTBARRIER;" "linux/blkdev.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "REQ_SOFTBARRIER" "linux/blk_types.h" + elif compile_module $cur_name "REQ_SOFTBARRIER;" "linux/blk_types.h" then echo $cur_name "2" >> $config_file_path - elif compile_module $cur_name "BIO_RW_BARRIER" "linux/fs.h" + elif compile_module $cur_name "BIO_RW_BARRIER;" "linux/fs.h" then echo $cur_name "3" >> $config_file_path else diff --git a/configure.d/2_bio_cmpl.conf b/configure.d/2_bio_cmpl.conf index 7523ea9..d847070 100644 --- a/configure.d/2_bio_cmpl.conf +++ b/configure.d/2_bio_cmpl.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,10 +9,10 @@ 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" + 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" + 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 diff --git a/configure.d/2_generic_acct.conf b/configure.d/2_generic_acct.conf index b567d8a..f5ecfee 100644 --- a/configure.d/2_generic_acct.conf +++ b/configure.d/2_generic_acct.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,19 +9,19 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "bio_start_io_acct(NULL)" "linux/blkdev.h" + if compile_module $cur_name "bio_start_io_acct(NULL);" "linux/blkdev.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "generic_start_io_acct(NULL, 0, 0, NULL)" "linux/bio.h" + elif compile_module $cur_name "generic_start_io_acct(NULL, 0, 0, NULL);" "linux/bio.h" then echo $cur_name "2" >> $config_file_path - elif compile_module $cur_name "generic_start_io_acct(0, 0, NULL)" "linux/bio.h" + elif compile_module $cur_name "generic_start_io_acct(0, 0, NULL);" "linux/bio.h" then echo $cur_name "3" >> $config_file_path - elif compile_module $cur_name "part_round_stats(1, 1)" "linux/genhd.h" + elif compile_module $cur_name "part_round_stats(1, 1);" "linux/genhd.h" then echo $cur_name "4" >> $config_file_path - elif compile_module $cur_name "part_round_stats(NULL, 1, 1)" "linux/genhd.h" + elif compile_module $cur_name "part_round_stats(NULL, 1, 1);" "linux/genhd.h" then echo $cur_name "5" >> $config_file_path else diff --git a/configure.d/2_queue_write.conf b/configure.d/2_queue_write.conf index 9a91e1f..6d17998 100644 --- a/configure.d/2_queue_write.conf +++ b/configure.d/2_queue_write.conf @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -9,10 +9,10 @@ check() { cur_name=$(basename $2) config_file_path=$1 - if compile_module $cur_name "blk_queue_write_cache(NULL, 0, 0)" "linux/blkdev.h" + if compile_module $cur_name "blk_queue_write_cache(NULL, 0, 0);" "linux/blkdev.h" then echo $cur_name "1" >> $config_file_path - elif compile_module $cur_name "struct request_queue rq;rq.flush_flags" "linux/blkdev.h" + elif compile_module $cur_name "struct request_queue rq; rq.flush_flags;" "linux/blkdev.h" then echo $cur_name "2" >> $config_file_path else diff --git a/configure.d/conf_framework b/configure.d/conf_framework index b1a6000..8a98369 100644 --- a/configure.d/conf_framework +++ b/configure.d/conf_framework @@ -48,7 +48,7 @@ compile_module(){ $INCLUDE int init_module(void) { - $2; + $2 return 0; } void cleanup_module(void) {}; From a4610f96cc6704fc47548349846d570fd56711ce Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Tue, 9 Aug 2022 19:42:26 +0200 Subject: [PATCH 3/3] configure: Add get_define() helper function Signed-off-by: Robert Baldyga --- configure.d/conf_framework | 49 +++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/configure.d/conf_framework b/configure.d/conf_framework index 8a98369..21f4e54 100644 --- a/configure.d/conf_framework +++ b/configure.d/conf_framework @@ -20,10 +20,10 @@ add_function() { printf "%s\n" $1 >> $DEFINE_FILE } -compile_module(){ - if [ $# -gt 2 ] +__compile_module(){ + if [ $# -gt 1 ] then - i=3 + i=2 while [ "$i" -le "$#" ]; do INCLUDE+=$(echo -e "\n#include <${!i}>\\n") i=$((i + 1)) @@ -32,9 +32,6 @@ compile_module(){ INCLUDE="" fi - config_file=$1 - test_module_dir=$SCRIPTPATH/configure.d/${config_file}_dir - test_module_log=$SCRIPTPATH/configure.d/.${config_file}.log test_module_file=$test_module_dir/test_mod.c test_module_obj=$test_module_dir/test_mod.o @@ -48,7 +45,7 @@ compile_module(){ $INCLUDE int init_module(void) { - $2 + $1 return 0; } void cleanup_module(void) {}; @@ -56,10 +53,21 @@ compile_module(){ EOF ####################################### - echo "### $2 ###" >> $test_module_log + echo "### $1 ###" >> $test_module_log make -C $test_module_dir KERNEL_DIR=${KERNEL_DIR} &>> $test_module_log + return $? +} + +compile_module(){ + config_file=$1 + shift + + test_module_dir=$SCRIPTPATH/configure.d/${config_file}_dir + test_module_log=$SCRIPTPATH/configure.d/.${config_file}.log + + __compile_module $@ local ret=$? rm -Rf $test_module_dir @@ -72,6 +80,31 @@ compile_module(){ return $ret } +get_define(){ + config_file=$1 + define_name=$2 + include=$3 + test_module_dir=$SCRIPTPATH/configure.d/${config_file}_dir + test_module_log=$SCRIPTPATH/configure.d/.${config_file}.log + + read -r -d '' CODE << EOM + #define XSTR(x) STR(x) + #define STR(x) #x + #pragma message "$define_name " XSTR($define_name) +EOM + + __compile_module "$CODE" "$include" + + rm -Rf $test_module_dir + + grep -Pom 1 "note:.*$define_name .*" $test_module_log | cut -d' ' -f 5- | tr -d '"' + local ret=$? + + rm -f $test_module_log + + return $ret +} + kernel_not_supp_fail() { echo "Current kernel is not supported!" rm $DEFINE_FILE