From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] gnu: Allow nfs filesystems to be automatically mounted. Date: Thu, 24 Nov 2016 17:08:37 +0100 Message-ID: <8760nc6et6.fsf@gnu.org> References: <87a8cy780c.fsf@gnu.org> <1479842100-13226-1-git-send-email-jmd@gnu.org> <87mvgp4zq8.fsf@gnu.org> <20161123233258.GA17068@jocasta.intra> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9wZo-0006PT-5d for guix-devel@gnu.org; Thu, 24 Nov 2016 11:08:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9wZk-0004rE-W1 for guix-devel@gnu.org; Thu, 24 Nov 2016 11:08:44 -0500 In-Reply-To: <20161123233258.GA17068@jocasta.intra> (John Darrington's message of "Thu, 24 Nov 2016 00:32:58 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: John Darrington Cc: guix-devel@gnu.org, John Darrington John Darrington skribis: > It's also instructive to experiment a bit by running a command like: > > sudo strace mount -v :/export/junk -o addr=3D192.168.0.125 /mnt > in which one can see the system call:=20 > mount(":/export/junk", "/mnt", "nfs", MS_MGC_VAL, "addr=3D192.168.0.125")= =3D 0 Oooh, in that case the patch makes perfect sense. Thanks for explaining! > diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm > index 0d55e91..c6fc784 100644 > --- a/gnu/build/file-systems.scm > +++ b/gnu/build/file-systems.scm > @@ -481,7 +481,21 @@ run a file system check." > (call-with-output-file mount-point (const #t))) > (mkdir-p mount-point)) >=20=20 > - (mount source mount-point type flags options) > + (mount source mount-point type flags > + (cond > + ((string-match "^nfs.*" type) > + (let* ((host (car (string-split source #\:))) > + (aa (car (getaddrinfo host #f))) > + (sa (addrinfo:addr aa)) > + (inet-addr (inet-ntop (sockaddr:fam sa) > + (sockaddr:addr sa)))) > + (string-append "addr=3D" > + inet-addr > + (if options > + (string-append "," options) > + "")))) > + (else > + options))) Could we write it as: (if (string-prefix? "nfs" type) (mount-nfs source mount-point type flags options) (mount source mount-point type flags options)) and have a separate: (define (mount-nfs source mount-point type flags options) =E2=80=A6) ? Also, the code above must be changed to use =E2=80=98match=E2=80=99 instead= of =E2=80=98car=E2=80=99. It should be (getaddrinfo host "nfs") instead of (getaddrinfo host #f). I=E2=80=99m assuming the syntax for SOURCE doesn=E2=80=99t allow one to spe= cify a TCP port. Is this correct? Thanks, Ludo=E2=80=99.