rpm  5.4.14
Macros | Functions | Variables
rpmxar.c File Reference
#include "system.h"
#include <rpmxar.h>
#include <rpmio_internal.h>
#include <rpmhash.h>
#include <ugid.h>
#include "debug.h"
Include dependency graph for rpmxar.c:

Go to the source code of this file.

Macros

#define READ   0
 
#define WRITE   1
 
#define xar_open(_fn, _f)   (NULL)
 
#define xar_close(_x)   (1)
 
#define xar_iter_new()   (NULL)
 
#define xar_iter_free(_i)
 
#define xar_file_first(_x, _i)   (NULL)
 
#define xar_file_next(_i)   (NULL)
 
#define xar_add_frombuffer(_x, _parent, _fn, _b, _bsize)   (NULL)
 
#define xar_extract_tobuffersz(_x, _f, _b, _bsize)   (1)
 
#define xar_get_path(_f)   "*No XAR*"
 
#define xar_opt_set(_a1, _a2, _a3)   (1)
 
#define XAR_OPT_COMPRESSION   0
 
#define XAR_OPT_VAL_NONE   0
 
#define XAR_OPT_VAL_GZIP   0
 
#define _RPMXAR_INTERNAL
 

Functions

static void rpmxarFini (void *_xar)
 
static rpmxar rpmxarGetPool (rpmioPool pool)
 
rpmxar rpmxarNew (const char *fn, const char *fmode)
 Create a xar archive instance. More...
 
int rpmxarNext (rpmxar xar)
 Iterate a xar archive instance. More...
 
int rpmxarPush (rpmxar xar, const char *fn, unsigned char *b, size_t bsize)
 
int rpmxarPull (rpmxar xar, const char *fn)
 
int rpmxarSwapBuf (rpmxar xar, unsigned char *b, size_t bsize, unsigned char **obp, size_t *obsizep)
 
ssize_t xarRead (void *cookie, char *buf, size_t count)
 
const char * rpmxarPath (rpmxar xar)
 Return path of current archive member. More...
 
static mode_t xarMode (rpmxar xar)
 
static dev_t xarDev (rpmxar xar)
 
static long long xarSize (rpmxar xar)
 
static uid_t xarUid (rpmxar xar)
 
static gid_t xarGid (rpmxar xar)
 
static void xarTime (rpmxar xar, const char *tprop, struct timeval *tv)
 
int rpmxarStat (rpmxar xar, struct stat *st)
 Return stat(2) of current archive member. More...
 

Variables

int _xar_debug = 0
 
rpmioPool _xarPool
 

Macro Definition Documentation

#define _RPMXAR_INTERNAL

Definition at line 59 of file rpmxar.c.

#define READ   0

Definition at line 42 of file rpmxar.c.

Referenced by rpmxarNew().

#define WRITE   1

Definition at line 43 of file rpmxar.c.

Referenced by rpmxarNew().

#define xar_add_frombuffer (   _x,
  _parent,
  _fn,
  _b,
  _bsize 
)    (NULL)

Definition at line 50 of file rpmxar.c.

Referenced by rpmxarPush().

#define xar_close (   _x)    (1)

Definition at line 45 of file rpmxar.c.

Referenced by rpmxarFini().

#define xar_extract_tobuffersz (   _x,
  _f,
  _b,
  _bsize 
)    (1)

Definition at line 51 of file rpmxar.c.

Referenced by rpmxarPull().

#define xar_file_first (   _x,
  _i 
)    (NULL)

Definition at line 48 of file rpmxar.c.

Referenced by rpmxarNext().

#define xar_file_next (   _i)    (NULL)

Definition at line 49 of file rpmxar.c.

Referenced by rpmxarNext().

#define xar_get_path (   _f)    "*No XAR*"

Definition at line 52 of file rpmxar.c.

Referenced by rpmxarPath(), and rpmxarPull().

#define xar_iter_free (   _i)

Definition at line 47 of file rpmxar.c.

Referenced by rpmxarFini().

#define xar_iter_new ( )    (NULL)

Definition at line 46 of file rpmxar.c.

Referenced by rpmxarNew().

#define xar_open (   _fn,
  _f 
)    (NULL)

Definition at line 44 of file rpmxar.c.

Referenced by rpmxarNew().

#define XAR_OPT_COMPRESSION   0

Definition at line 54 of file rpmxar.c.

Referenced by rpmxarPush().

#define xar_opt_set (   _a1,
  _a2,
  _a3 
)    (1)

Definition at line 53 of file rpmxar.c.

Referenced by rpmxarPush().

#define XAR_OPT_VAL_GZIP   0

Definition at line 56 of file rpmxar.c.

Referenced by rpmxarPush().

#define XAR_OPT_VAL_NONE   0

Definition at line 55 of file rpmxar.c.

Referenced by rpmxarPush().

Function Documentation

static void rpmxarFini ( void _xar)
static

Definition at line 76 of file rpmxar.c.

References _free(), NULL, xar_close, xar_iter_free, and xx.

Referenced by rpmxarGetPool().

static rpmxar rpmxarGetPool ( rpmioPool  pool)
static

Definition at line 96 of file rpmxar.c.

References _xar_debug, _xarPool, memset(), NULL, rpmioGetPool(), rpmioNewPool(), and rpmxarFini().

Referenced by rpmxarNew().

rpmxar rpmxarNew ( const char *  fn,
const char *  fmode 
)

Create a xar archive instance.

Parameters
fnxar file
fmode"r" for reading, "w" for writing
Returns
new xar instance

Definition at line 112 of file rpmxar.c.

References _xar_debug, assert(), flags, fprintf(), NULL, READ, rpmxarGetPool(), rpmxarLink(), WRITE, xar_iter_new, and xar_open.

Referenced by rdLead().

int rpmxarNext ( rpmxar  xar)

Iterate a xar archive instance.

Parameters
xarxar archive
Returns
0 on SUCCESS, 1 on end-of-iteration

Definition at line 128 of file rpmxar.c.

References _xar_debug, fprintf(), NULL, rc, xar_file_first, and xar_file_next.

Referenced by rdLead(), rdSignature(), readFile(), rpmReadHeader(), and xarRead().

const char* rpmxarPath ( rpmxar  xar)

Return path of current archive member.

Parameters
xarxar archive
Returns
path of xar member

Definition at line 260 of file rpmxar.c.

References _xar_debug, fprintf(), NULL, path, and xar_get_path.

Referenced by rpmxarStat().

int rpmxarPull ( rpmxar  xar,
const char *  fn 
)
int rpmxarPush ( rpmxar  xar,
const char *  fn,
unsigned char *  b,
size_t  bsize 
)
int rpmxarStat ( rpmxar  xar,
struct stat *  st 
)

Return stat(2) of current archive member.

Parameters
xarxar archive
Return values
*ststat(2) of current member
Returns
0 on success

Definition at line 395 of file rpmxar.c.

References _free(), _xar_debug, fprintf(), hashFunctionString(), memset(), path, rc, rpmxarPath(), xarDev(), xarGid(), xarMode(), xarSize(), xarTime(), and xarUid().

int rpmxarSwapBuf ( rpmxar  xar,
unsigned char *  b,
size_t  bsize,
unsigned char **  obp,
size_t *  obsizep 
)

Definition at line 203 of file rpmxar.c.

References _free(), _xar_debug, b, fprintf(), and NULL.

Referenced by rdLead(), and xarRead().

static dev_t xarDev ( rpmxar  xar)
static

Definition at line 304 of file rpmxar.c.

References major, makedev, minor, NULL, t, and unsigned.

Referenced by rpmxarStat().

static gid_t xarGid ( rpmxar  xar)
static

Definition at line 359 of file rpmxar.c.

References g, gnameToGid(), NULL, and t.

Referenced by rpmxarStat().

static mode_t xarMode ( rpmxar  xar)
static

Definition at line 268 of file rpmxar.c.

References m, NULL, S_IFSOCK, strcmp(), and t.

Referenced by rpmxarStat().

ssize_t xarRead ( void cookie,
char *  buf,
size_t  count 
)

Definition at line 229 of file rpmxar.c.

References _xar_debug, assert(), b, fd, fdGetXAR(), fprintf(), nb, NULL, rc, RPMRC_FAIL, rpmxarNext(), rpmxarPull(), rpmxarSwapBuf(), void, and xx.

Referenced by __fdRead().

static long long xarSize ( rpmxar  xar)
static

Definition at line 324 of file rpmxar.c.

References _free(), L, NULL, and t.

Referenced by rpmxarStat().

static void xarTime ( rpmxar  xar,
const char *  tprop,
struct timeval *  tv 
)
static

Definition at line 375 of file rpmxar.c.

References NULL, and t.

Referenced by rpmxarStat().

static uid_t xarUid ( rpmxar  xar)
static

Definition at line 343 of file rpmxar.c.

References NULL, t, u, and unameToUid().

Referenced by rpmxarStat().

Variable Documentation

int _xar_debug = 0
rpmioPool _xarPool

Definition at line 73 of file rpmxar.c.

Referenced by rpmioClean(), and rpmxarGetPool().