unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: Richard Sent <richard@freakingpenguin.com>, 70542@debbugs.gnu.org
Subject: [bug#70542] [PATCH 2/4] services: base: Use requirements to delay some file-systems
Date: Wed, 24 Apr 2024 19:30:47 +0200	[thread overview]
Message-ID: <c995ccb5629fc07a11db60d6aa8d9b72cd5bd931.camel@gmail.com> (raw)
In-Reply-To: <91efec381997bd89208d9f4a47141ae6481fb963.1713904784.git.richard@freakingpenguin.com>

Am Dienstag, dem 23.04.2024 um 16:47 -0400 schrieb Richard Sent:
> Add a mechanism to only require a subset of file-system entries
> during early
> Shepherd initialization. Any file-system with additional Shepherd
> service
> requirements (e.g. networking) will be brought up after 'file-systems
> is
> provisioned.
> 
> * gnu/services/base.scm (file-system-shepherd-service): Splice
> file-system-requirements into the Shepherd service requirement list.
> * gnu/services/base.scm (file-system-shepherd-services): Provision
> 'file-system when file-systems that satisfy initial-file-system?  are
> started.
> 
> Change-Id: I7b1336ee970f4320f7431bef187e66f34f0d718c
> ---
>  gnu/services/base.scm | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/gnu/services/base.scm b/gnu/services/base.scm
> index 3f912225a0..af92b700b4 100644
> --- a/gnu/services/base.scm
> +++ b/gnu/services/base.scm
> @@ -403,6 +403,7 @@ (define (file-system-shepherd-service file-
> system)
>          (create? (file-system-create-mount-point? file-system))
>          (mount?  (file-system-mount? file-system))
>          (dependencies (file-system-dependencies file-system))
> +        (requirements (file-system-requirements file-system))
>          (packages (file-system-packages (list file-system))))
>      (and (or mount? create?)
>           (with-imported-modules (source-module-closure
> @@ -411,7 +412,8 @@ (define (file-system-shepherd-service file-
> system)
>              (provision (list (file-system->shepherd-service-name
> file-system)))
>              (requirement `(root-file-system
>                             udev
> -                           ,@(map dependency->shepherd-service-name
> dependencies)))
> +                           ,@(map dependency->shepherd-service-name
> dependencies)
> +                           ,@requirements))
>              (documentation "Check, mount, and unmount the given file
> system.")
>              (start #~(lambda args
>                         #$(if create?
> @@ -460,12 +462,22 @@ (define (file-system-shepherd-services file-
> systems)
>                                   (or (file-system-mount? x)
>                                       (file-system-create-mount-
> point? x)))
>                                 file-systems)))
> +
> +    (define (initial-file-system? file-system)
> +      "Return #t if the file system should be mounted initially or
> #f."
> +      ;; File systems with additional Shepherd requirements (e.g.
> networking)
> +      ;; should not be considered initial. Those requirements likely
> rely on
> +      ;; 'file-systems being provisioned.
> +      (null? (file-system-requirements file-system)))
> +
>      (define sink
>        (shepherd-service
>         (provision '(file-systems))
>         (requirement (cons* 'root-file-system 'user-file-systems
>                             (map file-system->shepherd-service-name
> -                                file-systems)))
> +                                ;; Only file systems considered
> initial should
> +                                ;; be required to provision 'file-
> systems.
> +                                (filter initial-file-system? file-
> systems))))
I'd compose null? and file-system-requirements directly in the filter –
that's easier to wrap my head around.
You then also have a little more space to explain why this composition
is done in the first place.

Cheers

  reply	other threads:[~2024-04-24 17:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 20:44 [bug#70542] [PATCH 0/4] Improve Shepherd service support for networked file systems Richard Sent
2024-04-23 20:47 ` [bug#70542] [PATCH 1/4] file-systems: Add requirements field to file-systems Richard Sent
2024-04-24 17:31   ` Liliana Marie Prikler
2024-04-23 20:47 ` [bug#70542] [PATCH 2/4] services: base: Use requirements to delay some file-systems Richard Sent
2024-04-24 17:30   ` Liliana Marie Prikler [this message]
2024-04-23 20:47 ` [bug#70542] [PATCH 3/4] file-systems: Add support for mounting CIFS file systems Richard Sent
2024-04-24 17:29   ` Liliana Marie Prikler
2024-04-24 18:22     ` Richard Sent
2024-04-24 18:47       ` Liliana Marie Prikler
2024-04-24 19:19         ` Richard Sent
2024-04-23 20:47 ` [bug#70542] [PATCH 4/4] system: Do not check for CIFS file system availability Richard Sent
2024-04-24 17:26   ` Liliana Marie Prikler
2024-04-23 20:51 ` [bug#70542] Missing reference in cover letter Richard Sent
2024-04-25  4:56 ` [bug#70542] [PATCH v2 1/3] services: base: Add optional delayed mount of file-systems Richard Sent
2024-04-25  4:56   ` [bug#70542] [PATCH v2 2/3] file-systems: Add host-to-ip nested function Richard Sent
2024-04-25  4:56   ` [bug#70542] [PATCH v2 3/3] file-systems: Add support for mounting CIFS file systems Richard Sent
2024-04-25  6:51 ` [bug#70542] [PATCH 0/4] Improve Shepherd service support for networked " Jonathan Brielmaier via Guix-patches via
2024-04-25 13:43   ` Richard Sent
2024-06-01 23:26 ` [bug#70542] [PATCH v3 0/3] " Richard Sent
2024-06-01 23:26   ` [bug#70542] [PATCH v3 1/3] services: base: Add optional delayed mount of file-systems Richard Sent
2024-06-01 23:26   ` [bug#70542] [PATCH v3 2/3] file-systems: Add host-to-ip nested function Richard Sent
2024-06-01 23:26   ` [bug#70542] [PATCH v3 3/3] file-systems: Add support for mounting CIFS file systems Richard Sent
2024-06-04 10:06   ` bug#70542: [PATCH v3 0/3] Improve Shepherd service support for networked " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c995ccb5629fc07a11db60d6aa8d9b72cd5bd931.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=70542@debbugs.gnu.org \
    --cc=richard@freakingpenguin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).