From patchwork Tue Jul 15 15:09:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 4554751 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9443C9F1D6 for ; Tue, 15 Jul 2014 15:10:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CEAA22011D for ; Tue, 15 Jul 2014 15:10:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D880620172 for ; Tue, 15 Jul 2014 15:10:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753826AbaGOPKK (ORCPT ); Tue, 15 Jul 2014 11:10:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58438 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754349AbaGOPJw (ORCPT ); Tue, 15 Jul 2014 11:09:52 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6FF9iHu002449 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Jul 2014 11:09:44 -0400 Received: from smallhat.boston.devel.redhat.com (smallhat.boston.devel.redhat.com [10.19.60.65]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6FF9aha009793; Tue, 15 Jul 2014 11:09:44 -0400 From: Steve Dickson To: Libtirpc-devel Mailing List Cc: Linux NFS Mailing list Subject: [PATCH 14/15] svc_dg: Convert fprintf calls to LIBTIRPC_DEBUG() calls Date: Tue, 15 Jul 2014 11:09:33 -0400 Message-Id: <1405436974-4161-15-git-send-email-steved@redhat.com> In-Reply-To: <1405436974-4161-1-git-send-email-steved@redhat.com> References: <1405436974-4161-1-git-send-email-steved@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Steve Dickson --- src/svc_dg.c | 51 +++++++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/src/svc_dg.c b/src/svc_dg.c index 6e00191..f8255cc 100644 --- a/src/svc_dg.c +++ b/src/svc_dg.c @@ -49,13 +49,11 @@ #include #include #include -#ifdef RPC_CACHE_DEBUG #include -#include -#endif #include #include "rpc_com.h" +#include "debug.h" #define su_data(xprt) ((struct svc_dg_data *)(xprt->xp_p2)) #define rpc_buffer(xprt) ((xprt)->xp_p1) @@ -506,10 +504,8 @@ cache_set(xprt, replylen) struct cl_cache *uc = (struct cl_cache *) su->su_cache; u_int loc; char *newbuf; -#ifdef RPC_CACHE_DEBUG struct netconfig *nconf; char *uaddr; -#endif mutex_lock(&dupreq_lock); /* @@ -549,17 +545,17 @@ cache_set(xprt, replylen) /* * Store it away */ -#ifdef RPC_CACHE_DEBUG - if (nconf = getnetconfigent(xprt->xp_netid)) { - uaddr = taddr2uaddr(nconf, &xprt->xp_rtaddr); - freenetconfigent(nconf); - printf( - "cache set for xid= %x prog=%d vers=%d proc=%d for rmtaddr=%s\n", - su->su_xid, uc->uc_prog, uc->uc_vers, - uc->uc_proc, uaddr); - free(uaddr); + if (libtirpc_debug_level > 3) { + if ((nconf = getnetconfigent(xprt->xp_netid))) { + uaddr = taddr2uaddr(nconf, &xprt->xp_rtaddr); + freenetconfigent(nconf); + LIBTIRPC_DEBUG(4, + ("cache set for xid= %x prog=%d vers=%d proc=%d for rmtaddr=%s\n", + su->su_xid, uc->uc_prog, uc->uc_vers, + uc->uc_proc, uaddr)); + free(uaddr); + } } -#endif victim->cache_replylen = replylen; victim->cache_reply = rpc_buffer(xprt); rpc_buffer(xprt) = newbuf; @@ -596,10 +592,8 @@ cache_get(xprt, msg, replyp, replylenp) cache_ptr ent; struct svc_dg_data *su = su_data(xprt); struct cl_cache *uc = (struct cl_cache *) su->su_cache; -#ifdef RPC_CACHE_DEBUG struct netconfig *nconf; char *uaddr; -#endif mutex_lock(&dupreq_lock); loc = CACHE_LOC(xprt, su->su_xid); @@ -611,18 +605,19 @@ cache_get(xprt, msg, replyp, replylenp) ent->cache_addr.len == xprt->xp_rtaddr.len && (memcmp(ent->cache_addr.buf, xprt->xp_rtaddr.buf, xprt->xp_rtaddr.len) == 0)) { -#ifdef RPC_CACHE_DEBUG - if (nconf = getnetconfigent(xprt->xp_netid)) { - uaddr = taddr2uaddr(nconf, &xprt->xp_rtaddr); - freenetconfigent(nconf); - printf( - "cache entry found for xid=%x prog=%d vers=%d proc=%d for rmtaddr=%s\n", - su->su_xid, msg->rm_call.cb_prog, - msg->rm_call.cb_vers, - msg->rm_call.cb_proc, uaddr); - free(uaddr); + if (libtirpc_debug_level > 3) { + if ((nconf = getnetconfigent(xprt->xp_netid))) { + uaddr = taddr2uaddr(nconf, &xprt->xp_rtaddr); + freenetconfigent(nconf); + LIBTIRPC_DEBUG(4, + ("cache entry found for xid=%x prog=%d" + "vers=%d proc=%d for rmtaddr=%s\n", + su->su_xid, msg->rm_call.cb_prog, + msg->rm_call.cb_vers, + msg->rm_call.cb_proc, uaddr)); + free(uaddr); + } } -#endif *replyp = ent->cache_reply; *replylenp = ent->cache_replylen; mutex_unlock(&dupreq_lock);