diff mbox series

[v2,11/41] filelock: add coccinelle scripts to move fields to struct file_lock_core

Message ID 20240125-flsplit-v2-11-7485322b62c7@kernel.org (mailing list archive)
State New, archived
Headers show
Series filelock: split struct file_lock into file_lock and file_lease structs | expand

Commit Message

Jeff Layton Jan. 25, 2024, 10:42 a.m. UTC
This patch creates two ".cocci" semantic patches in a top level cocci/
directory. These patches were used to help generate several of the
following patches. We can drop this patch or move the files to a more
appropriate location before merging.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 cocci/filelock.cocci | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 cocci/nlm.cocci      | 81 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 169 insertions(+)
diff mbox series

Patch

diff --git a/cocci/filelock.cocci b/cocci/filelock.cocci
new file mode 100644
index 000000000000..93fb4ed8341a
--- /dev/null
+++ b/cocci/filelock.cocci
@@ -0,0 +1,88 @@ 
+@@
+struct file_lock *fl;
+@@
+(
+- fl->fl_blocker
++ fl->fl_core.flc_blocker
+|
+- fl->fl_list
++ fl->fl_core.flc_list
+|
+- fl->fl_link
++ fl->fl_core.flc_link
+|
+- fl->fl_blocked_requests
++ fl->fl_core.flc_blocked_requests
+|
+- fl->fl_blocked_member
++ fl->fl_core.flc_blocked_member
+|
+- fl->fl_owner
++ fl->fl_core.flc_owner
+|
+- fl->fl_flags
++ fl->fl_core.flc_flags
+|
+- fl->fl_type
++ fl->fl_core.flc_type
+|
+- fl->fl_pid
++ fl->fl_core.flc_pid
+|
+- fl->fl_link_cpu
++ fl->fl_core.flc_link_cpu
+|
+- fl->fl_wait
++ fl->fl_core.flc_wait
+|
+- fl->fl_file
++ fl->fl_core.flc_file
+)
+
+@@
+struct file_lock fl;
+@@
+(
+- fl.fl_blocker
++ fl.fl_core.flc_blocker
+|
+- fl.fl_list
++ fl.fl_core.flc_list
+|
+- fl.fl_link
++ fl.fl_core.flc_link
+|
+- fl.fl_blocked_requests
++ fl.fl_core.flc_blocked_requests
+|
+- fl.fl_blocked_member
++ fl.fl_core.flc_blocked_member
+|
+- fl.fl_owner
++ fl.fl_core.flc_owner
+|
+- fl.fl_flags
++ fl.fl_core.flc_flags
+|
+- fl.fl_type
++ fl.fl_core.flc_type
+|
+- fl.fl_pid
++ fl.fl_core.flc_pid
+|
+- fl.fl_link_cpu
++ fl.fl_core.flc_link_cpu
+|
+- fl.fl_wait
++ fl.fl_core.flc_wait
+|
+- fl.fl_file
++ fl.fl_core.flc_file
+)
+
+@@
+struct file_lock *fl;
+struct list_head *li;
+@@
+- list_for_each_entry(fl, li, fl_list)
++ list_for_each_entry(fl, li, fl_core.flc_list)
diff --git a/cocci/nlm.cocci b/cocci/nlm.cocci
new file mode 100644
index 000000000000..bf22f0a75812
--- /dev/null
+++ b/cocci/nlm.cocci
@@ -0,0 +1,81 @@ 
+@@
+struct nlm_lock *nlck;
+@@
+(
+- nlck->fl.fl_blocker
++ nlck->fl.fl_core.flc_blocker
+|
+- nlck->fl.fl_list
++ nlck->fl.fl_core.flc_list
+|
+- nlck->fl.fl_link
++ nlck->fl.fl_core.flc_link
+|
+- nlck->fl.fl_blocked_requests
++ nlck->fl.fl_core.flc_blocked_requests
+|
+- nlck->fl.fl_blocked_member
++ nlck->fl.fl_core.flc_blocked_member
+|
+- nlck->fl.fl_owner
++ nlck->fl.fl_core.flc_owner
+|
+- nlck->fl.fl_flags
++ nlck->fl.fl_core.flc_flags
+|
+- nlck->fl.fl_type
++ nlck->fl.fl_core.flc_type
+|
+- nlck->fl.fl_pid
++ nlck->fl.fl_core.flc_pid
+|
+- nlck->fl.fl_link_cpu
++ nlck->fl.fl_core.flc_link_cpu
+|
+- nlck->fl.fl_wait
++ nlck->fl.fl_core.flc_wait
+|
+- nlck->fl.fl_file
++ nlck->fl.fl_core.flc_file
+)
+
+@@
+struct nlm_args *argp;
+@@
+(
+- argp->lock.fl.fl_blocker
++ argp->lock.fl.fl_core.flc_blocker
+|
+- argp->lock.fl.fl_list
++ argp->lock.fl.fl_core.flc_list
+|
+- argp->lock.fl.fl_link
++ argp->lock.fl.fl_core.flc_link
+|
+- argp->lock.fl.fl_blocked_requests
++ argp->lock.fl.fl_core.flc_blocked_requests
+|
+- argp->lock.fl.fl_blocked_member
++ argp->lock.fl.fl_core.flc_blocked_member
+|
+- argp->lock.fl.fl_owner
++ argp->lock.fl.fl_core.flc_owner
+|
+- argp->lock.fl.fl_flags
++ argp->lock.fl.fl_core.flc_flags
+|
+- argp->lock.fl.fl_type
++ argp->lock.fl.fl_core.flc_type
+|
+- argp->lock.fl.fl_pid
++ argp->lock.fl.fl_core.flc_pid
+|
+- argp->lock.fl.fl_link_cpu
++ argp->lock.fl.fl_core.flc_link_cpu
+|
+- argp->lock.fl.fl_wait
++ argp->lock.fl.fl_core.flc_wait
+|
+- argp->lock.fl.fl_file
++ argp->lock.fl.fl_core.flc_file
+)