[Rpm-maint] [rpm-software-management/rpm] Improve documentation in files.cc and cpio.cc (.hh) (PR #4154)

Daniel Alley notifications at github.com
Mon Mar 16 22:07:40 UTC 2026


@dralley commented on this pull request.



> +/**
+ * Write NUL padding bytes to align cpio->offset to a 4-byte boundary.
+ *
+ * In newc CPIO format, both header+name and file data regions are independently
+ * padded to 4-byte boundaries. This means:
+ *   - After writing magic + header + name, pad so file data starts at a 4-byte boundary.
+ *   - After writing file data, pad so the next header starts at a 4-byte boundary.
+ *
+ * This function is called from multiple places:
+ *   - rpmcpioHeaderWrite: once after the header+name, and the previous entry's
+ *     file data is implicitly padded by calling this at the *start* of the function
+ *     (before the new header is written).
+ *   - rpmcpioStrippedHeaderWrite: same pattern — pads the previous entry's data
+ *     at the start, then pads the stripped header itself (which is 14 bytes, needing
+ *     2 bytes of padding to reach 16).
+ *   - rpmcpioTrailerWrite: pads the last file's data before writing the trailer.

I was of split minds including information like this in doc comments. This one is non-public, but, I can remove it if it's not adding value.  

I found it somewhat useful while trying to grasp how everything fits  together though.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/4154#pullrequestreview-3956940940
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/4154/review/3956940940 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20260316/57652d49/attachment-0001.htm>


More information about the Rpm-maint mailing list