Linux Kernel
3.7.1
|
#include <linux/types.h>
#include <linux/slab.h>
Go to the source code of this file.
Data Structures | |
struct | d_level |
Macros | |
#define | _d_printf(l, tag, dev, f, a...) |
#define | __D_PASTE__(varname, modulename) varname##_##modulename |
#define | __D_PASTE(varname, modulename) (__D_PASTE__(varname, modulename)) |
#define | _D_SUBMODULE_INDEX(_name) (D_SUBMODULE_DECLARE(_name)) |
#define | D_LEVEL __D_PASTE(d_level, D_MODULENAME) |
#define | D_LEVEL_SIZE __D_PASTE(d_level_size, D_MODULENAME) |
#define | D_MODULENAME undefined_modulename |
#define | D_MASTER 0 |
#define | D_SUBMODULE undefined_module |
#define | D_SUBMODULE_DECLARE(_name) __D_SUBMODULE_##_name |
#define | D_SUBMODULE_DEFINE(_name) |
#define | d_test(l) |
#define | d_fnstart(l, _dev, f, a...) _d_printf(l, " FNSTART", _dev, f, ## a) |
#define | d_fnend(l, _dev, f, a...) _d_printf(l, " FNEND", _dev, f, ## a) |
#define | d_printf(l, _dev, f, a...) _d_printf(l, "", _dev, f, ## a) |
#define | d_dump(l, dev, ptr, size) |
#define | d_level_register_debugfs(prefix, name, parent) |
Variables | |
struct d_level | D_LEVEL [] |
size_t | D_LEVEL_SIZE |
#define __D_PASTE | ( | varname, | |
modulename | |||
) | (__D_PASTE__(varname, modulename)) |
#define __D_PASTE__ | ( | varname, | |
modulename | |||
) | varname##_##modulename |
#define _D_SUBMODULE_INDEX | ( | _name | ) | (D_SUBMODULE_DECLARE(_name)) |
#define D_LEVEL __D_PASTE(d_level, D_MODULENAME) |
Export a submodule's debug level over debugfs as PREFIXSUBMODULE
: string to prefix the name with : name of submodule (not a string, just the name) : debugfs parent dentry
Returns: 0 if ok, < 0 errno on error.
For removing, just use debugfs_remove_recursive() on the parent.
#define D_LEVEL_SIZE __D_PASTE(d_level_size, D_MODULENAME) |
#define D_MASTER 0 |
D_MASTER - Compile time maximum debug level
#define in your debug-levels.h file to the maximum debug level the runtime code will be allowed to have. This allows you to provide a main knob.
Anything above that level will be optimized out of the compile.
Defaults to zero (no debug code compiled in).
Maximum one definition per module (at the debug-levels.h file).
#define D_MODULENAME undefined_modulename |
#define D_SUBMODULE undefined_module |
D_SUBMODULE - Name of the current submodule
#define in your submodule .c file before #including debug-levels.h to the name of the current submodule as previously declared and defined with D_SUBMODULE_DECLARE() (in your module's debug-levels.h) and D_SUBMODULE_DEFINE().
This is used to provide runtime-control over the debug levels.
Maximum one per .c file! Can be shared among different .c files (meaning they belong to the same submodule categorization).
#define D_SUBMODULE_DECLARE | ( | _name | ) | __D_SUBMODULE_##_name |
D_SUBMODULE_DECLARE - Declare a submodule for runtime debug level control
: name of the submodule, restricted to the chars that make up a valid C identifier ([a-zA-Z0-9_]).
Declare in the module's debug-levels.h header file as:
enum d_module { D_SUBMODULE_DECLARE(submodule_1), D_SUBMODULE_DECLARE(submodule_2), D_SUBMODULE_DECLARE(submodule_3), };
Some corresponding .c file needs to have a matching D_SUBMODULE_DEFINE().
#define D_SUBMODULE_DEFINE | ( | _name | ) |
D_SUBMODULE_DEFINE - Define a submodule for runtime debug level control
: name of the submodule, restricted to the chars that make up a valid C identifier ([a-zA-Z0-9_]).
Use once per module (in some .c file) as:
static struct d_level d_level_SUBMODULENAME[] = { D_SUBMODULE_DEFINE(submodule_1), D_SUBMODULE_DEFINE(submodule_2), D_SUBMODULE_DEFINE(submodule_3), }; size_t d_level_size_SUBDMODULENAME = ARRAY_SIZE(d_level_SUBDMODULENAME);
Matching D_SUBMODULE_DECLARE()s have to be present in a debug-levels.h header file.
#define d_test | ( | l | ) |
d_test - Returns true if debugging should be enabled
: intended debug level (unsigned)
If the master debug switch is enabled and the current settings are higher or equal to the requested level, then debugging output/actions should be enabled.
NOTE:
This needs to be coded so that it can be evaluated in compile time; this is why the ugly BUG_ON() is placed in there, so the D_MASTER evaluation compiles all out if it is compile-time false.