From patchwork Wed Nov 11 01:22:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1397889 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CW6Rx5zRDz9s1l for ; Wed, 11 Nov 2020 12:23:09 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 84CDB874E1; Wed, 11 Nov 2020 01:23:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7bWlCmx19CRj; Wed, 11 Nov 2020 01:23:05 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id C9BA0874C8; Wed, 11 Nov 2020 01:23:05 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id AEA84C088B; Wed, 11 Nov 2020 01:23:05 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id A6DA7C016F for ; Wed, 11 Nov 2020 01:23:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 913C386B9E for ; Wed, 11 Nov 2020 01:23:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gw4XVY9SZRls for ; Wed, 11 Nov 2020 01:23:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 9749886B9A for ; Wed, 11 Nov 2020 01:23:03 +0000 (UTC) Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 9D07D100007; Wed, 11 Nov 2020 01:23:00 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Tue, 10 Nov 2020 17:22:46 -0800 Message-Id: <20201111012253.2574279-2-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201111012253.2574279-1-blp@ovn.org> References: <20201111012253.2574279-1-blp@ovn.org> MIME-Version: 1.0 Cc: Leonid Ryzhyk , Ben Pfaff Subject: [ovs-dev] [PATCH ovn v4 1/8] Export `VLOG_WARN` and `VLOG_ERR` from libovn for use in ddlog X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Leonid Ryzhyk Export `ddlog_warn` and `ddlog_err` functions that are just wrappers around `VLOG_WARN` and `VLOG_ERR`. This is not ideal because the functions are exported by `ovn_util.c` and the resulting log messages use `ovn_util` as module name. More importantly, these functions do not do log rate limiting. Signed-off-by: Leonid Ryzhyk Signed-off-by: Ben Pfaff --- lib/ovn-util.c | 17 +++++++++++++++++ lib/ovn-util.h | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/lib/ovn-util.c b/lib/ovn-util.c index abe6b04a7701..eb4f14efffa6 100644 --- a/lib/ovn-util.c +++ b/lib/ovn-util.c @@ -722,3 +722,20 @@ ip_address_and_port_from_lb_key(const char *key, char **ip_address, *addr_family = ss.ss_family; return true; } + +#ifdef DDLOG + +/* Callbacks used by the ddlog northd code to print warnings and errors. + */ +void +ddlog_warn(const char *msg) +{ + VLOG_WARN("%s", msg); +} + +void +ddlog_err(const char *msg) +{ + VLOG_ERR("%s", msg); +} +#endif diff --git a/lib/ovn-util.h b/lib/ovn-util.h index a39cbef5a47e..77d0936a5fbc 100644 --- a/lib/ovn-util.h +++ b/lib/ovn-util.h @@ -230,4 +230,10 @@ char *str_tolower(const char *orig); bool ip_address_and_port_from_lb_key(const char *key, char **ip_address, uint16_t *port, int *addr_family); +#ifdef DDLOG +void ddlog_warn(const char *msg); +void ddlog_err(const char *msg); +#endif + + #endif