Message ID | 20231017140657.95860-3-stefano.babic@swupdate.org |
---|---|
State | Accepted |
Delegated to: | Stefano Babic |
Headers | show
Return-Path: <swupdate+bncBAABBBVKXKUQMGQE4R2PGJI@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=OG9+7hCS; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::b3e; helo=mail-yb1-xb3e.google.com; envelope-from=swupdate+bncbaabbbvkxkuqmgqe4r2pgji@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-yb1-xb3e.google.com (mail-yb1-xb3e.google.com [IPv6:2607:f8b0:4864:20::b3e]) (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 4S8wlZ10Blz1ypX for <incoming@patchwork.ozlabs.org>; Wed, 18 Oct 2023 01:07:05 +1100 (AEDT) Received: by mail-yb1-xb3e.google.com with SMTP id 3f1490d57ef6-d9b9aeb4962sf4100842276.3 for <incoming@patchwork.ozlabs.org>; Tue, 17 Oct 2023 07:07:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697551622; cv=pass; d=google.com; s=arc-20160816; b=YdCDr4VyuvCoPIsd/kM3V+DMLEFoojpxdiNZsnPW1yHgPzHjAY5HralERAIO8bMk90 HGHR9hnY3M1txnwzmb11iMZkB+PBayblj2hbyN/Q74GkCjcIJ2VWeLGXzSTah+Ui1Hk8 K/gQlXggqdpHiEwGD6XOTtJU1lGwJoArkMs/UM36mnILlS0m1HiUjXUgErkf7aW+pKIA 6Plv8aYgv19bimpPLLJ4AtFNZM0HGIeIDAe9NJe0w/NDc/I+fX4Bllg2BbdypfvwEEOi bB/fGk2hwW3DrkK6Z/NHbYaOuMvyd7yXYB8/rPJHar8rR5k+E6/NWnWD8kQNo9Gd+GZe jJHw== 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=/+kcquXHK5vVcXawRq3VPaGqG0VYgk9ceNdJjFdqOjI=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=n7Mg/4ieQnJC0gqhnEOX+kT/Wp8s8Ec5wTqueZHVL+SvOMIMq3XZE3OeBlccNV05gb PT5mRbYf92ZDzSP0SAZVya9KMnXd04c0JQ3RPEJGmAf/qPIvKsx0i2dcKA4F9SK+d1yk HwvWOwrKriZLW4y6YLjvlmrmP4cj+0tYxptYEvufdJb1mN/weyUsmRxKEkN39gc4P9Gz J3xcNT151TXNZvNI79UViLZGPbS4L7fZ4cjOU+EIJ+5AT97dp8WV3XPJUzOMn6d7oIF4 f1vm7H3b+Yk2nhyqzmMV8hl4CNW5Va8PoSaegcTiCD6fR/AWEp2aLeTdW7e/ZqX0h1rw vLSA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.13 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=1697551622; x=1698156422; 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=/+kcquXHK5vVcXawRq3VPaGqG0VYgk9ceNdJjFdqOjI=; b=OG9+7hCSSIqLCfKSXCIZCke+zk5/QBBFlJiZlGpvWrvHU+Z7FAT6kRQUF5bOnAYhVM HM8nX1DX0wc3Lp6g/vd4dNyyvZn+cTamaa6qhYHMKs2L9BNVqrAMl5Urb4kZslo6cZ1k +6mAh1tzBUalOzVkSJKr93GkcStHFO3AAOTTOrwh8OJm4LBDdomb6v2+PFGlMvn3kYxC WZoG2UwrXWyXNlb1dV12yv0aJMCFri53oJMd0w6Hnuhib8iAHj6bESygvzgkRhpoF5AW kb2FQTGZ1khnDKdd17v4nDysDfYu6nYjp2qmKDzXa4XK5goTODdDZ8fElTk4Zj+ADfmN lxyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697551622; x=1698156422; 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=/+kcquXHK5vVcXawRq3VPaGqG0VYgk9ceNdJjFdqOjI=; b=a6Jp+U0OXMETgmLX6xh8mzhm0VcgtJgQ5W7uE8MifM1zlh6AbYeHQ9JWgQ8JJFUKHm rrAfHq3Nv63psWEootOCQw+bDS0+k+Lkw+2tQDP9MXbGl67kj8WWjdL4mrmrzT1YjpbB D2ozSfSBxOjonUs8MYsAHDmvxHNq7KhwRPKssferaxnvqmZv4O10Q4MzkZVIIRn4W+6y CYLEjYybbXZhM4NdKygzEbBEawCiMNoLy+H7J2JTTUWG56tg1AzscjoPIeMeJ1uaURzk N695gJ5sGqKOJpYs27poXHxczs232Wq1pN3qVWo/4XO7R5Luclc4cAaECKtG3hd6ItRv pWXQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOJu0Ywe8Uyu6E+qGHm0iW6UTRSnU+Ulpc82S6aSX2ILFLFQiZN0Lj6d zSJXsbGv3HRA6XJKmRhNGH4= X-Google-Smtp-Source: AGHT+IGk7N98oIwO1yDBSHxOd1JROSqXK0jybPL8lxmuJrojOY4daCgxX2d41TZYZMr405vHzrZwsQ== X-Received: by 2002:a25:2412:0:b0:d9a:5a05:abc with SMTP id k18-20020a252412000000b00d9a5a050abcmr2595936ybk.10.1697551622597; Tue, 17 Oct 2023 07:07:02 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a25:d48f:0:b0:d9a:4f4e:e735 with SMTP id m137-20020a25d48f000000b00d9a4f4ee735ls589137ybf.1.-pod-prod-02-us; Tue, 17 Oct 2023 07:07:01 -0700 (PDT) X-Received: by 2002:a25:ad92:0:b0:d9b:454c:10c7 with SMTP id z18-20020a25ad92000000b00d9b454c10c7mr2387742ybi.32.1697551621495; Tue, 17 Oct 2023 07:07:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697551621; cv=none; d=google.com; s=arc-20160816; b=x/4NeINIyML+54x/W/3GmgB/nYIeOYMtjtGqvVmojSFKoyluvh8YWSLH2mHPGFT6ow kCgjZ35ZENdPea/RmX6BGl2bhtQIpU/L2mOM4kEDFyBEsJb9vn8chUzs4LKpZcyffY3x rVos2xIBXjfgdgxi0nyyMUMTubrhF9wbaAhQtZeQLXHKzC6zbtcKn0pWWhmZb3JTP513 m7DHEVMHhGvjWjRCoOYFgXJE8m8zVjVyXjItKF2xb6XHEzA0H1EJIZIexQ090/S8aKe1 2LyvmEn1zn65AfTDpiirEFO2LHAJHc+RNj1Bol48IPvDRDBG0b+iLnLa+b5J7aRKun3x 93vQ== 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; bh=FA2yo59mzoz76T7dhL5eTb4a0jvcwBo/SuTUve/g1yw=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=NoQsZV4XoNKXwS/V/DkHVnFotNusObfagt7KNWXIvahGO8pOb/3GuWZLZRSVYyHw22 3pa9TzGDmLotYOGiktAOPCpoRaaW5W2NkOh58fCEsnvy0cyHnYnei9TYzNTTFpkNXEgP 32AEcsMbyes4SZK8jDqyKMEL+kUge6dKYj4GaCaouD04Gu4aR8V00HFuE0c+Z8yRfRJs hzrcgM81Fbt2frI5x8oBNZwNLkKzhEv2HXuixt9JHib7zyFMQtW1L7fU3MOqIyFiUGL2 4VQg88BneKD8qgAt4p8Q20hwIj/DLUrhsYwhMIRVk2S8QY46H5UGtZqsB8ZYepvAwOK9 FxTw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.13 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.17.13]) by gmr-mx.google.com with ESMTPS id 191-20020a2504c8000000b00d9ae0536766si110534ybe.4.2023.10.17.07.07.01 for <swupdate@googlegroups.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 07:07:01 -0700 (PDT) Received-SPF: pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.13 as permitted sender) client-ip=212.227.17.13; Received: from paperino.fritz.box ([88.217.136.221]) by mrelayeu.kundenserver.de (mreue108 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MV6Bs-1r00HK0DoM-00S7cX; Tue, 17 Oct 2023 16:07:00 +0200 From: Stefano Babic <stefano.babic@swupdate.org> To: swupdate@googlegroups.com Cc: Stefano Babic <stefano.babic@swupdate.org> Subject: [swupdate] [PATCH V2 02/11] Store globally namespace for swupdate_vars Date: Tue, 17 Oct 2023 16:06:48 +0200 Message-Id: <20231017140657.95860-3-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017140657.95860-1-stefano.babic@swupdate.org> References: <20231017140657.95860-1-stefano.babic@swup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YAFCQ+iNH+/HGPOHszbZw2DuCWt5nOiRhYLJUrT8z/tupof4DhI8 esx3rSbqr9odMoiW81n/oRcvNuq/x4l3c5LtLBE00NcfMKjOzJanUYwYV/5pp6j+wGBg1cc6u ISHS+sjw5q3t0lg== 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.17.13 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org 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 |
Handle Hawkbit action_id and on the fly updates
|
expand
|
diff --git a/core/swupdate.c b/core/swupdate.c index 50a34fec..1625ca95 100644 --- a/core/swupdate.c +++ b/core/swupdate.c @@ -50,6 +50,7 @@ #include "bootloader.h" #include "versions.h" #include "hw-compatibility.h" +#include "swupdate_vars.h" #ifdef CONFIG_SYSTEMD #include <systemd/sd-daemon.h> @@ -318,6 +319,11 @@ static int read_globals_settings(void *elem, void *data) "preupdatecmd", sw->preupdatecmd); GET_FIELD_STRING(LIBCFG_PARSER, elem, "namespace-vars", sw->namespace_for_vars); + if (strlen(sw->namespace_for_vars)) { + if (!swupdate_set_default_namespace(sw->namespace_for_vars)) + WARN("Default Namaspace for SWUpdate vars cannot be set, possible side-effects"); + } + get_field(LIBCFG_PARSER, elem, "verbose", &sw->verbose); get_field(LIBCFG_PARSER, elem, "loglevel", &sw->loglevel); get_field(LIBCFG_PARSER, elem, "syslog", &sw->syslog_enabled); diff --git a/core/swupdate_vars.c b/core/swupdate_vars.c index 5d2f95ab..4dd97ff7 100644 --- a/core/swupdate_vars.c +++ b/core/swupdate_vars.c @@ -101,3 +101,13 @@ int swupdate_vars_apply_list(const char *filename, const char *namespace) return ret; } + +bool swupdate_set_default_namespace(const char *namespace) +{ + if (namespace_default) + free(namespace_default); + + namespace_default = strdup(namespace); + + return namespace_default != NULL; +}
Namespace (see also libubootenv) for SWUpdate's own variable is defined in configuration file. At the moment, SWUpdate will support to write just into a single namespace. Most processes do not need to know it, and it is ok to define a default mechanism to retrieve the namespace. This patch adds a singleton for namespace. AWupdate will store the selected namespace at the startup and will use it in calls where the namespace is not set. Signed-off-by: Stefano Babic <stefano.babic@swupdate.org> --- core/swupdate.c | 6 ++++++ core/swupdate_vars.c | 10 ++++++++++ 2 files changed, 16 insertions(+)