unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Thompson <dthompson2@worcester.edu>
To: guix-devel@gnu.org
Subject: [PATCH 1/2] gnu: Make 'mount' interface in static Guile consistent with Guix API.
Date: Thu, 18 Jun 2015 20:43:59 -0400	[thread overview]
Message-ID: <87r3p8il2o.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-gnu-Make-mount-interface-in-static-Guile-consistent-.patch --]
[-- Type: text/x-patch, Size: 3286 bytes --]

From 6efe8e786674d40e01df48c7df9a952107831ad9 Mon Sep 17 00:00:00 2001
From: David Thompson <davet@gnu.org>
Date: Thu, 18 Jun 2015 20:21:41 -0400
Subject: [PATCH 1/2] gnu: Make 'mount' interface in static Guile consistent
 with Guix API.

Rather than expecting a pointer, the version of 'mount' in
guile-static-stripped now takes a string for the 'options' argument, just like
the 'mount' procedure in (guix build syscalls).

* gnu/packages/patches/guile-linux-syscalls.patch (mount): Expect a string or
  #f for 'options' argument.
* gnu/build/file-systems.scm (mount-file-system): Use new 'mount' interface.
---
 gnu/build/file-systems.scm                      |  9 +++------
 gnu/packages/patches/guile-linux-syscalls.patch | 16 +++++++++++-----
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index dc99d60..72c8bd5 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -286,16 +286,13 @@ run a file system check."
        (when check?
          (check-file-system source type))
        (mkdir-p mount-point)
-       (mount source mount-point type flags
-              (if options
-                  (string->pointer options)
-                  %null-pointer))
+       (mount source mount-point type flags options)
 
        ;; For read-only bind mounts, an extra remount is needed, as per
        ;; <http://lwn.net/Articles/281157/>, which still applies to Linux 4.0.
        (when (and (= MS_BIND (logand flags MS_BIND))
                   (= MS_RDONLY (logand flags MS_RDONLY)))
-         (mount source mount-point type (logior MS_BIND MS_REMOUNT MS_RDONLY)
-                %null-pointer))))))
+         (let ((flags (logior MS_BIND MS_REMOUNT MS_RDONLY)))
+           (mount source mount-point type flags #f)))))))
 
 ;;; file-systems.scm ends here
diff --git a/gnu/packages/patches/guile-linux-syscalls.patch b/gnu/packages/patches/guile-linux-syscalls.patch
index 57c7f25..73a062b 100644
--- a/gnu/packages/patches/guile-linux-syscalls.patch
+++ b/gnu/packages/patches/guile-linux-syscalls.patch
@@ -7,10 +7,10 @@ diff --git a/libguile/posix.c b/libguile/posix.c
 index 324f21b..cbee94d 100644
 --- a/libguile/posix.c
 +++ b/libguile/posix.c
-@@ -2286,6 +2286,261 @@ scm_init_popen (void)
+@@ -2245,6 +2245,267 @@ scm_init_popen (void)
  }
  #endif
- 
+
 +\f
 +/* Linux! */
 +
@@ -25,15 +25,18 @@ index 324f21b..cbee94d 100644
 +#define FUNC_NAME s_scm_mount
 +{
 +  int err;
-+  char *c_source, *c_target, *c_type;
++  char *c_source, *c_target, *c_type, *c_data;
 +  unsigned long c_flags;
-+  void *c_data;
 +
 +  c_source = scm_to_locale_string (source);
 +  c_target = scm_to_locale_string (target);
 +  c_type = scm_to_locale_string (type);
 +  c_flags = SCM_UNBNDP (flags) ? 0 : scm_to_ulong (flags);
-+  c_data = SCM_UNBNDP (data) ? NULL : scm_to_pointer (data);
++
++  if (SCM_UNBNDP (data) || scm_is_false (data))
++    c_data = NULL;
++  else
++    c_data = scm_to_locale_string (data);
 +
 +  err = mount (c_source, c_target, c_type, c_flags, c_data);
 +  if (err != 0)
@@ -43,6 +46,9 @@ index 324f21b..cbee94d 100644
 +  free (c_target);
 +  free (c_type);
 +
++  if (c_data != NULL)
++    free (c_data);
++
 +  if (err != 0)
 +    {
 +      errno = err;
-- 
2.2.1


[-- Attachment #2: Type: text/plain, Size: 38 bytes --]


-- 
David Thompson
GPG Key: 0FF1D807

             reply	other threads:[~2015-06-19  0:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19  0:43 David Thompson [this message]
2015-06-19 11:42 ` [PATCH 1/2] gnu: Make 'mount' interface in static Guile consistent with Guix API Ludovic Courtès
2015-06-19 12:02   ` Thompson, David

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r3p8il2o.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me \
    --to=dthompson2@worcester.edu \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).