From patchwork Tue Jul 15 15:09:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 4554651 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 D63389F1D6 for ; Tue, 15 Jul 2014 15:09:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 157142012B for ; Tue, 15 Jul 2014 15:09:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24A8320170 for ; Tue, 15 Jul 2014 15:09:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753410AbaGOPJq (ORCPT ); Tue, 15 Jul 2014 11:09:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41824 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753313AbaGOPJp (ORCPT ); Tue, 15 Jul 2014 11:09:45 -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 s6FF9ccm002410 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Jul 2014 11:09:38 -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 s6FF9ahO009793; Tue, 15 Jul 2014 11:09:37 -0400 From: Steve Dickson To: Libtirpc-devel Mailing List Cc: Linux NFS Mailing list Subject: [PATCH 02/15] gss_log: Convert existing gss debugging routines Date: Tue, 15 Jul 2014 11:09:21 -0400 Message-Id: <1405436974-4161-3-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 Convert the gss_log_XXX routines to used the new LIBTIRPC_DEBUG() macros. Signed-off-by: Steve Dickson --- src/authgss_prot.c | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/src/authgss_prot.c b/src/authgss_prot.c index a3c93c9..d7480fc 100644 --- a/src/authgss_prot.c +++ b/src/authgss_prot.c @@ -42,8 +42,11 @@ #include #include #include +#include #include +#include "debug.h" + /* additional space needed for encoding */ #define RPC_SLACK_SPACE 1024 @@ -296,18 +299,13 @@ xdr_rpc_gss_data(XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr, return (FALSE); } -#ifdef DEBUG -#include - void gss_log_debug(const char *fmt, ...) { va_list ap; va_start(ap, fmt); - fprintf(stderr, "rpcsec_gss: "); - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n"); + vlibtirpc_log_dbg(2, fmt, ap); va_end(ap); } @@ -316,18 +314,18 @@ gss_log_status(char *m, OM_uint32 maj_stat, OM_uint32 min_stat) { OM_uint32 min; gss_buffer_desc msg; - int msg_ctx = 0; + u_int32_t msg_ctx = 0; - fprintf(stderr, "rpcsec_gss: %s: ", m); + LIBTIRPC_DEBUG(1, ("rpcsec_gss: %s: ", m)); gss_display_status(&min, maj_stat, GSS_C_GSS_CODE, GSS_C_NULL_OID, &msg_ctx, &msg); - fprintf(stderr, "%s - ", (char *)msg.value); + LIBTIRPC_DEBUG(1, ("%s - ", (char *)msg.value)); gss_release_buffer(&min, &msg); gss_display_status(&min, min_stat, GSS_C_MECH_CODE, GSS_C_NULL_OID, &msg_ctx, &msg); - fprintf(stderr, "%s\n", (char *)msg.value); + LIBTIRPC_DEBUG(1, ("%s", (char *)msg.value)); gss_release_buffer(&min, &msg); } @@ -337,6 +335,9 @@ gss_log_hexdump(const u_char *buf, int len, int offset) u_int i, j, jm; int c; + if (libtirpc_debug_level < 3 || log_stderr == 0) + return; + fprintf(stderr, "\n"); for (i = 0; i < len; i += 0x10) { fprintf(stderr, " %04x: ", (u_int)(i + offset)); @@ -364,23 +365,3 @@ gss_log_hexdump(const u_char *buf, int len, int offset) } } -#else - -void -gss_log_debug(const char *fmt, ...) -{ -} - -void -gss_log_status(char *m, OM_uint32 maj_stat, OM_uint32 min_stat) -{ -} - -void -gss_log_hexdump(const u_char *buf, int len, int offset) -{ -} - -#endif - -