Whamcloud - gitweb
Revert "LU-6245 libcfs: remove cfs_fs_time handling"
[fs/lustre-release.git] / contrib / scripts / libcfs_cleanup.sed
index 717d8ed..af7f758 100644 (file)
@@ -2,7 +2,11 @@
 
 # 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.hpdd.intel.com/browse/LU-1346
+
+# Run this script like:
+#      find libcfs lnet lustre -name "*.[ch]" | grep -v gnilnd |
+#              xargs sed -i "" -f contrib/scripts/libcfs_cleanup.sed
 
 
 ################################################################################
@@ -88,7 +92,7 @@ s/\bcfs_read_unlock\b/read_unlock/g
 /#[ \t]*define[ \t]*\bread_unlock\b *( *\w* *)[ \t]*\bread_unlock\b *( *\w* *)/d
 s/\bcfs_read_unlock_irqrestore\b/read_unlock_irqrestore/g
 #/#[ \t]*define[ \t]*\bread_unlock_irqrestore\b *( *\w* *)[ \t]*\bread_unlock_irqrestore\b *( *\w* *)/d
-/#define read_unlock_irqrestore(lock,flags) \\/{N;d}
+/#define read_unlock_irqrestore(lock,flags) \\/{N;d;}
 s/\bcfs_write_lock\b/write_lock/g
 /#[ \t]*define[ \t]*\bwrite_lock\b *( *\w* *)[ \t]*\bwrite_lock\b *( *\w* *)/d
 s/\bcfs_write_unlock\b/write_unlock/g
@@ -120,7 +124,7 @@ s/\bcfs_complete\b/complete/g
 s/\bcfs_wait_for_completion\b/wait_for_completion/g
 /#[ \t]*define[ \t]*\bwait_for_completion\b *( *\w* *)[ \t]*\bwait_for_completion\b *( *\w* *)/d
 s/\bcfs_wait_for_completion_interruptible\b/wait_for_completion_interruptible/g
-/#define wait_for_completion_interruptible(c) \\/{N;d}
+/#define wait_for_completion_interruptible(c) \\/{N;d;}
 s/\bcfs_complete_and_exit\b/complete_and_exit/g
 /#[ \t]*define[ \t]*\bcomplete_and_exit\b *( *\w* *, *\w* *)[ \t]*\bcomplete_and_exit\b *( *\w* *, *\w* *)/d
 s/\bcfs_fini_completion\b/fini_completion/g
@@ -177,7 +181,7 @@ s/\bcfs_lockdep_on\b/lockdep_on/g
 
 s/\bcfs_mutex_lock_nested\b/mutex_lock_nested/g
 #/#[ \t]*define[ \t]*\bmutex_lock_nested\b *( *\w* *, *\w* *)[ \t]*\bmutex_lock_nested\b *( *\w* *, *\w* *)/d
-/#define mutex_lock_nested(mutex, subclass) \\/{N;d}
+/#define mutex_lock_nested(mutex, subclass) \\/{N;d;}
 s/\bcfs_spin_lock_nested\b/spin_lock_nested/g
 /#[ \t]*define[ \t]*\bspin_lock_nested\b *( *\w* *, *\w* *)[ \t]*\bspin_lock_nested\b *( *\w* *, *\w* *)/d
 s/\bcfs_down_read_nested\b/down_read_nested/g
@@ -205,7 +209,7 @@ s/\bcfs_find_first_zero_bit\b/find_first_zero_bit/g
 s/\bcfs_find_next_bit\b/find_next_bit/g
 /#[ \t]*define[ \t]*\bfind_next_bit\b *( *\w* *, *\w* *, *\w* *)[ \t]*\bfind_next_bit\b *( *\w* *, *\w* *, *\w* *)/d
 s/\bcfs_find_next_zero_bit\b/find_next_zero_bit/g
-/#define find_next_zero_bit(addr, size, off) \\/{N;d}
+/#define find_next_zero_bit(addr, size, off) \\/{N;d;}
 s/\bcfs_ffz\b/ffz/g
 /#[ \t]*define[ \t]*\bffz\b *( *\w* *)[ \t]*\bffz\b *( *\w* *)/d
 s/\bcfs_ffs\b/ffs/g
@@ -431,3 +435,172 @@ s/\bcfs_curproc_is_in_groups\b/in_group_p/g
 s/\bcfs_curproc_umask\b/current_umask/g
 s/\bcfs_curproc_comm\b/current_comm/g
 s/\bcfs_curproc_is_32bit\b/current_is_32bit/g
+
+################################################################################
+# linux primitives (linux-prim.h)
+# debug level
+s/\bCFS_KERN_EMERG\b/KERN_EMERG/g
+/#[ \t]*define[ \t]*\bKERN_EMERG\b[ \t]*\bKERN_EMERG\b/d
+s/\bCFS_KERN_ALERT\b/KERN_ALERT/g
+/#[ \t]*define[ \t]*\bKERN_ALERT\b[ \t]*\bKERN_ALERT\b/d
+s/\bCFS_KERN_CRIT\b/KERN_CRIT/g
+/#[ \t]*define[ \t]*\bKERN_CRIT\b[ \t]*\bKERN_CRIT\b/d
+s/\bCFS_KERN_ERR\b/KERN_ERR/g
+/#[ \t]*define[ \t]*\bKERN_ERR\b[ \t]*\bKERN_ERR\b/d
+s/\bCFS_KERN_WARNING\b/KERN_WARNING/g
+/#[ \t]*define[ \t]*\bKERN_WARNING\b[ \t]*\bKERN_WARNING\b/d
+s/\bCFS_KERN_NOTICE\b/KERN_NOTICE/g
+/#[ \t]*define[ \t]*\bKERN_NOTICE\b[ \t]*\bKERN_NOTICE\b/d
+s/\bCFS_KERN_INFO\b/KERN_INFO/g
+/#[ \t]*define[ \t]*\bKERN_INFO\b[ \t]*\bKERN_INFO\b/d
+s/\bCFS_KERN_DEBUG\b/KERN_DEBUG/g
+/#[ \t]*define[ \t]*\bKERN_DEBUG\b[ \t]*\bKERN_DEBUG\b/d
+# cache
+s/\bCFS_L1_CACHE_ALIGN\b/L1_CACHE_ALIGN/g
+/#[ \t]*define[ \t]*\bL1_CACHE_ALIGN\b *( *\w* *)[ \t]*\bL1_CACHE_ALIGN\b *( *\w* *)/d
+# IRQs
+s/\bCFS_NR_IRQS\b/NR_IRQS/g
+/#[ \t]*define[ \t]*\bNR_IRQS\b[ \t]*\bNR_IRQS\b/d
+s/\bCFS_EXPORT_SYMBOL\b/EXPORT_SYMBOL/g
+/#[ \t]*define[ \t]*\bEXPORT_SYMBOL\b *( *\w* *)[ \t]*\bEXPORT_SYMBOL\b *( *\w* *)/d
+# Pseudo device register
+s/\bcfs_psdev_t\b/struct miscdevice/g
+s/\bcfs_psdev_register\b/misc_register/g
+/#[ \t]*define[ \t]*\bmisc_register\b *( *\w* *)[ \t]*\bmisc_register\b *( *\w* *)/d
+s/\bcfs_psdev_deregister\b/misc_deregister/g
+/#[ \t]*define[ \t]*\bmisc_deregister\b *( *\w* *)[ \t]*\bmisc_deregister\b *( *\w* *)/d
+# Sysctl register
+s/\bcfs_sysctl_table_t\b/struct ctl_table/g
+s/\bcfs_sysctl_table_header_t\b/struct ctl_table_header/g
+# Symbol register
+s/\bcfs_register_sysctl_table\b/register_sysctl_table/g
+s/\bcfs_unregister_sysctl_table\b/unregister_sysctl_table/g
+/#[ \t]*define[ \t]*\bunregister_sysctl_table\b *( *\w* *)[ \t]*\bunregister_sysctl_table\b *( *\w* *)/d
+s/\bPORTAL_SYMBOL_PUT\b/symbol_put/g
+/#[ \t]*define[ \t]*\bsymbol_put\b *( *\w* *)[ \t]*\bsymbol_put\b *( *\w* *)/d
+s/\bPORTAL_SYMBOL_GET\b/symbol_get/g
+/#[ \t]*define[ \t]*\bsymbol_get\b *( *\w* *)[ \t]*\bsymbol_get\b *( *\w* *)/d
+# Module interfaces
+s/\bPORTAL_MODULE_USE\b/cfs_module_get()/g
+s/\bcfs_module_get()/try_module_get(THIS_MODULE)/g
+s/\bcfs_try_module_get\b/try_module_get/g
+/#[ \t]*define[ \t]*\btry_module_get\b.*\btry_module_get\b/d
+s/\bPORTAL_MODULE_UNUSE\b/cfs_module_put(THIS_MODULE)/g
+s/\bcfs_module_put\b/module_put/g
+/#[ \t]*define[ \t]*\bmodule_put\b *( *\w* *)[ \t]*\bmodule_put\b *( *\w* *)/d
+s/\b__cfs_module_get\b/__module_get/g
+/#[ \t]*define[ \t]*\b__module_get\b *( *\w* *)[ \t]*\b__module_get\b *( *\w* *)/d
+s/\bcfs_module_refcount\b/module_refcount/g
+/#[ \t]*define[ \t]*\bmodule_refcount\b *( *\w* *)[ \t]*\bmodule_refcount\b *( *\w* *)/d
+s/\bcfs_module_t\b/struct module/g
+# s/\bcfs_module\b/declare_module/g
+s/\bcfs_request_module\b/request_module/g
+/#[ \t]*define[ \t]*\brequest_module\b[ \t]*\brequest_module\b/d
+# Wait Queue
+s/\bCFS_TASK_INTERRUPTIBLE\b/TASK_INTERRUPTIBLE/g
+/#[ \t]*define[ \t]*\bTASK_INTERRUPTIBLE\b[ \t]*\bTASK_INTERRUPTIBLE\b/d
+s/\bCFS_TASK_UNINT\b/TASK_UNINTERRUPTIBLE/g
+/#[ \t]*define[ \t]*\bTASK_UNINTERRUPTIBLE\b[ \t]*\bTASK_UNINTERRUPTIBLE\b/d
+s/\bCFS_TASK_RUNNING\b/TASK_RUNNING/g
+/#[ \t]*define[ \t]*\bTASK_RUNNING\b[ \t]*\bTASK_RUNNING\b/d
+s/\bcfs_set_current_state\b/set_current_state/g
+/#[ \t]*define[ \t]*\bset_current_state\b *( *\w* *)[ \t]*\bset_current_state\b *( *\w* *)/d
+s/\bcfs_wait_event\b/wait_event/g
+/#[ \t]*define[ \t]*\bwait_event\b *( *\w* *, *\w* *)[ \t]*\bwait_event\b *( *\w* *, *\w* *)/d
+s/\bcfs_waitlink_t\b/wait_queue_t/g
+/typedef[ \t]*\bwait_queue_t\b[ \t]*\bwait_queue_t\b/d
+s/\bcfs_waitq_t\b/wait_queue_head_t/g
+/typedef[ \t]*\bwait_queue_head_t\b[ \t]*\bwait_queue_head_t\b/d
+#s/\bcfs_task_state_t\b/task_state_t/g
+s/\bcfs_waitq_init\b/init_waitqueue_head/g
+/#[ \t]*define[ \t]*\binit_waitqueue_head\b *( *\w* *)[ \t]*\binit_waitqueue_head\b *( *\w* *)/d
+s/\bcfs_waitlink_init\b/init_waitqueue_entry_current/g
+s/\bcfs_waitq_add\b/add_wait_queue/g
+/#[ \t]*define[ \t]*\badd_wait_queue\b *( *\w* *, *\w* *)[ \t]*\badd_wait_queue\b *( *\w* *, *\w* *)/d
+s/\bcfs_waitq_add_exclusive\b/add_wait_queue_exclusive/g
+/#[ \t]*define[ \t]*\badd_wait_queue_exclusive\b *( *\w* *, *\w* *)[ \t]*\badd_wait_queue_exclusive\b *( *\w* *, *\w* *)/d
+s/\bcfs_waitq_del\b/remove_wait_queue/g
+/#[ \t]*define[ \t]*\bremove_wait_queue\b *( *\w* *, *\w* *)[ \t]*\bremove_wait_queue\b *( *\w* *, *\w* *)/d
+s/\bcfs_waitq_active\b/waitqueue_active/g
+/#[ \t]*define[ \t]*\bwaitqueue_active\b *( *\w* *)[ \t]*\bwaitqueue_active\b *( *\w* *)/d
+s/\bcfs_waitq_signal\b/wake_up/g
+/#[ \t]*define[ \t]*\bwake_up\b *( *\w* *)[ \t]*\bwake_up\b *( *\w* *)/d
+s/\bcfs_waitq_signal_nr\b/wake_up_nr/g
+/#[ \t]*define[ \t]*\bwake_up_nr\b *( *\w* *, *\w* *)[ \t]*\bwake_up_nr\b *( *\w* *, *\w* *)/d
+s/\bcfs_waitq_broadcast\b/wake_up_all/g
+/#[ \t]*define[ \t]*\bwake_up_all\b *( *\w* *)[ \t]*\bwake_up_all\b *( *\w* *)/d
+s/\bcfs_waitq_wait\b/waitq_wait/g
+s/\bcfs_waitq_timedwait\b/waitq_timedwait/g
+s/\bcfs_schedule_timeout\b/schedule_timeout/g
+/#[ \t]*define[ \t]*\bschedule_timeout\b *( *\w* *)[ \t]*\bschedule_timeout\b *( *\w* *)/d
+s/\bcfs_schedule\b/schedule/g
+/#[ \t]*define[ \t]*\bschedule\b *( *)[ \t]*\bschedule\b *( *)/d
+s/\bcfs_need_resched\b/need_resched/g
+/#[ \t]*define[ \t]*\bneed_resched\b *( *)[ \t]*\bneed_resched\b *( *)/d
+s/\bcfs_cond_resched\b/cond_resched/g
+/#[ \t]*define[ \t]*\bcond_resched\b *( *)[ \t]*\bcond_resched\b *( *)/d
+s/\bcfs_waitq_add_exclusive_head\b/add_wait_queue_exclusive_head/g
+s/\bcfs_schedule_timeout_and_set_state\b/schedule_timeout_and_set_state/g
+s/\bCFS_MAX_SCHEDULE_TIMEOUT\b/MAX_SCHEDULE_TIMEOUT/g
+s/\bcfs_task_state_t\b/long/g
+
+# Kernel thread
+s/\bcfs_kthread_run\b/kthread_run/g
+/#[ \t]*define[ \t]*\bkthread_run\b.*\bkthread_run\b/d
+#s/\bcfs_thread_t\b/thread_t/g
+s/\bCFS_DAEMON_FLAGS\b/DAEMON_FLAGS/g
+#s/\bcfs_create_thread\b/create_thread/g
+# Task struct
+s/\bcfs_task_t\b/struct task_struct/g
+s/\bcfs_current()/current/g
+/#[ \t]*define[ \t]*\bcurrent\b[ \t]*\bcurrent\b/d
+s/\bcfs_task_lock\b/task_lock/g
+/#[ \t]*define[ \t]*\btask_lock\b *( *\w* *)[ \t]*\btask_lock\b *( *\w* *)/d
+s/\bcfs_task_unlock\b/task_unlock/g
+/#[ \t]*define[ \t]*\btask_unlock\b *( *\w* *)[ \t]*\btask_unlock\b *( *\w* *)/d
+s/\bCFS_DECL_JOURNAL_DATA\b/DECL_JOURNAL_DATA/g
+s/\bCFS_PUSH_JOURNAL\b/PUSH_JOURNAL/g
+s/\bCFS_POP_JOURNAL\b/POP_JOURNAL/g
+# Signal
+s/\bcfs_sigset_t\b/sigset_t/g
+/typedef[ \t]*\bsigset_t\b[ \t]*\bsigset_t\b/d
+# Timer
+s/\bcfs_timer_t\b/struct timer_list/g
+s/\bCFS_MAX_SCHEDULE_TIMEOUT\b/MAX_SCHEDULE_TIMEOUT/g
+/#[ \t]*define[ \t]*\bMAX_SCHEDULE_TIMEOUT\b[ \t]*\bMAX_SCHEDULE_TIMEOUT\b/d
+
+# membar
+s/\bcfs_mb\b/smp_mb/g
+/#[ \t]*define[ \t]*\bmb\b *( *)[ \t]*\bmb\b *( *)/d
+# interrupt
+s/\bcfs_in_interrupt\b/in_interrupt/g
+/#[ \t]*define[ \t]*\bin_interrupt\b *( *)[ \t]*\bin_interrupt\b *( *)/d
+# might_sleep
+s/\bcfs_might_sleep\b/might_sleep/g
+/#[ \t]*define[ \t]*\bmight_sleep\b *( *)[ \t]*\bmight_sleep\b *( *)/d
+# group_info
+s/\bcfs_group_info_t\b/struct group_info/g
+s/\bcfs_get_group_info\b/get_group_info/g
+/#[ \t]*define[ \t]*\bget_group_info\b *( *\w* *)[ \t]*\bget_group_info\b *( *\w* *)/d
+s/\bcfs_put_group_info\b/put_group_info/g
+/#[ \t]*define[ \t]*\bput_group_info\b *( *\w* *)[ \t]*\bput_group_info\b *( *\w* *)/d
+s/\bcfs_set_current_groups\b/set_current_groups/g
+/#[ \t]*define[ \t]*\bset_current_groups\b *( *\w* *)[ \t]*\bset_current_groups\b *( *\w* *)/d
+s/\bcfs_groups_free\b/groups_free/g
+/#[ \t]*define[ \t]*\bgroups_free\b *( *\w* *)[ \t]*\bgroups_free\b *( *\w* *)/d
+s/\bcfs_groups_alloc\b/groups_alloc/g
+/#[ \t]*define[ \t]*\bgroups_alloc\b *( *\w* *)[ \t]*\bgroups_alloc\b *( *\w* *)/d
+# Random bytes
+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
+
+################################################################################
+# list operations
+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
+/#[ \t]*define[ \t]*\bhlist_for_each_safe\b *(.*)[ \t]*\bhlist_for_each_safe\b *(.*)/d
+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