From patchwork Fri Jan 3 17:35:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 19561 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4AB0F17979; Fri, 3 Jan 2020 17:36:41 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 0FA2417979 for ; Fri, 3 Jan 2020 17:36:41 +0000 (GMT) Received: from localhost ([::1]:55248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQsK-0007WN-E3 for patchwork@mira.cbaines.net; Fri, 03 Jan 2020 12:36:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37452) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQrl-00077B-F1 for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inQrk-0003Cj-3y for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35438) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inQrj-0003Ba-ST for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1inQrj-0008Gx-QG for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38902] [PATCH 4/9] services: nfs: Allow pipefs-service-type to be extended. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jan 2020 17:36:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38902 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38902@debbugs.gnu.org Cc: Ricardo Wurmus Received: via spool by 38902-submit@debbugs.gnu.org id=B38902.157807293331676 (code B ref 38902); Fri, 03 Jan 2020 17:36:03 +0000 Received: (at 38902) by debbugs.gnu.org; 3 Jan 2020 17:35:33 +0000 Received: from localhost ([127.0.0.1]:41393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrF-0008Ep-JU for submit@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:33 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21156) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrD-0008Ef-Q8 for 38902@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:32 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578072929; cv=none; d=zohomail.com; s=zohoarc; b=aP5Ts44eRvrA17uDE9MLUCyWcjBNS4lxVmxhqnNzMbElPrKzRPQ2+Kr6H6HCiwtJeOt0HbAsg/TqIGoyfkD4Pg4k63c2yEBY3GF+d3KU72xfXu1u9WFFvciaFW1/yu9RvKsD76z8M10CkmccPNKGNT64EAY1BrJ6zq8DPK3V74I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578072929; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=5YthAeQPn05rEtRBi3MOB1thMHytLr1DmnmYxJnfQws=; b=nTzFZXMa0JkQuFd4ul9V83N/MHwHHWBeoKeJJnSIhYKhbo4IQwp6el2w1IXOMM0KnddARg/W3WSTtFF8fdRmDo5W5KEjgQgaP1wtKcJwg20ZVCIt1HSuZbgoAOb6I3t5vrc64iCMf/8385zBgDWLEj5V/UeG98kCgdqeGkHyoVM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1578072929; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=5YthAeQPn05rEtRBi3MOB1thMHytLr1DmnmYxJnfQws=; b=O4Bx3AwwQzyg9CzPu3Pixa/M4PnWMW+j8VNImIVRl9mXktfKQ0tRQtwaRuMxf+Sv XOxdbWolKr65Z+oYIfpft4NXH1K63cj3cAaGyAEuxjKvsdiqo7p8Ay+UReS0cBQWzB1 2gk1bdhbf0PmcG34n978LT3MJysh7Dl6rZpdInw8= Received: from localhost (p54AD4FBF.dip0.t-ipconnect.de [84.173.79.191]) by mx.zohomail.com with SMTPS id 1578072926833808.040745756275; Fri, 3 Jan 2020 09:35:26 -0800 (PST) From: Ricardo Wurmus Message-ID: <20200103173506.9779-4-rekado@elephly.net> Date: Fri, 3 Jan 2020 18:35:01 +0100 X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200103173506.9779-1-rekado@elephly.net> References: <20200103173506.9779-1-rekado@elephly.net> MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/nfs.scm (pipefs-service-type): Rewrite using SERVICE-TYPE to add ability to extend the service. --- gnu/services/nfs.scm | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm index 0681e764ec..1b5dcb0e97 100644 --- a/gnu/services/nfs.scm +++ b/gnu/services/nfs.scm @@ -24,6 +24,7 @@ #:use-module (gnu packages linux) #:use-module (guix) #:use-module (guix records) + #:use-module (srfi srfi-1) #:use-module (ice-9 match) #:use-module (gnu build file-systems) #:export (rpcbind-service-type @@ -96,23 +97,33 @@ (default default-pipefs-directory))) (define pipefs-service-type - (shepherd-service-type - 'pipefs - (lambda (config) - (define pipefs-directory (pipefs-configuration-mount-point config)) + (let ((proc + (lambda (config) + (define pipefs-directory (pipefs-configuration-mount-point config)) - (shepherd-service - (documentation "Mount the pipefs pseudo file system.") - (provision '(rpc-pipefs)) + (shepherd-service + (documentation "Mount the pipefs pseudo file system.") + (provision '(rpc-pipefs)) - (start #~(lambda () - (mkdir-p #$pipefs-directory) - (mount "rpc_pipefs" #$pipefs-directory "rpc_pipefs") - (member #$pipefs-directory (mount-points)))) + (start #~(lambda () + (mkdir-p #$pipefs-directory) + (mount "rpc_pipefs" #$pipefs-directory "rpc_pipefs") + (member #$pipefs-directory (mount-points)))) - (stop #~(lambda (pid . args) - (umount #$pipefs-directory MNT_DETACH) - (not (member #$pipefs-directory (mount-points))))))))) + (stop #~(lambda (pid . args) + (umount #$pipefs-directory MNT_DETACH) + (not (member #$pipefs-directory (mount-points))))))))) + (service-type + (name 'pipefs) + (extensions + (list (service-extension shepherd-root-service-type + (compose list proc)))) + ;; We use the extensions feature to allow other services to automatically + ;; configure and start this service. Only one value can be provided. We + ;; override it with the value returned by the extending service. + (compose identity) + (extend (lambda (config values) (first values))) + (default-value (pipefs-configuration)))))