# lib/cpio.h File Reference

Structures used to handle cpio payloads within rpm packages. More...

`#include <sys/types.h>`
`#include <rpmio_internal.h>`
`#include <rpmlib.h>`

Go to the source code of this file.

## Data Structures

struct | cpioCrcPhysicalHeader
| Cpio archive header information. More...

## Defines

#define | CPIOERR_CHECK_ERRNO 0x00008000
#define | CPIO_NEWC_MAGIC "070701"
#define | CPIO_CRC_MAGIC "070702"
#define | CPIO_TRAILER "TRAILER!!!"
#define | PHYS_HDR_SIZE 110

## Typedefs

typedef enum cpioMapFlags_e | cpioMapFlags

## Enumerations

enum

cpioErrorReturns {
CPIOERR_BAD_MAGIC = (2 ), CPIOERR_BAD_HEADER = (3 ), CPIOERR_OPEN_FAILED = (4 | CPIOERR_CHECK_ERRNO), CPIOERR_CHMOD_FAILED = (5 | CPIOERR_CHECK_ERRNO),
CPIOERR_CHOWN_FAILED = (6 | CPIOERR_CHECK_ERRNO), CPIOERR_WRITE_FAILED = (7 | CPIOERR_CHECK_ERRNO), CPIOERR_UTIME_FAILED = (8 | CPIOERR_CHECK_ERRNO), CPIOERR_UNLINK_FAILED = (9 | CPIOERR_CHECK_ERRNO),
CPIOERR_RENAME_FAILED = (10 | CPIOERR_CHECK_ERRNO), CPIOERR_SYMLINK_FAILED = (11 | CPIOERR_CHECK_ERRNO), CPIOERR_STAT_FAILED = (12 | CPIOERR_CHECK_ERRNO), CPIOERR_LSTAT_FAILED = (13 | CPIOERR_CHECK_ERRNO),
CPIOERR_MKDIR_FAILED = (14 | CPIOERR_CHECK_ERRNO), CPIOERR_RMDIR_FAILED = (15 | CPIOERR_CHECK_ERRNO), CPIOERR_MKNOD_FAILED = (16 | CPIOERR_CHECK_ERRNO), CPIOERR_MKFIFO_FAILED = (17 | CPIOERR_CHECK_ERRNO),
CPIOERR_LINK_FAILED = (18 | CPIOERR_CHECK_ERRNO), CPIOERR_READLINK_FAILED = (19 | CPIOERR_CHECK_ERRNO), CPIOERR_READ_FAILED = (20 | CPIOERR_CHECK_ERRNO), CPIOERR_COPY_FAILED = (21 | CPIOERR_CHECK_ERRNO),
CPIOERR_HDR_SIZE = (22 ), CPIOERR_HDR_TRAILER = (23 ), CPIOERR_UNKNOWN_FILETYPE = (24 ), CPIOERR_MISSING_HARDLINK = (25 ),
CPIOERR_MD5SUM_MISMATCH = (26 ), CPIOERR_INTERNAL = (27 ), CPIOERR_UNMAPPED_FILE = (28 )
}

enum | cpioMapFlags_e { CPIO_MAP_PATH = (1 << 0), CPIO_MAP_MODE = (1 << 1), CPIO_MAP_UID = (1 << 2), CPIO_MAP_GID = (1 << 3), CPIO_FOLLOW_SYMLINKS = (1 << 4), CPIO_MAP_ABSOLUTE = (1 << 5), CPIO_MAP_ADDDOT = (1 << 6), CPIO_ALL_HARDLINKS = (1 << 7), CPIO_MAP_TYPE = (1 << 8), CPIO_MULTILIB = (1 << 31) }

## Functions

int | cpioTrailerWrite (FSM_t fsm)
| Write cpio trailer.
int | cpioHeaderWrite (FSM_t fsm, struct stat *st)
| Write cpio header.
int | cpioHeaderRead (FSM_t fsm, struct stat *st)
| Read cpio header.
const char *const | cpioStrerror (int rc)
| Return formatted error message on payload handling failure.

## Detailed Description

Structures used to handle cpio payloads within rpm packages.

Warning:
  Rpm's cpio implementation may be different than standard cpio. The implementation is pretty close, but it has some behaviors which are more to RPM's liking. I tried to document the differing behavior in cpio.c, but I may have missed some (ewt).

Definition in file cpio.h.

## Define Documentation

#define CPIO_CRC_MAGIC "070702"

Definition at line 74 of file cpio.h.

#define CPIO_NEWC_MAGIC "070701"

Definition at line 73 of file cpio.h.

#define CPIO_TRAILER "TRAILER!!!"

Definition at line 75 of file cpio.h.

#define PHYS_HDR_SIZE 110

Don't depend on sizeof(struct)

Definition at line 97 of file cpio.h.

## Function Documentation

int cpioHeaderRead | ( | FSM_t | fsm,
|  | struct stat * | st |
| ) |  |  |

Read cpio header.

Return values:

  | fsm | file path and stat info

Returns:
  0 on success

< Don't depend on sizeof(struct)

Definition at line 118 of file cpio.c.

int cpioHeaderWrite | ( | FSM_t | fsm,
|  | struct stat * | st |
| ) |  |  |

Write cpio header.

Return values:

  | fsm | file path and stat info

Returns:
  0 on success

< Don't depend on sizeof(struct)

< Don't depend on sizeof(struct)

Definition at line 82 of file cpio.c.

int cpioTrailerWrite | ( | FSM_t | fsm | ) |

Write cpio trailer.

Return values:

  | fsm | file path and stat info

Returns:
  0 on success

< Don't depend on sizeof(struct)

< Don't depend on sizeof(struct)

< Don't depend on sizeof(struct)

Definition at line 56 of file cpio.c.