blob: c7db56a31b9209076975f6380aad69761cccfde9 [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>
Jérémy Lefaure296200d2017-10-01 15:30:48 -040018#include <linux/kernel.h>
Mike Marshallf7ab0932015-07-17 10:38:11 -040019#else
20#include <stdint.h>
Jérémy Lefaure296200d2017-10-01 15:30:48 -040021#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
Mike Marshallf7ab0932015-07-17 10:38:11 -040022#endif
23
Mike Marshallb4cf67a2015-12-11 11:00:12 -050024#define GOSSIP_NO_DEBUG (__u64)0
Mike Marshallf7ab0932015-07-17 10:38:11 -040025
26#define GOSSIP_SUPER_DEBUG ((__u64)1 << 0)
27#define GOSSIP_INODE_DEBUG ((__u64)1 << 1)
28#define GOSSIP_FILE_DEBUG ((__u64)1 << 2)
29#define GOSSIP_DIR_DEBUG ((__u64)1 << 3)
30#define GOSSIP_UTILS_DEBUG ((__u64)1 << 4)
31#define GOSSIP_WAIT_DEBUG ((__u64)1 << 5)
32#define GOSSIP_ACL_DEBUG ((__u64)1 << 6)
33#define GOSSIP_DCACHE_DEBUG ((__u64)1 << 7)
34#define GOSSIP_DEV_DEBUG ((__u64)1 << 8)
35#define GOSSIP_NAME_DEBUG ((__u64)1 << 9)
36#define GOSSIP_BUFMAP_DEBUG ((__u64)1 << 10)
37#define GOSSIP_CACHE_DEBUG ((__u64)1 << 11)
38#define GOSSIP_DEBUGFS_DEBUG ((__u64)1 << 12)
39#define GOSSIP_XATTR_DEBUG ((__u64)1 << 13)
40#define GOSSIP_INIT_DEBUG ((__u64)1 << 14)
41#define GOSSIP_SYSFS_DEBUG ((__u64)1 << 15)
42
43#define GOSSIP_MAX_NR 16
44#define GOSSIP_MAX_DEBUG (((__u64)1 << GOSSIP_MAX_NR) - 1)
45
46/*function prototypes*/
Yi Liu8bb8aef2015-11-24 15:12:14 -050047__u64 ORANGEFS_kmod_eventlog_to_mask(const char *event_logging);
48__u64 ORANGEFS_debug_eventlog_to_mask(const char *event_logging);
49char *ORANGEFS_debug_mask_to_eventlog(__u64 mask);
50char *ORANGEFS_kmod_mask_to_eventlog(__u64 mask);
Mike Marshallf7ab0932015-07-17 10:38:11 -040051
52/* a private internal type */
53struct __keyword_mask_s {
54 const char *keyword;
55 __u64 mask_val;
56};
57
Mike Marshallf7ab0932015-07-17 10:38:11 -040058/*
59 * Map all kmod keywords to kmod debug masks here. Keep this
60 * structure "packed":
61 *
62 * "all" is always last...
63 *
64 * keyword mask_val index
65 * foo 1 0
66 * bar 2 1
67 * baz 4 2
68 * qux 8 3
69 * . . .
70 */
71static struct __keyword_mask_s s_kmod_keyword_mask_map[] = {
72 {"super", GOSSIP_SUPER_DEBUG},
73 {"inode", GOSSIP_INODE_DEBUG},
74 {"file", GOSSIP_FILE_DEBUG},
75 {"dir", GOSSIP_DIR_DEBUG},
76 {"utils", GOSSIP_UTILS_DEBUG},
77 {"wait", GOSSIP_WAIT_DEBUG},
78 {"acl", GOSSIP_ACL_DEBUG},
79 {"dcache", GOSSIP_DCACHE_DEBUG},
80 {"dev", GOSSIP_DEV_DEBUG},
81 {"name", GOSSIP_NAME_DEBUG},
82 {"bufmap", GOSSIP_BUFMAP_DEBUG},
83 {"cache", GOSSIP_CACHE_DEBUG},
84 {"debugfs", GOSSIP_DEBUGFS_DEBUG},
85 {"xattr", GOSSIP_XATTR_DEBUG},
86 {"init", GOSSIP_INIT_DEBUG},
87 {"sysfs", GOSSIP_SYSFS_DEBUG},
88 {"none", GOSSIP_NO_DEBUG},
89 {"all", GOSSIP_MAX_DEBUG}
90};
91
92static const int num_kmod_keyword_mask_map = (int)
Jérémy Lefaure296200d2017-10-01 15:30:48 -040093 (ARRAY_SIZE(s_kmod_keyword_mask_map));
Mike Marshallf7ab0932015-07-17 10:38:11 -040094
Yi Liu8bb8aef2015-11-24 15:12:14 -050095#endif /* __ORANGEFS_DEBUG_H */