rpm
4.5
|
Handle cpio payloads within rpm packages. More...
#include "system.h"
#include <rpmio_internal.h>
#include <rpmlib.h>
#include "cpio.h"
#include "fsm.h"
#include "rpmerr.h"
#include "debug.h"
Go to the source code of this file.
Defines | |
#define | GET_NUM_FIELD(phys, log) |
#define | SET_NUM_FIELD(phys, val, space) |
Functions | |
static int | strntoul (const char *str, char **endptr, int base, int num) |
Convert string to unsigned integer (with buffer size check). | |
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 * | cpioStrerror (int rc) |
Return formatted error message on payload handling failure. | |
Variables | |
int | _cpio_debug = 0 |
Handle cpio payloads within rpm packages.
Definition in file cpio.c.
#define GET_NUM_FIELD | ( | phys, | |
log | |||
) |
/*@-boundswrite@*/ \ log = strntoul(phys, &end, 16, sizeof(phys)); \ /*@=boundswrite@*/ \ if ( (end - phys) != sizeof(phys) ) return CPIOERR_BAD_HEADER;
Definition at line 56 of file cpio.c.
Referenced by cpioHeaderRead().
#define SET_NUM_FIELD | ( | phys, | |
val, | |||
space | |||
) |
sprintf(space, "%8.8lx", (unsigned long) (val)); \ /*@-boundsread@*/ \ memcpy(phys, space, 8) \
Definition at line 61 of file cpio.c.
Referenced by cpioHeaderWrite().
int cpioHeaderRead | ( | FSM_t | fsm, |
struct stat * | st | ||
) |
Read cpio header.
fsm | file path and stat info |
st |
Definition at line 148 of file cpio.c.
References _cpio_debug, _free(), CPIO_CRC_MAGIC, CPIO_NEWC_MAGIC, CPIOERR_BAD_HEADER, CPIOERR_BAD_MAGIC, CPIOERR_READ_FAILED, cpioCrcPhysicalHeader::devMajor, cpioCrcPhysicalHeader::devMinor, cpioCrcPhysicalHeader::filesize, FSM_DREAD, FSM_POS, fsmNext(), GET_NUM_FIELD, cpioCrcPhysicalHeader::gid, cpioCrcPhysicalHeader::inode, fsm_s::lpath, 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, S_ISLNK, cpioCrcPhysicalHeader::uid, fsm_s::wrbuf, fsm_s::wrlen, fsm_s::wrsize, xmalloc(), and xstrdup().
Referenced by fsmSetup().
int cpioHeaderWrite | ( | FSM_t | fsm, |
struct stat * | st | ||
) |
Write cpio header.
fsm | file path and stat info |
st |
Definition at line 95 of file cpio.c.
References _cpio_debug, cpioCrcPhysicalHeader::checksum, CPIO_NEWC_MAGIC, CPIOERR_WRITE_FAILED, cpioCrcPhysicalHeader::devMajor, cpioCrcPhysicalHeader::devMinor, cpioCrcPhysicalHeader::filesize, FSM_DWRITE, FSM_PAD, fsmNext(), cpioCrcPhysicalHeader::gid, cpioCrcPhysicalHeader::inode, fsm_s::lpath, cpioCrcPhysicalHeader::magic, major, minor, cpioCrcPhysicalHeader::mode, cpioCrcPhysicalHeader::mtime, cpioCrcPhysicalHeader::namesize, cpioCrcPhysicalHeader::nlink, fsm_s::path, PHYS_HDR_SIZE, fsm_s::rdbuf, cpioCrcPhysicalHeader::rdevMajor, cpioCrcPhysicalHeader::rdevMinor, fsm_s::rdnb, S_ISLNK, SET_NUM_FIELD, cpioCrcPhysicalHeader::uid, and fsm_s::wrnb.
Referenced by fsmSetup().
int cpioTrailerWrite | ( | FSM_t | fsm | ) |
Write cpio trailer.
fsm | file path and stat info |
Definition at line 67 of file cpio.c.
References CPIO_NEWC_MAGIC, CPIO_TRAILER, FSM_DWRITE, FSM_PAD, fsmNext(), cpioCrcPhysicalHeader::magic, cpioCrcPhysicalHeader::namesize, cpioCrcPhysicalHeader::nlink, PHYS_HDR_SIZE, fsm_s::rdbuf, and fsm_s::rdnb.
Referenced by fsmSetup().
static int strntoul | ( | const char * | str, |
char ** | endptr, | ||
int | base, | ||
int | num | ||
) | [static] |
Convert string to unsigned integer (with buffer size check).
str | input string |
endptr | address of 1st character not processed |
base | numerical conversion base |
num | max no. of bytes to read |
Definition at line 34 of file cpio.c.
References alloca().
int _cpio_debug = 0 |
Definition at line 24 of file cpio.c.
Referenced by cpioHeaderRead(), and cpioHeaderWrite().