>From 62f62a1b49adbe13a1d401ac16f56d58fda2af78 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer
Date: Wed, 25 Sep 2019 22:43:41 +0900 Subject: [PATCH 3/5] file-systems: Add helpers for parsing the options string into an alist. * gnu/system/file-systems.scm (file-system-options->alist) (alist->file-system-options): New procedures. * tests/file-systems.scm: New tests. * doc/guix.texi (File Systems): Add note about the newly added procedures. --- doc/guix.texi | 12 ++++++++---- gnu/system/file-systems.scm | 31 +++++++++++++++++++++++++++++++ tests/file-systems.scm | 19 +++++++++++++++++++ 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 11b6884cab..f55098cfd5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11501,10 +11501,14 @@ update time on the in-memory version of the file inode), and Manual}, for more information on these flags. @item @code{options} (default: @code{#f}) -This is either @code{#f}, or a string denoting mount options passed to the -file system driver. @xref{Mount-Unmount-Remount,,, libc, The GNU C Library -Reference Manual}, for details and run @command{man 8 mount} for options for -various file systems. +This is either @code{#f}, or a string denoting mount options passed to +the file system driver. @xref{Mount-Unmount-Remount,,, libc, The GNU C +Library Reference Manual}, for details and run @command{man 8 mount} for +options for various file systems. Note that the +@code{file-system-options->alist} and @code{alist->file-system-options} +procedures from @code{(gnu system file-systems)} can be used to convert +file system options given as an association list to the string +representation, and vice-versa. @item @code{mount?} (default: @code{#t}) This value indicates whether to automatically mount the file system when diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 3b599efa8e..bde2b93702 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès +;;; Copyright © 2020 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -37,6 +38,9 @@ file-system-needed-for-boot? file-system-flags file-system-options + file-system-options->alist + alist->file-system-options + file-system-mount? file-system-check? file-system-create-mount-point? @@ -250,6 +254,33 @@ UUID-TYPE, a symbol such as 'dce or 'iso9660." ((? string?) device))) +(define (file-system-options->alist string) + "Translate the option string format of a