unofficial mirror of guix-patches@gnu.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 2/3] linux-initrd: Add special-file->cpio-header*
Date: Sat,  7 Nov 2020 22:27:32 +0100	[thread overview]
Message-ID: <20201107212733.22326-2-dannym@scratchpost.org> (raw)
In-Reply-To: <20201107212733.22326-1-dannym@scratchpost.org>

* guix/cpio.scm (special-file->cpio-header*): New public procedure.
---
 guix/cpio.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/guix/cpio.scm b/guix/cpio.scm
index 5d38573971..c9932f5bf9 100644
--- a/guix/cpio.scm
+++ b/guix/cpio.scm
@@ -27,6 +27,7 @@
             make-cpio-header
             file->cpio-header
             file->cpio-header*
+            special-file->cpio-header*
             write-cpio-header
             read-cpio-header
 
@@ -190,6 +191,25 @@ produced in a deterministic fashion."
                       #:size (stat:size st)
                       #:name-size (string-length file-name))))
 
+(define* (special-file->cpio-header* file
+                                     device-type
+                                     device-major
+                                     device-minor
+                                     permission-bits
+                                     #:optional (file-name file))
+  "Create a character or block device header.
+
+DEVICE-TYPE is either 'char-special or 'block-special.
+
+The number of hard links is assumed to be 1."
+  (make-cpio-header #:mode (logior (match device-type
+                                    ('block-special C_ISBLK)
+                                    ('char-special C_ISCHR))
+                                    permission-bits)
+                    #:nlink 1
+                    #:rdev (device-number device-major device-minor)
+                    #:name-size (string-length file-name)))
+
 (define %trailer
   "TRAILER!!!")
 




  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 ` [bug#44507] [PATCH 1/3] linux-initrd: Handle 'block-special and 'char-special cpio headers as well Danny Milosavljevic
2020-11-07 21:27   ` Danny Milosavljevic [this message]
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

  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=20201107212733.22326-2-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 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).