From patchwork Mon Nov 16 09:14:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1400711 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::540; helo=mail-ed1-x540.google.com; envelope-from=swupdate+bncbcxploxj6ikrbeegzh6qkgqe52yy4da@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=sct1wcRU; dkim-atps=neutral Received: from mail-ed1-x540.google.com (mail-ed1-x540.google.com [IPv6:2a00:1450:4864:20::540]) (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 4CZNh66d9tz9sPB for ; Mon, 16 Nov 2020 20:15:01 +1100 (AEDT) Received: by mail-ed1-x540.google.com with SMTP id c24sf7902285edx.2 for ; Mon, 16 Nov 2020 01:15:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1605518097; cv=pass; d=google.com; s=arc-20160816; b=SHUH6tAzNR4/S6w1C6rhcQVFu5WlxUqVSWnIicgIpMMUAV1N/l/ZJ68v1CDji6Rvc3 dgsiJLU7FlkA0PoO7c1wWMuJIeHSgNHKfeQsxWqw7G3wt7nLT4oVLQBnOafc05hxsDK6 4LUJ/7tN3VYYqplRD4R7O/zzOpLi8ZR9eXdv4E1U6s6fESKuQMA6qhMhjDLBp8jM42v8 NT+K2XFYM7DTASTcQ2+PBRuinfHlZKWaHKUK4f2ws/I3smcXl2Vh37kKwhEcqfOt8dqG zMsJ8dOURxWeMiHcl57RAXiIv8e1iSDgyw/y8fyC7MvCF1U254mUzNRND/JLvSsVdprO i3nA== 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=LugOvTfltpUQImUAQ5ITdi2zKKtjDca2nr1NypaCbRc=; b=dT7forkFHCHsjWTXY5o7OH9mmSXswz1KDAM3t49bw/Ql0bAjh01set073RrsxiaLIT fZy9syORX25ZzX+cOKvxLfabNj+Gbu7yb9lgzDzHhioh9XrjTo7tIYDTmhiByo5SDkvD JKkedhgzCO2gZmKJV17X8Zl4dhib/zXxCKdY0h0/SVKt2+L9WQE5mF8xxfNPtbNIDhEp VAnvIMIkzqWoJynuzo6D76+AZimkWgir7qydJ2jX7mXyGDRWa5nSHvsHVNk97sSRX+l8 v+o5L3M8x9HF2Xubp/u+Ec1aQymxylfAeC+kfRPPO2coGEQhP+LgXja7WnQ2YO5U9Qzj oGSA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 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:in-reply-to:references :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=LugOvTfltpUQImUAQ5ITdi2zKKtjDca2nr1NypaCbRc=; b=sct1wcRUdyBDVX/U10dWvxd1dXogYPiGRJEhNLgx2LFu/O/JnfxGZ6OFj5ewz7h41T d0FHRn9R+2jfsuCLdjmybtMiAaj72GeAthanHXSFtqKMKOEDpxcdtN6rBeNLmf4CUdVY 9A/kql7vcNZY1Ya6sFk2xdz0pNzXkGCvNWl+0PFX+0AWkeVVkGZmEsywCV/WBJ6Sc/le eL4TnKVw5M9vPgjvRdTAZgI+F7S/kvZX5mAixQR6GWc0OYn6+MNRh+KpSp012sq3/rc+ eQd3Oz7EPr6Qg70xpNaBd5qAzHAMxazIaNZy5M1zknI8sIja3Q9XY/v7jRJgj+9CRz43 poDw== 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 :in-reply-to:references: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=LugOvTfltpUQImUAQ5ITdi2zKKtjDca2nr1NypaCbRc=; b=nlWTpS+5uAqBVXUnqMpg4i+PcACcQ99yhlMye1bvIOZJp6pTaDtw4BVEZpyQ6+fO0L d/w0gaRlVN3S0PHH9xydqyzO9li8q9d74lfK8F0J9N1SCiLlLU+SfB10eWrtAnT4tXWC jZnCOTUeceyOrR8jbk6kqJDrDkj172Obf9oraQbG7el474MOSqxCwOnphQjY5IkniwC8 TwiHUgMPGE3kAMoT9Rcuyb+n9e31/ZF0qhQ+lmg31G5Tq/rGNHm6EfORT7kdxlDXepoX ZzAwef8TjSVfTPILDWlU3A2BYQA8VEb+8HABEvIzWe/+zYeyJXBhp+su1m5g042iBuxj zpgQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM532qQyPBKiOAp4HsD9HIKWTSwt7HxYS6eTtYqyPgF6PKe/LI0wbb lQB1Uag5QIMtmarjaL4EpoQ= X-Google-Smtp-Source: ABdhPJyX+EqcJHSVwiq/MMo6B0bqnGBb6G11+vGWaiX4MV7g8Z+BD3qS6cI20FFJUma3HAFGXfEz3g== X-Received: by 2002:a17:906:3617:: with SMTP id q23mr13935000ejb.371.1605518097309; Mon, 16 Nov 2020 01:14:57 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a50:c049:: with SMTP id u9ls6091444edd.1.gmail; Mon, 16 Nov 2020 01:14:56 -0800 (PST) X-Received: by 2002:a50:ed14:: with SMTP id j20mr14995399eds.247.1605518096200; Mon, 16 Nov 2020 01:14:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605518096; cv=none; d=google.com; s=arc-20160816; b=pUQcDg3DfYIPboFdQvVK0ZP21b0m6XdRz9HomaIv8KomoztElVvK8SyTKZaQvPT7N6 3I4ZjIkdqtuh00c/OwoPsLOW7SrwiT0LmHGILBfleuA7JxSdCQEs1J170oAPo2d9utMW W5YEVi9DbuUzLY3MlYe9BTPEna/fafGnWhZce0C8dknLDZhq/shGjkKLSvUM0eEJwvmm c0tH4/f0AEoX21t/6PXd7h7QuU3MsNQe9UM89kkMi8YQKqEmKoiWsV5mPkYbn3z9Ftlm V5ufgMtzClim08FvzCN5Kj/0N0sJf1/QTSOtM31i72Angq0NDGR3AfTVm5H2Vypy1XA3 +5UQ== 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; bh=1NU62j/4ZhmT14bVM4mxUL9LZYVW2JaG8Aofow793kE=; b=Z6wbj0j/0DeZCDywD4BkkFO80/Br6dsmX6ztzHeGwVKicPpcqKfmvHkg8zSt1Imet/ AEvXZ75F8fePgi2sKMihIyAiGNntsNOn43S0ykpi2j0gzNn2bePjUFfbd/JR/1cLxAlO SdzUglv7wmL+5Q2b2TbfkzdFJoytcfoIYwKW6ukARDTJPhFJQHONyn/OEgUGSvtlcKJj Y0OHCXIcJ5+nUCME9ptlxpCjG6o2i+C3MQ+MroV76fgcyfrwdCPODZd9YdB8qe0P/5pi eBliuoB3wzNtlTxcKQvfgJX/tDnghKKsScVRUqsOFOmEbbiUnw09eIW7UtQ0rHE/uHe3 9twg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 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. [2001:a60:0:28:0:1:25:1]) by gmr-mx.google.com with ESMTPS id v21si355245edd.4.2020.11.16.01.14.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2020 01:14:56 -0800 (PST) Received-SPF: neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=2001:a60:0:28:0:1:25:1; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4CZNgz6lzBz1rxY6; Mon, 16 Nov 2020 10:14:55 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4CZNgz6YVHz1qsp2; Mon, 16 Nov 2020 10:14:55 +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 4-N3xJAKfwkJ; Mon, 16 Nov 2020 10:14:55 +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, 16 Nov 2020 10:14:55 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id E3FB84540B1A; Mon, 16 Nov 2020 10:14:53 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LcAW2UCsHYHE; Mon, 16 Nov 2020 10:14:48 +0100 (CET) Received: from paperino.fritz.box (paperino.fritz.box [192.168.178.64]) by babic.homelinux.org (Postfix) with ESMTP id 4E4DF454064F; Mon, 16 Nov 2020 10:14:48 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH V3 01/10] Move global structure for installer in private header Date: Mon, 16 Nov 2020 10:14:36 +0100 Message-Id: <20201116091445.797119-2-sbabic@denx.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201116091445.797119-1-sbabic@denx.de> References: <20201116091445.797119-1-sbabic@denx.de> MIME-Version: 1.0 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 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: , The "struct installer" is a shared global data structure used to store setup for the current installation and to lock if an update is running by storing the current status. It is loaded just by the initiator of an update (the installers as streaming or file). It should be better moved to a private file instead of beeing in util.h that is included by all due to get logging facilities. Signed-off-by: Stefano Babic --- core/network_thread.c | 1 + core/stream_interface.c | 1 + include/installer_priv.h | 25 +++++++++++++++++++++++++ include/util.h | 12 ------------ 4 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 include/installer_priv.h diff --git a/core/network_thread.c b/core/network_thread.c index b565a80..698c139 100644 --- a/core/network_thread.c +++ b/core/network_thread.c @@ -27,6 +27,7 @@ #include "network_ipc.h" #include "network_interface.h" #include "installer.h" +#include "installer_priv.h" #include "swupdate.h" #include "pctl.h" #include "generated/autoconf.h" diff --git a/core/stream_interface.c b/core/stream_interface.c index 87883ae..8285c72 100644 --- a/core/stream_interface.c +++ b/core/stream_interface.c @@ -40,6 +40,7 @@ #include "network_interface.h" #include "mongoose_interface.h" #include "installer.h" +#include "installer_priv.h" #include "progress.h" #include "pctl.h" #include "state.h" diff --git a/include/installer_priv.h b/include/installer_priv.h new file mode 100644 index 0000000..a84143d --- /dev/null +++ b/include/installer_priv.h @@ -0,0 +1,25 @@ +/* + * (C) Copyright 2020 + * Stefano Babic, DENX Software Engineering, sbabic@denx.de. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef _INSTALLER_PRIV_H +#define _INSTALLER_PRIV_H + +#include "swupdate_status.h" + +struct installer { + int fd; /* install image file handle */ + RECOVERY_STATUS status; /* "idle" or "request source" info */ + RECOVERY_STATUS last_install; /* result from last installation */ + int last_error; /* error code if installation failed */ + char errormsg[64]; /* error message if installation failed */ + sourcetype source; /* Who triggered the update */ + int dry_run; /* set it if no changes in hardware must be done */ + unsigned int len; /* Len of data valid in info, data is optional */ + char info[2048]; /* info */ +}; + +#endif diff --git a/include/util.h b/include/util.h index 7d9c721..99da3a8 100644 --- a/include/util.h +++ b/include/util.h @@ -76,18 +76,6 @@ enum { RECOVERY_DWL, }; -struct installer { - int fd; /* install image file handle */ - RECOVERY_STATUS status; /* "idle" or "request source" info */ - RECOVERY_STATUS last_install; /* result from last installation */ - int last_error; /* error code if installation failed */ - char errormsg[64]; /* error message if installation failed */ - sourcetype source; /* Who triggered the update */ - int dry_run; /* set it if no changes in hardware must be done */ - unsigned int len; /* Len of data valid in info */ - char info[2048]; /* info */ -}; - typedef void (*notifier) (RECOVERY_STATUS status, int error, int level, const char *msg); void notify(RECOVERY_STATUS status, int error, int level, const char *msg);