From patchwork Mon Oct 9 16:18:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1845323 X-Patchwork-Delegate: sbabic@denx.de 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=QvY+XfSO; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::13d; helo=mail-lf1-x13d.google.com; envelope-from=swupdate+bncbaabbv6pscuqmgqeh44ojmi@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-lf1-x13d.google.com (mail-lf1-x13d.google.com [IPv6:2a00:1450:4864:20::13d]) (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 4S44322tDSz20Vh for ; Tue, 10 Oct 2023 03:18:36 +1100 (AEDT) Received: by mail-lf1-x13d.google.com with SMTP id 2adb3069b0e04-5041a779c75sf3988101e87.2 for ; Mon, 09 Oct 2023 09:18:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696868313; cv=pass; d=google.com; s=arc-20160816; b=UJDk3pFTw0B9M/0WPecf5hVbbQ8rIagU+GSz23aIXbln0e050JizkqiXCU6I5rtJRn fGESfO2ajzouIYuDCmYJ9qCYXpoT8rOBTDlUCQXWxqSXwos7e0WhaKVfzy5TsGjuX0ui ybL1g6jJq24oaogHjRctjtUXH2lX4+RdmSpsC41BCpiBtza1JBboRT2D5SckVezjrMN3 q+/qBRqSEk/zRuUhidWk/Gru98E0rwsDLJ0Nt6jQbPXkaJojSKSrn4CzdWvycfaESVcT FhA57ByYQU6eelzkIGW2lwsJTKbSqgzgaecNmMYlLv1jT02F5AaIxNkAwK5+r/6VoGnY cE5Q== 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:ui-outboundreport:mime-version :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=CdCzwDFUJrtB7ymrzN6t+w1sFuZA48GQZvuQap/gWIA=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=jfEyhaNKpf2BSUulTEGCGvNmvkRRmlrRM4eWDGbjnVkCt5qC4xNlxNHlQYgCqooCL3 VMB6STJVBAr+UK/CUr59bQB8xQZ3Exwb4P3mlBoryFKcI6aHgfJRI6i9RcUqiLMHY5Xz AnADtWNX3VbCqYX6uG/OSTVePksd4TRPVQsnMkZ67tNxBObqOsnFRM0JMII6IHEc0heN aE7O7i/Lo7Rh2H/1UzhNI/lTiiEYEIWJNBTdiMdLKcS1ESSkS4VEZFBA5IRuMTcq3USH KNMkXqKMLj48l6joLoUZyGesA+JAyC54ATwyePgTVwCKaQ9Xpnp+HqDFgHpL4wicRD7x jX1Q== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.131 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1696868313; x=1697473113; 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:ui-outboundreport:mime-version:message-id:date :subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=CdCzwDFUJrtB7ymrzN6t+w1sFuZA48GQZvuQap/gWIA=; b=QvY+XfSO7JwvyCjHRxhzKsB/XIO2gYC4cwmTOmsFi1T0ArJF/56JLC8LBZ80qwnwVJ IYpUS+ugoABix6trDxffJW4L1fWKLho48wAf5hx8QVYtcIrBh67EBJRMVX5gmK/7YOmK R0AtVTub00HUD0uEEAbQYTGl9RKfmxA/0CfeGhe7inv0ulhI0P3QEDO1tN+xuqy7610v zGeaRTig1b5uh0WnBKkLCDFadpDjHkep3YnwP6pOJctOhGvPFcCdif9w73uIegNhxlxE T6WUGHC1lM9glnOE0NfYIEeepI+q3HL1AFR9CoE44DSy3oa6ekx4DmGVsAC7qTea2Dp0 0STw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696868313; x=1697473113; 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 :ui-outboundreport:mime-version:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=CdCzwDFUJrtB7ymrzN6t+w1sFuZA48GQZvuQap/gWIA=; b=Bt9CFqgHWXoqhop/Bbz4k5Gy9J0mE4KXVDldLsbUNnDfN3eN7tfFlGFjNE714MeGGh H6N69rHXb7PXWNJY8cZEIX26cMaxBwloY8rtjjvnCegNbL8XYduGIXlNBhdtf2qegnIH uHp/ESMS4B8cWM0Pl7Sxe37TtYhozL7Ak04cAUFQHDVr5N0RfAWBnvrh5rb3JmAOcZG/ 2+FoeGHqTKr2HDtaOvmg9drHqvb9F/scaHvsxZyL+vq8y9wt4n4vUzlQ5K2K64dUP30l aS3rFb9PQ2aK2f0Z0wMj5gyvp8/7u7x7F5V4o1iVzmSHBuQeVjUDXqr3vZjj+eYndmqD 4suw== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOJu0Yx182gJ+T/m/7H6nQjpBMpK1sqvYqLTPJdysftaD3OB3AFshW02 JaU7EORUL2NT74tF/tT+s9E= X-Google-Smtp-Source: AGHT+IFxTsOwbCjK7c8vBA6tmfoTnVCAw2BWlimpeMvWFp3PkbAsYOVqAbI74aWS6eQ74spN/fp9aQ== X-Received: by 2002:a05:6512:4026:b0:500:94c5:6e06 with SMTP id br38-20020a056512402600b0050094c56e06mr17534204lfb.56.1696868312997; Mon, 09 Oct 2023 09:18:32 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a19:4f47:0:b0:504:21fa:eb91 with SMTP id a7-20020a194f47000000b0050421faeb91ls1127428lfk.0.-pod-prod-02-eu; Mon, 09 Oct 2023 09:18:30 -0700 (PDT) X-Received: by 2002:ac2:44cb:0:b0:4fe:279b:8a02 with SMTP id d11-20020ac244cb000000b004fe279b8a02mr13156336lfm.67.1696868310437; Mon, 09 Oct 2023 09:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696868310; cv=none; d=google.com; s=arc-20160816; b=TM8G3qj1C4HThgMibA6eHjfXpWX2/vkr+CpYdGYLA1wp+scxTvwuMcHQNaGYshnaJh s4uZgaxe+3XdvFHkR0hZbplyQszGDZafPBpRDx2Q5hP6LK+59tN2178mcF/VlkRnYkjE pggcIuunUfWtyeK5loQfvlunyHNCW+NpHgNiLsjN8nRUAyYI4cYmyGchoo6ZajuWBJ+K mxsHjtwqd7arsADuNWaMbuTPTABqhm6gP4RSAjMG3D8w0NQJkNLXaGRQ2HsfWpcg4+hf N948kaukXByXnEGhY396v91taIXCE7ByYEp3rtdU4iY97x/E5K9Pp5fPxtcn8H2x58lW zlIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version:message-id :date:subject:cc:to:from; bh=L4JfEi3FEaEer8LP3nbrJ9wdxkEa2UdEf226ai+62og=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=tKWB7kLQUJkqf8Lvsv9Pe907oLtT8mUsdifPKfL/JLwJZ11qkJ1vsR5dbMdd+/wR4p ffBUf5W1vN9TNP7WWpGkgqb5hTllCdFIrxtxDbb+L8soCqxjaf6PxIGFLL/VK8Aq+4NC 9b51f2V9n0g7hFHKLI+aNMTrvcjJLEc1ljpQoU1wMpHZETEu72aQ4uXdoNefIDAKr665 NZCW6Gs9Cs37hDDwsPjLh2wmnDx9QuDaV/jmEMyIPT5HuEx9QtM4ID6hz4EnmEwvjlA8 pLtwu/wbggF7IQaYW3/UinHte32h+G7X9hF/a8KZpyUGPepuZ+2pjbwRYq6LZY4EHADE U4HQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.131 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.126.131]) by gmr-mx.google.com with ESMTPS id d7-20020a056512368700b004fe3ba741c8si395833lfs.8.2023.10.09.09.18.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 09:18:30 -0700 (PDT) Received-SPF: pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.131 as permitted sender) client-ip=212.227.126.131; Received: from paperino.fritz.box ([88.217.136.221]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MwQKr-1rg3bk2yOL-00sQpC; Mon, 09 Oct 2023 18:18:29 +0200 From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 10/10] Relax dependencies for hw_compatibility Date: Mon, 9 Oct 2023 18:18:27 +0200 Message-Id: <20231009161827.422108-1-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:GeO54ADNb7Rdew5jn8/gwIwwztGZR5A0ZQ+mBkcYk+VHYkiCaQl 0tYhLq2kHPqmT6hJ1kT18pypTz7865hztdwwjm+Tra5usc3R/KVgWObhBVpfLTf8Ui3KXHS qoHUyYDN/7bfjKHbisy0DsY72E4xm3lChCj5ggZOBCQycjl1SwuGdYEp+0FSXBCerAO6NNj XE1oy554R7GmloHHBJmSQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:/RzW4zGLhdU=;5rUxyedk8UAv0G/enX2yd4zuai6 c8UxQPqDQdkloJf+sZBRXsE9lRoR5WFB6BcD4bz89KlMiyMO854VKoQG1YBePiy5X0cT3ml3t Wm4BHhPRq814ZNHqbkX7ShdJ2f1CX+Nf7jFpvB8H2nMDrvN6HnI3rBXdSVawg/F+Fs9t1HKv7 FgIZ83DMG5W/TrTHhVsENCqlICUm+WffsejLcBrSr+hgn5o1ISaMgamYerr6ZNmrAzQQQsF2B j9CAkbF5S1BuPp0AzQzZTkOGX9dGy3OKdtUu7GPqSZkfLv1HqqJLykLdnFO3CLgyD16wuQkZF yXHiByME5xQmKyiF8Re3NtYZsQkawKU2pYsy/VB/czV/FEqkVf53Of2woEK6p7+jEDqHCEMb0 Jy9S3BjgSsSpkOpepyTsuflWbzNnvX1HGvpDgkuZcmiFf5bxxROz3e2osP53eYKYp5X5pFAUI 5N6gFfCSHYWoeeJX7SRnlwJjGoVZM/8+FkWlXE8FkTzqxuu6pvhDRQ/d1Hgogap0NYKmGBaA4 w1oQQjIsNEZeQNh4oBCPoMPQBdqZ1VUIZoHJHIiaTpd8tp9EROck49ajsTIEFxs60pbMxMAr5 O2CWs3Zig7AFJsAD5Zi20YDFvfKcGLdLhJGB60kJSst1DkF8eAWGQinteBjSczYuNmaWVyF/A OvVO9UNs34JTjTIkJ4kISUPti4I/dscQ5CYCkQ+k+56aXapHVvXN2ya2K/2/9v15i0QYw0PGa Xg0ZN+yEYpBYK+bnnXcub65bvf9vyh9nc449WrigQy46ItgOSl6qKfQvIpLIr2QUzf66GDeQX TgqkM1F4shmDY3i48/7CSTd8yewAwuLllPL7F2/2bPit8ofazW6uQpI9wgrwz1ngMdz5dPsTD sYk1GcHUp0ClAQA== X-Original-Sender: stefano.babic@swupdate.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.131 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org 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: , Drop dependencies from swupdate configuration and just pass hardware related structures. Signed-off-by: Stefano Babic --- core/hw-compatibility.c | 14 ++++++-------- core/stream_interface.c | 2 +- corelib/lua_interface.c | 2 +- include/hw-compatibility.h | 13 +++++++++++-- include/swupdate.h | 9 +-------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/core/hw-compatibility.c b/core/hw-compatibility.c index 7c6cd253..34a27cb6 100644 --- a/core/hw-compatibility.c +++ b/core/hw-compatibility.c @@ -10,7 +10,6 @@ #include #include #include "util.h" -#include "swupdate.h" #include "hw-compatibility.h" /* @@ -18,19 +17,19 @@ * in the sw-description file */ #ifdef CONFIG_HW_COMPATIBILITY -int check_hw_compatibility(struct swupdate_cfg *cfg) +int check_hw_compatibility(struct hw_type *hwt, struct hwlist *hardware) { struct hw_type *hw; int ret; - ret = get_hw_revision(&cfg->hw); + ret = get_hw_revision(hwt); if (ret < 0) return -1; - TRACE("Hardware %s Revision: %s", cfg->hw.boardname, cfg->hw.revision); - LIST_FOREACH(hw, &cfg->hardware, next) { + TRACE("Hardware %s Revision: %s", hwt->boardname, hwt->revision); + LIST_FOREACH(hw, hardware, next) { if (hw && - (!hwid_match(hw->revision, cfg->hw.revision))) { + (!hwid_match(hw->revision, hwt->revision))) { TRACE("Hardware compatibility verified"); return 0; } @@ -39,8 +38,7 @@ int check_hw_compatibility(struct swupdate_cfg *cfg) return -1; } #else -int check_hw_compatibility(struct swupdate_cfg - __attribute__ ((__unused__)) *cfg) +int check_hw_compatibility(struct hw_type __attribute__ ((__unused__)) *hwt, struct hwlist __attribute__ ((__unused__)) *hardware) { return 0; } diff --git a/core/stream_interface.c b/core/stream_interface.c index aa971d2c..d9afa4af 100644 --- a/core/stream_interface.c +++ b/core/stream_interface.c @@ -183,7 +183,7 @@ static int extract_files(int fd, struct swupdate_cfg *software) return -1; } - if (check_hw_compatibility(software)) { + if (check_hw_compatibility(&software->hw, &software->hardware)) { ERROR("SW not compatible with hardware"); return -1; } diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c index ac2b82eb..0ef8f87a 100644 --- a/corelib/lua_interface.c +++ b/corelib/lua_interface.c @@ -23,7 +23,7 @@ #include "bootloader.h" #include "progress.h" #include "swupdate_image.h" -#include "hw-compatibility.h" +#include "swupdate.h" #define LUA_TYPE_PEMBSCR 1 #define LUA_TYPE_HANDLER 2 diff --git a/include/hw-compatibility.h b/include/hw-compatibility.h index 21e73818..3c2dca82 100644 --- a/include/hw-compatibility.h +++ b/include/hw-compatibility.h @@ -8,9 +8,18 @@ #ifndef _SWUPDATE_HW_COMPATIBILITY_H #define _SWUPDATE_HW_COMPATIBILITY_H -#include "swupdate.h" +#include "bsdqueue.h" +#include "globals.h" -int check_hw_compatibility(struct swupdate_cfg *cfg); +struct hw_type { + char boardname[SWUPDATE_GENERAL_STRING_SIZE]; + char revision[SWUPDATE_GENERAL_STRING_SIZE]; + LIST_ENTRY(hw_type) next; +}; + +LIST_HEAD(hwlist, hw_type); + +int check_hw_compatibility(struct hw_type *hwt, struct hwlist *hardware); int get_hw_revision(struct hw_type *hw); #endif diff --git a/include/swupdate.h b/include/swupdate.h index e473e411..9e48d04a 100644 --- a/include/swupdate.h +++ b/include/swupdate.h @@ -15,6 +15,7 @@ #include "mongoose_interface.h" #include "swupdate_dict.h" #include "swupdate_image.h" +#include "hw-compatibility.h" /* * this is used to indicate if a file @@ -27,14 +28,6 @@ typedef enum { INSTALL_FROM_STREAM } swupdate_file_t; -struct hw_type { - char boardname[SWUPDATE_GENERAL_STRING_SIZE]; - char revision[SWUPDATE_GENERAL_STRING_SIZE]; - LIST_ENTRY(hw_type) next; -}; - -LIST_HEAD(hwlist, hw_type); - struct extproc { char name[SWUPDATE_GENERAL_STRING_SIZE]; char exec[SWUPDATE_GENERAL_STRING_SIZE];