From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 966E890233; Mon, 10 Oct 2022 23:32:31 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id EB3B4900F0; Mon, 10 Oct 2022 23:32:19 +0000 (UTC) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by atuin.qyliss.net (Postfix) with ESMTPS id 78BA090072 for ; Mon, 10 Oct 2022 23:32:12 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 040275C0102 for ; Mon, 10 Oct 2022 19:32:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 10 Oct 2022 19:32:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1665444727; x=1665531127; bh=rX p2B7NSveemWWonZrMEOEdQGFj40n0llisfXm0VL6U=; b=BjtsciwVMJ0SMk4mJh aeneEFQIfGgOBRNmbFjxW5RC6UTg26oUuua6P1NvbKynoa9UPbhGHe7MzvLCW0HE J8ZlCPKUBc89pnQqoidxboRzcMNsbWue3BvI5COSD8PwkQ9HVWDpswBnARjmEA2c 0iV6BRKfPiB5C81MwhhS5bTz4KiZFMJnpFEnKugPzveby/qliN/2/wihG4PK12q+ 6/df6h+LTt5p8/0WwmINjOjqYajWO8uTs9k+KYSXL9C+djX+cpi6LcKQWxP829vp ccvtdb+mus3PnqtoJKZy1yaM1thbW53dfJ7Y/Rwizrb2qZxutu6w3uPuFFNXOl+y s7sA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1665444727; x=1665531127; bh=rXp2B7NSveemW WonZrMEOEdQGFj40n0llisfXm0VL6U=; b=bC+AUkJ1s5elwUB2eBPqFwq6dEGAT NajRcml+u+SYYvs9NuEgFySGVlvNhApi5lnhV+mmp74r/+QK/lQs8SNgSIKrwSgi +Slt23LAYRGNge17W/i/J13ocXonrrcXPZLczlGAyNPLkkhBDEWQ/vtz7jrOnMFV 5OB0Zv33Frcu//oeGahkuRaUt8/dB+/T3STW534h+EyJLe2jhpp6QBVl3V2G4QtU Q1yDD0s97CHPSGy7lag2cwyHqDEJw0xz8mZYfqh5hhI/KWJd1Aj5dOHJdy9Irwms K6PfmsP0lTD6qvl9MmTazJvw5P7nlTHilZDILvqVllh9SiIpQYAYDrndw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeejhedgvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlhihsshgrucftohhsshcuoehhihesrghlhihsshgrrdhi sheqnecuggftrfgrthhtvghrnhepgfefudekvdelieelledufeevheeglefggedvudejvd dtffeuueevffehleejkedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomhepqhihlhhishhsseigvddvtddrqhihlhhishhsrdhnvght X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 10 Oct 2022 19:32:07 -0400 (EDT) Received: by x220.qyliss.net (Postfix, from userid 1000) id 05650BB3; Mon, 10 Oct 2022 23:32:06 +0000 (UTC) From: Alyssa Ross To: devel@spectrum-os.org Subject: [PATCH 03/22] host/rootfs: generate virtiofsd services Date: Mon, 10 Oct 2022 23:28:43 +0000 Message-Id: <20221010232909.1953738-4-hi@alyssa.is> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221010232909.1953738-1-hi@alyssa.is> References: <20221010232909.1953738-1-hi@alyssa.is> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: PSNSKKFTUADEX6FLHWUY3YD4PX74GVS5 X-Message-ID-Hash: PSNSKKFTUADEX6FLHWUY3YD4PX74GVS5 X-MailFrom: qyliss@x220.qyliss.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.5 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The approach of having a template service for each virtiofsd comes from the work I need on Wayland support for Unikie, hence the Unikie copyright in etc/s6-rc/ext-rc-init/up. Signed-off-by: Alyssa Ross --- host/rootfs/Makefile | 3 +++ host/rootfs/default.nix | 4 ++-- host/rootfs/etc/s6-rc/ext-rc-init/up | 11 +++++++++++ host/rootfs/etc/template/fs/notification-fd | 1 + host/rootfs/etc/template/fs/notification-fd.license | 2 ++ host/rootfs/etc/template/fs/run | 11 +++++++++++ host/rootfs/etc/template/fs/type | 1 + host/rootfs/etc/template/fs/type.license | 2 ++ 8 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 host/rootfs/etc/template/fs/notification-fd create mode 100644 host/rootfs/etc/template/fs/notification-fd.license create mode 100755 host/rootfs/etc/template/fs/run create mode 100644 host/rootfs/etc/template/fs/type create mode 100644 host/rootfs/etc/template/fs/type.license diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile index 31f76d2..249af6d 100644 --- a/host/rootfs/Makefile +++ b/host/rootfs/Makefile @@ -28,6 +28,9 @@ FILES = \ etc/mdev/wait \ etc/parse-devname \ etc/passwd \ + etc/template/fs/notification-fd \ + etc/template/fs/run \ + etc/template/fs/type \ etc/s6-linux-init/run-image/service/getty-tty1/run \ etc/s6-linux-init/run-image/service/getty-tty2/run \ etc/s6-linux-init/run-image/service/getty-tty3/run \ diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix index 4788628..7932845 100644 --- a/host/rootfs/default.nix +++ b/host/rootfs/default.nix @@ -7,7 +7,7 @@ pkgs.pkgsStatic.callPackage ( { lib, stdenvNoCC, nixos, runCommand, writeReferencesToFile, s6-rc, tar2ext4 , busybox, cloud-hypervisor, cryptsetup, execline, jq, kmod -, mdevd, s6, s6-linux-init, socat, util-linuxMinimal, xorg +, mdevd, s6, s6-linux-init, socat, util-linuxMinimal, virtiofsd, xorg }: let @@ -45,7 +45,7 @@ let packages = [ cloud-hypervisor execline jq kmod mdevd s6 s6-linux-init s6-rc socat - start-vm + start-vm virtiofsd (cryptsetup.override { programs = { diff --git a/host/rootfs/etc/s6-rc/ext-rc-init/up b/host/rootfs/etc/s6-rc/ext-rc-init/up index 1aec7fb..53ab127 100644 --- a/host/rootfs/etc/s6-rc/ext-rc-init/up +++ b/host/rootfs/etc/s6-rc/ext-rc-init/up @@ -1,5 +1,6 @@ # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross +# SPDX-FileCopyrightText: 2022 Unikie if { mkdir -p /run/s6-rc.ext.src } @@ -15,6 +16,16 @@ if { if { redirfd -w 1 ${name}/notification-fd echo 3 } if { ln -s -- /bin/start-vm ${name}/run } + if { + elglob -0 paths ${dir}/shared-dirs/* + forx -pE path { $paths } + backtick -E fsname { basename -- $path } + if { cp -R -- /etc/template/fs ${name}-fs-${fsname} } + if { mkdir -- ${name}-fs-${fsname}/data ${name}-fs-${fsname}/env } + if { cp -P -- ${path}/dir ${name}-fs-${fsname}/data/shared-dir } + touch -- ${name}/dependencies.d/${name}-fs-${fsname} + } + elglob -0 paths /ext/svc/data/${name}/providers/net/* forx -pE path { $paths } backtick -E dep { basename -- $path } diff --git a/host/rootfs/etc/template/fs/notification-fd b/host/rootfs/etc/template/fs/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/host/rootfs/etc/template/fs/notification-fd @@ -0,0 +1 @@ +3 diff --git a/host/rootfs/etc/template/fs/notification-fd.license b/host/rootfs/etc/template/fs/notification-fd.license new file mode 100644 index 0000000..5a40633 --- /dev/null +++ b/host/rootfs/etc/template/fs/notification-fd.license @@ -0,0 +1,2 @@ +SPDX-License-Identifier: CC0-1.0 +SPDX-FileCopyrightText: 2022 Alyssa Ross diff --git a/host/rootfs/etc/template/fs/run b/host/rootfs/etc/template/fs/run new file mode 100755 index 0000000..5ca214a --- /dev/null +++ b/host/rootfs/etc/template/fs/run @@ -0,0 +1,11 @@ +#!/bin/execlineb -P +# SPDX-License-Identifier: EUPL-1.2+ +# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross + +s6-ipcserver-socketbinder -a 0700 -B env/virtiofsd.sock + +if { fdmove 1 3 echo } +fdclose 3 + +export TMPDIR /run +virtiofsd --fd 0 --shared-dir data/shared-dir diff --git a/host/rootfs/etc/template/fs/type b/host/rootfs/etc/template/fs/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/host/rootfs/etc/template/fs/type @@ -0,0 +1 @@ +longrun diff --git a/host/rootfs/etc/template/fs/type.license b/host/rootfs/etc/template/fs/type.license new file mode 100644 index 0000000..5a40633 --- /dev/null +++ b/host/rootfs/etc/template/fs/type.license @@ -0,0 +1,2 @@ +SPDX-License-Identifier: CC0-1.0 +SPDX-FileCopyrightText: 2022 Alyssa Ross -- 2.37.1