Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

lib/cpio.h File Reference

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

Go to the source code of this file.

Data Structures

struct  cpioCrcPhysicalHeader

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 | 0x00008000 ), CPIOERR_CHMOD_FAILED = (5 | 0x00008000 ),
  CPIOERR_CHOWN_FAILED = (6 | 0x00008000 ), CPIOERR_WRITE_FAILED = (7 | 0x00008000 ), CPIOERR_UTIME_FAILED = (8 | 0x00008000 ), CPIOERR_UNLINK_FAILED = (9 | 0x00008000 ),
  CPIOERR_RENAME_FAILED = (10 | 0x00008000 ), CPIOERR_SYMLINK_FAILED = (11 | 0x00008000 ), CPIOERR_STAT_FAILED = (12 | 0x00008000 ), CPIOERR_LSTAT_FAILED = (13 | 0x00008000 ),
  CPIOERR_MKDIR_FAILED = (14 | 0x00008000 ), CPIOERR_RMDIR_FAILED = (15 | 0x00008000 ), CPIOERR_MKNOD_FAILED = (16 | 0x00008000 ), CPIOERR_MKFIFO_FAILED = (17 | 0x00008000 ),
  CPIOERR_LINK_FAILED = (18 | 0x00008000 ), CPIOERR_READLINK_FAILED = (19 | 0x00008000 ), CPIOERR_READ_FAILED = (20 | 0x00008000 ), CPIOERR_COPY_FAILED = (21 | 0x00008000 ),
  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 ), CPIOERR_ENOENT = (29 ),
  CPIOERR_ENOTEMPTY = (30 )
}
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)
}

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)


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 70 of file cpio.h.

Referenced by cpioHeaderRead().

#define CPIO_NEWC_MAGIC   "070701"
 

Definition at line 69 of file cpio.h.

Referenced by cpioHeaderRead(), cpioHeaderWrite(), and cpioTrailerWrite().

#define CPIO_TRAILER   "TRAILER!!!"
 

Definition at line 71 of file cpio.h.

Referenced by cpioTrailerWrite(), and fsmStage().

#define PHYS_HDR_SIZE   110
 

Don't depend on sizeof(struct)

Definition at line 93 of file cpio.h.

Referenced by cpioHeaderRead(), cpioHeaderWrite(), and cpioTrailerWrite().


Function Documentation

int cpioHeaderRead FSM_t    fsm,
struct stat *    st
 

Read cpio header.

Return values:
fsm  file path and stat info
st 
Returns:
0 on success

Definition at line 130 of file cpio.c.

References _free(), CPIO_CRC_MAGIC, CPIO_NEWC_MAGIC, CPIOERR_BAD_HEADER, CPIOERR_BAD_MAGIC, CPIOERR_READ_FAILED, cpioCrcPhysicalHeader::devMajor, cpioCrcPhysicalHeader::devMinor, cpioCrcPhysicalHeader::filesize, FSM_DREAD, fsmStage(), GET_NUM_FIELD, cpioCrcPhysicalHeader::gid, cpioCrcPhysicalHeader::inode, cpioCrcPhysicalHeader::magic, major, makedev, minor, cpioCrcPhysicalHeader::mode, cpioCrcPhysicalHeader::mtime, cpioCrcPhysicalHeader::namesize, cpioCrcPhysicalHeader::nlink, fsm_s::path, PHYS_HDR_SIZE, cpioCrcPhysicalHeader::rdevMajor, cpioCrcPhysicalHeader::rdevMinor, fsm_s::rdnb, cpioCrcPhysicalHeader::uid, fsm_s::wrbuf, fsm_s::wrlen, fsm_s::wrsize, and xmalloc().

Referenced by fsmStage().

int cpioHeaderWrite FSM_t    fsm,
struct stat *    st
 

Write cpio header.

Return values:
fsm  file path and stat info
Parameters:
st 
Returns:
0 on success

Definition at line 92 of file cpio.c.

References cpioCrcPhysicalHeader::checksum, CPIO_NEWC_MAGIC, CPIOERR_WRITE_FAILED, cpioCrcPhysicalHeader::devMajor, cpioCrcPhysicalHeader::devMinor, cpioCrcPhysicalHeader::filesize, FSM_DWRITE, FSM_PAD, fsmStage(), cpioCrcPhysicalHeader::gid, cpioCrcPhysicalHeader::inode, cpioCrcPhysicalHeader::magic, major, minor, cpioCrcPhysicalHeader::mode, cpioCrcPhysicalHeader::mtime, cpioCrcPhysicalHeader::namesize, cpioCrcPhysicalHeader::nlink, PHYS_HDR_SIZE, cpioCrcPhysicalHeader::rdevMajor, cpioCrcPhysicalHeader::rdevMinor, SET_NUM_FIELD, and cpioCrcPhysicalHeader::uid.

Referenced by fsmStage().

const char* const cpioStrerror int    rc
 

Return formatted error message on payload handling failure.

Parameters:
rc  error code
Returns:
formatted error string

Definition at line 196 of file cpio.c.

References _, CPIOERR_BAD_HEADER, CPIOERR_BAD_MAGIC, CPIOERR_CHECK_ERRNO, CPIOERR_CHMOD_FAILED, CPIOERR_CHOWN_FAILED, CPIOERR_COPY_FAILED, CPIOERR_HDR_SIZE, CPIOERR_INTERNAL, CPIOERR_LINK_FAILED, CPIOERR_LSTAT_FAILED, CPIOERR_MD5SUM_MISMATCH, CPIOERR_MISSING_HARDLINK, CPIOERR_MKDIR_FAILED, CPIOERR_MKFIFO_FAILED, CPIOERR_MKNOD_FAILED, CPIOERR_OPEN_FAILED, CPIOERR_READ_FAILED, CPIOERR_READLINK_FAILED, CPIOERR_RENAME_FAILED, CPIOERR_RMDIR_FAILED, CPIOERR_STAT_FAILED, CPIOERR_SYMLINK_FAILED, CPIOERR_UNKNOWN_FILETYPE, CPIOERR_UNLINK_FAILED, CPIOERR_UNMAPPED_FILE, CPIOERR_UTIME_FAILED, CPIOERR_WRITE_FAILED, errno, and strerror().

Referenced by cpio_doio().

int cpioTrailerWrite FSM_t    fsm
 

Write cpio trailer.

Return values:
fsm  file path and stat info
Returns:
0 on success

Definition at line 64 of file cpio.c.

References CPIO_NEWC_MAGIC, CPIO_TRAILER, FSM_DWRITE, FSM_PAD, fsmStage(), cpioCrcPhysicalHeader::magic, cpioCrcPhysicalHeader::namesize, cpioCrcPhysicalHeader::nlink, and PHYS_HDR_SIZE.

Referenced by fsmStage().


Generated on Sun Oct 26 13:02:05 2003 for rpm by doxygen1.2.18