From patchwork Wed Nov 6 09:48:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 11229847 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D9771599 for ; Wed, 6 Nov 2019 09:49:35 +0000 (UTC) Received: from bastion.fedoraproject.org (bastion01.fedoraproject.org [209.132.181.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7ACE72173B for ; Wed, 6 Nov 2019 09:49:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7ACE72173B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=libteam-bounces@lists.fedorahosted.org Received: from mailman01.phx2.fedoraproject.org (mailman01.phx2.fedoraproject.org [10.5.126.36]) by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id 0EBE16069A75; Wed, 6 Nov 2019 09:49:35 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org 0EBE16069A75 Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 068A25AA79C93; Wed, 6 Nov 2019 09:49:35 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id 50A5C5AA79C7E; Wed, 6 Nov 2019 09:49:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mailman01.phx2.fedoraproject.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=disabled version=3.4.0 Received: from smtp-mm-ib01.fedoraproject.org (smtp-mm-ib01.vpn.fedoraproject.org [192.168.1.83]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id B58395AA79C7E for ; Wed, 6 Nov 2019 09:49:23 +0000 (UTC) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by smtp-mm-ib01.fedoraproject.org (Postfix) with ESMTPS id 4B93E605D243 for ; Wed, 6 Nov 2019 09:49:23 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id w8so11163036plq.5 for ; Wed, 06 Nov 2019 01:49:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AcmHcxaIua90ioNWeX3z0lt1Jay25KtpGto4DSrsnkU=; b=htXFDeGdgxVRz9e08k8Q+2TE5u30gQPvZXmoNAj6WbCqrgffTY2XpgRF9Idj5zBjyU XWGbkWFTQkUu7PUw2iIxfi5vPLflXx3sWmgC/O4K0g/HfnIc0RVDQuSyaW6uwcJKK5rE g9RuEU9dKQljwtt6KCz9j/Ji0GLC+TwzZUtMrLE7YJd5PMoLDsZjlKi+1xVsVegnESbP oVAAteWULF88Hfe8Uukz7Wl0gHfR1W2gmxg4abaVGF6pgW/kgi+y+V3qxgRl+P4B7wZZ cn+EnQanZUvEZbCf7s5A/N8M0BQCcXVgeKPU1YxwrQjrseBGfiFNuhUZP2L8/d2qMlx4 qaxg== X-Gm-Message-State: APjAAAXWOBwchbZ/upoSVizvz5/9pWmN8BMd6PYYNbQIKHgETc8O9z28 HgsBUJwaHDusibtrFQUeu/VtjGn2DFxnYw== X-Google-Smtp-Source: APXvYqxGIJMqSJJx2gMiJr+ds/n+W04V8nmvm90iz0rTrNhzJj0tOHD4adTHbvqcjqsLgPopJCVEIQ== X-Received: by 2002:a17:902:36a:: with SMTP id 97mr1675181pld.83.1573033761875; Wed, 06 Nov 2019 01:49:21 -0800 (PST) Received: from dhcp-12-139.nay.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id j11sm22249238pgk.3.2019.11.06.01.49.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2019 01:49:21 -0800 (PST) From: Hangbin Liu To: libteam@lists.fedorahosted.org Subject: [libteam PATCH 5/6] teamd/teamd_link_watch.c: move teamd_log_dbg to teamd_log_dbgx Date: Wed, 6 Nov 2019 17:48:54 +0800 Message-Id: <20191106094855.13859-6-liuhangbin@gmail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20191106094855.13859-1-liuhangbin@gmail.com> References: <20191106094855.13859-1-liuhangbin@gmail.com> MIME-Version: 1.0 Message-ID-Hash: VFDPO2FUUSFKXM742H7CENAQIXX2H5CM X-Message-ID-Hash: VFDPO2FUUSFKXM742H7CENAQIXX2H5CM X-MailFrom: liuhangbin@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Hangbin Liu , Jiri Pirko X-Mailman-Version: 3.1.1 Precedence: list List-Id: Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: As libdaemon do not filter log messages when we use syslog as output, all debug messages will be printed to the syslog even if we set daemon_verbosity_level to LOG_INFO. This would make user full confused and annoying. Since we have a -g option to enable debug message specially, let's move all teamd_log_dbg to teamd_log_dbgx so user could choose to print debug message or not. This patch will move all teamd_log_dbg to teamd_log_dbgx for teamd_link_watch files. Signed-off-by: Hangbin Liu --- teamd/teamd_link_watch.c | 14 +++++++------- teamd/teamd_lw_arp_ping.c | 12 ++++++------ teamd/teamd_lw_ethtool.c | 4 ++-- teamd/teamd_lw_nsna_ping.c | 2 +- teamd/teamd_lw_psr.c | 12 ++++++------ teamd/teamd_lw_tipc.c | 8 ++++---- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/teamd/teamd_link_watch.c b/teamd/teamd_link_watch.c index 62f8267..7cf2185 100644 --- a/teamd/teamd_link_watch.c +++ b/teamd/teamd_link_watch.c @@ -281,8 +281,8 @@ static int link_watch_load_config_one(struct teamd_context *ctx, err = team_get_port_user_linkup(ctx->th, tdport->ifindex, &linkup); if (!err) { - teamd_log_dbg("%s: Current user link state is \"%s\".", - tdport->ifname, linkup ? "up" : "down"); + teamd_log_dbgx(ctx, 1, "%s: Current user link state is \"%s\".", + tdport->ifname, linkup ? "up" : "down"); } err = teamd_config_string_get(ctx, &link_watch_name, @@ -351,8 +351,8 @@ static int link_watch_event_watch_port_added(struct teamd_context *ctx, cpcookie = teamd_config_path_cookie_get(ctx, "$.ports.%s.link_watch", tdport->ifname); if (cpcookie) { - teamd_log_dbg("%s: Got link watch from port config.", - tdport->ifname); + teamd_log_dbgx(ctx, 1, "%s: Got link watch from port config.", + tdport->ifname); err = link_watch_load_config(ctx, tdport, cpcookie); if (err) return err; @@ -360,8 +360,8 @@ static int link_watch_event_watch_port_added(struct teamd_context *ctx, cpcookie = teamd_config_path_cookie_get(ctx, "$.link_watch"); if (cpcookie) { - teamd_log_dbg("%s: Got link watch from global config.", - tdport->ifname); + teamd_log_dbgx(ctx, 1, "%s: Got link watch from global config.", + tdport->ifname); err = link_watch_load_config(ctx, tdport, cpcookie); if (err) return err; @@ -380,7 +380,7 @@ static int link_watch_event_watch_port_added(struct teamd_context *ctx, tdport->ifname); return err; } - teamd_log_dbg("%s: Using implicit link watch.", tdport->ifname); + teamd_log_dbgx(ctx, 1, "%s: Using implicit link watch.", tdport->ifname); return link_watch_event_watch_port_added(ctx, tdport, priv); } return 0; diff --git a/teamd/teamd_lw_arp_ping.c b/teamd/teamd_lw_arp_ping.c index 81806f0..5eb46f9 100644 --- a/teamd/teamd_lw_arp_ping.c +++ b/teamd/teamd_lw_arp_ping.c @@ -178,7 +178,7 @@ static int lw_ap_load_options(struct teamd_context *ctx, * If source_host is not provided, just use address 0.0.0.0 according * to RFC 5227 (IPv4 Address Conflict Detection). */ - teamd_log_dbg("source address \"%s\".", + teamd_log_dbgx(ctx, 1, "source address \"%s\".", str_in_addr(&ap_ppriv->src)); err = teamd_config_string_get(ctx, &host, "@.target_host", cpcookie); @@ -189,25 +189,25 @@ static int lw_ap_load_options(struct teamd_context *ctx, err = set_in_addr(&ap_ppriv->dst, host); if (err) return err; - teamd_log_dbg("target address \"%s\".", str_in_addr(&ap_ppriv->dst)); + teamd_log_dbgx(ctx, 1, "target address \"%s\".", str_in_addr(&ap_ppriv->dst)); err = teamd_config_bool_get(ctx, &ap_ppriv->validate_active, "@.validate_active", cpcookie); if (err) ap_ppriv->validate_active = false; - teamd_log_dbg("validate_active \"%d\".", ap_ppriv->validate_active); + teamd_log_dbgx(ctx, 1, "validate_active \"%d\".", ap_ppriv->validate_active); err = teamd_config_bool_get(ctx, &ap_ppriv->validate_inactive, "@.validate_inactive", cpcookie); if (err) ap_ppriv->validate_inactive = false; - teamd_log_dbg("validate_inactive \"%d\".", ap_ppriv->validate_inactive); + teamd_log_dbgx(ctx, 1, "validate_inactive \"%d\".", ap_ppriv->validate_inactive); err = teamd_config_bool_get(ctx, &ap_ppriv->send_always, "@.send_always", cpcookie); if (err) ap_ppriv->send_always = false; - teamd_log_dbg("send_always \"%d\".", ap_ppriv->send_always); + teamd_log_dbgx(ctx, 1, "send_always \"%d\".", ap_ppriv->send_always); err = teamd_config_int_get(ctx, &tmp, "@.vlanid", cpcookie); if (!err) { @@ -217,7 +217,7 @@ static int lw_ap_load_options(struct teamd_context *ctx, } ap_ppriv->vlanid_in_use = true; ap_ppriv->vlanid = tmp; - teamd_log_dbg("vlan id \"%u\".", ap_ppriv->vlanid); + teamd_log_dbgx(ctx, 1, "vlan id \"%u\".", ap_ppriv->vlanid); } return 0; diff --git a/teamd/teamd_lw_ethtool.c b/teamd/teamd_lw_ethtool.c index 2010136..0cb6437 100644 --- a/teamd/teamd_lw_ethtool.c +++ b/teamd/teamd_lw_ethtool.c @@ -115,7 +115,7 @@ static int lw_ethtool_load_options(struct teamd_context *ctx, teamd_log_err("\"delay_up\" must not be negative number."); return -EINVAL; } - teamd_log_dbg("delay_up \"%d\".", tmp); + teamd_log_dbgx(ctx, 1, "delay_up \"%d\".", tmp); ms_to_timespec(ðtool_ppriv->delay_up, tmp); } err = teamd_config_int_get(ctx, &tmp, "@.delay_down", cpcookie); @@ -124,7 +124,7 @@ static int lw_ethtool_load_options(struct teamd_context *ctx, teamd_log_err("\"delay_down\" must not be negative number."); return -EINVAL; } - teamd_log_dbg("delay_down \"%d\".", tmp); + teamd_log_dbgx(ctx, 1, "delay_down \"%d\".", tmp); ms_to_timespec(ðtool_ppriv->delay_down, tmp); } return 0; diff --git a/teamd/teamd_lw_nsna_ping.c b/teamd/teamd_lw_nsna_ping.c index 82371c4..6956f44 100644 --- a/teamd/teamd_lw_nsna_ping.c +++ b/teamd/teamd_lw_nsna_ping.c @@ -175,7 +175,7 @@ static int lw_nsnap_load_options(struct teamd_context *ctx, err = set_sockaddr_in6(&nsnap_ppriv->dst, host); if (err) return err; - teamd_log_dbg("target address \"%s\".", + teamd_log_dbgx(ctx, 1, "target address \"%s\".", str_sockaddr_in6(&nsnap_ppriv->dst)); return 0; diff --git a/teamd/teamd_lw_psr.c b/teamd/teamd_lw_psr.c index ad6e56b..88246b7 100644 --- a/teamd/teamd_lw_psr.c +++ b/teamd/teamd_lw_psr.c @@ -46,9 +46,9 @@ static int lw_psr_callback_periodic(struct teamd_context *ctx, int events, void } else { psr_ppriv->missed++; if (psr_ppriv->missed > psr_ppriv->missed_max && link_up) { - teamd_log_dbg("%s: Missed %u replies (max %u).", - tdport->ifname, psr_ppriv->missed, - psr_ppriv->missed_max); + teamd_log_dbgx(ctx, 1, "%s: Missed %u replies (max %u).", + tdport->ifname, psr_ppriv->missed, + psr_ppriv->missed_max); link_up = false; } } @@ -86,7 +86,7 @@ static int lw_psr_load_options(struct teamd_context *ctx, } else { tmp = LW_PSR_DEFAULT_INTERVAL; } - teamd_log_dbg("interval \"%d\".", tmp); + teamd_log_dbgx(ctx, 1, "interval \"%d\".", tmp); ms_to_timespec(&psr_ppriv->interval, tmp); err = teamd_config_int_get(ctx, &tmp, "@.init_wait", cpcookie); @@ -95,7 +95,7 @@ static int lw_psr_load_options(struct teamd_context *ctx, /* if init_wait is set to 0, use default_init_wait */ if (err || !tmp) psr_ppriv->init_wait = lw_psr_default_init_wait; - teamd_log_dbg("init_wait \"%d\".", timespec_to_ms(&psr_ppriv->init_wait)); + teamd_log_dbgx(ctx, 1, "init_wait \"%d\".", timespec_to_ms(&psr_ppriv->init_wait)); err = teamd_config_int_get(ctx, &tmp, "@.missed_max", cpcookie); if (!err) { @@ -106,7 +106,7 @@ static int lw_psr_load_options(struct teamd_context *ctx, } else { tmp = LW_PSR_DEFAULT_MISSED_MAX; } - teamd_log_dbg("missed_max \"%d\".", tmp); + teamd_log_dbgx(ctx, 1, "missed_max \"%d\".", tmp); psr_ppriv->missed_max = tmp; return 0; diff --git a/teamd/teamd_lw_tipc.c b/teamd/teamd_lw_tipc.c index 6d7277d..07b7cee 100644 --- a/teamd/teamd_lw_tipc.c +++ b/teamd/teamd_lw_tipc.c @@ -88,7 +88,7 @@ static int lw_tipc_link_state_change(struct teamd_context *ctx, if (strcmp(link->name, lnr->linkname)) continue; link->up = link_up; - teamd_log_dbg("tipc: link <%s> went %s.", + teamd_log_dbgx(ctx, 1, "tipc: link <%s> went %s.", lnr->linkname, link_up ? "up" : "down"); check: path_ok = lw_tipc_topology_check(priv, link->peer); @@ -100,7 +100,7 @@ check: lnr->linkname); return -EINVAL; } - teamd_log_dbg("tipc: established new link <%s>", lnr->linkname); + teamd_log_dbgx(ctx, 1, "tipc: established new link <%s>", lnr->linkname); link = malloc(sizeof(struct tipc_link)); if (!link) return -ENOMEM; @@ -153,7 +153,7 @@ static int lw_tipc_callback_socket(struct teamd_context *ctx, int events, void * else if (event.event == htonl(TIPC_WITHDRAWN)) return lw_tipc_link_state_change(ctx, &lnr, tipc_ppriv, false); tipc_cb_err: - teamd_log_dbg("tipc: link state event error"); + teamd_log_dbgx(ctx, 1, "tipc: link state event error"); return -EINVAL; } @@ -234,7 +234,7 @@ static void lw_tipc_port_removed(struct teamd_context *ctx, struct lw_tipc_port_priv *tipc_ppriv = priv; struct tipc_link *link; - teamd_log_dbg("tipc port removed\n"); + teamd_log_dbgx(ctx, 1, "tipc port removed\n"); teamd_loop_callback_del(ctx, LW_TIPC_TOPSRV_SOCKET, priv); close(tipc_ppriv->topsrv_sock); while (!LIST_EMPTY(&tipc_ppriv->links)) {