unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Pierre Neidhardt <mail@ambrevar.xyz>
Cc: "Ludovic Courtès" <ludo@gnu.org>, 37305-done@debbugs.gnu.org
Subject: [bug#37305] [PATCH v3] Allow booting from a Btrfs subvolume
Date: Thu, 28 May 2020 00:30:17 -0400	[thread overview]
Message-ID: <87lflc65ra.fsf@gmail.com> (raw)
In-Reply-To: <87tv09epux.fsf@ambrevar.xyz> (Pierre Neidhardt's message of "Thu, 21 May 2020 08:58:30 +0200")

[-- Attachment #1: Type: text/plain, Size: 735 bytes --]

Hello,

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> To me, another consideration is familiarity with Btrfs for those who’ll
>> touch the code: to someone not familiar with it, the code may be viewed
>> as “read-only” because it says “btrfs”.  Whereas if it clearly states
>> that it’s just about prepending a directory name or similar, it’s easy
>> to reason about it.
>
> Agreed, this is where I was going to with my comment on ZFS.
> Maybe the "btrfs" part of the symbols can be left out to make it more
> general and understandable.

I've adapted with the naming suggested earlier by Ludovic.  Does the
patch below fit the bill?

Thanks,

Maxim


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-bootloader-grub-Rename-the-btrfs-subvolume-file-name.patch --]
[-- Type: text/x-patch, Size: 7440 bytes --]

From ee23cc391cce7b8dcdcb5146d4b84a55881a5cb9 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Wed, 27 May 2020 22:44:28 -0400
Subject: [PATCH] bootloader: grub: Rename the btrfs-subvolume-file-name
 parameter.

Following discussion in <https://issues.guix.gnu.org/37305>, it seems more
appropriate to give the parameter a more generic name that better describes
what it does.

* gnu/bootloader/grub.scm (normalize-file): Rename the
btrfs-subvolume-file-name parameter to store-directory-prefix.
(eye-candy): Likewise.
(grub-configuration-file): Likewise.
* gnu/system.scm (operating-system-bootcfg): Adapt.
---
 gnu/bootloader/grub.scm | 46 ++++++++++++++++++++---------------------
 gnu/system.scm          |  2 +-
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index bb40c551a7..7b2fc18103 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -58,8 +58,8 @@
 ;;;
 ;;; Code:
 
-(define* (normalize-file file mount-point btrfs-subvolume-file-name)
-  "Strip MOUNT-POINT and prepend BTRFS-SUBVOLUME-FILE-NAME to FILE, a
+(define* (normalize-file file mount-point store-directory-prefix)
+  "Strip MOUNT-POINT and prepend STORE-DIRECTORY-PREFIX to FILE, a
 G-expression or other lowerable object denoting a file name."
 
   (define (strip-mount-point mount-point file)
@@ -72,12 +72,12 @@ G-expression or other lowerable object denoting a file name."
                     file)))
         file))
 
-  (define (prepend-btrfs-subvolume-file-name btrfs-subvolume-file-name file)
-    (if btrfs-subvolume-file-name
-        #~(string-append #$btrfs-subvolume-file-name #$file)
+  (define (prepend-store-directory-prefix store-directory-prefix file)
+    (if store-directory-prefix
+        #~(string-append #$store-directory-prefix #$file)
         file))
 
-  (prepend-btrfs-subvolume-file-name btrfs-subvolume-file-name
+  (prepend-store-directory-prefix store-directory-prefix
                                      (strip-mount-point mount-point file)))
 
 
@@ -135,14 +135,14 @@ file with the resolution provided in CONFIG."
            (_ #f)))))
 
 (define* (eye-candy config store-device store-mount-point
-                    #:key btrfs-store-subvolume-file-name system port)
+                    #:key store-directory-prefix system port)
   "Return a gexp that writes to PORT (a port-valued gexp) the 'grub.cfg' part
 concerned with graphics mode, background images, colors, and all that.
 STORE-DEVICE designates the device holding the store, and STORE-MOUNT-POINT is
 its mount point; these are used to determine where the background image and
 fonts must be searched for.  SYSTEM must be the target system string---e.g.,
-\"x86_64-linux\".  BTRFS-STORE-SUBVOLUME-FILE-NAME is the file name of the
-Btrfs subvolume, to be prepended to any store path, if any."
+\"x86_64-linux\".  STORE-DIRECTORY-PREFIX is a directory prefix to prepend to
+any store path."
   (define setup-gfxterm-body
     (let ((gfxmode
            (or (and-let* ((theme (bootloader-configuration-theme config))
@@ -181,12 +181,12 @@ fi~%" #+font-file)
   (define font-file
     (normalize-file (file-append grub "/share/grub/unicode.pf2")
                     store-mount-point
-                    btrfs-store-subvolume-file-name))
+                    store-directory-prefix))
 
   (define image
     (normalize-file (grub-background-image config)
                     store-mount-point
-                    btrfs-store-subvolume-file-name))
+                    store-directory-prefix))
 
   (and image
        #~(format #$port "
@@ -320,13 +320,13 @@ code."
                                   #:key
                                   (system (%current-system))
                                   (old-entries '())
-                                  btrfs-subvolume-file-name)
+                                  store-directory-prefix)
   "Return the GRUB configuration file corresponding to CONFIG, a
 <bootloader-configuration> object, and where the store is available at
-STORE-FS, a <file-system> object.  OLD-ENTRIES is taken to be a list
-of menu entries corresponding to old generations of the system.
-BTRFS-SUBVOLUME-FILE-NAME may be used to specify on which subvolume a
-Btrfs root file system resides."
+STORE-FS, a <file-system> object.  OLD-ENTRIES is taken to be a list of menu
+entries corresponding to old generations of the system.
+STORE-DIRECTORY-PREFIX may be used to specify a store prefix, as is required
+when booting a root file system on a Btrfs subvolume."
   (define all-entries
     (append entries (bootloader-configuration-menu-entries config)))
   (define (menu-entry->gexp entry)
@@ -336,17 +336,17 @@ Btrfs root file system resides."
            (arguments (menu-entry-linux-arguments entry))
            (kernel (normalize-file (menu-entry-linux entry)
                                    device-mount-point
-                                   btrfs-subvolume-file-name))
+                                   store-directory-prefix))
            (initrd (normalize-file (menu-entry-initrd entry)
                                    device-mount-point
-                                   btrfs-subvolume-file-name)))
+                                   store-directory-prefix)))
       ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point.
       ;; Use the right file names for KERNEL and INITRD in case
       ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a
       ;; separate partition.
 
-      ;; When BTRFS-SUBVOLUME-FILE-NAME is defined, prepend it the kernel and
-      ;; initrd paths, to allow booting from a Btrfs subvolume.
+      ;; When STORE-DIRECTORY-PREFIX is defined, prepend it to the kernel and
+      ;; initrd paths, for example to allow booting from a Btrfs subvolume.
       #~(format port "menuentry ~s {
   ~a
   linux ~a ~a
@@ -360,7 +360,7 @@ Btrfs root file system resides."
     (eye-candy config
                (menu-entry-device (first all-entries))
                (menu-entry-device-mount-point (first all-entries))
-               #:btrfs-store-subvolume-file-name btrfs-subvolume-file-name
+               #:store-directory-prefix store-directory-prefix
                #:system system
                #:port #~port))
 
@@ -371,8 +371,8 @@ Btrfs root file system resides."
            (keymap* (and layout
                          (keyboard-layout-file layout #:grub grub)))
            (keymap (and keymap*
-                        (if btrfs-subvolume-file-name
-                            #~(string-append #$btrfs-subvolume-file-name
+                        (if store-directory-prefix
+                            #~(string-append #$store-directory-prefix
                                              #$keymap*)
                             keymap*))))
       #~(when #$keymap
diff --git a/gnu/system.scm b/gnu/system.scm
index d929187695..ac8bbd1d16 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1118,7 +1118,7 @@ a list of <menu-entry>, to populate the \"old entries\" menu."
 
     (generate-config-file bootloader-conf (list entry)
                           #:old-entries old-entries
-                          #:btrfs-subvolume-file-name
+                          #:store-directory-prefix
 			  (btrfs-store-subvolume-file-name file-systems))))
 
 (define* (operating-system-boot-parameters os root-device
-- 
2.26.2


  reply	other threads:[~2020-05-28  4:31 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05  0:20 [bug#37305] [PATCH] Allow booting from a Btrfs subvolume Maxim Cournoyer
2019-09-08 16:10 ` Christopher Baines
2019-09-22 21:43 ` Ludovic Courtès
2020-02-12  8:47   ` Maxim Cournoyer
2020-02-13 20:27     ` [bug#37305] [PATCH V2] " Maxim Cournoyer
2020-02-14 17:22       ` Ludovic Courtès
2020-02-16  5:36         ` Maxim Cournoyer
2020-02-16 11:11           ` [bug#37305] Making system installation tests faster Ludovic Courtès
2020-02-18 13:37             ` Maxim Cournoyer
2020-02-18 21:27               ` Maxim Cournoyer
2020-03-07  4:01                 ` Maxim Cournoyer
2020-02-24 16:02           ` [bug#37305] [PATCH V2] Allow booting from a Btrfs subvolume Ludovic Courtès
2020-03-03  5:00             ` Maxim Cournoyer
2020-02-24 14:23         ` [bug#37305] [PATCH V3] " Maxim Cournoyer
2020-02-19  2:52 ` [bug#37305] Allow booting from a Btrfs subvolume [review part 2] Maxim Cournoyer
2020-02-20  9:55   ` Ludovic Courtès
2020-03-18 15:27     ` maxim.cournoyer
2020-05-17 13:29       ` Pierre Neidhardt
2020-05-17 16:13         ` [bug#37305] [PATCH v3] Allow booting from a Btrfs subvolume Maxim Cournoyer
2020-05-17 16:37           ` Pierre Neidhardt
2020-05-17 19:05             ` Pierre Neidhardt
2020-05-17 19:09               ` Pierre Neidhardt
2020-05-17 19:48                 ` Pierre Neidhardt
2020-05-18  1:16                   ` Maxim Cournoyer
2020-05-18  8:54                     ` Pierre Neidhardt
2020-05-17 20:22                 ` Pierre Neidhardt
2020-05-18  0:49                   ` Maxim Cournoyer
2020-05-18 21:55           ` Ludovic Courtès
2020-05-20 12:44             ` Maxim Cournoyer
2020-05-20 12:44             ` bug#37305: " Maxim Cournoyer
2020-05-20 13:29               ` [bug#37305] " Pierre Neidhardt
2020-05-20 22:03               ` Ludovic Courtès
2020-05-21  6:58                 ` Pierre Neidhardt
2020-05-28  4:30                   ` Maxim Cournoyer [this message]
2020-05-28  8:26                     ` Pierre Neidhardt
2020-05-29 21:14                       ` Maxim Cournoyer
2020-05-28 12:30                     ` Ludovic Courtès
2020-05-30  2:00                       ` Maxim Cournoyer
2020-05-30  7:32                         ` Pierre Neidhardt
2020-05-30  7:32                         ` Pierre Neidhardt
2020-05-31  2:44                           ` Maxim Cournoyer
2020-05-31  7:32                             ` Pierre Neidhardt
2020-05-17 14:03       ` [bug#37305] Allow booting from a Btrfs subvolume [review part 2] Pierre Neidhardt
2020-05-17 16:16         ` Maxim Cournoyer

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=87lflc65ra.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=37305-done@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=mail@ambrevar.xyz \
    /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).