drbd/0018-gen_patch_names-reorder-blk_mode_t.patch
2025-01-08 07:34:16 +00:00

58 lines
2.3 KiB
Diff

From b340c96d60065f08397d14360e7f045005c587e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20B=C3=B6hmwalder?=
<christoph.boehmwalder@linbit.com>
Date: Fri, 23 Aug 2024 12:30:45 +0200
Subject: [PATCH 18/32] gen_patch_names: reorder blk_mode_t
And match against bdev_file_open_by_path.
---
drbd/drbd-kernel-compat/cocci/blk_mode_t__no_present.cocci | 7 +------
drbd/drbd-kernel-compat/gen_patch_names.c | 6 +++---
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drbd/drbd-kernel-compat/cocci/blk_mode_t__no_present.cocci b/drbd/drbd-kernel-compat/cocci/blk_mode_t__no_present.cocci
index d1312a093ffe..cde4430478e5 100644
--- a/drbd/drbd-kernel-compat/cocci/blk_mode_t__no_present.cocci
+++ b/drbd/drbd-kernel-compat/cocci/blk_mode_t__no_present.cocci
@@ -22,12 +22,7 @@ identifier mode;
@@
// special case: bdev_open_by_path takes a blk_mode_t, so convert that too. I can't seem to get
// coccinelle to match the "READ | WRITE" condition generically, so just hard code it.
-// NOTE: we use blkdev_get_by_path instead of bdev_open_by_path in some compat cases, so support that too.
-(
-bdev_open_by_path
-|
-blkdev_get_by_path
-)
+bdev_file_open_by_path
(...,
- BLK_OPEN_READ | BLK_OPEN_WRITE
+ FMODE_READ | FMODE_WRITE
diff --git a/drbd/drbd-kernel-compat/gen_patch_names.c b/drbd/drbd-kernel-compat/gen_patch_names.c
index 13aec5c8bd5f..6f62ea5827b7 100644
--- a/drbd/drbd-kernel-compat/gen_patch_names.c
+++ b/drbd/drbd-kernel-compat/gen_patch_names.c
@@ -568,6 +568,9 @@ int main(int argc, char **argv)
patch(1, "__bio_add_page", true, false,
COMPAT_HAVE___BIO_ADD_PAGE, "present");
+ patch(1, "blk_mode_t", true, false,
+ COMPAT_HAVE_BLK_MODE_T, "present");
+
/* blkdev_put is oldest, then bdev_open_by_path, then bdev_file_open_by_path */
patch(1, "bdev_file_open_by_path", true, false,
COMPAT_HAVE_BDEV_FILE_OPEN_BY_PATH, "present");
@@ -590,9 +593,6 @@ int main(int argc, char **argv)
patch(1, "block_device_operations_release", true, false,
COMPAT_BLOCK_DEVICE_OPERATIONS_RELEASE_TAKES_SINGLE_ARGUMENT, "takes_single_argument");
- patch(1, "blk_mode_t", true, false,
- COMPAT_HAVE_BLK_MODE_T, "present");
-
patch(1, "genl_info_userhdr", true, false,
COMPAT_HAVE_GENL_INFO_USERHDR, "present");
--
2.35.3