blob: ee665c0e7dc80f21f31e40bd34a9e574f0d6684b [file] [log] [blame]
David Howells3d3c9502020-05-13 17:41:20 +01001/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* Internal definitions for network filesystem support
3 *
4 * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#ifdef pr_fmt
9#undef pr_fmt
10#endif
11
12#define pr_fmt(fmt) "netfs: " fmt
13
14/*
15 * read_helper.c
16 */
17extern unsigned int netfs_debug;
18
19#define netfs_stat(x) do {} while(0)
20#define netfs_stat_d(x) do {} while(0)
21
22/*****************************************************************************/
23/*
24 * debug tracing
25 */
26#define dbgprintk(FMT, ...) \
27 printk("[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__)
28
29#define kenter(FMT, ...) dbgprintk("==> %s("FMT")", __func__, ##__VA_ARGS__)
30#define kleave(FMT, ...) dbgprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__)
31#define kdebug(FMT, ...) dbgprintk(FMT, ##__VA_ARGS__)
32
33#ifdef __KDEBUG
34#define _enter(FMT, ...) kenter(FMT, ##__VA_ARGS__)
35#define _leave(FMT, ...) kleave(FMT, ##__VA_ARGS__)
36#define _debug(FMT, ...) kdebug(FMT, ##__VA_ARGS__)
37
38#elif defined(CONFIG_NETFS_DEBUG)
39#define _enter(FMT, ...) \
40do { \
41 if (netfs_debug) \
42 kenter(FMT, ##__VA_ARGS__); \
43} while (0)
44
45#define _leave(FMT, ...) \
46do { \
47 if (netfs_debug) \
48 kleave(FMT, ##__VA_ARGS__); \
49} while (0)
50
51#define _debug(FMT, ...) \
52do { \
53 if (netfs_debug) \
54 kdebug(FMT, ##__VA_ARGS__); \
55} while (0)
56
57#else
58#define _enter(FMT, ...) no_printk("==> %s("FMT")", __func__, ##__VA_ARGS__)
59#define _leave(FMT, ...) no_printk("<== %s()"FMT"", __func__, ##__VA_ARGS__)
60#define _debug(FMT, ...) no_printk(FMT, ##__VA_ARGS__)
61#endif