Whamcloud - gitweb
LU-6245 uapi: move libcfs/lnet UAPI header into own uapi directory
[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  * Lustre is a trademark of Sun Microsystems, Inc.
31  *
32  * libcfs/include/libcfs/libcfs_debug.h
33  *
34  * Debug messages and assertions
35  *
36  */
37
38 #ifndef __UAPI_LIBCFS_DEBUG_H__
39 #define __UAPI_LIBCFS_DEBUG_H__
40
41 /**
42  * Format for debug message headers
43  */
44 struct ptldebug_header {
45         __u32 ph_len;
46         __u32 ph_flags;
47         __u32 ph_subsys;
48         __u32 ph_mask;
49         __u16 ph_cpu_id;
50         __u16 ph_type;
51         /* time_t overflow in 2106 */
52         __u32 ph_sec;
53         __u64 ph_usec;
54         __u32 ph_stack;
55         __u32 ph_pid;
56         __u32 ph_extern_pid;
57         __u32 ph_line_num;
58 } __attribute__((packed));
59
60 #define PH_FLAG_FIRST_RECORD    1
61
62 /* Debugging subsystems (32 bits, non-overlapping) */
63 #define S_UNDEFINED     0x00000001
64 #define S_MDC           0x00000002
65 #define S_MDS           0x00000004
66 #define S_OSC           0x00000008
67 #define S_OST           0x00000010
68 #define S_CLASS         0x00000020
69 #define S_LOG           0x00000040
70 #define S_LLITE         0x00000080
71 #define S_RPC           0x00000100
72 #define S_MGMT          0x00000200
73 #define S_LNET          0x00000400
74 #define S_LND           0x00000800 /* ALL LNDs */
75 #define S_PINGER        0x00001000
76 #define S_FILTER        0x00002000
77 #define S_LIBCFS        0x00004000
78 #define S_ECHO          0x00008000
79 #define S_LDLM          0x00010000
80 #define S_LOV           0x00020000
81 #define S_LQUOTA        0x00040000
82 #define S_OSD           0x00080000
83 #define S_LFSCK         0x00100000
84 #define S_SNAPSHOT      0x00200000
85 /* unused */
86 #define S_LMV           0x00800000 /* b_new_cmd */
87 /* unused */
88 #define S_SEC           0x02000000 /* upcall cache */
89 #define S_GSS           0x04000000 /* b_new_cmd */
90 /* unused */
91 #define S_MGC           0x10000000
92 #define S_MGS           0x20000000
93 #define S_FID           0x40000000 /* b_new_cmd */
94 #define S_FLD           0x80000000 /* b_new_cmd */
95
96 #define LIBCFS_DEBUG_SUBSYS_NAMES {                                     \
97         "undefined", "mdc", "mds", "osc", "ost", "class", "log",        \
98         "llite", "rpc", "mgmt", "lnet", "lnd", "pinger", "filter",      \
99         "libcfs", "echo", "ldlm", "lov", "lquota", "osd", "lfsck",      \
100         "snapshot", "", "lmv", "", "sec", "gss", "", "mgc", "mgs",      \
101         "fid", "fld", NULL }
102
103 /* Debugging masks (32 bits, non-overlapping) */
104 #define D_TRACE         0x00000001 /* ENTRY/EXIT markers */
105 #define D_INODE         0x00000002
106 #define D_SUPER         0x00000004
107 #define D_EXT2          0x00000008 /* anything from ext2_debug */
108 #define D_MALLOC        0x00000010 /* print malloc, free information */
109 #define D_CACHE         0x00000020 /* cache-related items */
110 #define D_INFO          0x00000040 /* general information */
111 #define D_IOCTL         0x00000080 /* ioctl related information */
112 #define D_NETERROR      0x00000100 /* network errors */
113 #define D_NET           0x00000200 /* network communications */
114 #define D_WARNING       0x00000400 /* CWARN(...) == CDEBUG (D_WARNING, ...) */
115 #define D_BUFFS         0x00000800
116 #define D_OTHER         0x00001000
117 #define D_DENTRY        0x00002000
118 #define D_NETTRACE      0x00004000
119 #define D_PAGE          0x00008000 /* bulk page handling */
120 #define D_DLMTRACE      0x00010000
121 #define D_ERROR         0x00020000 /* CERROR(...) == CDEBUG (D_ERROR, ...) */
122 #define D_EMERG         0x00040000 /* CEMERG(...) == CDEBUG (D_EMERG, ...) */
123 #define D_HA            0x00080000 /* recovery and failover */
124 #define D_RPCTRACE      0x00100000 /* for distributed debugging */
125 #define D_VFSTRACE      0x00200000
126 #define D_READA         0x00400000 /* read-ahead */
127 #define D_MMAP          0x00800000
128 #define D_CONFIG        0x01000000
129 #define D_CONSOLE       0x02000000
130 #define D_QUOTA         0x04000000
131 #define D_SEC           0x08000000
132 #define D_LFSCK         0x10000000 /* For both OI scrub and LFSCK */
133 #define D_HSM           0x20000000
134 #define D_SNAPSHOT      0x40000000 /* snapshot */
135 #define D_LAYOUT        0x80000000
136
137 #define LIBCFS_DEBUG_MASKS_NAMES {                                      \
138         "trace", "inode", "super", "ext2", "malloc", "cache", "info",   \
139         "ioctl", "neterror", "net", "warning", "buffs", "other",        \
140         "dentry", "nettrace", "page", "dlmtrace", "error", "emerg",     \
141         "ha", "rpctrace", "vfstrace", "reada", "mmap", "config",        \
142         "console", "quota", "sec", "lfsck", "hsm", "snapshot", "layout",\
143         NULL }
144
145 #define D_CANTMASK   (D_ERROR | D_EMERG | D_WARNING | D_CONSOLE)
146
147 #define LIBCFS_DEBUG_FILE_PATH_DEFAULT "/tmp/lustre-log"
148
149 #endif  /* __UAPI_LIBCFS_DEBUG_H__ */