2ba6f6
From 42955c0b4d9c0723de72a810f80e4b3543053631 Mon Sep 17 00:00:00 2001
2ba6f6
From: Kazuhito Hagio <k-hagio-ab@nec.com>
2ba6f6
Date: Wed, 30 Nov 2022 12:02:44 +0900
2ba6f6
Subject: [PATCH 3/7] [PATCH] IMPLEMENTAION: Add a description of the flattened
2ba6f6
 format
2ba6f6
2ba6f6
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
2ba6f6
---
2ba6f6
 IMPLEMENTATION | 45 +++++++++++++++++++++++++++++++++++++++++++++
2ba6f6
 1 file changed, 45 insertions(+)
2ba6f6
2ba6f6
diff --git a/makedumpfile-1.7.2/IMPLEMENTATION b/makedumpfile-1.7.2/IMPLEMENTATION
2ba6f6
index 589c5bf..b7a1603 100644
2ba6f6
--- a/makedumpfile-1.7.2/IMPLEMENTATION
2ba6f6
+++ b/makedumpfile-1.7.2/IMPLEMENTATION
2ba6f6
@@ -280,3 +280,48 @@
2ba6f6
 
2ba6f6
     If there is no segment dumped into the DUMPFILE, the DUMPFILE can't be
2ba6f6
     analysed by crash.
2ba6f6
+
2ba6f6
+
2ba6f6
+* The flattened format
2ba6f6
+
2ba6f6
+  This format is mostly used to send dump data to a remote host via SSH.
2ba6f6
+  The kdump-compressed format and ELF format require random access to create
2ba6f6
+  a DUMPFILE, so it cannot be written directly to standard output.
2ba6f6
+  The flattened format adds the original offset and size of each data block,
2ba6f6
+  and it can be rearranged to the original format on the remote host.
2ba6f6
+
2ba6f6
+  - File structure
2ba6f6
+
2ba6f6
+    This is the case of the kdump-compressed format.
2ba6f6
+                                                 File offset
2ba6f6
+    +------------------------------------------+ 0x0
2ba6f6
+    | flat header (struct makedumpfile_header) |
2ba6f6
+    |                                          |
2ba6f6
+    |------------------------------------------| 0x1000 (4096)
2ba6f6
+    | flat data header                         |
2ba6f6
+    |     (struct makedumpfile_data_header)    |
2ba6f6
+    |   main header (struct disk_dump_header)  |
2ba6f6
+    |------------------------------------------| (not aligned)
2ba6f6
+    | flat data header                         |
2ba6f6
+    |                    :                     |
2ba6f6
+
2ba6f6
+    Note: For the ELF format, ELF header is not always the first data.
2ba6f6
+
2ba6f6
+  - flat header
2ba6f6
+
2ba6f6
+    struct makedumpfile_header {
2ba6f6
+            char    signature[SIG_LEN_MDF]; /* = "makedumpfile\0\0\0\0" */
2ba6f6
+            int64_t type;                   /* = TYPE_FLAT_HEADER (1) */
2ba6f6
+            int64_t version;                /* = VERSION_FLAT_HEADER (1) */
2ba6f6
+    };
2ba6f6
+
2ba6f6
+    Note: the type and version are big endian.
2ba6f6
+
2ba6f6
+  - flat data header
2ba6f6
+
2ba6f6
+    struct makedumpfile_data_header {
2ba6f6
+            int64_t offset;
2ba6f6
+            int64_t buf_size;
2ba6f6
+    };
2ba6f6
+
2ba6f6
+    Note: the offset and buf_size are big endian.
2ba6f6
-- 
2ba6f6
2.33.1
2ba6f6