Whamcloud - gitweb
LU-6215 kernel: use f_path for inode dentry
[fs/lustre-release.git] / contrib / scripts / checkpatch.pl
index b766319..4936fbe 100755 (executable)
@@ -389,13 +389,6 @@ my %dep_functions = (
        'cfs_hlist_empty',              'hlist_empty',
        'cfs_hlist_entry',              'hlist_entry',
        'cfs_hlist_for_each',           'hlist_for_each',
-       'cfs_hlist_for_each_entry',     'hlist_for_each_entry',
-       'cfs_hlist_for_each_entry_continue',
-                                       'hlist_for_each_entry_continue',
-       'cfs_hlist_for_each_entry_from',
-                                       'hlist_for_each_entry_from',
-       'cfs_hlist_for_each_entry_safe',
-                                       'hlist_for_each_entry_safe',
        'cfs_hlist_for_each_safe',      'hlist_for_each_safe',
        'cfs_hlist_head_t',             'struct hlist_head',
        'cfs_hlist_node_t',             'struct hlist_node',
@@ -404,7 +397,7 @@ my %dep_functions = (
        'cfs_inode_t',                  'struct inode',
 
        'CFS_INIT_LIST_HEAD',           'INIT_LIST_HEAD',
-       'CFS_LIST_HEAD',                'LIST_HEAD',
+       'CFS_LIST_HEAD',                'struct list_head foo = LIST_HEAD_INIT(foo);',
        'CFS_LIST_HEAD_INIT',           'LIST_HEAD_INIT',
        'cfs_list_add',                 'list_add',
        'cfs_list_add_tail',            'list_add_tail',
@@ -445,6 +438,7 @@ my %dep_functions = (
 
        'cfs_rcu_head_t',               'struct rcu_head',
 
+       'LPROCFS',                      'CONFIG_PROC_FS',
        'alloca',                       'malloc',
        'mktemp',                       'mkstemp',
        'sprintf',                      'snprintf',
@@ -1848,8 +1842,9 @@ sub process {
                        }
                }
 
-# check we are in a valid source file C or perl if not then ignore this hunk
-               next if ($realfile !~ /\.(h|c|pl)$/);
+# check we are in a valid source file C, perl or bash script
+# if not then ignore this hunk
+               next if ($realfile !~ /\.(h|c|pl|sh)$/);
 
 # at the beginning of a line any tabs must come first and anything
 # more than 8 must use tabs.
@@ -3091,6 +3086,27 @@ sub process {
                        }
                }
 
+# try to replace assertions with error handling
+               if ($line =~ /\bLASSERTF?\s*\(/) {
+                   WARN("LASSERT",
+                        "try to replace assertions with error handling\n" .
+                        $herecurr);
+               }
+
+# avoid new console messages
+               if ($line =~ /\bLCONSOLE[A-Z_]*\s*\(/) {
+                   WARN("LCONSOLE",
+                        "avoid adding new console messages\n" .
+                        $herecurr);
+               }
+
+# minimize new CERROR messages
+               if ($line =~ /\bC(EMERG|ERROR|NETERR|WARN)\s*\(/) {
+                   WARN("LCONSOLE",
+                        "think hard before adding new CERROR messages\n" .
+                        $herecurr);
+               }
+
 # no volatiles please
                my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
                if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) {
@@ -3435,6 +3451,11 @@ sub process {
                        WARN("EXPORTED_WORLD_WRITABLE",
                             "Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr);
                }
+
+               if ($rawline =~ /version 3/) {
+                       WARN("GPLV3",
+                            "using GPLv3 is usually wrong\n" . $herecurr);
+               }
        }
 
        # If we have no input at all, then there is nothing to report on