xref: /openbmc/linux/fs/orangefs/orangefs-debug.h (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * (C) 2001 Clemson University and The University of Chicago
4  *
5  * See COPYING in top-level directory.
6  */
7 
8 /* This file just defines debugging masks to be used with the gossip
9  * logging utility.  All debugging masks for ORANGEFS are kept here to make
10  * sure we don't have collisions.
11  */
12 
13 #ifndef __ORANGEFS_DEBUG_H
14 #define __ORANGEFS_DEBUG_H
15 
16 #ifdef __KERNEL__
17 #include <linux/types.h>
18 #else
19 #include <stdint.h>
20 #endif
21 
22 #define	GOSSIP_NO_DEBUG			(__u64)0
23 
24 #define GOSSIP_SUPER_DEBUG		((__u64)1 << 0)
25 #define GOSSIP_INODE_DEBUG		((__u64)1 << 1)
26 #define GOSSIP_FILE_DEBUG		((__u64)1 << 2)
27 #define GOSSIP_DIR_DEBUG		((__u64)1 << 3)
28 #define GOSSIP_UTILS_DEBUG		((__u64)1 << 4)
29 #define GOSSIP_WAIT_DEBUG		((__u64)1 << 5)
30 #define GOSSIP_ACL_DEBUG		((__u64)1 << 6)
31 #define GOSSIP_DCACHE_DEBUG		((__u64)1 << 7)
32 #define GOSSIP_DEV_DEBUG		((__u64)1 << 8)
33 #define GOSSIP_NAME_DEBUG		((__u64)1 << 9)
34 #define GOSSIP_BUFMAP_DEBUG		((__u64)1 << 10)
35 #define GOSSIP_CACHE_DEBUG		((__u64)1 << 11)
36 #define GOSSIP_DEBUGFS_DEBUG		((__u64)1 << 12)
37 #define GOSSIP_XATTR_DEBUG		((__u64)1 << 13)
38 #define GOSSIP_INIT_DEBUG		((__u64)1 << 14)
39 #define GOSSIP_SYSFS_DEBUG		((__u64)1 << 15)
40 
41 #define GOSSIP_MAX_NR                 16
42 #define GOSSIP_MAX_DEBUG              (((__u64)1 << GOSSIP_MAX_NR) - 1)
43 
44 /*function prototypes*/
45 __u64 ORANGEFS_kmod_eventlog_to_mask(const char *event_logging);
46 __u64 ORANGEFS_debug_eventlog_to_mask(const char *event_logging);
47 char *ORANGEFS_debug_mask_to_eventlog(__u64 mask);
48 char *ORANGEFS_kmod_mask_to_eventlog(__u64 mask);
49 
50 /* a private internal type */
51 struct __keyword_mask_s {
52 	const char *keyword;
53 	__u64 mask_val;
54 };
55 
56 /*
57  * Map all kmod keywords to kmod debug masks here. Keep this
58  * structure "packed":
59  *
60  *   "all" is always last...
61  *
62  *   keyword     mask_val     index
63  *     foo          1           0
64  *     bar          2           1
65  *     baz          4           2
66  *     qux          8           3
67  *      .           .           .
68  */
69 static struct __keyword_mask_s s_kmod_keyword_mask_map[] = {
70 	{"super", GOSSIP_SUPER_DEBUG},
71 	{"inode", GOSSIP_INODE_DEBUG},
72 	{"file", GOSSIP_FILE_DEBUG},
73 	{"dir", GOSSIP_DIR_DEBUG},
74 	{"utils", GOSSIP_UTILS_DEBUG},
75 	{"wait", GOSSIP_WAIT_DEBUG},
76 	{"acl", GOSSIP_ACL_DEBUG},
77 	{"dcache", GOSSIP_DCACHE_DEBUG},
78 	{"dev", GOSSIP_DEV_DEBUG},
79 	{"name", GOSSIP_NAME_DEBUG},
80 	{"bufmap", GOSSIP_BUFMAP_DEBUG},
81 	{"cache", GOSSIP_CACHE_DEBUG},
82 	{"debugfs", GOSSIP_DEBUGFS_DEBUG},
83 	{"xattr", GOSSIP_XATTR_DEBUG},
84 	{"init", GOSSIP_INIT_DEBUG},
85 	{"sysfs", GOSSIP_SYSFS_DEBUG},
86 	{"none", GOSSIP_NO_DEBUG},
87 	{"all", GOSSIP_MAX_DEBUG}
88 };
89 
90 static const int num_kmod_keyword_mask_map = (int)
91 	(sizeof(s_kmod_keyword_mask_map) / sizeof(struct __keyword_mask_s));
92 
93 #endif /* __ORANGEFS_DEBUG_H */
94