blob: b6001bb28f5a94f6d86a17a76b3245525748be9c [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Mike Marshallf7ab0932015-07-17 10:38:11 -04002/*
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
Yi Liu8bb8aef2015-11-24 15:12:14 -05009 * logging utility. All debugging masks for ORANGEFS are kept here to make
Mike Marshallf7ab0932015-07-17 10:38:11 -040010 * sure we don't have collisions.
11 */
12
Yi Liu8bb8aef2015-11-24 15:12:14 -050013#ifndef __ORANGEFS_DEBUG_H
14#define __ORANGEFS_DEBUG_H
Mike Marshallf7ab0932015-07-17 10:38:11 -040015
16#ifdef __KERNEL__
17#include <linux/types.h>
18#else
19#include <stdint.h>
20#endif
21
Mike Marshallb4cf67a2015-12-11 11:00:12 -050022#define GOSSIP_NO_DEBUG (__u64)0
Mike Marshallf7ab0932015-07-17 10:38:11 -040023
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*/
Yi Liu8bb8aef2015-11-24 15:12:14 -050045__u64 ORANGEFS_kmod_eventlog_to_mask(const char *event_logging);
46__u64 ORANGEFS_debug_eventlog_to_mask(const char *event_logging);
47char *ORANGEFS_debug_mask_to_eventlog(__u64 mask);
48char *ORANGEFS_kmod_mask_to_eventlog(__u64 mask);
Mike Marshallf7ab0932015-07-17 10:38:11 -040049
50/* a private internal type */
51struct __keyword_mask_s {
52 const char *keyword;
53 __u64 mask_val;
54};
55
Mike Marshallf7ab0932015-07-17 10:38:11 -040056/*
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 */
69static 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
90static const int num_kmod_keyword_mask_map = (int)
91 (sizeof(s_kmod_keyword_mask_map) / sizeof(struct __keyword_mask_s));
92
Yi Liu8bb8aef2015-11-24 15:12:14 -050093#endif /* __ORANGEFS_DEBUG_H */