Handle cpio(1) archives. More...
#include "system.h"
#include <rpmio.h>
#include <ugid.h>
#include <cpio.h>
#include <iosm.h>
#include "debug.h"
Go to the source code of this file.
Defines | |
#define | _IOSM_INTERNAL |
#define | _IOSMRC(_rc) if ((_rc) <= 0) return ((_rc) ? (int) -rc : IOSMERR_HDR_TRAILER) |
#define | GET_NUM_FIELD(phys, log) |
#define | SET_NUM_FIELD(phys, val, space) |
Functions | |
static int | strntoul (const char *str, char **endptr, int base, size_t num) |
Convert string to unsigned integer (with buffer size check). | |
static ssize_t | cpioRead (void *_iosm, void *buf, size_t count) |
int | cpioHeaderRead (void *_iosm, struct stat *st) |
Read cpio header. | |
static ssize_t | cpioWrite (void *_iosm, const void *buf, size_t count) |
int | cpioHeaderWrite (void *_iosm, struct stat *st) |
Write cpio header. | |
int | cpioTrailerWrite (void *_iosm) |
Write cpio trailer. | |
Variables | |
int | _cpio_debug = 0 |
Handle cpio(1) archives.
Definition in file cpio.c.
#define _IOSMRC | ( | _rc ) | if ((_rc) <= 0) return ((_rc) ? (int) -rc : IOSMERR_HDR_TRAILER) |
Definition at line 54 of file cpio.c.
Referenced by cpioHeaderRead(), cpioHeaderWrite(), and cpioTrailerWrite().
#define GET_NUM_FIELD | ( | phys, | |
log | |||
) |
log = strntoul(phys, &end, 16, sizeof(phys)); \ if ( (end - phys) != sizeof(phys) ) return IOSMERR_BAD_HEADER;
Definition at line 88 of file cpio.c.
Referenced by cpioHeaderRead().
#define SET_NUM_FIELD | ( | phys, | |
val, | |||
space | |||
) |
sprintf(space, "%8.8lx", (unsigned long) (val)); \ memcpy(phys, space, 8)
Definition at line 91 of file cpio.c.
Referenced by cpioHeaderWrite().
int cpioHeaderRead | ( | void * | _iosm, |
struct stat * | st | ||
) |
Read cpio header.
_iosm | file path and stat info |
st |
Definition at line 95 of file cpio.c.
References _cpio_debug, _free(), _iosmNext, _IOSMRC, CPIO_CRC_MAGIC, CPIO_NEWC_MAGIC, cpioRead(), cpioCrcPhysicalHeader_s::devMajor, cpioCrcPhysicalHeader_s::devMinor, cpioCrcPhysicalHeader_s::filesize, GET_NUM_FIELD, cpioCrcPhysicalHeader_s::gid, cpioCrcPhysicalHeader_s::inode, IOSM_POS, cpioCrcPhysicalHeader_s::magic, major, Makedev, minor, cpioCrcPhysicalHeader_s::mode, cpioCrcPhysicalHeader_s::mtime, cpioCrcPhysicalHeader_s::namesize, cpioCrcPhysicalHeader_s::nlink, PHYS_HDR_SIZE, cpioCrcPhysicalHeader_s::rdevMajor, cpioCrcPhysicalHeader_s::rdevMinor, S_ISLNK, cpioCrcPhysicalHeader_s::uid, and xmalloc().
Referenced by fsmSetup(), and iosmSetup().
int cpioHeaderWrite | ( | void * | _iosm, |
struct stat * | st | ||
) |
Write cpio header.
_iosm | file path and stat info |
st |
Definition at line 224 of file cpio.c.
References _cpio_debug, _iosmNext, _IOSMRC, cpioCrcPhysicalHeader_s::checksum, CPIO_NEWC_MAGIC, cpioWrite(), cpioCrcPhysicalHeader_s::devMajor, cpioCrcPhysicalHeader_s::devMinor, cpioCrcPhysicalHeader_s::filesize, cpioCrcPhysicalHeader_s::gid, cpioCrcPhysicalHeader_s::inode, IOSM_PAD, cpioCrcPhysicalHeader_s::magic, major, minor, cpioCrcPhysicalHeader_s::mode, cpioCrcPhysicalHeader_s::mtime, cpioCrcPhysicalHeader_s::namesize, cpioCrcPhysicalHeader_s::nlink, PHYS_HDR_SIZE, cpioCrcPhysicalHeader_s::rdevMajor, cpioCrcPhysicalHeader_s::rdevMinor, S_ISLNK, SET_NUM_FIELD, and cpioCrcPhysicalHeader_s::uid.
Referenced by fsmSetup(), and iosmSetup().
static ssize_t cpioRead | ( | void * | _iosm, |
void * | buf, | ||
size_t | count | ||
) | [static] |
Definition at line 57 of file cpio.c.
References _cpio_debug, _iosmNext, and IOSM_DREAD.
Referenced by cpioHeaderRead().
int cpioTrailerWrite | ( | void * | _iosm ) |
Write cpio trailer.
_iosm | file path and stat info |
Definition at line 278 of file cpio.c.
References _cpio_debug, _iosmNext, _IOSMRC, CPIO_NEWC_MAGIC, CPIO_TRAILER, cpioWrite(), IOSM_PAD, cpioCrcPhysicalHeader_s::magic, cpioCrcPhysicalHeader_s::namesize, cpioCrcPhysicalHeader_s::nlink, and PHYS_HDR_SIZE.
Referenced by fsmSetup(), and iosmSetup().
static ssize_t cpioWrite | ( | void * | _iosm, |
const void * | buf, | ||
size_t | count | ||
) | [static] |
Definition at line 188 of file cpio.c.
References _cpio_debug, _iosmNext, IOSM_DWRITE, and IOSM_PAD.
Referenced by cpioHeaderWrite(), and cpioTrailerWrite().
static int strntoul | ( | const char * | str, |
char ** | endptr, | ||
int | base, | ||
size_t | num | ||
) | [static] |
int _cpio_debug = 0 |
Definition at line 20 of file cpio.c.
Referenced by cpioHeaderRead(), cpioHeaderWrite(), cpioRead(), cpioTrailerWrite(), and cpioWrite().