guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: linux-initrd: Handle 'block-special and 'char-special cpio header


From: guix-commits
Subject: 01/03: linux-initrd: Handle 'block-special and 'char-special cpio headers as well.
Date: Sun, 22 Nov 2020 05:05:46 -0500 (EST)

dannym pushed a commit to branch master
in repository guix.

commit b1dfc64552265d66e60d11c2a1b6f4da549cd495
Author: Danny Milosavljevic <dannym@scratchpost.org>
AuthorDate: Sat Nov 7 22:27:31 2020 +0100

    linux-initrd: Handle 'block-special and 'char-special cpio headers as well.
    
    * guix/cpio.scm (make-cpio-header): Handle size correctly for all file 
types.
    (mode->type): Add 'block-special, 'char-special.
---
 guix/cpio.scm | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/guix/cpio.scm b/guix/cpio.scm
index e4692e2..5d38573 100644
--- a/guix/cpio.scm
+++ b/guix/cpio.scm
@@ -132,9 +132,10 @@
     (%make-cpio-header MAGIC
                        inode mode uid gid
                        nlink mtime
-                       (if (= C_ISDIR (logand mode C_FMT))
-                           0
-                           size)
+                       (if (or (= C_ISLNK (logand mode C_FMT))
+                               (= C_ISREG (logand mode C_FMT)))
+                           size
+                           0)
                        major minor rmajor rminor
                        (+ name-size 1)              ;include trailing zero
                        0)))                          ;checksum
@@ -146,6 +147,8 @@ denotes, similar to 'stat:type'."
     (cond ((= C_ISREG fmt) 'regular)
           ((= C_ISDIR fmt) 'directory)
           ((= C_ISLNK fmt) 'symlink)
+          ((= C_ISBLK fmt) 'block-special)
+          ((= C_ISCHR fmt) 'char-special)
           (else
            (error "unsupported file type" mode)))))
 
@@ -233,6 +236,10 @@ produces with the '-H newc' option."
            (put-string port target)))
         ((directory)
          #t)
+        ((block-special)
+         #t)
+        ((char-special)
+         #t)
         (else
          (error "file type not supported")))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]