all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: 44507@debbugs.gnu.org
Cc: Danny Milosavljevic <dannym@scratchpost.org>
Subject: [bug#44507] [PATCH 1/3] linux-initrd: Handle 'block-special and 'char-special cpio headers as well.
Date: Sat,  7 Nov 2020 22:27:31 +0100	[thread overview]
Message-ID: <20201107212733.22326-1-dannym@scratchpost.org> (raw)
In-Reply-To: <20201107204718.21824-1-dannym@scratchpost.org>

* 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 e4692e2e9c..5d38573971 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	other threads:[~2020-11-07 21:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-07 20:47 [bug#44507] [PATCH 0/3] Create "dev.cpio" for Heads Danny Milosavljevic
2020-11-07 21:27 ` Danny Milosavljevic [this message]
2020-11-07 21:27   ` [bug#44507] [PATCH 2/3] linux-initrd: Add special-file->cpio-header* Danny Milosavljevic
2020-11-07 21:27   ` [bug#44507] [PATCH 3/3] gnu: Add heads-dev-cpio Danny Milosavljevic
2020-11-22 10:07 ` bug#44507: [PATCH 0/3] Create "dev.cpio" for Heads Danny Milosavljevic

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201107212733.22326-1-dannym@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=44507@debbugs.gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.