From patchwork Wed Feb 21 08:22:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1901892 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=IFNV52AD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::53f; helo=mail-ed1-x53f.google.com; envelope-from=swupdate+bncbaabbqpf22xamgqehl6i7aq@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-ed1-x53f.google.com (mail-ed1-x53f.google.com [IPv6:2a00:1450:4864:20::53f]) (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 4Tfq5M1rx6z23hR for ; Wed, 21 Feb 2024 19:22:30 +1100 (AEDT) Received: by mail-ed1-x53f.google.com with SMTP id 4fb4d7f45d1cf-564901924f4sf1616999a12.0 for ; Wed, 21 Feb 2024 00:22:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708503747; cv=pass; d=google.com; s=arc-20160816; b=bbhfaBD5kQNsA/MVLP4ZM9Crb+6RJ/m+3pc57cxNoA3rnY7Z86QrmmyElzEKuPzXE/ I+HHaWctlPijGeoto9jtn8c+H5rAI8nsC1mKBrPaKndTvoz+zOr59E+xZPzOFYmq8C4E /v6ICffBTkAQY+l2MhZHcgjZaOK4e4hfshIfGfZEjs4R9oySaMuPElSj2W4V5VeeArXo tJRgCs57tj6A7NV+SJKVpbnlhl+JHP22UdrM26dYGHrpjGow5C+4lfBditOBPQ+D5LXL uOMNkG/hpEavLSJw3UKW3dzvyidVLg7oT3+tHCvxHb711bole20BTvotvPNNZoJg70gp ClHA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=fiXR+IrhTdNopWc0Vq1FhhnOfw5dJin/A720IaimDv0=; fh=g5VdsSTeITmfFGmzFM31+wmYi4mUj7PfLQQGHH3hJYo=; b=iDJECtekpuF3Mw7aw7YFx6dqWrP+nkJSUFkD04kO/rKuG3j1NwWIuwv3yp49//kP9l t9A5UZ34G1DrwcIPbkYpfyS9zHs17AkN5d8Ri3hR4Fz+G7uBd7mLZ49pwBydMyWZUxyJ lVtaIBqyk55oPxRvjkw3cDLd3GZOjWVZSwbwvUVy9Xo9fun8mMkRqO1VAGy6q+Y0+Lwn GYvJHUFG9F8ZeTUpqpahWHju8hRAc0CbaWEkno9NSd9RCuLzxDyqjc3URLxSJkuSBeKP z+xPgdu5DKc4TPduegTtGQ0f4Gyflxlw2Btmkz8he4JoTEl4qwAQ9eSKWFvlA8tZglxg eqLQ==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=toQB9Sd1; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.135 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=1708503747; x=1709108547; 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:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=fiXR+IrhTdNopWc0Vq1FhhnOfw5dJin/A720IaimDv0=; b=IFNV52ADVMq2bIVZYDD8JYAdxuMyg/trfFvnkUjssxpBdGIpe2/nhjSfJGptON0ZzH COBEC2XP202+7bQMZSekdJN9bmw7cEZj9xORnvaayQv+BzyABdCEv2DO8EW1ftyb16AG R9whQrWqMu+Y5uo44tmnPwxw7Lz3obLcPrLx8brSzWKc/3+xdR06tSJaQc8pIIUJuaVo qShRhOaBOycdLg0jn0QOx7LkFsZ0F4j+BzoL9b3Qtr1lNQ0Ab++2vXtGPKX0xG46krmt dZ25jafeJp2Z83J4pW7QFhSTMTT/JzHN0I2ehCVB/k99M+ln1hiJgLs8m/L/DvGU8z12 TUbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708503747; x=1709108547; 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: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=fiXR+IrhTdNopWc0Vq1FhhnOfw5dJin/A720IaimDv0=; b=nwpaPQBnT37n7mUZkdhMZqvzq32xQ7GYm0Zine4rvARc/piI1eqularCgQuV73qGz2 G2fzWOIEUVuEBhknmBHiOw4E/X3b5p7VDx7bEqY3XPmf6ehMAUcixqDgkk7NZyI5JPVI bhG5YoY4bkYmQREUN6lHRR9eS8/itfScbVx2Wmy9Ezh8Rtcx5kEHm5TbvI4NyL3NYY+M ejHp/UxKHm1emdzpE/rgQC8tpjbNHP89QGsSHNQScpyGgsqORThUECYIqse4480ipfw2 rfuXansUilBkpzBe+ghG5ypEPzEN1jln0K7aVDt/+fegzIxvVDNP/keFgc04ThSvZp0T 62wQ== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCXy8RxEo+pt7QihhU9HN5b5hPwbSk9q0C0ZYtabtPejQQ0L7O0pap5ydqTlZIZ2o2IWPv1CtKo3CB19gv1YKQ4bIYbkYXsti2NG0RROeQ== X-Gm-Message-State: AOJu0Yw3tih7AMtvWiLXBuWuyzBtRwR5UIyrhbP2V4kk3nOb7/k8sHDk 9yrASctJWJKbAfhqIf87r21+NuW7Afh/lockF2HCEtl8qPkOb57l X-Google-Smtp-Source: AGHT+IGr15ez5/fl06n7bC6jDdn1hlXZvJ7FGuxOucWEjp4MBw931FCdIRivUaB1g6unJEg5xdMirQ== X-Received: by 2002:aa7:d44c:0:b0:561:a18e:e1b with SMTP id q12-20020aa7d44c000000b00561a18e0e1bmr11001988edr.5.1708503746498; Wed, 21 Feb 2024 00:22:26 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6402:3811:b0:563:7dc3:bec8 with SMTP id es17-20020a056402381100b005637dc3bec8ls1137416edb.2.-pod-prod-08-eu; Wed, 21 Feb 2024 00:22:24 -0800 (PST) X-Received: by 2002:a05:6402:8d6:b0:564:813f:7af3 with SMTP id d22-20020a05640208d600b00564813f7af3mr4014875edz.18.1708503744581; Wed, 21 Feb 2024 00:22:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708503744; cv=none; d=google.com; s=arc-20160816; b=SZzacR5z70s3wRKTWlp93gjqkvAlA1ZfSv6AWrXtIGtHjui8+bWzt3NEwPUte3CYGs 6YxgDngpjqglkOduxr0zexIyl7ECcx4Q74CdLplazWEEcPrdbkJ+Upda49FW9d80rZMw DzTFassGPXAcSCjBVWb/lCr6fSGceWPV3oFblsW0DeYHIJOoB00TYhlENN1zG9OO3h/c dOXno5gpcOmq9v7NBWFliGgtGZqnix/rE+u1UAtF63aAeps+W5eoAQkcGPO5UPBkoYQg NF9qkEYDI1OHtHNuYlyjPZ6fCt0sz6KPeVf9xs9rvMD4TPpoDF48howA1cQPFgWcAoq3 YhXA== 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:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=8gmCup5IR0j8lJbE+d7lpC4ClDUITS1Uyu+cympBB34=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=Rxtti8JRpGSJD8LdWJ9V7MT82CxuGLWuZMZODwo6JJmjNGhFxnM7TotPyu5mcRP6Eb KkHdlM9eH18CSYgQWCAiiOXXDpN3k+TPr94/os86v6EFZGJPBaGBKEBKUIuhLMpqhwgn f+t9gpxyj7F52QEgQof6cm1g9dN9FKnT6aKVcBIiIvsnRS3pas1qfn2zYjZVs1+99eql UBitr/hKwcQcsIGXOrfsNWEbZ6IhWhyWVU7mcPB0XEpXWWgHGzpn/irrCrDXBMFLe29r iHE/K3ahC0l2ymiO4cBNJBLrDmOa7ORIZ7PdGlI5ardRrRPInz+OLKtf5IYn31ChZgR5 jyRA==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=toQB9Sd1; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.135 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.126.135]) by gmr-mx.google.com with ESMTPS id m20-20020a50d7d4000000b00563fcbe92aasi690733edj.0.2024.02.21.00.22.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 00:22:24 -0800 (PST) Received-SPF: pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.135 as permitted sender) client-ip=212.227.126.135; X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from paperino.fritz.box ([88.217.136.221]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MiaHf-1qy8GN0kFz-00fkGL; Wed, 21 Feb 2024 09:22:24 +0100 From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 03/13] image: create pointer to per install Lua state Date: Wed, 21 Feb 2024 09:22:11 +0100 Message-Id: <20240221082221.11997-4-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240221082221.11997-1-stefano.babic@swupdate.org> References: <20240221082221.11997-1-stefano.babic@swupdate.org> MIME-Version: 1.0 X-Provags-ID: V03:K1:nYcC4oXrJGd2ap+c/uRPc0OtFoma7711g0xseh30eLaMs/AelCe BeUAxIML2QgaE/hM0Pd+dah4t35fL19vW9S8NQI2OoC58moiHDYcSJAtA4jrN1xc7cFpiSQ r1y5vSUhwNAKjmKONrn9I14f0rs9c0EOeCrs/2RyF7DsPU/s6DB3X56r6rCBtUWMNNUosKI vFmPcIEEN2IChJw9bnfwQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:nFPOpfGsXmk=;bWIX9U2rp208fKInW93y7iE6e1x DRu1rrsDSRE42fCXo5ZDspf3MYQjmdhl+Wo6L8pjepeiMNSACYu5gVUfD7kB5+9R7MDYLnYJk UOjoScj9hQlolxIT2bkEHNmf79duwwysg+TImRh/XclQ95YWPdEitEyZ68rTCZN7X+m9JiRVm rqUP2X2Oh+F+oJkdqEeXtnPQfFkOln7R/86ynN0jsLTfSjRmlwNj8gkgSB4v9i6loHYmGerlj HUajvHtEjw/V4A1QZks5qpa3nfsG3Kx7W4bljnuxWlaArxeeBYgCr/IqCwoFxCuuzxwdcVFbO ukAxLV9u33t3CAF/uc/mRRBu2u0GDW0y4AFrYtBolgJP5YtDlT+LntpTmFR4Um76K55vrrR5o qQ6KLtSPLHfSpUSemQqX351gP/QKnVIbwMe5Ujj0bjqn1MsA4VMAMsLD9m4BQt6A6dcIGBZHQ okXxSaF+v4Ll5FlOB3hH82lvJU2JCEC5k53WF3Q6pjyFMYub1VBSEJX/ezj0LAFQDnPRYgYVn xwuPLd5iWJdVIwiwVaruIZJCj6X4PQ59DglSWBDBSH9jtBV3GxWo3JWRZjePImMz7d2A+86eS wG/6GuWEZgy1tKG3QvYGyg5CbX8c1GYMAC56lUVyRmjch8lpBcY3xviubCY8WminVYT1Wtcnd T9mD3g1HKSBnI9RpJfOuS2EcuMfdaRrUUyL98y0rJEmzcw1q02Comgv9p+wLDfgBfHHuSYoT5 T2iyspRrssUZHJDN7lxBzJuMhr3W3pG3ykxVRpjYlWC8l9hwoMCtYg= X-Original-Sender: stefano.babic@swupdate.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=toQB9Sd1; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.135 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: , Add pointer to image structure to the global Lua state to allow handlers to use it instead of creating a new one. This allows to call Lua functions that were previously loaded by the parser or by scripts, or loaded at the startup. Signed-off-by: Stefano Babic --- include/swupdate_image.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.34.1 diff --git a/include/swupdate_image.h b/include/swupdate_image.h index 592a886b..68d97a02 100644 --- a/include/swupdate_image.h +++ b/include/swupdate_image.h @@ -12,6 +12,7 @@ #include "bsdqueue.h" #include "globals.h" #include "swupdate_dict.h" +#include "lua_util.h" typedef enum { FLASH, @@ -60,7 +61,14 @@ struct img_type { int is_script; int is_partitioner; struct dict properties; - struct dict *bootloader; /* pointer to swupdate_cfg's bootloader dict for handlers to modify */ + + /* + * Pointers to global structures + * that are alive during an installation. They can be used by handlers + */ + struct dict *bootloader;/* pointer to swupdate_cfg's bootloader dict for handlers to modify */ + lua_State *L; /* pointer to swupdate_cfg's LUa state created by parser */ + long long partsize; int fdin; /* Used for streaming file */ off_t offset; /* offset in cpio file */