1 /// Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
4 //# Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
5 //# imposes some significant overhead as compared to
6 //# DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().
8 // Copyright (C): 2016 Nicolai Stange
9 // Options: --no-includes
18 declarer name DEFINE_SIMPLE_ATTRIBUTE;
20 expression dsa_get, dsa_set, dsa_fmt;
23 DEFINE_SIMPLE_ATTRIBUTE@p(dsa_fops, dsa_get, dsa_set, dsa_fmt);
26 expression name, mode, parent, data;
27 identifier dsa.dsa_fops;
29 debugfs_create_file(name, mode, parent, data, &dsa_fops)
32 @context_dsa depends on context && dcf@
33 declarer name DEFINE_DEBUGFS_ATTRIBUTE;
34 identifier dsa.dsa_fops;
35 expression dsa.dsa_get, dsa.dsa_set, dsa.dsa_fmt;
37 * DEFINE_SIMPLE_ATTRIBUTE(dsa_fops, dsa_get, dsa_set, dsa_fmt);
40 @patch_dcf depends on patch expression@
41 expression name, mode, parent, data;
42 identifier dsa.dsa_fops;
44 - debugfs_create_file(name, mode, parent, data, &dsa_fops)
45 + debugfs_create_file_unsafe(name, mode, parent, data, &dsa_fops)
47 @patch_dsa depends on patch_dcf && patch@
48 identifier dsa.dsa_fops;
49 expression dsa.dsa_get, dsa.dsa_set, dsa.dsa_fmt;
51 - DEFINE_SIMPLE_ATTRIBUTE(dsa_fops, dsa_get, dsa_set, dsa_fmt);
52 + DEFINE_DEBUGFS_ATTRIBUTE(dsa_fops, dsa_get, dsa_set, dsa_fmt);
55 @script:python depends on org && dcf@
59 msg="%s should be defined with DEFINE_DEBUGFS_ATTRIBUTE" % (fops)
60 coccilib.org.print_todo(p[0], msg)
62 @script:python depends on report && dcf@
66 msg="WARNING: %s should be defined with DEFINE_DEBUGFS_ATTRIBUTE" % (fops)
67 coccilib.report.print_report(p[0], msg)