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.
This commit is contained in:
David Thompson 2015-06-18 20:21:41 -04:00
parent 14a983c28a
commit 5fd77f3f43
2 changed files with 14 additions and 11 deletions

View File

@ -286,16 +286,13 @@ run a file system check."
(when check? (when check?
(check-file-system source type)) (check-file-system source type))
(mkdir-p mount-point) (mkdir-p mount-point)
(mount source mount-point type flags (mount source mount-point type flags options)
(if options
(string->pointer options)
%null-pointer))
;; For read-only bind mounts, an extra remount is needed, as per ;; For read-only bind mounts, an extra remount is needed, as per
;; <http://lwn.net/Articles/281157/>, which still applies to Linux 4.0. ;; <http://lwn.net/Articles/281157/>, which still applies to Linux 4.0.
(when (and (= MS_BIND (logand flags MS_BIND)) (when (and (= MS_BIND (logand flags MS_BIND))
(= MS_RDONLY (logand flags MS_RDONLY))) (= MS_RDONLY (logand flags MS_RDONLY)))
(mount source mount-point type (logior MS_BIND MS_REMOUNT MS_RDONLY) (let ((flags (logior MS_BIND MS_REMOUNT MS_RDONLY)))
%null-pointer)))))) (mount source mount-point type flags #f)))))))
;;; file-systems.scm ends here ;;; file-systems.scm ends here

View File

@ -7,10 +7,10 @@ diff --git a/libguile/posix.c b/libguile/posix.c
index 324f21b..cbee94d 100644 index 324f21b..cbee94d 100644
--- a/libguile/posix.c --- a/libguile/posix.c
+++ b/libguile/posix.c +++ b/libguile/posix.c
@@ -2286,6 +2286,261 @@ scm_init_popen (void) @@ -2245,6 +2245,267 @@ scm_init_popen (void)
} }
#endif #endif
+ +
+/* Linux! */ +/* Linux! */
+ +
@ -25,15 +25,18 @@ index 324f21b..cbee94d 100644
+#define FUNC_NAME s_scm_mount +#define FUNC_NAME s_scm_mount
+{ +{
+ int err; + int err;
+ char *c_source, *c_target, *c_type; + char *c_source, *c_target, *c_type, *c_data;
+ unsigned long c_flags; + unsigned long c_flags;
+ void *c_data;
+ +
+ c_source = scm_to_locale_string (source); + c_source = scm_to_locale_string (source);
+ c_target = scm_to_locale_string (target); + c_target = scm_to_locale_string (target);
+ c_type = scm_to_locale_string (type); + c_type = scm_to_locale_string (type);
+ c_flags = SCM_UNBNDP (flags) ? 0 : scm_to_ulong (flags); + 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); + err = mount (c_source, c_target, c_type, c_flags, c_data);
+ if (err != 0) + if (err != 0)
@ -43,6 +46,9 @@ index 324f21b..cbee94d 100644
+ free (c_target); + free (c_target);
+ free (c_type); + free (c_type);
+ +
+ if (c_data != NULL)
+ free (c_data);
+
+ if (err != 0) + if (err != 0)
+ { + {
+ errno = err; + errno = err;