From patchwork Mon Dec 4 10:05:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Glembotzki X-Patchwork-Id: 1871477 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=mVy0/Fc2; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=fvbMiQsv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::13c; helo=mail-lf1-x13c.google.com; envelope-from=swupdate+bncbdy5juxlviebbjwjw2vqmgqerp7ajgi@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-lf1-x13c.google.com (mail-lf1-x13c.google.com [IPv6:2a00:1450:4864:20::13c]) (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 4SkK7w37RMz23p4 for ; Mon, 4 Dec 2023 21:06:36 +1100 (AEDT) Received: by mail-lf1-x13c.google.com with SMTP id 2adb3069b0e04-50bf00775ecsf1122137e87.0 for ; Mon, 04 Dec 2023 02:06:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701684392; cv=pass; d=google.com; s=arc-20160816; b=yIbOkeXzXo1NlSiOpS6SWQBtFE+Tnn+xYTAPpExJU0CH+XbCMzUI1XygMz5nMH8JKa GlowTf2nG01sSpyTmoMrPRbQ1Rsv63Kolgqu7g65s340swr7pthVHRknvT0dx5S8fER0 5Jmnx0YBiswER483AEc+0uLejLOlcHQnQEAPyG3vvVEs9/Evao+hsVjp2nd8zMrL7yub PT7Jl9B325WZDTsQF4SadMYTSybLUbic31ZI5XNbj3M6aJXvva7RncV9jv08yGHWstP5 zpYpjZyZX9RDS6pmgyfRsO4yRM1dDJAIjvZ0G+H6ilxkNXKtkqX6ZAQ4zoNdUU1IzClp xtdg== 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 :dkim-signature; bh=xh/uhyfWusYUXyNUjNrT6qkeGxIa/s+tAriFs6VPotA=; fh=zydHuzCQWrku2OPQyZfraJZFcOpEXLQ/YBcu3QNiBd0=; b=vmKvF4unNj19tDtTs492BjRprQpInT8BEsZgRlh6i1sZLSwnDfy/tOmNVA+WaZ8gC4 NRpn27ozMsKUM38KHaeKTWYlAl93KC84/5lymmwWSUzBuao/IBK+eKbhqCm9tVRtA82h ScQ/3mInEMsYis0LUqTO8zZU4P3rUZBJYfqtW82uzQRfDn87VC1i1hH8nXVsvc/qV0yw 2t+D/iO9nhvJQwfIsEqcziM+1OV6kpYrTp18YgL9J9QSmQhtjmdx3szITJIPLSIBqfYx rFR2tajyiL6i6H+rf6ffaVb5ICuDMDfpBjbkUsKoD0QPdTSs+VZM/I10988FZvFPEj2T WBGw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dedRnovb; spf=pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::52e as permitted sender) smtp.mailfrom=m.glembo@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1701684392; x=1702289192; 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=xh/uhyfWusYUXyNUjNrT6qkeGxIa/s+tAriFs6VPotA=; b=mVy0/Fc2DDst36Iw/LpbuOJPVGAq4xUQ8fmL6C6fRCWuxplmCKsWJSZYCxhrB1n7Hd TT2BkDir4iA0CG/cMdP2Pc2pW+15MiJKEYoUTgHhzCZ0DZKotMhInmp30nPPjJ9NNbVG Q89XdxNuZBb5Yi1lXF0adv07rbWfOhbFeLsU+ceUreMdzBY9e3XgOOEnAcJMhZ6uoc+u VXIxbAJxACO7gEFogU14lnu4dAhO6e8ONiCVuub8sBWpWk1pdZgljt356aWwKhTf/qox RzR6Pu8ptAv0nU1IxjtBMDwTsJ7s6ZhUU3YohU+pDS6qhWzDBeUIQDdSuLn1QBlELqiv W8BA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701684392; x=1702289192; 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:from:to:cc:subject:date:message-id:reply-to; bh=xh/uhyfWusYUXyNUjNrT6qkeGxIa/s+tAriFs6VPotA=; b=fvbMiQsvOiZ2Jh7ycfMZJkwTd0Nd7hGfQR6qRkWYQcJJteaTsmRMrOShP3xKsrtcn8 6+SnIgjSgEPaL9j75nIvgL6GZA2PhzdiaMrp/ZpR2/jtBJ52f5ysmwQXw77SzjGW9DH3 ss69ChJ4JmvSydgVZ+7NUK5zYm9VW45r3G0N9iBGpM2QnICsTSTBrrOUhX2hslxUwov8 HXNF0vgKdVx91MsznMHllj5AcJCSqJmsgQ7+mKX0Yn+RtCENsNC/wy7JX52OdStmIABf 1nU9audvtCKMvNDR1rw3A34qY/ZDM+DF09TdHqwresY1Hy9pIKI8zU5sGDToi5BQIDW8 2Mag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701684392; x=1702289192; 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=xh/uhyfWusYUXyNUjNrT6qkeGxIa/s+tAriFs6VPotA=; b=aY2tET21Rl0dDhDNRO5jjJkwazTEZx7GWHL6JoDnsDPj/dDf23936edhACAKtmeyUa 9LaX7x2sjlMUgzCY9QU8h60ywr9y4m3zcb2TuQnP3T8mCwy00YoVVDOteFufG6S6nBO5 SiMn5v/nzL2KZPa/LwxR0vuVjO/wnVjSIJlPJw9sOiEFZwEOyeeWxlkx0bAGrj6c/uQz AfmhcpByZakf4PRUOsNvGsz+jvZhJLievtTLCVfEI+PmYpIW7qFN1Y+P/+INifGE5fC0 INoToZRPMIO7/5yNuJmXazNQZkvPctGS746GuPLxEXgRMnUAlLzPRjLa5/INS0kb+gdg LsLg== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOJu0YyEOW634EEQ1G3llPdpk7Y6hadF3upwwXiiZXg+dlu4eu3wWdtm s8vUBcuvk6Uf7zGb/YsGuX8= X-Google-Smtp-Source: AGHT+IGvqGcZkq1k3wgd6dA0ZcccveYwkkElD0VGllrXPQzNW+HYDAgz7imz6F2IVHFIkqOsrgznjQ== X-Received: by 2002:a05:6512:e83:b0:50b:d764:9695 with SMTP id bi3-20020a0565120e8300b0050bd7649695mr3213169lfb.121.1701684390852; Mon, 04 Dec 2023 02:06:30 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6512:6ce:b0:50b:f483:50fa with SMTP id u14-20020a05651206ce00b0050bf48350fals452103lff.0.-pod-prod-09-eu; Mon, 04 Dec 2023 02:06:28 -0800 (PST) X-Received: by 2002:ac2:59dc:0:b0:50b:e8c4:271b with SMTP id x28-20020ac259dc000000b0050be8c4271bmr1131036lfn.7.1701684388477; Mon, 04 Dec 2023 02:06:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701684388; cv=none; d=google.com; s=arc-20160816; b=fBKZmPwTUONsI9v5HAN+CzMBWrFu659tV8xbXe05hOUn5wR7kjuEOihUtE9uW6f1tV o4DdW1+ylG4Mco99xSLmSnUsYhKWpysXdH99NGg2notv6AsckgMZyoPBhmWSdikIafa2 gkTzICjlJiMe9V8dcvQRnUqh14+DdDLVhpqNH+Hw8YSBzjtyquGXeeDZzug+7oZ/5+QZ d78J0sFo2g2TA3ExlDTIIYOqx/vAu10VKo/3pvRQQFCuuRtQ0/pfGb8vaKn1Aoa4iHFX aUA1ODhMWoXPSDrks0JUm/ZrmGfR+iNho2DZXgaFJLZpVzX+PQOVpv6cRCsWYRbFHiQA uyGQ== 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; bh=SrpAgY+l8/Oe4+9iPVltwGkeShtPSJlcuQe3hFxIX4E=; fh=zydHuzCQWrku2OPQyZfraJZFcOpEXLQ/YBcu3QNiBd0=; b=KThXPov9EX1HrXaBHCv+EoLngqFz74FPIskk4q5Nwk7aBh+rThHn3efIobWLmyTo9N tmgzlaCHJ/xo4r1f2In+nJ8/uqOQYqzVrrfD18F2tAtyFAPmmMKk0gB5gmY5YgVCfgED dXnrJOVFr7Nbz9eHPk4Odb2WSerLUPEOuL4uexfy01W1XR3m8bqYgaLq+uJHHm+ODHVB 7C9jJ8SRFe5/lhWRxByWX1ZW0OodbVMTANEL3/yjYG+IS39/mHb755knWmo/2J3cqOlM 1fTwvEna/lxn18UkcGwwdKFP1HI1eroaIOSSJ5Gk3E5ppApz93HyvSgC3yla8Mb9BJY5 zznA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dedRnovb; spf=pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::52e as permitted sender) smtp.mailfrom=m.glembo@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com. [2a00:1450:4864:20::52e]) by gmr-mx.google.com with ESMTPS id p27-20020a05600c1d9b00b0040b54466ee8si536481wms.2.2023.12.04.02.06.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Dec 2023 02:06:28 -0800 (PST) Received-SPF: pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::52e as permitted sender) client-ip=2a00:1450:4864:20::52e; Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-54cde11d0f4so627282a12.2 for ; Mon, 04 Dec 2023 02:06:28 -0800 (PST) X-Received: by 2002:a17:907:3a0f:b0:a17:7de2:cf55 with SMTP id fb15-20020a1709073a0f00b00a177de2cf55mr2392860ejc.10.1701684387638; Mon, 04 Dec 2023 02:06:27 -0800 (PST) Received: from PC-2635.irisgmbh.local (dslb-002-203-161-041.002.203.pools.vodafone-ip.de. [2.203.161.41]) by smtp.gmail.com with ESMTPSA id js22-20020a17090797d600b00a1b32663d7csm2032919ejc.102.2023.12.04.02.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 02:06:26 -0800 (PST) From: Michael Glembotzki To: swupdate@googlegroups.com Cc: Michael Glembotzki Subject: [swupdate] [V2][PATCH 03/10] util: Remove unused function extract_next_file Date: Mon, 4 Dec 2023 11:05:35 +0100 Message-ID: <20231204100620.27789-4-Michael.Glembotzki@iris-sensing.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231204100620.27789-1-Michael.Glembotzki@iris-sensing.com> References: <20231204100620.27789-1-Michael.Glembotzki@iris-sensing.com> MIME-Version: 1.0 X-Original-Sender: m.glembo@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dedRnovb; spf=pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::52e as permitted sender) smtp.mailfrom=m.glembo@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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: , --- core/cpio_utils.c | 46 ---------------------------------------------- include/util.h | 2 -- 2 files changed, 48 deletions(-) Acked-by: Stefano Babic diff --git a/core/cpio_utils.c b/core/cpio_utils.c index 7049f73..0a6ebc1 100644 --- a/core/cpio_utils.c +++ b/core/cpio_utils.c @@ -807,52 +807,6 @@ int extract_img_from_cpio(int fd, unsigned long offset, struct filehdr *fdh) return 0; } -off_t extract_next_file(int fd, int fdout, off_t start, int compressed, - int encrypted, char *ivt, unsigned char *hash) -{ - int ret; - struct filehdr fdh; - uint32_t checksum = 0; - unsigned long offset = start; - - ret = lseek(fd, offset, SEEK_SET); - if (ret < 0) { - ERROR("CPIO file corrupted : %s", - strerror(errno)); - return ret; - } - - ret = extract_cpio_header(fd, &fdh, &offset); - if (ret) { - ERROR("CPIO Header wrong"); - return ret; - } - - ret = lseek(fd, offset, SEEK_SET); - if (ret < 0) { - ERROR("CPIO file corrupted : %s", strerror(errno)); - return ret; - } - - ret = copyfile(fd, &fdout, fdh.size, &offset, 0, 0, compressed, &checksum, hash, encrypted, ivt, NULL); - if (ret < 0) { - ERROR("Error copying extracted file"); - return ret; - } - - TRACE("Copied file:\n\tfilename %s\n\tsize %u\n\tchecksum 0x%lx %s", - fdh.filename, - (unsigned int)fdh.size, - (unsigned long)checksum, - (checksum == fdh.chksum) ? "VERIFIED" : "WRONG"); - - if (!swupdate_verify_chksum(checksum, &fdh)) { - return -EINVAL; - } - - return offset; -} - int cpio_scan(int fd, struct swupdate_cfg *cfg, off_t start) { struct filehdr fdh; diff --git a/include/util.h b/include/util.h index afe3a4f..958274c 100644 --- a/include/util.h +++ b/include/util.h @@ -207,8 +207,6 @@ int copyfile(int fdin, void *out, size_t nbytes, unsigned long *offs, int copyimage(void *out, struct img_type *img, writeimage callback); int copybuffer(unsigned char *inbuf, void *out, size_t nbytes, int compressed, unsigned char *hash, bool encrypted, const char *imgivt, writeimage callback); -off_t extract_next_file(int fd, int fdout, off_t start, int compressed, - int encrypted, char *ivt, unsigned char *hash); int openfileoutput(const char *filename); int mkpath(char *dir, mode_t mode); int swupdate_file_setnonblock(int fd, bool block);