162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * (C) 2001 Clemson University and The University of Chicago
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * See COPYING in top-level directory.
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci/* This file just defines debugging masks to be used with the gossip
962306a36Sopenharmony_ci * logging utility.  All debugging masks for ORANGEFS are kept here to make
1062306a36Sopenharmony_ci * sure we don't have collisions.
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#ifndef __ORANGEFS_DEBUG_H
1462306a36Sopenharmony_ci#define __ORANGEFS_DEBUG_H
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#ifdef __KERNEL__
1762306a36Sopenharmony_ci#include <linux/types.h>
1862306a36Sopenharmony_ci#include <linux/kernel.h>
1962306a36Sopenharmony_ci#else
2062306a36Sopenharmony_ci#include <stdint.h>
2162306a36Sopenharmony_ci#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
2262306a36Sopenharmony_ci#endif
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#define	GOSSIP_NO_DEBUG			(__u64)0
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#define GOSSIP_SUPER_DEBUG		((__u64)1 << 0)
2762306a36Sopenharmony_ci#define GOSSIP_INODE_DEBUG		((__u64)1 << 1)
2862306a36Sopenharmony_ci#define GOSSIP_FILE_DEBUG		((__u64)1 << 2)
2962306a36Sopenharmony_ci#define GOSSIP_DIR_DEBUG		((__u64)1 << 3)
3062306a36Sopenharmony_ci#define GOSSIP_UTILS_DEBUG		((__u64)1 << 4)
3162306a36Sopenharmony_ci#define GOSSIP_WAIT_DEBUG		((__u64)1 << 5)
3262306a36Sopenharmony_ci#define GOSSIP_ACL_DEBUG		((__u64)1 << 6)
3362306a36Sopenharmony_ci#define GOSSIP_DCACHE_DEBUG		((__u64)1 << 7)
3462306a36Sopenharmony_ci#define GOSSIP_DEV_DEBUG		((__u64)1 << 8)
3562306a36Sopenharmony_ci#define GOSSIP_NAME_DEBUG		((__u64)1 << 9)
3662306a36Sopenharmony_ci#define GOSSIP_BUFMAP_DEBUG		((__u64)1 << 10)
3762306a36Sopenharmony_ci#define GOSSIP_CACHE_DEBUG		((__u64)1 << 11)
3862306a36Sopenharmony_ci#define GOSSIP_DEBUGFS_DEBUG		((__u64)1 << 12)
3962306a36Sopenharmony_ci#define GOSSIP_XATTR_DEBUG		((__u64)1 << 13)
4062306a36Sopenharmony_ci#define GOSSIP_INIT_DEBUG		((__u64)1 << 14)
4162306a36Sopenharmony_ci#define GOSSIP_SYSFS_DEBUG		((__u64)1 << 15)
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#define GOSSIP_MAX_NR                 16
4462306a36Sopenharmony_ci#define GOSSIP_MAX_DEBUG              (((__u64)1 << GOSSIP_MAX_NR) - 1)
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci/* a private internal type */
4762306a36Sopenharmony_cistruct __keyword_mask_s {
4862306a36Sopenharmony_ci	const char *keyword;
4962306a36Sopenharmony_ci	__u64 mask_val;
5062306a36Sopenharmony_ci};
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci/*
5362306a36Sopenharmony_ci * Map all kmod keywords to kmod debug masks here. Keep this
5462306a36Sopenharmony_ci * structure "packed":
5562306a36Sopenharmony_ci *
5662306a36Sopenharmony_ci *   "all" is always last...
5762306a36Sopenharmony_ci *
5862306a36Sopenharmony_ci *   keyword     mask_val     index
5962306a36Sopenharmony_ci *     foo          1           0
6062306a36Sopenharmony_ci *     bar          2           1
6162306a36Sopenharmony_ci *     baz          4           2
6262306a36Sopenharmony_ci *     qux          8           3
6362306a36Sopenharmony_ci *      .           .           .
6462306a36Sopenharmony_ci */
6562306a36Sopenharmony_cistatic struct __keyword_mask_s s_kmod_keyword_mask_map[] = {
6662306a36Sopenharmony_ci	{"super", GOSSIP_SUPER_DEBUG},
6762306a36Sopenharmony_ci	{"inode", GOSSIP_INODE_DEBUG},
6862306a36Sopenharmony_ci	{"file", GOSSIP_FILE_DEBUG},
6962306a36Sopenharmony_ci	{"dir", GOSSIP_DIR_DEBUG},
7062306a36Sopenharmony_ci	{"utils", GOSSIP_UTILS_DEBUG},
7162306a36Sopenharmony_ci	{"wait", GOSSIP_WAIT_DEBUG},
7262306a36Sopenharmony_ci	{"acl", GOSSIP_ACL_DEBUG},
7362306a36Sopenharmony_ci	{"dcache", GOSSIP_DCACHE_DEBUG},
7462306a36Sopenharmony_ci	{"dev", GOSSIP_DEV_DEBUG},
7562306a36Sopenharmony_ci	{"name", GOSSIP_NAME_DEBUG},
7662306a36Sopenharmony_ci	{"bufmap", GOSSIP_BUFMAP_DEBUG},
7762306a36Sopenharmony_ci	{"cache", GOSSIP_CACHE_DEBUG},
7862306a36Sopenharmony_ci	{"debugfs", GOSSIP_DEBUGFS_DEBUG},
7962306a36Sopenharmony_ci	{"xattr", GOSSIP_XATTR_DEBUG},
8062306a36Sopenharmony_ci	{"init", GOSSIP_INIT_DEBUG},
8162306a36Sopenharmony_ci	{"sysfs", GOSSIP_SYSFS_DEBUG},
8262306a36Sopenharmony_ci	{"none", GOSSIP_NO_DEBUG},
8362306a36Sopenharmony_ci	{"all", GOSSIP_MAX_DEBUG}
8462306a36Sopenharmony_ci};
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_cistatic const int num_kmod_keyword_mask_map = (int)
8762306a36Sopenharmony_ci	(ARRAY_SIZE(s_kmod_keyword_mask_map));
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci#endif /* __ORANGEFS_DEBUG_H */
90