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