From patchwork Wed Oct 30 10:15:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 2004090 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=AmwCp2AW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::23a; helo=mail-lj1-x23a.google.com; envelope-from=swupdate+bncbd2zdgn6sekrbxeorc4qmgqe72hgybi@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-lj1-x23a.google.com (mail-lj1-x23a.google.com [IPv6:2a00:1450:4864:20::23a]) (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 4Xdjh4379Lz1xxx for ; Wed, 30 Oct 2024 21:16:03 +1100 (AEDT) Received: by mail-lj1-x23a.google.com with SMTP id 38308e7fff4ca-2fb6509b841sf4131351fa.0 for ; Wed, 30 Oct 2024 03:16:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1730283358; cv=pass; d=google.com; s=arc-20240605; b=Zj4oG56hQX6YR/bTfg6x+pYg4Fqx2El9yWgFW6MUaMXyk+lFBgcsK2jfOYptOecUa5 n/4oTeCFC9yymIEzJXJGvhwV8a6Fc/7SD5we7JSHoNhj6BbqD0QUEjOs+Jg5yEmgoYLj 8/ZIUVGplx052NkjowID9M8UnEXZ/w50+CckU0asL3iSRzx3apoXq9x3c9CdUrpOHjRe TZMvNdDJFpfqiDKxEb+WKsO3Fg0lU4kvjRqIgSNHvydF83DXbHPovmq2UkwlOJyA+5sw fxuj2uG5B38/6xuGyPTjZJUhs3Gyb4Xu/yf8evpq43GXrTke98x0k61eLKZUui3FgM8O 639A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=v8pyerop526Qqau0dmSREgXBnBU95i2y0xfG44iOO3s=; fh=jPfOx+7miaP5dRqou09mD0v+yC1zFDIEcaP+7THB5yY=; b=Wx4o40sU/1MQJEqIWF1ze1LiL44FO4gT0LUBdiId4aJMkw2DryxAEnE9sUM5eSFrIx /hk9mCFL3fDo/gi98VX0ZaLbU1GExShptVuHO0JfcH6Rc8i0Q6HNiPv723fiFHtHaux3 sNfki8+b5BgfltvQzXU6gClj0XNsQySa42xTFHkb49blgTcGHHf5LOZ3PEIMbSfqafTk lGt/4WkPDoLYLQRlaPd5eTlhuKOuhd/rnZwjrO9DTCgD7uhp/XDiU5DcARR6QWRsZry9 sMiua8G6SLL5LE6UTlqPEZIN/CIO88hPO0ZjaothIE9g7nnwRVo543YakThvrevPTVp5 gaiQ==; 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=ug59D0ZT; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 217.72.192.73 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=1730283358; x=1730888158; 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=v8pyerop526Qqau0dmSREgXBnBU95i2y0xfG44iOO3s=; b=AmwCp2AW1vKw0miUUINIaGJSrXGZyP171qjbqlm5Ej17oDetMpOKFHf4h8ah+/AhX8 X7AxjipF41JGwxuy2ghYePI9BM6xngIvokmPJLzMw+qAbVCJTQHMv2t/yGXQy0CXfeGX BVDRFy32K2hA4VTOHCpakcOwfw9fhDxCQmb4bRA6Q/Bses8Y4zR/gxmfYDQA1+DC1etx AW8LYWVUd+MJG7JrFa8b0D2k2Jsrmp9pns+2biNMyHHqx/5WZejEu0ICFFqZRac3BZeU eE9moEFBqBgXANHqVoqfUFCLJcpvOnFd8MhYz84NQ9FmSvuBXZ4RFSBaH/7sXIDCtf8H CgXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730283358; x=1730888158; 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=v8pyerop526Qqau0dmSREgXBnBU95i2y0xfG44iOO3s=; b=bn9CHQFTsuKYsEGgn6Vk1usbllN01447y7tb8qq+fEImxvxYfgreFZeBzvcHCjBJbL peJ2P4CcHEfxjMR+HvT3qwsAwuKczpWMFbwbnqHHmIhFtVV/VZvQaz5xzJ5wniNQcXWX rDTP2cHQO6dpgDthyUNeoDcLyt9Rik7xraXxjifyHvUztDZm5rT4j+6OxH+pQt7WM6vC 3pKHexblGasJ5GnJJ0pDtqOyn2T7RruLMch8xkTMpLg5Ptbzb4bvd/gn+8GCEMIMZxqP 2ZywPVxjczugZwFDhpK8MZQt17D2cONK5QnCFS742EySBAtblkhsCjtanm2TMdYaLmhK 6BVQ== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCXJ5WsFNp0cbmX4XQEYdwy+GkWI0h5LIJY2Hw7b4b4OhguJAvm+vapezNAqwlHsfX990P5GSRMKRg==@patchwork.ozlabs.org X-Gm-Message-State: AOJu0Yw3tQE5R7EcQ0Ry6zQ2VAUbXBifCRjTeRTpLk/TkO3uYspoe+Fz BkCNve6aFQRYp6fSH3ydEWSFhhQqF8CcFHYcBf2mC0i0hWOdp0MZ X-Google-Smtp-Source: AGHT+IFy9Z5m1sGsN9zSiZaALNS1J5t9GXe1ZXw7XcaPeKuLJU9YD/IXF+HagIjXcOpv1iCERy+AfA== X-Received: by 2002:a05:651c:908:b0:2fb:607b:4cd1 with SMTP id 38308e7fff4ca-2fdadcad62dmr6541361fa.21.1730283357920; Wed, 30 Oct 2024 03:15:57 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a2e:2a83:0:b0:2fb:4dc3:c903 with SMTP id 38308e7fff4ca-2fca5965b98ls52311fa.1.-pod-prod-00-eu; Wed, 30 Oct 2024 03:15:54 -0700 (PDT) X-Received: by 2002:a05:6512:2389:b0:53b:488c:fd37 with SMTP id 2adb3069b0e04-53b4942ae16mr2015694e87.12.1730283353960; Wed, 30 Oct 2024 03:15:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730283353; cv=none; d=google.com; s=arc-20240605; b=L5mmNbbMUVYcsyR5LwDW95w5pU7kzABLzcpEZq5/4sOVZFHJ9wsLkKJoMZ5++OoCWs TibyVAQ8eJzGCHSBTTrM/e+qlg5UPYbjjw8pGenONU80qSl7zkWv0prnGyAh3dHMamjs 35AhYtyFlJHbPSLtc9MKCQvXIMw14i2I+a+pi3/qXBoWVQkzZOvsvLj1IPaOrLbcvM/+ Qbr3U50Uaa+Sg2bRJQQj+999TS/UJzWGOD95tbMMDfYkUK8jE8KyEqStK+BohYaZBP9h y5nwJXPWJIViEyCSvuHZTesEtEEeGxHMWtob2pN0WXHY1trIzvsfDxW8x5+dVTRrol5B V0Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=ui-outboundreport:content-transfer-encoding:mime-version:message-id :date:subject:cc:to:from:dkim-signature; bh=5IPOzR4UXovdRkwmHyWdcNSVgA/1rEYizKoQTeRPits=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=TSJE8XIrmjhoj+sM4m0pdoabXCqUK7ZMVd+NZSKvtlAovaIOmGgObiqDV9ufBIUPBC F8NMdwd/sUJYECdm6cQyevRiWd+LE5ebGPPfVE8mrD4lmwB2OLZ5LzVWljA9OkxMN1Ub PM5Rv0vArobQKtnIlq8r/DLLSXAiCCCJJD5As/2S/604razvi8wrVu5ti/wJcrLWhIpX sc1WewOWnGokmy92gyaR67v7ndpDROmM7mwdkt2LM7S18b8xl9gth/D25o3qeZq9Khvw 1/0RRu/8YcrAzogW6dqYG/TW522p4jfGlkHq3kvfrYwBkc//Negz2TSAlrKyis7CqljE 8L7g==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=ug59D0ZT; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 217.72.192.73 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mout.kundenserver.de (mout.kundenserver.de. [217.72.192.73]) by gmr-mx.google.com with ESMTPS id 2adb3069b0e04-53bb838e367si26420e87.4.2024.10.30.03.15.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2024 03:15:53 -0700 (PDT) Received-SPF: pass (google.com: domain of stefano.babic@swupdate.org designates 217.72.192.73 as permitted sender) client-ip=217.72.192.73; X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from paperino.fritz.box ([88.217.136.221]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MkYsS-1tZPkt0XPS-00nl2l; Wed, 30 Oct 2024 11:15:53 +0100 From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 00/10] Introduce BTRFS Snapshot Handler Date: Wed, 30 Oct 2024 11:15:40 +0100 Message-Id: <20241030101550.21014-1-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:usWz53UUBNMmChJ2cOwsg3oGpc3yJcOeDfEKCYpH/xULu6zIIvV 2QauesNelDwoO3iSLtl72E+aOIb2xLd0FLv3vA5SiLtbriMyicUJwxVTFgsfb3SJrzBIoP1 MYGONrIiLmk3/PddaURP/2CDOguJe6vcFfwUjq/LeZqLRXdGmlymVm+LG4gd4bYHkZfj/Nu cF66XUFm7GR9vwmWBtUUw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:feP9Xo9ctIA=;GFKuMOhSI2WcHjicNfVBuW4Uhij rnsZlqH7IT1wiwu3DhRP0af/PmdFtsWI/NuUH3/4YMn7qfrPtBL2Pt7O5JbOf73Am8PTfOzmW 6ugi/n/tYsizDpy2hnQqjMGZejWrY+BWEkEq91sKzCfMBSOXwMCwZCE4S39B+bEkeNJSEKw/s kVdAyPiFHi3f3eVh2WT11nDgYFIPXsm+D4AOJShfCNx2fCu/dyMemYfyYO7Z3OLUP6t5cVjZM 1VKzjdJt4txlQNe0DDVe1/FrhEUl20u0Y1amN8L01u+UZo1JPb4xsxYD9an53tMzUAclQFGiP pNweP/B0QFKH7IXgjTGW/pql4J0wYdEPTnDeEdWSNefHKVu9fVqJAhz3rVIe3UDQahahxmKY4 N+YfZLBzHmtTNmXIVuinjGyuMp1D5KNY8nBSpmbVCOVZ6YuvQk2/ZRlOWoI2nDx9blz3VU83N F+x0U5JWo+JjpWoQENl+84Rb4mAWQgLeMoM2YviA4tPabPLnz/JLPo5w0rT/ID5UgiM9Bljm0 Y7UkV0kUcPAtybSCjrrvSpooQ17aJWr08w6P+nbZ2p+vBHZyuhxCoG60pTR3y9VAAT5ay+V15 ZallqB7LFfQTiGZf+6lXGCKLFqhxCOWKvwCCMO+KYt/5pYM6ING7RnC0UPOqvgAncAWpVX2pA 5EpxRwHLPKV3TZl385iV/KY1ZfpnEounZmXz7dsVWe+NePXd04v9ZyFlHIm2t0vmLPHiTVKZX WdnY5k1fAENP0NjaC5rwkR1+ZUGb7SHIQ== 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=ug59D0ZT; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 217.72.192.73 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: , This adds a handler that allows to stream a BTRFS snapshot and to install it into a BTRS subvolume. The handler, due to missing API for receive in libbtrfsutil library, requires that the btrfs utility is installed on the target. SWUpdate executes the command internally by creating pipes to drive and get answer from the btrfs utility. The full-blown output from the utility is intercepted by SWUpdate and added to the internal log. As side effect, the infrastructure to support btrfs can be used for any external command that accepts a stream from stdin. The "executor" handler is part of this series. Stefano Babic (10): util: introduce generic mount helpers Make use of introduced swupdate_temporary_(u)mount Cleanup: use bool instead of int for mount option Cleanup: drop sdup fuction Add helper to concatenate string Rename chained_handler.h in handler_helpers.h Factorize callback to transfer data via FIFO BUG: fix data transfer in callback used by docker Pass a stdin to run_cmd btrfs: introduce support for snapshot with btrfs receive core/pctl.c | 23 ++++- core/swupdate.c | 4 +- core/util.c | 89 ++++++++++++++++-- doc/source/handlers.rst | 54 ++++++++++- handlers/Makefile | 2 +- handlers/archive_handler.c | 13 +-- handlers/btrfs_handler.c | 115 +++++++++++++++++------ handlers/chain_handler.c | 49 ---------- handlers/copy_handler.c | 2 +- handlers/delta_handler.c | 11 +-- handlers/docker_handler.c | 38 +------- handlers/handler_helpers.c | 181 +++++++++++++++++++++++++++++++++++++ handlers/raw_handler.c | 11 +-- handlers/rdiff_handler.c | 7 +- include/chained_handler.h | 15 --- include/globals.h | 6 ++ include/handler_helpers.h | 32 +++++++ include/pctl.h | 1 + include/util.h | 4 +- 19 files changed, 487 insertions(+), 170 deletions(-) delete mode 100644 handlers/chain_handler.c create mode 100644 handlers/handler_helpers.c delete mode 100644 include/chained_handler.h create mode 100644 include/handler_helpers.h --- 2.34.1