From owner-svn-src-head@FreeBSD.ORG Tue Mar 25 18:30:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA4882D8; Tue, 25 Mar 2014 18:30:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8ABE22B9; Tue, 25 Mar 2014 18:30:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2PIUwWT029797; Tue, 25 Mar 2014 18:30:58 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2PIUvIu029793; Tue, 25 Mar 2014 18:30:57 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201403251830.s2PIUvIu029793@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 25 Mar 2014 18:30:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263740 - in head/sys: cam/ctl dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Mar 2014 18:30:58 -0000 Author: trasz Date: Tue Mar 25 18:30:57 2014 New Revision: 263740 URL: http://svnweb.freebsd.org/changeset/base/263740 Log: Use a less unusual syntax in debug printfs. Sponsored by: The FreeBSD Foundation Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/dev/iscsi/icl.c head/sys/dev/iscsi/iscsi.c Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Tue Mar 25 15:35:33 2014 (r263739) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Tue Mar 25 18:30:57 2014 (r263740) @@ -98,29 +98,38 @@ SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO &maxcmdsn_delta, 256, "Number of commands the initiator can send " "without confirmation"); -#define CFISCSI_DEBUG(X, ...) \ - if (debug > 1) { \ - printf("%s: " X "\n", __func__, ## __VA_ARGS__);\ +#define CFISCSI_DEBUG(X, ...) \ + do { \ + if (debug > 1) { \ + printf("%s: " X "\n", \ + __func__, ## __VA_ARGS__); \ + } \ } while (0) -#define CFISCSI_WARN(X, ...) \ - if (debug > 0) { \ - printf("WARNING: %s: " X "\n", \ - __func__, ## __VA_ARGS__); \ +#define CFISCSI_WARN(X, ...) \ + do { \ + if (debug > 0) { \ + printf("WARNING: %s: " X "\n", \ + __func__, ## __VA_ARGS__); \ + } \ } while (0) -#define CFISCSI_SESSION_DEBUG(S, X, ...) \ - if (debug > 1) { \ - printf("%s: %s (%s): " X "\n", \ - __func__, S->cs_initiator_addr, \ - S->cs_initiator_name, ## __VA_ARGS__); \ +#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, ...) \ - if (debug > 0) { \ - printf("WARNING: %s (%s): " X "\n", \ - S->cs_initiator_addr, \ - S->cs_initiator_name, ## __VA_ARGS__); \ +#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) Modified: head/sys/dev/iscsi/icl.c ============================================================================== --- head/sys/dev/iscsi/icl.c Tue Mar 25 15:35:33 2014 (r263739) +++ head/sys/dev/iscsi/icl.c Tue Mar 25 18:30:57 2014 (r263740) @@ -74,15 +74,18 @@ static uma_zone_t icl_pdu_zone; static volatile u_int icl_ncons; -#define ICL_DEBUG(X, ...) \ - if (debug > 1) { \ - printf("%s: " X "\n", __func__, ## __VA_ARGS__);\ +#define ICL_DEBUG(X, ...) \ + do { \ + if (debug > 1) \ + printf("%s: " X "\n", __func__, ## __VA_ARGS__);\ } while (0) -#define ICL_WARN(X, ...) \ - if (debug > 0) { \ - printf("WARNING: %s: " X "\n", \ - __func__, ## __VA_ARGS__); \ +#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) Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Tue Mar 25 15:35:33 2014 (r263739) +++ head/sys/dev/iscsi/iscsi.c Tue Mar 25 18:30:57 2014 (r263740) @@ -99,29 +99,36 @@ static uma_zone_t iscsi_outstanding_zone #define CONN_SESSION(X) ((struct iscsi_session *)X->ic_prv0) #define PDU_SESSION(X) (CONN_SESSION(X->ip_conn)) -#define ISCSI_DEBUG(X, ...) \ - if (debug > 1) { \ - printf("%s: " X "\n", __func__, ## __VA_ARGS__);\ +#define ISCSI_DEBUG(X, ...) \ + do { \ + if (debug > 1) \ + printf("%s: " X "\n", __func__, ## __VA_ARGS__);\ } while (0) -#define ISCSI_WARN(X, ...) \ - if (debug > 0) { \ - printf("WARNING: %s: " X "\n", \ - __func__, ## __VA_ARGS__); \ +#define ISCSI_WARN(X, ...) \ + do { \ + if (debug > 0) { \ + printf("WARNING: %s: " X "\n", \ + __func__, ## __VA_ARGS__); \ + } \ } while (0) -#define ISCSI_SESSION_DEBUG(S, X, ...) \ - if (debug > 1) { \ - printf("%s: %s (%s): " X "\n", \ - __func__, S->is_conf.isc_target_addr, \ - S->is_conf.isc_target, ## __VA_ARGS__); \ +#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, ...) \ - if (debug > 0) { \ - printf("WARNING: %s (%s): " X "\n", \ - S->is_conf.isc_target_addr, \ - S->is_conf.isc_target, ## __VA_ARGS__); \ +#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)