From patchwork Mon May 20 06:55:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 1936913 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=WNu1dkTQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::f40; helo=mail-qv1-xf40.google.com; envelope-from=swupdate+bncbcwivbv7sugrb3hhvozamgqebhtgzai@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-qv1-xf40.google.com (mail-qv1-xf40.google.com [IPv6:2607:f8b0:4864:20::f40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VjSyB1Qzlz20KG for ; Mon, 20 May 2024 16:55:44 +1000 (AEST) Received: by mail-qv1-xf40.google.com with SMTP id 6a1803df08f44-6a9a8590196sf15047176d6.0 for ; Sun, 19 May 2024 23:55:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716188142; cv=pass; d=google.com; s=arc-20160816; b=Yj3VYV5K+mXQ5vYBXxumOwG4PC1GKZCFk+9Qg1sjlYbgEDgoqM5Xdf9qyMik0Hnn+h e6O8Kc4iUts5J2o4lis0YsWvIvWXStNW74ttn+0D4tU8HXuOauSBqj8SRXnz9WNjOWj9 Bu7qaIly8RhcBdBGoQWx2ElyPnoa8qtOcb/9sMcF+B5iGohhO153qYRUkpruyQgqGF2r 5oejTGTVqMEQKivr2YExf/pBfZEx23keV1PSqzjbr1cJM4YdgsLjOU8tBXVTwiUbGqD4 43JFBccxzXoBU5gXwpabnv1NOuudPHIRVUiLMDfc+W48v0m+7kM9aCnBur/LWTbL6p5A 8llw== 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:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=dAo1IB3I7x0wcoyUBa5B0Tr+2fwsEenHqX8eyHcMm10=; fh=nW2fY4HlgmM5jCwhy3SpPdMy+h/n5tsnEy8NywEXhXU=; b=Jm+mLeXLzXXRf+1Wro8VhaGyUhUbRpv3srvxrfOkY/PZh1KHNwxbyMOJ+N2oPLL0QY rp1epfc4IFFAbXIQOKZhhWA20dahr9j/DboEgqmI0zzy/NjDLSTT2JSmD0l2drqJhJ4I WfBVmxCAwyBAyWrf0rNZN5TbqQzrgMyrPo4cSF8zN3CsfZh3lFa60+k40SMsZn5Ts2g1 sML8Ey2VSe9lchbiTkzZdy5+r/zd601ebaWSd9o7P14zhyxWqzQXf5uVETsYzhOzL7F/ ckDFdQVHi1w8mtqtgZEDRA3RDhjrcjCZhIfIBgoSc141fni2kenWc/YhkfD7KycsKRdA h1Rw==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@atmark-techno.com header.s=gw2_bookworm header.b="DYbNHZ/G"; dkim=pass header.i=@atmark-techno.com header.s=google header.b=POuLORBR; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=atmark-techno.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1716188142; x=1716792942; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=dAo1IB3I7x0wcoyUBa5B0Tr+2fwsEenHqX8eyHcMm10=; b=WNu1dkTQOYDsyoqgPGd6SKQZaXUqcayZKdPKZPzLV5cm0oTJFyTKcCwYYoI98xPBsC NzBEH5aC/rZthnUqZL/hqondVEE3tca2RP0trCRkZDO9Hl721TvMAucgTyoBzKVxl3am 5DP2VkO0Q/tAqQbsrgNhV5rhp8UW5eUdtOcHjN0rSnKX3VPEhCwKeU9k45Y6LCJJsTUW ZH2tUe4tq77vVvmWxX7Xf/pavAy1nUmorhDMgUSdVKNWsddQJ21lVGG7Nz+reiAIjMMw 18so7g+/bdnHfYP9HikVhsZ0jWTxoqfkGzisppLG3eTkxR3WHSRspBrVq9gZPR4fZsSJ 0iEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716188142; x=1716792942; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=dAo1IB3I7x0wcoyUBa5B0Tr+2fwsEenHqX8eyHcMm10=; b=QPLq41Yyod5RUak0/W5WJf4+Ezg32MtI4MDHLkznGUQz6KASeQASKPuyC1F5gCACd3 jq1Y+IDPFNAR8Yt3Y/CZY3F+AKZDgXhKSqojZyJIs1FCpNy9IS5KR9H2HiIasOh1PLbJ CtfYLLgI6Cb6hPVoSvSw6WBOlrEpy2Q1S4/0IPsylDlIGOjkjyCwETU8oVhSdRoShmfE TiZ520LD4+SYD9hAcMvIQno9P1QRRLsTiIVzcC1mljXmxeb0MmgBCT0r8r2u4701W1Tt UUWgZPQF4wnt5s8oCf0jZeOEMcrGsGL1rkEum+6pEoud3JjzQQz9vpwEkqa4TIUz2dq0 7Z2w== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCXMjXj3z4NQMiec9O663sW+qZcWZHOMInVCuhKJDSVaSe3vCQam4nAqhB2pGJqCuilW39oKch7QrrOCQDqDzBOLkt4MJNaXxNlRxvATCg== X-Gm-Message-State: AOJu0YwcQk8hsrHgxYFo2DFBVO16v9Ks4AKSI8qQ/PQD/iTnZlW7QIek Sq+k9JnZSrVRKD70pH9ldYFu4eEgKg5zmAtprRfE/9GG8telHFUM X-Google-Smtp-Source: AGHT+IEmoKZJ7FkCT3TUHwN71NOenoRzlywL7X66nN4L+6mCF2wOFpx/52xzK37Ke6clYEsZ60ArGw== X-Received: by 2002:a05:6214:4305:b0:6a0:a03e:6f15 with SMTP id 6a1803df08f44-6a16824be74mr374230526d6.58.1716188141681; Sun, 19 May 2024 23:55:41 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6214:1250:b0:6a0:a591:6f3d with SMTP id 6a1803df08f44-6a15d32feecls2483086d6.0.-pod-prod-07-us; Sun, 19 May 2024 23:55:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV0CCyJSvB7SOEMLXjEiVTFQ1g/CarHZHZZyhw6MQVAwxK0s1X6PxJ6MGo/dWx9y64q7/K/quYhDSYD6oCkZgOr2m/7JV5VoLuR X-Received: by 2002:a05:6214:570b:b0:6a0:94fe:939a with SMTP id 6a1803df08f44-6a16816372dmr343671556d6.28.1716188140233; Sun, 19 May 2024 23:55:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716188140; cv=none; d=google.com; s=arc-20160816; b=VJKXHLbcVZPhgSaB6QeCKkm0cxBru5KU2y+sN+I+ssfIkhIWptajP7/tGDv5IkSzsk TTly37WNb/JbJce9FTl6i+jcb5bJlXTHb/+mUZbMBkRnF5HK5+wfu86xGm6XdiyTkod4 i5U402B0oEgJZ3jRyBFOF8FbplZOLAkAihyJm+uUqmE1Ipt8eh2TN/0f6/rI8HveORsK ODfsxRcN0nI+p1F8wqHYXAhPe+YhIqwcspdAil7ExoG+4hnjOx8XeIIewzHS0nBRWuJg M9iJRoors4fMuvqBKe4N8kANBAEd7pZdypb5/tt8cmXOptZCsnJIZSkNXKFOYe/fo3z0 K2YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=2oGcjzKfY6aeiTpmnRBk6q5lU5nmjvMLPFKKA42zrzg=; fh=Vx9f7vkcR0tu2W2Pz92bYoKEDk0ML1q1EgY2HuYKXrs=; b=G0O89aotjvnyF9Ap75BEQiDM9Ap8CVcempw6ilBGHn5Px1MMk0ayYQMNjUfomydN2n eGqD2jgzLUX7vZRrNC6MAzuYSd+jkLVnNcfL1gO5wunMZOS3J8m5ESL6Rl4ORDLzlRX6 j02NufXP8yVPB+um7s0WVU1J4OymNEqwTaiSY8f5W+A0PKWJY+CcQuxzU23WaYxbnkea ORWnLANhXywvs9wYPBJor28Ek6eNIlpoOGefEZ1d36gI9HaKgf23fHdC4taVLTMvE+Qo +0yr3V8RoxdkOXll5h1yjsXeAFKdpU6jcdWUtfTOM6CKF/l3f0SOHVmTuFD954QqBzVr ai9Q==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@atmark-techno.com header.s=gw2_bookworm header.b="DYbNHZ/G"; dkim=pass header.i=@atmark-techno.com header.s=google header.b=POuLORBR; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=atmark-techno.com Received: from gw2.atmark-techno.com (gw2.atmark-techno.com. [35.74.137.57]) by gmr-mx.google.com with ESMTPS id 6a1803df08f44-6a15f315ac7si15520526d6.3.2024.05.19.23.55.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 May 2024 23:55:40 -0700 (PDT) Received-SPF: pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) client-ip=35.74.137.57; Received: from gw2.atmark-techno.com (localhost [127.0.0.1]) by gw2.atmark-techno.com (Postfix) with ESMTP id CB0E847D for ; Mon, 20 May 2024 15:55:37 +0900 (JST) Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by gw2.atmark-techno.com (Postfix) with ESMTPS id 5A7A647D for ; Mon, 20 May 2024 15:55:37 +0900 (JST) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-6f44ff14c17so5990424b3a.3 for ; Sun, 19 May 2024 23:55:37 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUq0A+/hPuo+rsnv87Vruh+iX3R3zyaOANwh/TLgSVoas4cmdUj/s7FgYkv5+sZTXPGkTI3gQt1eEo08IdOZUn59QtSwzwVz0qE X-Received: by 2002:a05:6a21:3115:b0:1b0:812:ab3e with SMTP id adf61e73a8af0-1b00812ab79mr20195809637.38.1716188136338; Sun, 19 May 2024 23:55:36 -0700 (PDT) X-Received: by 2002:a05:6a21:3115:b0:1b0:812:ab3e with SMTP id adf61e73a8af0-1b00812ab79mr20195798637.38.1716188135857; Sun, 19 May 2024 23:55:35 -0700 (PDT) Received: from pc-0182.atmarktech (76.125.194.35.bc.googleusercontent.com. [35.194.125.76]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f302ee9a1asm9027265ad.108.2024.05.19.23.55.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 May 2024 23:55:35 -0700 (PDT) Received: from [::1] (helo=pc-0182.atmark.tech) by pc-0182.atmarktech with esmtp (Exim 4.96) (envelope-from ) id 1s8wvl-00AKLy-2g; Mon, 20 May 2024 15:55:33 +0900 From: Dominique Martinet To: stefano.babic@swupdate.org, swupdate@googlegroups.com Cc: shinya.koga@atmark-techno.com, Dominique Martinet Subject: [swupdate] [PATCH v2 3/3] downloader: allow common channel settings Date: Mon, 20 May 2024 15:55:32 +0900 Message-Id: <20240520065532.2461510-1-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240520063757.2456044-4-dominique.martinet@atmark-techno.com> References: <20240520063757.2456044-4-dominique.martinet@atmark-techno.com> MIME-Version: 1.0 X-Original-Sender: dominique.martinet@atmark-techno.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@atmark-techno.com header.s=gw2_bookworm header.b="DYbNHZ/G"; dkim=pass header.i=@atmark-techno.com header.s=google header.b=POuLORBR; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=atmark-techno.com 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: , The previous patch added max-download-speed so just add this one to the config example, but using channel_settings() gets a few others for free if someone ever requires setting them. Signed-off-by: Dominique Martinet --- (Sending this ugly v2 as part of previous thread, please tell me if you'd rather I resend the whole thing) v1->v2: restore "retries" get_field(). Koga-san noticed the "chan->retries" setting in channel_settings() is actually named "retry", not "retries", so we need to keep both. In theory we could have channel_settings check both (and timeout too while we're here), but it's just as simple to keep it in downloader.c to avoid further confusions. corelib/downloader.c | 3 +-- examples/configuration/swupdate.cfg | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/corelib/downloader.c b/corelib/downloader.c index 04dea8b935ad..151648e4cd72 100644 --- a/corelib/downloader.c +++ b/corelib/downloader.c @@ -109,10 +109,9 @@ static int download_settings(void *elem, void __attribute__ ((__unused__)) *dat get_field(LIBCFG_PARSER, elem, "retries", &opt->retries); - get_field(LIBCFG_PARSER, elem, "retrywait", - &opt->retry_sleep); get_field(LIBCFG_PARSER, elem, "timeout", &opt->low_speed_timeout); + channel_settings(elem, &channel_options); return 0; } diff --git a/examples/configuration/swupdate.cfg b/examples/configuration/swupdate.cfg index b46c92d924ca..24aae3285f90 100644 --- a/examples/configuration/swupdate.cfg +++ b/examples/configuration/swupdate.cfg @@ -104,11 +104,15 @@ logcolors : { # authentication : string # credentials needed to get software if server # enables Basic Auth to allow this downloading +# max-download-speed : string +# Specify maximum download speed to use. Value can be expressed as +# B/s, kB/s, M/s, G/s. Example: 512k download : { authentication = "user:password"; retries = 3; timeout = 1800; + max-download-speed = "1M"; retrywait = 5; url = "http://example.com/software.swu"; userid = 1000;