cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

debug.h (2829B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2/*
      3 * linux/include/linux/sunrpc/debug.h
      4 *
      5 * Debugging support for sunrpc module
      6 *
      7 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
      8 */
      9#ifndef _LINUX_SUNRPC_DEBUG_H_
     10#define _LINUX_SUNRPC_DEBUG_H_
     11
     12#include <uapi/linux/sunrpc/debug.h>
     13
     14/*
     15 * Debugging macros etc
     16 */
     17#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
     18extern unsigned int		rpc_debug;
     19extern unsigned int		nfs_debug;
     20extern unsigned int		nfsd_debug;
     21extern unsigned int		nlm_debug;
     22#endif
     23
     24#define dprintk(fmt, ...)						\
     25	dfprintk(FACILITY, fmt, ##__VA_ARGS__)
     26#define dprintk_cont(fmt, ...)						\
     27	dfprintk_cont(FACILITY, fmt, ##__VA_ARGS__)
     28#define dprintk_rcu(fmt, ...)						\
     29	dfprintk_rcu(FACILITY, fmt, ##__VA_ARGS__)
     30#define dprintk_rcu_cont(fmt, ...)					\
     31	dfprintk_rcu_cont(FACILITY, fmt, ##__VA_ARGS__)
     32
     33#undef ifdebug
     34#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
     35# define ifdebug(fac)		if (unlikely(rpc_debug & RPCDBG_##fac))
     36
     37# define dfprintk(fac, fmt, ...)					\
     38do {									\
     39	ifdebug(fac)							\
     40		printk(KERN_DEFAULT fmt, ##__VA_ARGS__);		\
     41} while (0)
     42
     43# define dfprintk_cont(fac, fmt, ...)					\
     44do {									\
     45	ifdebug(fac)							\
     46		printk(KERN_CONT fmt, ##__VA_ARGS__);			\
     47} while (0)
     48
     49# define dfprintk_rcu(fac, fmt, ...)					\
     50do {									\
     51	ifdebug(fac) {							\
     52		rcu_read_lock();					\
     53		printk(KERN_DEFAULT fmt, ##__VA_ARGS__);		\
     54		rcu_read_unlock();					\
     55	}								\
     56} while (0)
     57
     58# define dfprintk_rcu_cont(fac, fmt, ...)				\
     59do {									\
     60	ifdebug(fac) {							\
     61		rcu_read_lock();					\
     62		printk(KERN_CONT fmt, ##__VA_ARGS__);			\
     63		rcu_read_unlock();					\
     64	}								\
     65} while (0)
     66
     67# define RPC_IFDEBUG(x)		x
     68#else
     69# define ifdebug(fac)		if (0)
     70# define dfprintk(fac, fmt, ...)	do {} while (0)
     71# define dfprintk_cont(fac, fmt, ...)	do {} while (0)
     72# define dfprintk_rcu(fac, fmt, ...)	do {} while (0)
     73# define RPC_IFDEBUG(x)
     74#endif
     75
     76/*
     77 * Sysctl interface for RPC debugging
     78 */
     79
     80struct rpc_clnt;
     81struct rpc_xprt;
     82
     83#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
     84void		rpc_register_sysctl(void);
     85void		rpc_unregister_sysctl(void);
     86void		sunrpc_debugfs_init(void);
     87void		sunrpc_debugfs_exit(void);
     88void		rpc_clnt_debugfs_register(struct rpc_clnt *);
     89void		rpc_clnt_debugfs_unregister(struct rpc_clnt *);
     90void		rpc_xprt_debugfs_register(struct rpc_xprt *);
     91void		rpc_xprt_debugfs_unregister(struct rpc_xprt *);
     92#else
     93static inline void
     94sunrpc_debugfs_init(void)
     95{
     96	return;
     97}
     98
     99static inline void
    100sunrpc_debugfs_exit(void)
    101{
    102	return;
    103}
    104
    105static inline void
    106rpc_clnt_debugfs_register(struct rpc_clnt *clnt)
    107{
    108	return;
    109}
    110
    111static inline void
    112rpc_clnt_debugfs_unregister(struct rpc_clnt *clnt)
    113{
    114	return;
    115}
    116
    117static inline void
    118rpc_xprt_debugfs_register(struct rpc_xprt *xprt)
    119{
    120	return;
    121}
    122
    123static inline void
    124rpc_xprt_debugfs_unregister(struct rpc_xprt *xprt)
    125{
    126	return;
    127}
    128#endif
    129
    130#endif /* _LINUX_SUNRPC_DEBUG_H_ */