Whamcloud - gitweb
LU-6142 lustre: convert IFTODT to S_DT
[fs/lustre-release.git] / contrib / scripts / libcfs_cleanup.sed
index 7d5aa99..fb6e160 100644 (file)
@@ -2,7 +2,7 @@
 
 # Script to cleanup libcfs macros, it runs against the tree at build time.
 # Migrate libcfs to emulate Linux kernel APIs.
-# http://jira.whamcloud.com/browse/LU-1346
+# https://jira.whamcloud.com/browse/LU-1346
 
 # Run this script like:
 #      find libcfs lnet lustre -name "*.[ch]" | grep -v gnilnd |
@@ -245,18 +245,15 @@ s/\bcfs_file_count\b/file_count/g
 s/\bCFS_INT_LIMIT\b/INT_LIMIT/g
 s/\bCFS_OFFSET_MAX\b/OFFSET_MAX/g
 s/\bcfs_flock_t\b/struct file_lock/g
-s/\bcfs_flock_type\b/flock_type/g
-s/\bcfs_flock_set_type\b/flock_set_type/g
-s/\bcfs_flock_pid\b/flock_pid/g
-s/\bcfs_flock_set_pid\b/flock_set_pid/g
-s/\bcfs_flock_start\b/flock_start/g
-s/\bcfs_flock_set_start\b/flock_set_start/g
-s/\bcfs_flock_end\b/flock_end/g
-s/\bcfs_flock_set_end\b/flock_set_end/g
+s/\b[cfs_]*flock_type(\([^)]*\))\b/\1->fl_type/g
+s/\b[cfs_]*flock_set_type(\([^,]*\), \([^)]*\))\b/\1->fl_type = \2/g
+s/\b[cfs_]*flock_pid(\([^)]*\))\b/\1->fl_pid/g
+s/\b[cfs_]*flock_set_pid(\([^,]*\), \([^)]*\))\b/\1->fl_pid = \2/g
+s/\b[cfs_]*flock_start(\([^)]*\))\b/\1->fl_start/g
+s/\b[cfs_]*flock_set_start(\([^,]*\), \([^)]*\))\b/\1->fl_start = \2/g
+s/\b[cfs_]*flock_end(\([^)]*\))\b/\1->fl_end/g
+s/\b[cfs_]*flock_set_end(\([^,]*\), \([^)]*\))\b/\1->fl_end = \2/g
 s/\bcfs_user_write\b/user_write/g
-s/\bCFS_IFSHIFT\b/IFSHIFT/g
-s/\bCFS_IFTODT\b/IFTODT/g
-s/\bCFS_DTTOIF\b/DTTOIF/g
 
 ################################################################################
 # memory operations
@@ -594,120 +591,8 @@ s/\bcfs_groups_alloc\b/groups_alloc/g
 s/\bcfs_get_random_bytes_prim\b/get_random_bytes/g
 /#[ \t]*define[ \t]*\bget_random_bytes\b *( *\w* *, *\w* *)[ \t]*\bget_random_bytes\b *( *\w* *, *\w* *)/d
 
-# atomic
-s/\bcfs_atomic_t\b/atomic_t/g
-/typedef[ \t]*\batomic_t\b[ \t]*\batomic_t\b/d
-s/\bcfs_atomic_read\b/atomic_read/g
-/#[ \t]*define[ \t]*\batomic_read\b *( *\w* *)[ \t]*\batomic_read\b *( *\w* *)/d
-s/\bcfs_atomic_add_unless\b/atomic_add_unless/g
-s/\bcfs_atomic_cmpxchg\b/atomic_cmpxchg/g
-s/\bcfs_atomic_inc\b/atomic_inc/g
-/#[ \t]*define[ \t]*\batomic_inc\b *( *\w* *)[ \t]*\batomic_inc\b *( *\w* *)/d
-s/\bcfs_atomic_inc_and_test\b/atomic_inc_and_test/g
-/#[ \t]*define[ \t]*\batomic_inc_and_test\b *( *\w* *)[ \t]*\batomic_inc_and_test\b *( *\w* *)/d
-s/\bcfs_atomic_inc_return\b/atomic_inc_return/g
-/#[ \t]*define[ \t]*\batomic_inc_return\b *( *\w* *)[ \t]*\batomic_inc_return\b *( *\w* *)/d
-s/\bcfs_atomic_inc_not_zero\b/atomic_inc_not_zero/g
-/#[ \t]*define[ \t]*\batomic_inc_not_zero\b *( *\w* *)[ \t]*\batomic_inc_not_zero\b *( *\w* *)/d
-s/\bcfs_atomic_dec\b/atomic_dec/g
-/#[ \t]*define[ \t]*\batomic_dec\b *( *\w* *)[ \t]*\batomic_dec\b *( *\w* *)/d
-s/\bcfs_atomic_dec_and_test\b/atomic_dec_and_test/g
-/#[ \t]*define[ \t]*\batomic_dec_and_test\b *( *\w* *)[ \t]*\batomic_dec_and_test\b *( *\w* *)/d
-s/\bcfs_atomic_dec_return\b/atomic_dec_return/g
-/#[ \t]*define[ \t]*\batomic_dec_return\b *( *\w* *)[ \t]*\batomic_dec_return\b *( *\w* *)/d
-s/\bcfs_atomic_dec_and_lock\b/atomic_dec_and_lock/g
-/#[ \t]*define[ \t]*\batomic_dec_and_lock\b *( *\w* *, *\w* *)[ \t]*\batomic_dec_and_lock\b *( *\w* *, *\w* *)/d
-s/\bcfs_atomic_set\b/atomic_set/g
-/#[ \t]*define[ \t]*\batomic_set\b *( *\w* *, *\w* *)[ \t]*\batomic_set\b *( *\w* *, *\w* *)/d
-s/\bcfs_atomic_add\b/atomic_add/g
-/#[ \t]*define[ \t]*\batomic_add\b *( *\w* *, *\w* *)[ \t]*\batomic_add\b *( *\w* *, *\w* *)/d
-s/\bcfs_atomic_add_return\b/atomic_add_return/g
-/#[ \t]*define[ \t]*\batomic_add_return\b *( *\w* *, *\w* *)[ \t]*\batomic_add_return\b *( *\w* *, *\w* *)/d
-s/\bcfs_atomic_sub\b/atomic_sub/g
-/#[ \t]*define[ \t]*\batomic_sub\b *( *\w* *, *\w* *)[ \t]*\batomic_sub\b *( *\w* *, *\w* *)/d
-s/\bcfs_atomic_sub_and_test\b/atomic_sub_and_test/g
-/#[ \t]*define[ \t]*\batomic_sub_and_test\b *( *\w* *, *\w* *)[ \t]*\batomic_sub_and_test\b *( *\w* *, *\w* *)/d
-s/\bcfs_atomic_sub_return\b/atomic_sub_return/g
-/#[ \t]*define[ \t]*\batomic_sub_return\b *( *\w* *, *\w* *)[ \t]*\batomic_sub_return\b *( *\w* *, *\w* *)/d
-s/\bCFS_ATOMIC_INIT\b/ATOMIC_INIT/g
-/#[ \t]*define[ \t]*\bATOMIC_INIT\b *( *\w* *)[ \t]*\bATOMIC_INIT\b *( *\w* *)/d
-
 ################################################################################
 # list operations
-s/\bcfs_list_t\b/struct list_head/g
-s/\b__cfs_list_add\b/__list_add/g
-/#[ \t]*define[ \t]*\b__list_add\b *(.*)[ \t]*\b__list_add\b *(.*)/d
-s/\bcfs_list_add\b/list_add/g
-/#[ \t]*define[ \t]*\blist_add\b *(.*)[ \t]*\blist_add\b *(.*)/d
-s/\bcfs_list_add_tail\b/list_add_tail/g
-/#[ \t]*define[ \t]*\blist_add_tail\b *(.*)[ \t]*\blist_add_tail\b *(.*)/d
-s/\b__cfs_list_del\b/__list_del/g
-/#[ \t]*define[ \t]*\b__list_del\b *(.*)[ \t]*\b__list_del\b *(.*)/d
-s/\bcfs_list_del\b/list_del/g
-/#[ \t]*define[ \t]*\blist_del\b *(.*)[ \t]*\blist_del\b *(.*)/d
-s/\bcfs_list_del_init\b/list_del_init/g
-/#[ \t]*define[ \t]*\blist_del_init\b *(.*)[ \t]*\blist_del_init\b *(.*)/d
-s/\bcfs_list_move\b/list_move/g
-/#[ \t]*define[ \t]*\blist_move\b *(.*)[ \t]*\blist_move\b *(.*)/d
-s/\bcfs_list_move_tail\b/list_move_tail/g
-/#[ \t]*define[ \t]*\blist_move_tail\b *(.*)[ \t]*\blist_move_tail\b *(.*)/d
-s/\bcfs_list_empty\b/list_empty/g
-/#[ \t]*define[ \t]*\blist_empty\b *(.*)[ \t]*\blist_empty\b *(.*)/d
-s/\bcfs_list_empty_careful\b/list_empty_careful/g
-/#[ \t]*define[ \t]*\blist_empty_careful\b *(.*)[ \t]*\blist_empty_careful\b *(.*)/d
-s/\b__cfs_list_splice\b/__list_splice/g
-/#[ \t]*define[ \t]*\b__list_splice\b *(.*)[ \t]*\b__list_splice\b *(.*)/d
-s/\bcfs_list_splice\b/list_splice/g
-/#[ \t]*define[ \t]*\blist_splice\b *(.*)[ \t]*\blist_splice\b *(.*)/d
-s/\bcfs_list_splice_init\b/list_splice_init/g
-/#[ \t]*define[ \t]*\blist_splice_init\b *(.*)[ \t]*\blist_splice_init\b *(.*)/d
-s/\bcfs_list_entry\b/list_entry/g
-/#[ \t]*define[ \t]*\blist_entry\b *(.*)[ \t]*\blist_entry\b *(.*)/d
-s/\bcfs_list_for_each\b/list_for_each/g
-/#[ \t]*define[ \t]*\blist_for_each\b *(.*)[ \t]*\blist_for_each\b *(.*)/d
-s/\bcfs_list_for_each_safe\b/list_for_each_safe/g
-/#[ \t]*define[ \t]*\blist_for_each_safe\b *(.*)[ \t]*\blist_for_each_safe\b *(.*)/d
-s/\bcfs_list_for_each_prev\b/list_for_each_prev/g
-/#[ \t]*define[ \t]*\blist_for_each_prev\b *(.*)[ \t]*\blist_for_each_prev\b *(.*)/d
-s/\bcfs_list_for_each_entry\b/list_for_each_entry/g
-/#[ \t]*define[ \t]*\blist_for_each_entry\b *(.*)[ \t]*\blist_for_each_entry\b *(.*)/d
-s/\bcfs_list_for_each_entry_reverse\b/list_for_each_entry_reverse/g
-/#[ \t]*define[ \t]*\blist_for_each_entry_reverse\b *(.*)[ \t]*\blist_for_each_entry_reverse\b *(.*)/d
-s/\bcfs_list_for_each_entry_safe_reverse\b/list_for_each_entry_safe_reverse/g
-/#[ \t]*define[ \t]*\blist_for_each_entry_safe_reverse\b *(.*)[ \t]*\blist_for_each_entry_safe_reverse\b *(.*)/d
-s/\bcfs_list_for_each_entry_safe\b/list_for_each_entry_safe/g
-/#[ \t]*define[ \t]*\blist_for_each_entry_safe\b *(.*)[ \t]*\blist_for_each_entry_safe\b *(.*)/d
-s/\bcfs_list_for_each_entry_safe_from\b/list_for_each_entry_safe_from/g
-/#[ \t]*define[ \t]*\blist_for_each_entry_safe_from\b *(.*)[ \t]*\blist_for_each_entry_safe_from\b *(.*)/d
-s/\bcfs_list_for_each_entry_continue\b/list_for_each_entry_continue/g
-/#[ \t]*define[ \t]*\blist_for_each_entry_continue\b *(.*)[ \t]*\blist_for_each_entry_continue\b *(.*)/d
-# LIST_HEAD defined in /usr/include/sys/queue.h
-s/\bCFS_LIST_HEAD_INIT\b/LIST_HEAD_INIT/g
-/#[ \t]*define[ \t]*\bLIST_HEAD_INIT\b *(.*)[ \t]*\bLIST_HEAD_INIT\b *(.*)/d
-s/\bCFS_LIST_HEAD\b/LIST_HEAD/g
-/#[ \t]*define[ \t]*\bLIST_HEAD\b *(.*)[ \t]*\bLIST_HEAD\b *(.*)/d
-s/\bCFS_INIT_LIST_HEAD\b/INIT_LIST_HEAD/g
-/#[ \t]*define[ \t]*\bINIT_LIST_HEAD\b *(.*)[ \t]*\bINIT_LIST_HEAD\b *(.*)/d
-s/\bcfs_hlist_head_t\b/struct hlist_head/g
-s/\bcfs_hlist_node_t\b/struct hlist_node/g
-s/\bcfs_hlist_unhashed\b/hlist_unhashed/g
-/#[ \t]*define[ \t]*\bhlist_unhashed\b *(.*)[ \t]*\bhlist_unhashed\b *(.*)/d
-s/\bcfs_hlist_empty\b/hlist_empty/g
-/#[ \t]*define[ \t]*\bhlist_empty\b *(.*)[ \t]*\bhlist_empty\b *(.*)/d
-s/\b__cfs_hlist_del\b/__hlist_del/g
-/#[ \t]*define[ \t]*\b__hlist_del\b *(.*)[ \t]*\b__hlist_del\b *(.*)/d
-s/\bcfs_hlist_del\b/hlist_del/g
-/#[ \t]*define[ \t]*\bhlist_del\b *(.*)[ \t]*\bhlist_del\b *(.*)/d
-s/\bcfs_hlist_del_init\b/hlist_del_init/g
-/#[ \t]*define[ \t]*\bhlist_del_init\b *(.*)[ \t]*\bhlist_del_init\b *(.*)/d
-s/\bcfs_hlist_add_head\b/hlist_add_head/g
-/#[ \t]*define[ \t]*\bhlist_add_head\b *(.*)[ \t]*\bhlist_add_head\b *(.*)/d
-s/\bcfs_hlist_add_before\b/hlist_add_before/g
-/#[ \t]*define[ \t]*\bhlist_add_before\b *(.*)[ \t]*\bhlist_add_before\b *(.*)/d
-s/\bcfs_hlist_add_after\b/hlist_add_after/g
-/#[ \t]*define[ \t]*\bhlist_add_after\b *(.*)[ \t]*\bhlist_add_after\b *(.*)/d
-s/\bcfs_hlist_entry\b/hlist_entry/g
-/#[ \t]*define[ \t]*\bhlist_entry\b *(.*)[ \t]*\bhlist_entry\b *(.*)/d
 s/\bcfs_hlist_for_each\b/hlist_for_each/g
 /#[ \t]*define[ \t]*\bhlist_for_each\b *(.*)[ \t]*\bhlist_for_each\b *(.*)/d
 s/\bcfs_hlist_for_each_safe\b/hlist_for_each_safe/g
@@ -716,14 +601,3 @@ s/\bcfs_hlist_for_each_entry_continue\b/hlist_for_each_entry_continue/g
 /#[ \t]*define[ \t]*\bhlist_for_each_entry_continue\b *(.*)[ \t]*\bhlist_for_each_entry_continue\b *(.*)/d
 s/\bcfs_hlist_for_each_entry_from\b/hlist_for_each_entry_from/g
 /#[ \t]*define[ \t]*\bhlist_for_each_entry_from\b *(.*)[ \t]*\bhlist_for_each_entry_from\b *(.*)/d
-s/\bCFS_HLIST_HEAD_INIT\b/HLIST_HEAD_INIT/g
-/#[ \t]*define[ \t]*\bHLIST_HEAD_INIT\b[ \t]*\bHLIST_HEAD_INIT\b/d
-s/\bCFS_HLIST_HEAD\b/HLIST_HEAD/g
-/#[ \t]*define[ \t]*\bHLIST_HEAD\b *(.*)[ \t]*\bHLIST_HEAD\b *(.*)/d
-s/\bCFS_INIT_HLIST_HEAD\b/INIT_HLIST_HEAD/g
-/#[ \t]*define[ \t]*\bINIT_HLIST_HEAD\b *(.*)[ \t]*\bINIT_HLIST_HEAD\b *(.*)/d
-s/\bCFS_INIT_HLIST_NODE\b/INIT_HLIST_NODE/g
-/#[ \t]*define[ \t]*\bINIT_HLIST_NODE\b *(.*)[ \t]*\bINIT_HLIST_NODE\b *(.*)/d
-s/\bcfs_list_for_each_entry_safe_from\b/list_for_each_entry_safe_from/g
-/cfs_list_for_each_entry_typed/{;N;s/\(cfs_list_for_each_entry_typed\)\([^,]*,\)[ ,\t,\n]*\([^,]*,\)[ ,\t,\n]*\([^,]*,\)[ ,\t,\n]*/list_for_each_entry\2 \3 /}
-/cfs_list_for_each_entry_safe_typed/{;N;s/\(cfs_list_for_each_entry_safe_typed\)\([^,]*,\)[ ,\t,\n]*\([^,]*,\)[ ,\t,\n]*\([^,]*,\)[ ,\t,\n]*\([^,]*,\)[ ,\t,\n]*/list_for_each_entry_safe\2 \3 \4 /}