From patchwork Wed Nov 16 21:06:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Darrington X-Patchwork-Id: 17533 Received: (qmail 86919 invoked by uid 89); 16 Nov 2016 21:48:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=car, our, H*F:D*au X-Spam-Status: No, score=-4.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: lists.gnu.org Received: from lists.gnu.org (HELO lists.gnu.org) (208.118.235.17) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Nov 2016 21:48:21 +0000 Received: from localhost ([::1]:55264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7843-0000oy-P2 for patchwork@sourceware.org; Wed, 16 Nov 2016 16:48:19 -0500 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 Received: from de.cellform.com ([88.217.224.109]:58235 helo=jocasta.intra) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c77PI-0000FG-Iw; Wed, 16 Nov 2016 16:06:12 -0500 Received: from jocasta.intra (localhost [127.0.0.1]) by jocasta.intra (8.14.4/8.14.4/Debian-8+deb8u1) with ESMTP id uAGL61eG000467 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2016 22:06:01 +0100 Received: (from john@localhost) by jocasta.intra (8.14.4/8.14.4/Submit) id uAGL61gn000464; Wed, 16 Nov 2016 22:06:01 +0100 Date: Wed, 16 Nov 2016 22:06:01 +0100 From: John Darrington To: Ludovic Court??s Subject: mount syscall 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-Disposition: inline In-Reply-To: <87inrpdnrq.fsf@gnu.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 88.217.224.109 X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+patchwork=sourceware.org@gnu.org Sender: "Guix-devel" On Tue, Nov 15, 2016 at 11:46:01AM +0100, Ludovic Court??s wrote: John Darrington skribis: > On Mon, Nov 14, 2016 at 10:48:18AM +0100, Ludovic Court??s wrote: > > The ???mount??? system call; see (gnu build file-systems). > > I confess, I have not really thought about this before. But supposing somebody has in their /etc/config.scm: > > (file-systems > (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? Maybe not. :-) The man page for mount(2) says: --8<---------------cut here---------------start------------->8--- Values 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"). Further types may become available when the appropriate modules are loaded. --8<---------------cut here---------------end--------------->8--- 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: WDYT? 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 TYPE 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 sa)))) + (string-append "addr=" + inet-addr + (if options + (string-append "," options) + "")))) + (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))