2 * Copyright (C) 2007 Vladislav Bolkhovitin
3 * Copyright (C) 2007 CMS Distribution Limited
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation, version 2
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
19 #define LOG_PREFIX "iscsi-scst"
21 #include <scst_debug.h>
23 #define TRACE_D_READ 0x80000000
24 #define TRACE_D_WRITE 0x40000000
25 #define TRACE_CONN_OC 0x20000000
26 #define TRACE_D_IOV 0x10000000
27 #define TRACE_D_DUMP_PDU 0x08000000
28 #define TRACE_NET_PG 0x04000000
30 #define TRACE_D_DATA (TRACE_D_READ | TRACE_D_WRITE)
32 #define TRACE_ALL_NO_DATA (TRACE_ALL & ~TRACE_D_IOV & ~TRACE_D_DUMP_PDU & ~TRACE_D_DATA)
35 #define ISCSI_DEFAULT_LOG_FLAGS (TRACE_FUNCTION | TRACE_LINE | TRACE_PID | \
36 TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MGMT_DEBUG | \
37 TRACE_MINOR | TRACE_SPECIAL | TRACE_CONN_OC)
39 #define ISCSI_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | \
40 TRACE_MINOR | TRACE_SPECIAL)
46 extern void iscsi_dump_iov(struct msghdr *msg);
47 extern void iscsi_dump_pdu(struct iscsi_pdu *pdu);
49 #define iscsi_dump_iov(x) do {} while (0)
50 #define iscsi_dump_pdu(x) do {} while (0)
53 #if defined(DEBUG) || defined(TRACING)
54 extern unsigned long iscsi_trace_flag;
55 #define trace_flag iscsi_trace_flag
57 #define TRACE_CONN_CLOSE(format, args...) \
59 if (trace_flag & TRACE_CONN_OC) \
61 char *__tflag = LOG_FLAG; \
62 if (debug_print_prefix(trace_flag, LOG_PREFIX, __FUNCTION__, \
67 PRINT(NO_FLAG, "%s" format, __tflag, args); \
71 #define TRACE_NET_PAGE(format, args...) \
73 if (trace_flag & TRACE_NET_PG) \
75 char *__tflag = LOG_FLAG; \
76 if (debug_print_prefix(trace_flag, LOG_PREFIX, __FUNCTION__, \
81 PRINT(NO_FLAG, "%s" format, __tflag, args); \
85 #else /* defined(DEBUG) || defined(TRACING) */
86 #define TRACE_CONN_CLOSE(format, args...) {}
87 #define TRACE_NET_PAGE(format, args...) {}