Use a less unusual syntax in debug printfs.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2014-03-25 18:30:57 +00:00
parent 55a76bf7ff
commit b1277ad1f7
3 changed files with 60 additions and 41 deletions

View File

@ -99,28 +99,37 @@ SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, maxcmdsn_delta, CTLFLAG_RW,
"without confirmation");
#define CFISCSI_DEBUG(X, ...) \
do { \
if (debug > 1) { \
printf("%s: " X "\n", __func__, ## __VA_ARGS__);\
printf("%s: " X "\n", \
__func__, ## __VA_ARGS__); \
} \
} while (0)
#define CFISCSI_WARN(X, ...) \
do { \
if (debug > 0) { \
printf("WARNING: %s: " X "\n", \
__func__, ## __VA_ARGS__); \
} \
} while (0)
#define CFISCSI_SESSION_DEBUG(S, X, ...) \
do { \
if (debug > 1) { \
printf("%s: %s (%s): " X "\n", \
__func__, S->cs_initiator_addr, \
S->cs_initiator_name, ## __VA_ARGS__); \
} \
} while (0)
#define CFISCSI_SESSION_WARN(S, X, ...) \
do { \
if (debug > 0) { \
printf("WARNING: %s (%s): " X "\n", \
S->cs_initiator_addr, \
S->cs_initiator_name, ## __VA_ARGS__); \
} \
} while (0)
#define CFISCSI_SESSION_LOCK(X) mtx_lock(&X->cs_lock)

View File

@ -75,14 +75,17 @@ static uma_zone_t icl_pdu_zone;
static volatile u_int icl_ncons;
#define ICL_DEBUG(X, ...) \
if (debug > 1) { \
do { \
if (debug > 1) \
printf("%s: " X "\n", __func__, ## __VA_ARGS__);\
} while (0)
#define ICL_WARN(X, ...) \
do { \
if (debug > 0) { \
printf("WARNING: %s: " X "\n", \
__func__, ## __VA_ARGS__); \
} \
} while (0)
#define ICL_CONN_LOCK(X) mtx_lock(&X->ic_lock)

View File

@ -100,28 +100,35 @@ static uma_zone_t iscsi_outstanding_zone;
#define PDU_SESSION(X) (CONN_SESSION(X->ip_conn))
#define ISCSI_DEBUG(X, ...) \
if (debug > 1) { \
do { \
if (debug > 1) \
printf("%s: " X "\n", __func__, ## __VA_ARGS__);\
} while (0)
#define ISCSI_WARN(X, ...) \
do { \
if (debug > 0) { \
printf("WARNING: %s: " X "\n", \
__func__, ## __VA_ARGS__); \
} \
} while (0)
#define ISCSI_SESSION_DEBUG(S, X, ...) \
do { \
if (debug > 1) { \
printf("%s: %s (%s): " X "\n", \
__func__, S->is_conf.isc_target_addr, \
S->is_conf.isc_target, ## __VA_ARGS__); \
} \
} while (0)
#define ISCSI_SESSION_WARN(S, X, ...) \
do { \
if (debug > 0) { \
printf("WARNING: %s (%s): " X "\n", \
S->is_conf.isc_target_addr, \
S->is_conf.isc_target, ## __VA_ARGS__); \
} \
} while (0)
#define ISCSI_SESSION_LOCK(X) mtx_lock(&X->is_lock)