Whamcloud - gitweb
LU-9859 libcfs: add "default" keyword for debug mask
[fs/lustre-release.git] / lnet / include / uapi / linux / lnet / libcfs_debug.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.gnu.org/licenses/gpl-2.0.html
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Use is subject to license terms.
25  *
26  * Copyright (c) 2012, 2014, Intel Corporation.
27  */
28 /*
29  * This file is part of Lustre, http://www.lustre.org/
30  *
31  * libcfs/include/libcfs/libcfs_debug.h
32  *
33  * Debug messages and assertions
34  *
35  */
36
37 #ifndef __UAPI_LIBCFS_DEBUG_H__
38 #define __UAPI_LIBCFS_DEBUG_H__
39
40 #include <linux/types.h>
41
42 /**
43  * Format for debug message headers
44  */
45 struct ptldebug_header {
46         __u32 ph_len;
47         __u32 ph_flags;
48         __u32 ph_subsys;
49         __u32 ph_mask;
50         __u16 ph_cpu_id;
51         __u16 ph_type;
52         /* time_t overflow in 2106 */
53         __u32 ph_sec;
54         __u64 ph_usec;
55         __u32 ph_stack;
56         __u32 ph_pid;
57         __u32 ph_extern_pid;
58         __u32 ph_line_num;
59 } __attribute__((packed));
60
61 #define PH_FLAG_FIRST_RECORD    1
62
63 /* Debugging subsystems (32 bits, non-overlapping) */
64 enum libcfs_debug_subsys {
65         S_UNDEFINED     = 0x00000001,
66         S_MDC           = 0x00000002,
67         S_MDS           = 0x00000004,
68         S_OSC           = 0x00000008,
69         S_OST           = 0x00000010,
70         S_CLASS         = 0x00000020,
71         S_LOG           = 0x00000040,
72         S_LLITE         = 0x00000080,
73         S_RPC           = 0x00000100,
74         S_MGMT          = 0x00000200,
75         S_LNET          = 0x00000400,
76         S_LND           = 0x00000800, /* ALL LNDs */
77         S_PINGER        = 0x00001000,
78         S_FILTER        = 0x00002000,
79         S_LIBCFS        = 0x00004000,
80         S_ECHO          = 0x00008000,
81         S_LDLM          = 0x00010000,
82         S_LOV           = 0x00020000,
83         S_LQUOTA        = 0x00040000,
84         S_OSD           = 0x00080000,
85         S_LFSCK         = 0x00100000,
86         S_SNAPSHOT      = 0x00200000,
87 /* unused */
88         S_LMV           = 0x00800000,
89 /* unused */
90         S_SEC           = 0x02000000, /* upcall cache */
91         S_GSS           = 0x04000000,
92 /* unused */
93         S_MGC           = 0x10000000,
94         S_MGS           = 0x20000000,
95         S_FID           = 0x40000000,
96         S_FLD           = 0x80000000,
97 };
98 #define LIBCFS_S_DEFAULT (~0)
99
100 #define LIBCFS_DEBUG_SUBSYS_NAMES {                                     \
101         "undefined", "mdc", "mds", "osc", "ost", "class", "log",        \
102         "llite", "rpc", "mgmt", "lnet", "lnd", "pinger", "filter",      \
103         "libcfs", "echo", "ldlm", "lov", "lquota", "osd", "lfsck",      \
104         "snapshot", "", "lmv", "", "sec", "gss", "", "mgc", "mgs",      \
105         "fid", "fld", NULL }
106
107 /* Debugging masks (32 bits, non-overlapping) */
108 enum libcfs_debug_masks {
109         D_TRACE         = 0x00000001, /* ENTRY/EXIT markers */
110         D_INODE         = 0x00000002,
111         D_SUPER         = 0x00000004,
112         D_IOTRACE       = 0x00000008, /* simple, low overhead io tracing */
113         D_MALLOC        = 0x00000010, /* print malloc, free information */
114         D_CACHE         = 0x00000020, /* cache-related items */
115         D_INFO          = 0x00000040, /* general information */
116         D_IOCTL         = 0x00000080, /* ioctl related information */
117         D_NETERROR      = 0x00000100, /* network errors */
118         D_NET           = 0x00000200, /* network communications */
119         D_WARNING       = 0x00000400, /* CWARN(...) == CDEBUG(D_WARNING, ...) */
120         D_BUFFS         = 0x00000800,
121         D_OTHER         = 0x00001000,
122         D_DENTRY        = 0x00002000,
123         D_NETTRACE      = 0x00004000,
124         D_PAGE          = 0x00008000, /* bulk page handling */
125         D_DLMTRACE      = 0x00010000,
126         D_ERROR         = 0x00020000, /* CERROR(...) == CDEBUG(D_ERROR, ...) */
127         D_EMERG         = 0x00040000, /* CEMERG(...) == CDEBUG(D_EMERG, ...) */
128         D_HA            = 0x00080000, /* recovery and failover */
129         D_RPCTRACE      = 0x00100000, /* for distributed debugging */
130         D_VFSTRACE      = 0x00200000,
131         D_READA         = 0x00400000, /* read-ahead */
132         D_MMAP          = 0x00800000,
133         D_CONFIG        = 0x01000000,
134         D_CONSOLE       = 0x02000000,
135         D_QUOTA         = 0x04000000,
136         D_SEC           = 0x08000000,
137         D_LFSCK         = 0x10000000, /* For both OI scrub and LFSCK */
138         D_HSM           = 0x20000000,
139         D_SNAPSHOT      = 0x40000000,
140         D_LAYOUT        = 0x80000000,
141 };
142 #define LIBCFS_D_DEFAULT (D_CANTMASK | D_NETERROR | D_HA | D_CONFIG | D_IOCTL |\
143                           D_LFSCK)
144
145 #define LIBCFS_DEBUG_MASKS_NAMES {                                      \
146         "trace", "inode", "super", "iotrace", "malloc", "cache", "info",\
147         "ioctl", "neterror", "net", "warning", "buffs", "other",        \
148         "dentry", "nettrace", "page", "dlmtrace", "error", "emerg",     \
149         "ha", "rpctrace", "vfstrace", "reada", "mmap", "config",        \
150         "console", "quota", "sec", "lfsck", "hsm", "snapshot", "layout",\
151         NULL }
152
153 #define D_CANTMASK   (D_ERROR | D_EMERG | D_WARNING | D_CONSOLE)
154
155 #define LIBCFS_DEBUG_FILE_PATH_DEFAULT "/tmp/lustre-log"
156
157 #endif  /* __UAPI_LIBCFS_DEBUG_H__ */