diff mbox series

[02/20] filelock: add coccinelle scripts to move fields to struct file_lock_core

Message ID 20240116-flsplit-v1-2-c9d0f4370a5d@kernel.org
State New
Headers show
Series filelock: split struct file_lock into file_lock and file_lease structs | expand

Commit Message

Jeff Layton Jan. 16, 2024, 7:45 p.m. UTC
Add some coccinelle scripts to handle the move of several fields from
struct file_lock to struct file_lock_core.

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

Patch

diff --git a/cocci/filelock.cocci b/cocci/filelock.cocci
new file mode 100644
index 000000000000..b84151ba091a
--- /dev/null
+++ b/cocci/filelock.cocci
@@ -0,0 +1,81 @@ 
+@@
+struct file_lock *fl;
+@@
+(
+- fl->fl_blocker
++ fl->fl_core.fl_blocker
+|
+- fl->fl_list
++ fl->fl_core.fl_list
+|
+- fl->fl_link
++ fl->fl_core.fl_link
+|
+- fl->fl_blocked_requests
++ fl->fl_core.fl_blocked_requests
+|
+- fl->fl_blocked_member
++ fl->fl_core.fl_blocked_member
+|
+- fl->fl_owner
++ fl->fl_core.fl_owner
+|
+- fl->fl_flags
++ fl->fl_core.fl_flags
+|
+- fl->fl_type
++ fl->fl_core.fl_type
+|
+- fl->fl_pid
++ fl->fl_core.fl_pid
+|
+- fl->fl_link_cpu
++ fl->fl_core.fl_link_cpu
+|
+- fl->fl_wait
++ fl->fl_core.fl_wait
+|
+- fl->fl_file
++ fl->fl_core.fl_file
+)
+
+@@
+struct file_lock fl;
+@@
+(
+- fl.fl_blocker
++ fl.fl_core.fl_blocker
+|
+- fl.fl_list
++ fl.fl_core.fl_list
+|
+- fl.fl_link
++ fl.fl_core.fl_link
+|
+- fl.fl_blocked_requests
++ fl.fl_core.fl_blocked_requests
+|
+- fl.fl_blocked_member
++ fl.fl_core.fl_blocked_member
+|
+- fl.fl_owner
++ fl.fl_core.fl_owner
+|
+- fl.fl_flags
++ fl.fl_core.fl_flags
+|
+- fl.fl_type
++ fl.fl_core.fl_type
+|
+- fl.fl_pid
++ fl.fl_core.fl_pid
+|
+- fl.fl_link_cpu
++ fl.fl_core.fl_link_cpu
+|
+- fl.fl_wait
++ fl.fl_core.fl_wait
+|
+- fl.fl_file
++ fl.fl_core.fl_file
+)
diff --git a/cocci/filelock2.cocci b/cocci/filelock2.cocci
new file mode 100644
index 000000000000..0154a14e81ca
--- /dev/null
+++ b/cocci/filelock2.cocci
@@ -0,0 +1,6 @@ 
+@@
+struct file_lock *fl;
+struct list_head *li;
+@@
+- list_for_each_entry(fl, li, fl_list)
++ list_for_each_entry(fl, li, fl_core.fl_list)
diff --git a/cocci/nlm.cocci b/cocci/nlm.cocci
new file mode 100644
index 000000000000..8ec5d02871e1
--- /dev/null
+++ b/cocci/nlm.cocci
@@ -0,0 +1,81 @@ 
+@@
+struct nlm_lock *nlck;
+@@
+(
+- nlck->fl.fl_blocker
++ nlck->fl.fl_core.fl_blocker
+|
+- nlck->fl.fl_list
++ nlck->fl.fl_core.fl_list
+|
+- nlck->fl.fl_link
++ nlck->fl.fl_core.fl_link
+|
+- nlck->fl.fl_blocked_requests
++ nlck->fl.fl_core.fl_blocked_requests
+|
+- nlck->fl.fl_blocked_member
++ nlck->fl.fl_core.fl_blocked_member
+|
+- nlck->fl.fl_owner
++ nlck->fl.fl_core.fl_owner
+|
+- nlck->fl.fl_flags
++ nlck->fl.fl_core.fl_flags
+|
+- nlck->fl.fl_type
++ nlck->fl.fl_core.fl_type
+|
+- nlck->fl.fl_pid
++ nlck->fl.fl_core.fl_pid
+|
+- nlck->fl.fl_link_cpu
++ nlck->fl.fl_core.fl_link_cpu
+|
+- nlck->fl.fl_wait
++ nlck->fl.fl_core.fl_wait
+|
+- nlck->fl.fl_file
++ nlck->fl.fl_core.fl_file
+)
+
+@@
+struct nlm_args *argp;
+@@
+(
+- argp->lock.fl.fl_blocker
++ argp->lock.fl.fl_core.fl_blocker
+|
+- argp->lock.fl.fl_list
++ argp->lock.fl.fl_core.fl_list
+|
+- argp->lock.fl.fl_link
++ argp->lock.fl.fl_core.fl_link
+|
+- argp->lock.fl.fl_blocked_requests
++ argp->lock.fl.fl_core.fl_blocked_requests
+|
+- argp->lock.fl.fl_blocked_member
++ argp->lock.fl.fl_core.fl_blocked_member
+|
+- argp->lock.fl.fl_owner
++ argp->lock.fl.fl_core.fl_owner
+|
+- argp->lock.fl.fl_flags
++ argp->lock.fl.fl_core.fl_flags
+|
+- argp->lock.fl.fl_type
++ argp->lock.fl.fl_core.fl_type
+|
+- argp->lock.fl.fl_pid
++ argp->lock.fl.fl_core.fl_pid
+|
+- argp->lock.fl.fl_link_cpu
++ argp->lock.fl.fl_core.fl_link_cpu
+|
+- argp->lock.fl.fl_wait
++ argp->lock.fl.fl_core.fl_wait
+|
+- argp->lock.fl.fl_file
++ argp->lock.fl.fl_core.fl_file
+)