From a5acc17a3c10a3779b5b8b1a2565ef130be77e51 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 18 May 2018 13:43:07 +0200 Subject: file-systems: Remove 'title' field and add . The 'title' field was easily overlooked and was an endless source of confusion. Now, the value of the 'device' field is self-contained. * gnu/system/file-systems.scm (): Change constructor name to '%file-system'. [title]: Remove. (): New record type with printer. (report-deprecation, device-expression) (process-file-system-declaration, file-system): New macros. (file-system-title): New procedure. (file-system->spec, spec->file-system): Adjust to handle . * gnu/system.scm (bootable-kernel-arguments): Add case for 'file-system-label?'. (read-boot-parameters): Likewise. (mapped-device-user): Avoid 'file-system-title'. (fs->boot-device): Remove. (operating-system-boot-parameters): Use 'file-system-device' instead of 'fs->boot-device'. (device->sexp): Add case for 'file-system-label?'. * gnu/bootloader/grub.scm (grub-root-search): Add case for 'file-system-label?'. * gnu/system/examples/bare-bones.tmpl, gnu/system/examples/beaglebone-black.tmpl, gnu/system/examples/lightweight-desktop.tmpl, gnu/system/examples/vm-image.tmpl: Remove uses of 'title'. * gnu/system/vm.scm (virtualized-operating-system): Remove uses of 'file-system-title'. * guix/scripts/system.scm (check-file-system-availability): Likewise, and adjust fix-it hint. (check-initrd-modules)[file-system-/dev]: Likewise. * gnu/build/file-systems.scm (canonicalize-device-spec): Remove 'title' parameter. [canonical-title]: Remove. Match on SPEC's type rather than on CANONICAL-TITLE. (mount-file-system): Adjust caller. * gnu/build/linux-boot.scm (boot-system): Interpret ROOT here. * gnu/services/base.scm (file-system->fstab-entry): Remove use of 'file-system-title'. * doc/guix.texi (File Systems): Remove documentation of the 'title' field. Rewrite documentation of 'device' and document 'file-system-label'. --- doc/guix.texi | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 5129b998bd..5eee40fc3c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9210,20 +9210,31 @@ This is a string specifying the type of the file system---e.g., This designates the place where the file system is to be mounted. @item @code{device} -This names the ``source'' of the file system. By default it is the name -of a node under @file{/dev}, but its meaning depends on the @code{title} -field described below. +This names the ``source'' of the file system. It can be one of three +things: a file system label, a file system UUID, or the name of a +@file{/dev} node. Labels and UUIDs offer a way to refer to file +systems without having to hard-code their actual device +name@footnote{Note that, while it is tempting to use +@file{/dev/disk/by-uuid} and similar device names to achieve the same +result, this is not recommended: These special device nodes are created +by the udev daemon and may be unavailable at the time the device is +mounted.}. -@item @code{title} (default: @code{'device}) -This is a symbol that specifies how the @code{device} field is to be -interpreted. +@findex file-system-label +File system labels are created using the @code{file-system-label} +procedure, UUIDs are created using @code{uuid}, and @file{/dev} node are +plain strings. Here's an example of a file system referred to by its +label, as shown by the @command{e2label} command: -When it is the symbol @code{device}, then the @code{device} field is -interpreted as a file name; when it is @code{label}, then @code{device} -is interpreted as a file system label name; when it is @code{uuid}, -@code{device} is interpreted as a file system unique identifier (UUID). +@example +(file-system + (mount-point "/home") + (type "ext4") + (device (file-system-label "my-home"))) +@end example -UUIDs may be converted from their string representation (as shown by the +@findex uuid +UUIDs are converted from their string representation (as shown by the @command{tune2fs -l} command) using the @code{uuid} form@footnote{The @code{uuid} form expects 16-byte UUIDs as defined in @uref{https://tools.ietf.org/html/rfc4122, RFC@tie{}4122}. This is the @@ -9235,22 +9246,13 @@ like this: (file-system (mount-point "/home") (type "ext4") - (title 'uuid) (device (uuid "4dab5feb-d176-45de-b287-9b0a6e4c01cb"))) @end example -The @code{label} and @code{uuid} options offer a way to refer to file -systems without having to hard-code their actual device -name@footnote{Note that, while it is tempting to use -@file{/dev/disk/by-uuid} and similar device names to achieve the same -result, this is not recommended: These special device nodes are created -by the udev daemon and may be unavailable at the time the device is -mounted.}. - -However, when the source of a file system is a mapped device (@pxref{Mapped +When the source of a file system is a mapped device (@pxref{Mapped Devices}), its @code{device} field @emph{must} refer to the mapped -device name---e.g., @file{/dev/mapper/root-partition}---and consequently -@code{title} must be set to @code{'device}. This is required so that +device name---e.g., @file{"/dev/mapper/root-partition"}. +This is required so that the system knows that mounting the file system depends on having the corresponding device mapping established. -- cgit v1.2.3