From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Darrington Subject: mount syscall Date: Wed, 16 Nov 2016 22:06:01 +0100 Message-ID: <20161116210601.GA409@jocasta.intra> References: <87wpg8lpfc.fsf@gnu.org> <20161112152808.GA21994@jocasta.intra> <20161112170948.GA23070@jocasta.intra> <874m3cjoku.fsf@gnu.org> <20161113082110.GA6656@jocasta.intra> <877f87io95.fsf@gnu.org> <20161113140647.GA10548@jocasta.intra> <87h97abdel.fsf@gnu.org> <20161114174628.GA32053@jocasta.intra> <87inrpdnrq.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LQksG6bCIzRHxTLp" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c77PN-00044q-P0 for guix-devel@gnu.org; Wed, 16 Nov 2016 16:06:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c77PM-0000J3-Hr for guix-devel@gnu.org; Wed, 16 Nov 2016 16:06:17 -0500 Content-Disposition: inline In-Reply-To: <87inrpdnrq.fsf@gnu.org> 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: Ludovic Court??s Cc: guix-devel@gnu.org --LQksG6bCIzRHxTLp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 15, 2016 at 11:46:01AM +0100, Ludovic Court??s wrote: John Darrington skribis: =20 > On Mon, Nov 14, 2016 at 10:48:18AM +0100, Ludovic Court??s wrote: > =20 > The ???mount??? system call; see (gnu build file-systems). > > I confess, I have not really thought about this before. But supposin= g somebody has in their /etc/config.scm: > > (file-systems=20 > (cons* > (file-system > (device "my-root") > (title 'label) > (mount-point "/") > (type "ext4")) > (file-system > (device "fileserver.example.com:/home") > (title 'device) > (mount-point "/home") > (type "nfs4")) > %base-file-systems)) > > Would the /home filesystem then get mounted on boot? =20 Maybe not. :-) =20 The man page for mount(2) says: =20 --8<---------------cut here---------------start------------->8--- Valu= es for the filesystemtype argument supported by the kernel are listed in /proc/filesystems (e.g., "btrfs", "ext4", "jfs", "xfs", "vfat", "fuse", "tmpfs", "cgroup", "proc", "mqueue", "nfs", "cifs", "iso9660"). Furth= er types may become available when the appropriate modules are loaded. --8<---------------cut here---------------end--------------->8--- =20 I don???t know what happens with NFS, you???ll have to tell us. The answer seems to be that it would fail unless we patch our mount syscall wrapper with something like: diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 2cee654..3435617 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -415,17 +415,33 @@ string. When FLAGS contains MS_REMOUNT, SOURCE and T= YPE are ignored. When UPDATE-MTAB? is true, update /etc/mtab. Raise a 'system-error' exception = on error." (let-values (((ret err) - (proc (if source - (string->pointer source) - %null-pointer) - (string->pointer target) - (if type - (string->pointer type) - %null-pointer) - flags - (if options - (string->pointer options) - %null-pointer)))) + (let ((xoptions + (cond + ((string-match "^nfs.*" type) + (let* ((hosts (string-split source #\:)) + (aa (car (getaddrinfo (car hosts) #f)= )) + (sa (addrinfo:addr aa)) + (inet-addr (inet-ntop (sockaddr:fam sa) + (sockaddr:addr s= a)))) + (string-append "addr=3D" + inet-addr + (if options + (string-append "," optio= ns) + "")))) + (else + options)))) + (proc + (if source + (string->pointer source) + %null-pointer) + (string->pointer target) + (if type + (string->pointer type) + %null-pointer) + flags + (if xoptions + (string->pointer xoptions) + %null-pointer))))) (unless (zero? ret) (throw 'system-error "mount" "mount ~S on ~S: ~A" (list source target (strerror err)) WDYT? =20 --=20 Avoid eavesdropping. Send strong encrypted email. PGP Public key ID: 1024D/2DE827B3=20 fingerprint =3D 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://sks-keyservers.net or any PGP keyserver for public key. --LQksG6bCIzRHxTLp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlgsyjgACgkQimdxnC3oJ7OCOgCeOQHQPsxxHrJMHYhYxDnX7wDG 6Z8An0xXaqpRrOe9SfKm5DtZy0EJKAC6 =F1nW -----END PGP SIGNATURE----- --LQksG6bCIzRHxTLp--