2 * Copyright (c) 2019 Tomohiro Kusumi <tkusumi@netbsd.org>
3 * Copyright (c) 2019 The DragonFly Project
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #include <sys/param.h>
32 #include <sys/systm.h>
37 #define FUSE_CMDNAME (curproc ? curproc->p_comm : "...")
38 #define FUSE_CMDPID (curproc ? curproc->p_pid : -1)
39 #define fuse_print(X, ...) \
40 kprintf("%s(%s|%d): " X, __func__, FUSE_CMDNAME, FUSE_CMDPID, ## __VA_ARGS__)
41 #define fuse_panic(X, ...) \
42 panic("%s(%s|%d): " X, __func__, FUSE_CMDNAME, FUSE_CMDPID, ## __VA_ARGS__)
43 #define fuse_dbg(X, ...) if (fuse_debug) \
44 kprintf("### %s(%s|%d): " X, __func__, FUSE_CMDNAME, FUSE_CMDPID, ## __VA_ARGS__)
45 #define fuse_dbgipc(fip, error, msg) do { \
46 struct fuse_in_header *ihd = fuse_in(fip); \
47 fuse_dbg("fip=%p ino=%ju op=%s len=%u error=%d %s\n", \
48 fip, ihd->nodeid, fuse_get_ops(ihd->opcode), ihd->len, error, msg); \
51 #define fuse_print(X, ...) kprintf(X, ## __VA_ARGS__)
52 #define fuse_panic(X, ...) panic(X, ## __VA_ARGS__)
53 #define fuse_dbg(X, ...) do { } while (0)
54 #define fuse_dbgipc(fip, error, msg) do { } while (0)
57 #endif /* FUSE_DEBUG_H */