From patchwork Mon Mar 2 09:53:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1247546 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=googlegroups.com (client-ip=2a00:1450:4864:20::43f; helo=mail-wr1-x43f.google.com; envelope-from=swupdate+bncbcxploxj6ikrbgnp6pzakgqehxikbgq@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20161025 header.b=AiFDbRpp; dkim-atps=neutral Received: from mail-wr1-x43f.google.com (mail-wr1-x43f.google.com [IPv6:2a00:1450:4864:20::43f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48WFp74Rstz9sSM for ; Mon, 2 Mar 2020 20:53:33 +1100 (AEDT) Received: by mail-wr1-x43f.google.com with SMTP id w18sf5584223wro.2 for ; Mon, 02 Mar 2020 01:53:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1583142809; cv=pass; d=google.com; s=arc-20160816; b=iNomqQIwQIKaXc8VjEQ9O5yn0pv7eZmMu6S6Gooy6EnjCG8+7yObh0+Khx8dKT0L4C DHWEo2U9R0taKcxycvvJTqpLzar8d9R6D/5/eN3YNF79KV44a7uMJd7u0D+xEDGIz9Mh GsDrf+jUcBpTnLzEVwIVvdhx+bWaiK0Le/+WFe9vO72wLrE2T9qgSh82cV7Dt5AvBSNO ADWOZk0C7v0Q4tg2AbfeOamLZ6KaudOv1pvMi7iPSXc7LIMYcJ4t8oh2NGreS72Cyvi3 cqkKZYWCgrv2hjJzJmtwt/n5UU+GFyX7vyQTdSHGgeAlCSwUzsgnjTgVx6WGUiGKAxaI SGRA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=IzG7bfeBvvz32xXRHVNVjNemt+kW+6mXuIxk6dLZ+co=; b=GVQykM6RUUSvYcIN5RJLGIN0lvCSpIbmyhCJcZb4MoshCXnCjt+NaWoEe93L9gShpG nGrXFGW/YwC9mSBhZTZQcSwnkdLlLRPl8Lcuk2MgRAD80NeHw0eRNiK6zlH5+JiAIdWJ dP4iT6erq3K+E0VzMrBvvwRs/mWupQ2C2Cjh/CWjDE0bVUNUd+3MUOJGZ1FT8644KaSf Q13CeI6pC2kFNUmAhiQQDZR2WOFI4dhhkQ96LUy5sykHEsSazuh0kZndTuu2+8zSenTv /5CnXCyF0Ou5v8sj0XcFVFuV4oCpW5GjL+QaB2nKH6pm/F6kSaB3g9YpOByoaHVqvLaZ 1e3g== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=IzG7bfeBvvz32xXRHVNVjNemt+kW+6mXuIxk6dLZ+co=; b=AiFDbRppfWhHU1i6FfLlQg9AiP21xi8EiLHH9sU3PxEpytetpalwrbsBpqQUWm/JXX +sldXJMrJdtzXde3fZDg63LSF3i6ho+zPNuV0QsTet/xeu3kqtBad9SRS3cthgAlwnIB lOFRgf+9y4mDr+OmixTxoiLIqjv2oFVImBQoTIzRHyRd/hz62s/6HFOM9N8LK6VV1Yg/ 47uCsYltNQTS3ifzeGABOVfAf2GnG/XTaaSDhi6CHL9AIvnDhXnozWkSDXjkwLNU3bhW vtiz5+Tjl2sjQdXxEFzD9Kk+VPklV7MczmjaR1Y9vhSaUZi3bBV32Zxbc/+jDfOaUVGg dO6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=IzG7bfeBvvz32xXRHVNVjNemt+kW+6mXuIxk6dLZ+co=; b=NofXHuO27MlLPN/utPUW/u+xsEhVUegiRcQsLQTx6IYb3EaAqzkPEhqQKM6YaaqpGA HHGDoUEOB4EJX5xxZp+ORDyT42roE5J+nfemQClmgKwMmF/7f5fuLuZJuXS/6cry/4yP sUTWR/WwUA6/gIV2kH0YtH7Ep40fVMxxaF+Myu1an09+NzZUPRM6oYr7caQUucl7suDh jbc00M3/+yymAAFaO3J0CuP8DIpMw+HZoz3O0W3cmqJBPZkWuHKDE+xWrQUPb1phmqNJ LaXtNBmC6mOg5HDi+kncEPLRGVjAlYUnE3VgDxYkOIwp1kc8wHh10g7U+91ujZOP2fEN qsDA== Sender: swupdate@googlegroups.com X-Gm-Message-State: APjAAAVDVfbSlKDbQws61z0N2xeZ0coDn+PhX8WNS9Ebql94YrfCOI04 AjyvCQU5ZGP88wru7NFJR4A= X-Google-Smtp-Source: APXvYqzRyeypFcWbaU3VGeHzn0MjAcv6sONW9/JRutG8IcVRhaaCSG4wH1JMKKPe2JATHKHt1RMn9Q== X-Received: by 2002:a5d:6690:: with SMTP id l16mr22753547wru.251.1583142809578; Mon, 02 Mar 2020 01:53:29 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a5d:508e:: with SMTP id a14ls2704569wrt.2.gmail; Mon, 02 Mar 2020 01:53:28 -0800 (PST) X-Received: by 2002:a5d:4b03:: with SMTP id v3mr22811000wrq.81.1583142808810; Mon, 02 Mar 2020 01:53:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583142808; cv=none; d=google.com; s=arc-20160816; b=u1XI81mEyTctuL4YIP/k/3jv4GHY3vEEfqxzkV1OaUJo74ow5R6+mOyTyDT19VhS0U SHYO9d7qE3k1iq4Y4p24UaYGewxVbgU2fe+GcDqtcswn5nujZQWfeZLmev7LFeiAVHbm Z81cXREsx18KNAuo3mRVSH2Cu5mcYTPeWf/ApdIapW8k8zmxb2VGdyIBIeThb6djml99 5SZ50uAGnk38PI6LfZ4BybNdgWtsmu2pNpmW6XSoT3q/n/4tt4zZWNJV04SqbyhcMSyw 1lL5g65UP/WuVCNR8jlFCfrudTMmQSulMG7tAV8dJ+65GqCxHgYEZ4DOEzVG70sNlGzH 3iPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=XM6Kkrrz3KnDraIyFXutKK9NDejhG+sRZ8DfHDTtrhU=; b=ugDQ3XEiNosUZQN6djF9oABDwUEAJs/UHoA04QX4a58piesT/zgNsIpGdzS8cWR+be +BeoXKoGlI7t18IgD60uywD7GG0mNJ8tJEGb9QbeTHRMDzHuooV428Lw3gH4K7cpjRTB X63HhdpznqeqcLwI2Fach5NWEaYA5h0yANerPC7sdIho25FXNiwSCwJgRFqaM0oPM+BS re3eVHQiFjWzD/9mNM9MVqiTLfeiDEixYv60yhuuaQVIjz38xbRZa+Vl2eup+TtX/LL3 i09Q/yEP315cU1TZb2xSZzPEuYinJSQW2cfxUF8R4WNU4lnFKT4mBaTehAeUfAx6IE4s e2ww== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id w11si721121wmk.0.2020.03.02.01.53.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2020 01:53:28 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 48WFp04LpGz1qql2; Mon, 2 Mar 2020 10:53:28 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 48WFp047LXz1qwyR; Mon, 2 Mar 2020 10:53:28 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id Fa7Ujxx2NLLt; Mon, 2 Mar 2020 10:53:27 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Mon, 2 Mar 2020 10:53:27 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 0152C454049F; Mon, 2 Mar 2020 10:53:28 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([IPv6:::1]) by localhost (mail.babic.homelinux.org [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id sxjQ7ekT_6Ja; Mon, 2 Mar 2020 10:53:25 +0100 (CET) Received: from paperino.fritz.box (paperino.fritz.box [IPv6:2001:a61:6000:eb01:71f0:310b:488b:a336]) by babic.homelinux.org (Postfix) with ESMTP id 2B4B24540307; Mon, 2 Mar 2020 10:53:25 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH] Do not traces messages for progress interface Date: Mon, 2 Mar 2020 10:53:22 +0100 Message-Id: <20200302095322.26516-1-sbabic@denx.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , During downloading a TRACE is sent to the notifier with the goal to forward it to the progress interface. However, as TRACE, this is also shown and processed by all notifier causing an overflood of messages on the console that cna slow down the system. Move this to a separate notifier and drop it from console notifier. Signed-off-by: Stefano Babic --- core/notifier.c | 24 ++++++++++++++++++++++++ corelib/channel_curl.c | 2 +- include/swupdate_status.h | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/core/notifier.c b/core/notifier.c index 8643c6f..3dbc382 100644 --- a/core/notifier.c +++ b/core/notifier.c @@ -143,6 +143,13 @@ static void console_notifier (RECOVERY_STATUS status, int error, int level, cons case SUBPROCESS: snprintf(current, sizeof(current), "EVENT [%d] : ", error ); break; + /* + * PROGRESS is a special case. It is used for subprocesses to send + * progress information via the notifier. A trace with this status + * is processed by the progress notifier + */ + case PROGRESS: + return; case DONE: strncpy(current, "SWUPDATE done : ", sizeof(current)); break; @@ -203,6 +210,22 @@ static void process_notifier (RECOVERY_STATUS status, int event, int level, cons } +/* + * Progress notifier: the message should be forwarded to the progress + * interface only. + */ +static void progress_notifier (RECOVERY_STATUS status, int event, int level, const char *msg) +{ + (void)level; + + /* Check just in case a process want to send an info outside */ + if (status != PROGRESS) + return; + + swupdate_progress_info(status, event, msg); +} + + #if defined(__FreeBSD__) static char* socket_path = NULL; static void unlink_socket(void) @@ -365,6 +388,7 @@ void notify_init(void) STAILQ_INIT(&clients); register_notifier(console_notifier); register_notifier(process_notifier); + register_notifier(progress_notifier); start_thread(notifier_thread, NULL); } } diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c index c00e994..d7ca1eb 100644 --- a/corelib/channel_curl.c +++ b/corelib/channel_curl.c @@ -381,7 +381,7 @@ static int channel_callback_xferinfo(void *p, curl_off_t dltotal, curl_off_t dln "{\"percent\": %d, \"msg\":\"Received %" CURL_FORMAT_CURL_OFF_T "B " "of %" CURL_FORMAT_CURL_OFF_T "B\"}", (int)percent, dlnow, dltotal) != ENOMEM_ASPRINTF) { - notify(SUBPROCESS, RECOVERY_NO_ERROR, TRACELEVEL, info); + notify(PROGRESS, RECOVERY_NO_ERROR, TRACELEVEL, info); free(info); } return 0; diff --git a/include/swupdate_status.h b/include/swupdate_status.h index 38811e3..8ac9af1 100644 --- a/include/swupdate_status.h +++ b/include/swupdate_status.h @@ -27,6 +27,7 @@ typedef enum { DOWNLOAD, DONE, SUBPROCESS, + PROGRESS, } RECOVERY_STATUS; typedef enum {