6 * Structures used to handle cpio payloads within rpm packages.
8 * @warning Rpm's cpio implementation may be different than standard cpio.
9 * The implementation is pretty close, but it has some behaviors which are
10 * more to RPM's liking. I tried to document the differing behavior in cpio.c,
11 * but I may have missed some (ewt).
18 * @note CPIO_CHECK_ERRNO bit is set only if errno is valid.
20 #define CPIOERR_CHECK_ERRNO 0x00008000
24 enum cpioErrorReturns {
25 CPIOERR_BAD_MAGIC = 2,
26 CPIOERR_BAD_HEADER = 3,
27 CPIOERR_OPEN_FAILED = 4 | CPIOERR_CHECK_ERRNO,
28 CPIOERR_CHMOD_FAILED = 5 | CPIOERR_CHECK_ERRNO,
29 CPIOERR_CHOWN_FAILED = 6 | CPIOERR_CHECK_ERRNO,
30 CPIOERR_WRITE_FAILED = 7 | CPIOERR_CHECK_ERRNO,
31 CPIOERR_UTIME_FAILED = 8 | CPIOERR_CHECK_ERRNO,
32 CPIOERR_UNLINK_FAILED = 9 | CPIOERR_CHECK_ERRNO,
33 CPIOERR_RENAME_FAILED = 10 | CPIOERR_CHECK_ERRNO,
34 CPIOERR_SYMLINK_FAILED = 11 | CPIOERR_CHECK_ERRNO,
35 CPIOERR_STAT_FAILED = 12 | CPIOERR_CHECK_ERRNO,
36 CPIOERR_LSTAT_FAILED = 13 | CPIOERR_CHECK_ERRNO,
37 CPIOERR_MKDIR_FAILED = 14 | CPIOERR_CHECK_ERRNO,
38 CPIOERR_RMDIR_FAILED = 15 | CPIOERR_CHECK_ERRNO,
39 CPIOERR_MKNOD_FAILED = 16 | CPIOERR_CHECK_ERRNO,
40 CPIOERR_MKFIFO_FAILED = 17 | CPIOERR_CHECK_ERRNO,
41 CPIOERR_LINK_FAILED = 18 | CPIOERR_CHECK_ERRNO,
42 CPIOERR_READLINK_FAILED = 19 | CPIOERR_CHECK_ERRNO,
43 CPIOERR_READ_FAILED = 20 | CPIOERR_CHECK_ERRNO,
44 CPIOERR_COPY_FAILED = 21 | CPIOERR_CHECK_ERRNO,
45 CPIOERR_LSETFCON_FAILED = 22 | CPIOERR_CHECK_ERRNO,
46 CPIOERR_HDR_SIZE = 23,
47 CPIOERR_HDR_TRAILER = 24,
48 CPIOERR_UNKNOWN_FILETYPE= 25,
49 CPIOERR_MISSING_HARDLINK= 26,
50 CPIOERR_DIGEST_MISMATCH = 27,
51 CPIOERR_INTERNAL = 28,
52 CPIOERR_UNMAPPED_FILE = 29,
54 CPIOERR_ENOTEMPTY = 31,
55 CPIOERR_SETCAP_FAILED = 32 | CPIOERR_CHECK_ERRNO,
59 * Size limit for individual files in "new ascii format" cpio archives.
60 * The max size of the entire archive is unlimited from cpio POV,
61 * but subject to filesystem limitations.
63 #define CPIO_FILESIZE_MAX UINT32_MAX
65 #define CPIO_NEWC_MAGIC "070701"
66 #define CPIO_CRC_MAGIC "070702"
67 #define CPIO_TRAILER "TRAILER!!!"
70 * Cpio archive header information.
72 struct cpioCrcPhysicalHeader {
86 char checksum[8]; /* ignored !! */
89 #define PHYS_HDR_SIZE 110 /* Don't depend on sizeof(struct) */
97 * @retval fsm file path and stat info
98 * @return 0 on success
101 int cpioTrailerWrite(FSM_t fsm);
105 * @retval fsm file path and stat info
107 * @return 0 on success
110 int cpioHeaderWrite(FSM_t fsm, struct stat * st);
114 * @retval fsm file path and stat info
116 * @return 0 on success
119 int cpioHeaderRead(FSM_t fsm, struct stat * st);
122 * Return formatted error message on payload handling failure.
123 * @param rc error code
124 * @return formatted error string
126 /* XXX should be RPM_GNUC_INTERNAL too but build/pack.c uses */
127 const char * cpioStrerror(int rc);