Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 1 | /* |
| 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 Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 8 | * logging utility. All debugging masks for ORANGEFS are kept here to make |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 9 | * sure we don't have collisions. |
| 10 | */ |
| 11 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 12 | #ifndef __ORANGEFS_DEBUG_H |
| 13 | #define __ORANGEFS_DEBUG_H |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 14 | |
| 15 | #ifdef __KERNEL__ |
| 16 | #include <linux/types.h> |
| 17 | #else |
| 18 | #include <stdint.h> |
| 19 | #endif |
| 20 | |
Mike Marshall | b4cf67a | 2015-12-11 11:00:12 -0500 | [diff] [blame] | 21 | #define GOSSIP_NO_DEBUG (__u64)0 |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 22 | |
| 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 Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 44 | __u64 ORANGEFS_kmod_eventlog_to_mask(const char *event_logging); |
| 45 | __u64 ORANGEFS_debug_eventlog_to_mask(const char *event_logging); |
| 46 | char *ORANGEFS_debug_mask_to_eventlog(__u64 mask); |
| 47 | char *ORANGEFS_kmod_mask_to_eventlog(__u64 mask); |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 48 | |
| 49 | /* a private internal type */ |
| 50 | struct __keyword_mask_s { |
| 51 | const char *keyword; |
| 52 | __u64 mask_val; |
| 53 | }; |
| 54 | |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 55 | /* |
| 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 | */ |
| 68 | static 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 | |
| 89 | static const int num_kmod_keyword_mask_map = (int) |
| 90 | (sizeof(s_kmod_keyword_mask_map) / sizeof(struct __keyword_mask_s)); |
| 91 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 92 | #endif /* __ORANGEFS_DEBUG_H */ |