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: Wed, 23 Nov 2016 23:07:27 +0100 Message-ID: <87mvgp4zq8.fsf@gnu.org> References: <87a8cy780c.fsf@gnu.org> <1479842100-13226-1-git-send-email-jmd@gnu.org> 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]:34212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9fhV-0003a1-HV for guix-devel@gnu.org; Wed, 23 Nov 2016 17:07:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9fhS-000499-5t for guix-devel@gnu.org; Wed, 23 Nov 2016 17:07:33 -0500 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33951) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9fhS-00048x-2E for guix-devel@gnu.org; Wed, 23 Nov 2016 17:07:30 -0500 In-Reply-To: <1479842100-13226-1-git-send-email-jmd@gnu.org> (John Darrington's message of "Tue, 22 Nov 2016 20:15:00 +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 skribis: > How about this, then? > > > > > > * gnu/build/file-systems.scm (mount-file-system): Append target addr=3D w= hen > mounting nfs filesystems. > --- > gnu/build/file-systems.scm | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > 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))) Looking at mount(8), it seems that the normal way is for =E2=80=98source=E2= =80=99 to be something like =E2=80=9Cknuth.cwi.nl:/dir=E2=80=9D. The kernel then takes = care of parsing that and doing name resolution somehow. In that case, we don=E2=80=99t have anything to do, good for us. mount(8) doesn=E2=80=99t mention =E2=80=98addr=E2=80=99. Do you have docum= entation about it? Thanks, Ludo=E2=80=99.