Kernel 6.13: Add another definition of cas_bd_get_next_part()

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@huawei.com>
This commit is contained in:
Rafal Stefanowski 2025-02-05 16:17:06 +01:00
parent eff9ad3c9d
commit efa2c0ad5e

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# Copyright(c) 2012-2022 Intel Corporation
# Copyright(c) 2024 Huawei Technologies
# Copyright(c) 2024-2025 Huawei Technologies
# SPDX-License-Identifier: BSD-3-Clause
#
@ -10,16 +10,19 @@
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" ||
compile_module $cur_name "struct gendisk *disk = NULL; struct xarray xa; xa = disk->part_tbl;" "linux/blkdev.h"
if compile_module $cur_name "struct block_device bd; bdev_partno;" "linux/blkdev.h"
then
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "struct block_device bd; bd = *disk_part_iter_next(NULL);" "linux/blk_types.h" "linux/genhd.h"
elif compile_module $cur_name "struct gendisk *disk = NULL; struct xarray xa; xa = disk->part_tbl;" "linux/genhd.h" ||
compile_module $cur_name "struct gendisk *disk = NULL; struct xarray xa; xa = disk->part_tbl;" "linux/blkdev.h"
then
echo $cur_name "2" >> $config_file_path
elif compile_module $cur_name "struct hd_struct hd; hd = *disk_part_iter_next(NULL);" "linux/genhd.h"
elif compile_module $cur_name "struct block_device bd; bd = *disk_part_iter_next(NULL);" "linux/blk_types.h" "linux/genhd.h"
then
echo $cur_name "3" >> $config_file_path
elif compile_module $cur_name "struct hd_struct hd; hd = *disk_part_iter_next(NULL);" "linux/genhd.h"
then
echo $cur_name "4" >> $config_file_path
else
echo $cur_name "X" >> $config_file_path
fi
@ -37,7 +40,7 @@ apply() {
unsigned long idx;
xa_for_each(&disk->part_tbl, idx, part) {
if ((part_no = part->bd_partno)) {
if ((part_no = bdev_partno(part))) {
break;
}
}
@ -47,6 +50,23 @@ apply() {
"2")
add_function "
static inline int cas_bd_get_next_part(struct block_device *bd)
{
int part_no = 0;
struct gendisk *disk = bd->bd_disk;
struct block_device *part;
unsigned long idx;
xa_for_each(&disk->part_tbl, idx, part) {
if ((part_no = part->bd_partno)) {
break;
}
}
return part_no;
}" ;;
"3")
add_function "
static inline int cas_bd_get_next_part(struct block_device *bd)
{
int part_no = 0;
struct gendisk *disk = bd->bd_disk;
@ -66,7 +86,7 @@ apply() {
return part_no;
}" ;;
"3")
"4")
add_function "
static inline int cas_bd_get_next_part(struct block_device *bd)
{