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

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"

Go to the source code of this file.

Defines

#define GET_NUM_FIELD(phys, log)
#define SET_NUM_FIELD(phys, val, space)

Functions

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 *const cpioStrerror (int rc)


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.


Define 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 53 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) \

Definition at line 58 of file cpio.c.

Referenced by cpioHeaderWrite().


Function Documentation

int cpioHeaderRead FSM_t  fsm,
struct stat *  st
 

Read cpio header.

< Don't depend on sizeof(struct)

Definition at line 130 of file cpio.c.

References _free(), CPIO_CRC_MAGIC, CPIO_NEWC_MAGIC, cpioCrcPhysicalHeader::devMajor, cpioCrcPhysicalHeader::devMinor, cpioCrcPhysicalHeader::filesize, FSM_DREAD, FSM_t, fsmNext(), GET_NUM_FIELD, cpioCrcPhysicalHeader::gid, cpioCrcPhysicalHeader::inode, cpioCrcPhysicalHeader::magic, major, makedev, minor, cpioCrcPhysicalHeader::mode, cpioCrcPhysicalHeader::mtime, cpioCrcPhysicalHeader::namesize, cpioCrcPhysicalHeader::nlink, fsm_s::path, 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.

< Don't depend on sizeof(struct)

< Don't depend on sizeof(struct)

Definition at line 92 of file cpio.c.

References cpioCrcPhysicalHeader::checksum, CPIO_NEWC_MAGIC, cpioCrcPhysicalHeader::devMajor, cpioCrcPhysicalHeader::devMinor, cpioCrcPhysicalHeader::filesize, FSM_DWRITE, FSM_PAD, FSM_t, fsmNext(), cpioCrcPhysicalHeader::gid, cpioCrcPhysicalHeader::inode, 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, SET_NUM_FIELD, cpioCrcPhysicalHeader::uid, and fsm_s::wrnb.

Referenced by fsmStage().

int cpioTrailerWrite FSM_t  fsm  ) 
 

Write cpio trailer.

< Don't depend on sizeof(struct)

< Don't depend on sizeof(struct)

< Don't depend on sizeof(struct)

Definition at line 64 of file cpio.c.

References CPIO_NEWC_MAGIC, CPIO_TRAILER, FSM_DWRITE, FSM_PAD, FSM_t, fsmNext(), cpioCrcPhysicalHeader::magic, cpioCrcPhysicalHeader::namesize, cpioCrcPhysicalHeader::nlink, PHYS_HDR_SIZE, fsm_s::rdbuf, and fsm_s::rdnb.

Referenced by fsmStage().

int strntoul const char *  str,
char **  endptr,
int  base,
int  num
[static]
 

Convert string to unsigned integer (with buffer size check).

Parameters:
str input string
Return values:
endptr address of 1st character not processed
Parameters:
base numerical conversion base
num max no. of bytes to read
Returns:
converted integer

Definition at line 31 of file cpio.c.

References alloca().


Generated on Fri Aug 14 12:35:56 2009 for rpm by  doxygen 1.3.9.1