rpm  4.5
Macros | Functions | Variables
cpio.c File Reference

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"
Include dependency graph for cpio.c:

Go to the source code of this file.

Macros

#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). More...
 
int cpioTrailerWrite (FSM_t fsm)
 Write cpio trailer. More...
 
int cpioHeaderWrite (FSM_t fsm, struct stat *st)
 Write cpio header. More...
 
int cpioHeaderRead (FSM_t fsm, struct stat *st)
 Read cpio header. More...
 
const char * cpioStrerror (int rc)
 Return formatted error message on payload handling failure. More...
 

Variables

int _cpio_debug = 0
 

Detailed Description

Handle cpio payloads within rpm packages.

Warning
FIXME: We don't translate between cpio and system mode bits! These should both be the same, but really odd things are going to happen if that's not true!

Definition in file cpio.c.

Macro Definition Documentation

#define GET_NUM_FIELD (   phys,
  log 
)
Value:
/*@-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 
)
Value:
sprintf(space, "%8.8lx", (unsigned long) (val)); \
/*@-boundsread@*/ \
memcpy(phys, space, 8) \
/*@=boundsread@*/

Definition at line 61 of file cpio.c.

Referenced by cpioHeaderWrite().

Function Documentation

int cpioHeaderRead ( FSM_t  fsm,
struct stat *  st 
)
int cpioHeaderWrite ( FSM_t  fsm,
struct stat *  st 
)
int cpioTrailerWrite ( FSM_t  fsm)

Write cpio trailer.

Return values
fsmfile path and stat info
Returns
0 on success

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).

Parameters
strinput string
Return values
endptraddress of 1st character not processed
Parameters
basenumerical conversion base
nummax no. of bytes to read
Returns
converted integer

Definition at line 34 of file cpio.c.

References alloca().

Variable Documentation

int _cpio_debug = 0

Definition at line 24 of file cpio.c.

Referenced by cpioHeaderRead(), and cpioHeaderWrite().