Message ID | 20240603085602.2351411-6-dominique.martinet@atmark-techno.com |
---|---|
State | RFC |
Headers | show
Return-Path: <swupdate+bncBCWIVBV7SUGRBMEK62ZAMGQEMZE4DQY@googlegroups.com> 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=ftznpVxo; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::b39; helo=mail-yb1-xb39.google.com; envelope-from=swupdate+bncbcwivbv7sugrbmek62zamgqemze4dqy@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-yb1-xb39.google.com (mail-yb1-xb39.google.com [IPv6:2607:f8b0:4864:20::b39]) (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 4Vt6yr5bhxz23vC for <incoming@patchwork.ozlabs.org>; Mon, 3 Jun 2024 18:56:20 +1000 (AEST) Received: by mail-yb1-xb39.google.com with SMTP id 3f1490d57ef6-dfa787a3474sf174284276.1 for <incoming@patchwork.ozlabs.org>; Mon, 03 Jun 2024 01:56:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717404977; cv=pass; d=google.com; s=arc-20160816; b=jl9g1/NV10faA9S3AeM61HWneOHkn3wlM54sQc53UZepX5Ug+2P2xIcFjeBB5T45rf 34KPgrp0bgJrkHjjdPkCJ3IMnpayHKC3zVqXwCeB29Zfdg+djCJ0pzWB2prq46caqTLt arKBB7PcQdg7X6UPd0uoNqSPrP57RtUh32rpf9+PjkDJpT9phmoh0tRtlmAde71BCjrz ghu1ngaqnbelIqeVs3GdnY8JFRhjRD/e+zbONc2AgFw1famxHixh+tuE11nK9zHm4eOa DiVecB4d5m7fdNL/kcmGo/ZGaGkn9T5f61gSmmhMtsgt3WJBzvxLzG1cGywgLLDDbiVb WdLw== 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=bv6X7DVcXinQnts/zmjzsQBe7QW6M+j1IfVFfxGu0aY=; fh=LjOmSWUebNmrK8spun338GztgCTqIsfKWAM5wjl4ZKs=; b=gIDdKxKg9wYz9KJG/W4dZGO16B9CvbUmZDWrKB2iMd154Gc273NQEUBfcIUpJWfm93 hLo0Keq79Z4ssRB6ZpSnigywwX3f35FPj0BQV/JZ9DdVMLr4/2ltsHXAlqLuICcj4gmj CbE0N8KynX4j0Tn05myTcq/jIMoBeE9JgT8mG+rbn6RYKtAPRshD9a/yxm5xge35Zdn6 fX/bagavdIKD96XEifiOtybh0f2ibVEgxeI6Ga2dlmwOmG4NANFWYC8J/EqOYX/w/y6n Oa8LGmp/RMMm+hurbJ+OTg7mGFVib5I7w+8+RQn5L+T5na/OFqbkPAZagZ75MMAADdIh ViWQ==; 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=phvjzluQ; dkim=pass header.i=@atmark-techno.com header.s=google header.b=Caae2I6w; 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=1717404977; x=1718009777; 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=bv6X7DVcXinQnts/zmjzsQBe7QW6M+j1IfVFfxGu0aY=; b=ftznpVxo6X/YCh3eAJuDQHBEMxj6Kp1mzu3LRqS+4WU5goKCkGMRLA1RRgUjsfROJe ruoXZes8gi6UGs/cUyxhQlbYCFEeGo1PxjSi+3V3bLaPoRox1LshUDyl9WJLPwpHbe4g stO6kUGsAnGsAxQ5U4AefEp8DTNqZfWiKLoQvlRDibYQkeK/nhU/2yZcLwg8f9QOuPV/ qoN0yi8e0ptM5vpNbY8MNB/q9272Jb2rnnimp/GJ4UQwTFHYncj+fgHkYNAOoeJ10Eoo JH6DwV77bjgPQkXCjsywgRuK2mFlReosZdoUnir7qsmlAgxsaFCtdeGNiu6gRB13OSIQ L+bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717404977; x=1718009777; 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=bv6X7DVcXinQnts/zmjzsQBe7QW6M+j1IfVFfxGu0aY=; b=fxFSk9LL6oAabFflSm/NizTWQmkpAwZAbYciQW0fIswCHDQMM7t3pFDzBZOW/OLaIk 5hyq36Gz1Xw+GVwkP8+6ZOG3bUX2kwimiP3F3BNuVnt2CnnjL4fVIJDdCalStPUlqc4x QH6ucxS49l8c/V1uzwVuMkZWnj695nl9XBpn4y/26gEOclN6QQp4JRMMXDd7uKK0vOSN /RAsdZakKeJHAtgfIk3F0wYI74yACd4K0bxctEQnWRek5hHyWciPtu3gS3wM19JAUs+H eC2nBg3WOZrYdMdtKQQUipDy3b07UOZ/h2/0CZPVrhV3FD3QM5F0XLOWYpqJDGRYP3VA IrEA== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCWEn2HnZIX6VW/ZMdH/1X+NiujWI+xgR5kYcWACJ5MyxD66ivgYrpDuIRhlo1gVvKS5WmRFtVU9Ov/mKaNNtUPefCq/OP9oxs9Bro9NTQ== X-Gm-Message-State: AOJu0YzSTI38nlQj5PdlG29BV1K6q0Gv8T0ov3aXq0Bu61rr+SPm33Ij RIaqzyIt5RUu//AnuHMOQyJcu1fj8rIDxFFuHLBdVYpCQ9fk5QXR X-Google-Smtp-Source: AGHT+IGwOAWe1UDbZtYOe5dpfqBXoqD0k3xur85KFp8OFhau1a3xhF9FJZYSozWP5gSPyy+TZ4Bv1w== X-Received: by 2002:a05:6902:2605:b0:dee:883b:749b with SMTP id 3f1490d57ef6-dfa73e638ccmr6023215276.6.1717404977154; Mon, 03 Jun 2024 01:56:17 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a25:df04:0:b0:dfa:7878:d377 with SMTP id 3f1490d57ef6-dfa7878d671ls608326276.1.-pod-prod-01-us; Mon, 03 Jun 2024 01:56:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWBSJGRVt8iHXjhff93x2wOXkvgPoGbtG4r91CctzAsxEHuafYdNvTbtYPAdDA7OVppnY4a7hK+4IfvcafOKsf9PzadBoruhewD X-Received: by 2002:a25:ad03:0:b0:df4:a607:2429 with SMTP id 3f1490d57ef6-dfa73d90ac6mr9067389276.45.1717404975996; Mon, 03 Jun 2024 01:56:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717404975; cv=none; d=google.com; s=arc-20160816; b=UeDzq6mccpsR20GEEsqYuASVe6skpfC0AhaUNyEHsQoCOWAVtWT8PmUWoQY3ZzZeP/ uVvMeMcKDE7uWSJS6Iifkqr5oBXM3lBYQ4Fcs2vQDq3UXfm4WkaJPOPsRBWhc830D3tA uSKBzfoHXAroTIdRNihDmkyZPjlR8O1FrxFXaES+M/0rRBJplDU9F1dWyQXw9LZ8KfB5 GOFhkLO1givZCq6lw+0PC3YQEXbAhVkiCIhnshRFZ748v18VAs2dYZdcjeor1600Kh9w riJ164lEx+jHMi/wWuXSQH29sdF0bmD1WY5rX8N36+YMMoUdo2t3XPgWBbGxedl2Mvos MuQQ== 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=3JdZc8LJZIy0QWyHnPOFr0YCJM9Y4FswQvVMXgMhNdM=; fh=bLfBbaqm8quG3K8jSaX6CveKeaQgKa2+VV7zBcVdRJQ=; b=oLs6eKKpx2ZKLLF+nZLWaPp9+X7jbAU/nXeABigBD9PowSV98J/bqJElgAlwaIRV7D zXMwZclRnbF8fGuyWFsaq6bvpF82dafA57mTsMICYUeNDouoniE+KeYn/h3fvXfyPNR/ 1m4nFA8/UY372O4ELmNDU/Mgbtp73iOcQdw1UeX/+5F2XnhAdmeNwg3AT0jsIZ401Aoi mvwOHrGkHCX0hmCiD6B2h1+I6nyjY6qdxCxE/HwGYsGmjTDO2sliT5iL2mhy7k58meVu Gltt+uZTdXRHUVioNM91BuHPaOsrdsITWCCp4fC5D3qxjfbw9V2xF2fTN/A1m7ssh5GA qnkw==; 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=phvjzluQ; dkim=pass header.i=@atmark-techno.com header.s=google header.b=Caae2I6w; 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-6ae4b405ed9si3830386d6.5.2024.06.03.01.56.15 for <swupdate@googlegroups.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 01:56:15 -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 18EFBA95 for <swupdate@googlegroups.com>; Mon, 3 Jun 2024 17:56:13 +0900 (JST) Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by gw2.atmark-techno.com (Postfix) with ESMTPS id DE62EA4A for <swupdate@googlegroups.com>; Mon, 3 Jun 2024 17:56:10 +0900 (JST) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-70258f8869cso1748667b3a.1 for <swupdate@googlegroups.com>; Mon, 03 Jun 2024 01:56:10 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCU9CtwzB48JeYwgpgPHXTrhlLRaogs1Yb8YYGqmgLnzqS8kB2lXQWooYOpz6M/368db46Xy5f/YY6CPO+OyYhpaDsJFLXt6B3G6 X-Received: by 2002:a05:6a00:21c8:b0:702:3375:85cc with SMTP id d2e1a72fcca58-702477e5c29mr10034905b3a.8.1717404969912; Mon, 03 Jun 2024 01:56:09 -0700 (PDT) X-Received: by 2002:a05:6a00:21c8:b0:702:3375:85cc with SMTP id d2e1a72fcca58-702477e5c29mr10034890b3a.8.1717404969532; Mon, 03 Jun 2024 01:56:09 -0700 (PDT) Received: from pc-0182.atmarktech (117.209.187.35.bc.googleusercontent.com. [35.187.209.117]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-702423cdb8fsm5055031b3a.28.2024.06.03.01.56.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jun 2024 01:56:08 -0700 (PDT) Received: from [::1] (helo=pc-0182.atmark.tech) by pc-0182.atmarktech with esmtp (Exim 4.96) (envelope-from <dominique.martinet@atmark-techno.com>) id 1sE3U6-009riT-11; Mon, 03 Jun 2024 17:56:06 +0900 From: Dominique Martinet <dominique.martinet@atmark-techno.com> To: stefano.babic@swupdate.org, swupdate@googlegroups.com Cc: Dominique Martinet <dominique.martinet@atmark-techno.com> Subject: [swupdate] [PATCH RFC 5/9] cpio_utils: cleanup state chaining code Date: Mon, 3 Jun 2024 17:55:58 +0900 Message-Id: <20240603085602.2351411-6-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240603085602.2351411-1-dominique.martinet@atmark-techno.com> References: <20240603085602.2351411-1-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=phvjzluQ; dkim=pass header.i=@atmark-techno.com header.s=google header.b=Caae2I6w; 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 Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series |
Proof of concept of chunked checksums
|
expand
|
diff --git a/core/cpio_utils.c b/core/cpio_utils.c index acb3f3b634f8..b0a97004baf6 100644 --- a/core/cpio_utils.c +++ b/core/cpio_utils.c @@ -616,31 +616,22 @@ int copyfile(struct swupdate_copy *args) } } + step = &input_step; + state = &input_state; + + if (args->encrypted) { + decrypt_state.upstream_step = step; + decrypt_state.upstream_state = state; + step = &decrypt_step; + state = &decrypt_state; + } + #if defined(CONFIG_GUNZIP) || defined(CONFIG_ZSTD) if (args->compressed) { - if (args->encrypted) { - decrypt_state.upstream_step = &input_step; - decrypt_state.upstream_state = &input_state; - decompress_state.upstream_step = &decrypt_step; - decompress_state.upstream_state = &decrypt_state; - } else { - decompress_state.upstream_step = &input_step; - decompress_state.upstream_state = &input_state; - } + decompress_state.upstream_step = step; + decompress_state.upstream_state = state; step = decompress_step; state = &decompress_state; - } else { -#endif - if (args->encrypted) { - decrypt_state.upstream_step = &input_step; - decrypt_state.upstream_state = &input_state; - step = &decrypt_step; - state = &decrypt_state; - } else { - step = &input_step; - state = &input_state; - } -#if defined(CONFIG_GUNZIP) || defined(CONFIG_ZSTD) } #endif
We don't need to nest ifs so much, chain steps as they become required. The step order (input step, decryption, decompression) is preserved. There is no intended functional change. Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com> --- core/cpio_utils.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)