rpm  5.4.10
Data Structures | Macros | Functions | Variables
rpmfi.c File Reference

Routines to handle file info tag sets. More...

#include "system.h"
#include <rpmiotypes.h>
#include <rpmio.h>
#include <rpmlog.h>
#include <rpmbf.h>
#include <rpmurl.h>
#include <rpmdir.h>
#include <rpmmacro.h>
#include <ugid.h>
#include <rpmdav.h>
#include <rpmtypes.h>
#include <rpmtag.h>
#include "fprint.h"
#include "fsm.h"
#include "legacy.h"
#include "rpmds.h"
#include "rpmte.h"
#include "rpmts.h"
#include <rpmcli.h>
#include "debug.h"
Include dependency graph for rpmfi.c:

Go to the source code of this file.

Data Structures

struct  rpmRelocation_s
 

Macros

#define _RPMDIR_INTERNAL
 
#define _RPMAV_INTERNAL   /* XXX avOpendir */
 
#define _FPRINT_INTERNAL
 
#define _IOSM_INTERNAL
 
#define _RPMFI_INTERNAL
 
#define _RPMTE_INTERNAL   /* relocations */
 
#define alloca_strdup(_s)   strcpy((char *)alloca(strlen(_s)+1), (_s))
 
#define _fdupestring(_h, _tag, _data)
 
#define _fdupedata(_h, _tag, _cast, _data)
 

Functions

static char * stripTrailingChar (char *s, char c)
 Remove occurrences of trailing character from string. More...
 
int rpmfiFC (rpmfi fi)
 Return file count from file info set. More...
 
int rpmfiDC (rpmfi fi)
 Return directory count from file info set. More...
 
int rpmfiFX (rpmfi fi)
 Return current file index from file info set. More...
 
int rpmfiSetFX (rpmfi fi, int fx)
 Set current file index in file info set. More...
 
int rpmfiDX (rpmfi fi)
 Return current directory index from file info set. More...
 
int rpmfiSetDX (rpmfi fi, int dx)
 Set current directory index in file info set. More...
 
int rpmfiIsSource (rpmfi fi)
 Return source rpm marker from file info set. More...
 
const char * rpmfiBN (rpmfi fi)
 Return current base name from file info set. More...
 
const char * rpmfiDN (rpmfi fi)
 Return current directory name from file info set. More...
 
const char * rpmfiFN (rpmfi fi)
 Return current file name from file info set. More...
 
void * rpmfiFNBF (rpmfi fi)
 Return FN Bloom filter from file info set. More...
 
size_t rpmfiFNMaxLen (rpmfi fi)
 Return maximum file name length from file info set. More...
 
rpmuint32_t rpmfiFFlags (rpmfi fi)
 Return current file flags from file info set. More...
 
rpmuint32_t rpmfiSetFFlags (rpmfi fi, rpmuint32_t FFlags)
 Set current file flags in file info set. More...
 
rpmuint32_t rpmfiVFlags (rpmfi fi)
 Return current file verify flags from file info set. More...
 
rpmuint32_t rpmfiSetVFlags (rpmfi fi, rpmuint32_t VFlags)
 Set current file verify flags in file info set. More...
 
rpmuint16_t rpmfiFMode (rpmfi fi)
 Return current file mode from file info set. More...
 
rpmfileState rpmfiFState (rpmfi fi)
 Return current file state from file info set. More...
 
rpmfileState rpmfiSetFState (rpmfi fi, rpmfileState fstate)
 Set current file state in file info set. More...
 
const unsigned char * rpmfiDigest (rpmfi fi, int *algop, size_t *lenp)
 Return current file (binary) digest from file info set. More...
 
const char * rpmfiFLink (rpmfi fi)
 Return current file linkto (i.e. More...
 
rpmuint32_t rpmfiFSize (rpmfi fi)
 Return current file size from file info set. More...
 
rpmuint16_t rpmfiFRdev (rpmfi fi)
 Return current file rdev from file info set. More...
 
rpmuint32_t rpmfiFInode (rpmfi fi)
 Return current file inode from file info set. More...
 
rpmuint32_t rpmfiColor (rpmfi fi)
 Return union of all file color bits from file info set. More...
 
rpmuint32_t rpmfiFColor (rpmfi fi)
 Return current file color bits from file info set. More...
 
const char * rpmfiFClass (rpmfi fi)
 Return current file class from file info set. More...
 
const char * rpmfiFContext (rpmfi fi)
 Return current file security context from file info set. More...
 
rpmuint32_t rpmfiFDepends (rpmfi fi, const rpmuint32_t **fddictp)
 Return current file depends dictionary from file info set. More...
 
rpmuint32_t rpmfiFNlink (rpmfi fi)
 Return (calculated) current file nlink count from file info set. More...
 
rpmuint32_t rpmfiFMtime (rpmfi fi)
 Return current file modify time from file info set. More...
 
const char * rpmfiFUser (rpmfi fi)
 Return current file owner from file info set. More...
 
const char * rpmfiFGroup (rpmfi fi)
 Return current file group from file info set. More...
 
void * rpmfiBloomFN (const rpmfi fi)
 Return file path Bloom filter. More...
 
void * rpmfiExclude (const rpmfi fi)
 Return file info exclude patterns. More...
 
int rpmfiNExclude (const rpmfi fi)
 Return no. More...
 
void * rpmfiInclude (const rpmfi fi)
 Return file info include patterns. More...
 
int rpmfiNInclude (const rpmfi fi)
 Return no. More...
 
struct fingerPrint_srpmfiFpsIndex (rpmfi fi, int ix)
 
void rpmfiFpLookup (rpmfi fi, fingerPrintCache fpc)
 
int rpmfiNext (rpmfi fi)
 Return next file iterator index. More...
 
rpmfi rpmfiInit (rpmfi fi, int fx)
 Initialize file iterator index. More...
 
int rpmfiNextD (rpmfi fi)
 Return next directory iterator index. More...
 
rpmfi rpmfiInitD (rpmfi fi, int dx)
 Initialize directory iterator index. More...
 
static const char * rpmfiFtstring (rpmFileTypes ft)
 Identify a file type. More...
 
static rpmFileTypes rpmfiWhatis (rpmuint16_t mode)
 Return file type from mode_t. More...
 
int rpmfiCompare (const rpmfi afi, const rpmfi bfi)
 Return file info comparison. More...
 
int rpmfiDecideFate (const rpmfi ofi, rpmfi nfi, int skipMissing)
 Return file disposition. More...
 
const char * rpmfiTypeString (rpmfi fi)
 Return formatted string representation of package disposition. More...
 
static Header relocateFileList (const rpmts ts, rpmfi fi, Header origH, iosmFileAction *actions)
 Relocate files in header. More...
 
int rpmfiSetHeader (rpmfi fi, Header h)
 Link a header to a file info set. More...
 
static void rpmfiFini (void *_fi)
 
static rpmfi rpmfiGetPool (rpmioPool pool)
 
static unsigned char nibble (char c)
 Convert hex to binary nibble. More...
 
rpmfi rpmfiNew (const void *_ts, Header h, rpmTag tagN, int flags)
 Create and load a file info set. More...
 
int rpmfiAddRelocation (rpmRelocation *relp, int *nrelp, const char *oldPath, const char *newPath)
 Add relocation element to array. More...
 
rpmRelocation rpmfiFreeRelocations (rpmRelocation relocs)
 Free relocation array. More...
 
rpmRelocation rpmfiDupeRelocations (rpmRelocation relocs, int *nrelocsp)
 Duplicate a relocation array. More...
 
int rpmfiFStat (rpmfi fi, struct stat *st)
 Return current stat(2) data from file info set. More...
 
int rpmfiStat (rpmfi fi, const char *path, struct stat *st)
 Return lstat(2) data of path from file info set. More...
 
void * rpmfiOpendir (rpmfi fi, const char *name)
 Return directory stream onto file info set. More...
 
void rpmfiBuildFClasses (Header h, const char ***fclassp, rpmuint32_t *fcp)
 Retrieve file classes from header. More...
 
void rpmfiBuildFDeps (Header h, rpmTag tagN, const char ***fdepsp, rpmuint32_t *fcp)
 Retrieve per-file dependencies from header. More...
 

Variables

int _rpmfi_debug = 0
 
rpmioPool _rpmfiPool
 

Detailed Description

Routines to handle file info tag sets.

Definition in file rpmfi.c.

Macro Definition Documentation

§ _fdupedata

#define _fdupedata (   _h,
  _tag,
  _cast,
  _data 
)
Value:
he->tag = _tag; \
xx = headerGet((_h), he, 0); \
_data = (_cast) he->p.ptr;
int headerGet(Header h, HE_t he, unsigned int flags)
Retrieve extension or tag value from a header.
Definition: header.c:2222

Definition at line 1397 of file rpmfi.c.

Referenced by rpmfiNew().

§ _fdupestring

#define _fdupestring (   _h,
  _tag,
  _data 
)
Value:
he->tag = _tag; \
xx = headerGet((_h), he, 0); \
_data = he->p.str;
int headerGet(Header h, HE_t he, unsigned int flags)
Retrieve extension or tag value from a header.
Definition: header.c:2222

Definition at line 1392 of file rpmfi.c.

Referenced by rpmfiNew().

§ _FPRINT_INTERNAL

#define _FPRINT_INTERNAL

Definition at line 24 of file rpmfi.c.

§ _IOSM_INTERNAL

#define _IOSM_INTERNAL

Definition at line 27 of file rpmfi.c.

§ _RPMAV_INTERNAL

#define _RPMAV_INTERNAL   /* XXX avOpendir */

Definition at line 18 of file rpmfi.c.

§ _RPMDIR_INTERNAL

#define _RPMDIR_INTERNAL

Definition at line 13 of file rpmfi.c.

§ _RPMFI_INTERNAL

#define _RPMFI_INTERNAL

Definition at line 28 of file rpmfi.c.

§ _RPMTE_INTERNAL

#define _RPMTE_INTERNAL   /* relocations */

Definition at line 34 of file rpmfi.c.

§ alloca_strdup

#define alloca_strdup (   _s)    strcpy((char *)alloca(strlen(_s)+1), (_s))

Definition at line 777 of file rpmfi.c.

Referenced by relocateFileList().

Function Documentation

§ nibble()

static unsigned char nibble ( char  c)
inlinestatic

Convert hex to binary nibble.

Parameters
chex character
Returns
binary nibble

Definition at line 1380 of file rpmfi.c.

Referenced by rpmfiNew().

§ relocateFileList()

static Header relocateFileList ( const rpmts  ts,
rpmfi  fi,
Header  origH,
iosmFileAction actions 
)
static

§ rpmfiAddRelocation()

int rpmfiAddRelocation ( rpmRelocation relp,
int *  nrelp,
const char *  oldPath,
const char *  newPath 
)

Add relocation element to array.

Return values
*relocationsrelocation array
*nrelocationsno. of elements
Parameters
oldPathold path
newPathnew path
Returns
0 on success

Definition at line 1726 of file rpmfi.c.

References xrealloc, and xstrdup().

Referenced by installArgCallback(), and main().

§ rpmfiBloomFN()

void* rpmfiBloomFN ( const rpmfi  fi)

Return file path Bloom filter.

Parameters
fifile info set
Returns
file path Bloom filter (NULL if not set)

Definition at line 482 of file rpmfi.c.

§ rpmfiBN()

const char* rpmfiBN ( rpmfi  fi)

Return current base name from file info set.

Parameters
fifile info set
Returns
current base name, NULL on invalid

Definition at line 141 of file rpmfi.c.

Referenced by arSetup(), freeFSM(), handleInstInstalledFile(), rpmfi_BN(), rpmfi_BN_get(), rpmtsFindBaseNamesInDB(), and rpmtsSkipFiles().

§ rpmfiBuildFClasses()

void rpmfiBuildFClasses ( Header  h,
const char ***  fclassp,
rpmuint32_t fcp 
)

Retrieve file classes from header.

This function is used to retrieve file classes from the header.

Parameters
hheader
Return values
*fclassparray of file classes
*fcpnumber of files

Definition at line 1878 of file rpmfi.c.

References _free(), alloca(), rpmfiFC(), rpmfiFClass(), rpmfiFContext(), rpmfiFMode(), rpmfiFN(), rpmfiFree(), rpmfiInit(), rpmfiNew(), rpmfiNext(), rpmGetPath(), RPMTAG_BASENAMES, stpcpy(), xmalloc, and xrealloc.

Referenced by fileclassTag().

§ rpmfiBuildFDeps()

void rpmfiBuildFDeps ( Header  h,
rpmTag  tagN,
const char ***  fdepsp,
rpmuint32_t fcp 
)

Retrieve per-file dependencies from header.

This function is used to retrieve per-file dependencies from the header.

Parameters
hheader
tagNRPMTAG_PROVIDENAME | RPMTAG_REQUIRENAME
Return values
*fdepsparray of file dependencies
*fcpnumber of files

Definition at line 2137 of file rpmfi.c.

References _free(), rpmdsDNEVR(), rpmdsFree(), rpmdsNew(), rpmdsNext(), rpmdsSetIx(), rpmfiFC(), rpmfiFDepends(), rpmfiFree(), rpmfiInit(), rpmfiNew(), rpmfiNext(), RPMTAG_BASENAMES, RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME, stpcpy(), and xmalloc.

Referenced by fileprovideTag(), and filerequireTag().

§ rpmfiColor()

rpmuint32_t rpmfiColor ( rpmfi  fi)

Return union of all file color bits from file info set.

Parameters
fifile info set
Returns
current color

Definition at line 361 of file rpmfi.c.

§ rpmfiCompare()

int rpmfiCompare ( const rpmfi  afi,
const rpmfi  bfi 
)

Return file info comparison.

Parameters
afi1st file info
bfi2nd file info
Returns
0 if identical

Definition at line 637 of file rpmfi.c.

References LINK, REG, rpmfiDigest(), rpmfiFLink(), rpmfiFMode(), and rpmfiWhatis().

Referenced by handleInstInstalledFile(), and handleOverlappedFiles().

§ rpmfiDC()

int rpmfiDC ( rpmfi  fi)

Return directory count from file info set.

Parameters
fifile info set
Returns
current directory count

Definition at line 92 of file rpmfi.c.

Referenced by rpmfi_DC(), rpmfi_DC_get(), and rpmtsSkipFiles().

§ rpmfiDecideFate()

int rpmfiDecideFate ( const rpmfi  ofi,
rpmfi  nfi,
int  skipMissing 
)

Return file disposition.

Parameters
ofiold file info
nfinew file info
skipMissingOK to skip missing files?
Returns
file disposition

Definition at line 671 of file rpmfi.c.

References D_, dodigest(), FA_ALTNAME, FA_CREATE, FA_SAVE, FA_SKIP, LINK, Lstat(), Readlink(), REG, rpmfiDigest(), rpmfiFFlags(), rpmfiFLink(), rpmfiFMode(), rpmfiFN(), RPMFILE_MISSINGOK, RPMFILE_NOREPLACE, RPMFILE_SPARSE, rpmfiWhatis(), rpmlog(), RPMLOG_DEBUG, and XDIR.

Referenced by handleInstInstalledFile().

§ rpmfiDigest()

const unsigned char* rpmfiDigest ( rpmfi  fi,
int *  algop,
size_t *  lenp 
)

Return current file (binary) digest from file info set.

Parameters
fifile info set
Return values
*algopdigest algorithm
*lenpdigest length (in bytes)
Returns
current file digest, NULL on invalid

Definition at line 300 of file rpmfi.c.

Referenced by handleOverlappedFiles(), rpmfi_Digest(), rpmfi_FDigest_get(), rpmfiCompare(), rpmfiDecideFate(), and showQueryPackage().

§ rpmfiDN()

const char* rpmfiDN ( rpmfi  fi)

Return current directory name from file info set.

Parameters
fifile info set
Returns
current directory, NULL on invalid

Definition at line 152 of file rpmfi.c.

Referenced by handleInstInstalledFile(), rpmfi_DN(), rpmfi_DN_get(), rpmtsSkipFiles(), and runScriptTriggersLoop().

§ rpmfiDupeRelocations()

rpmRelocation rpmfiDupeRelocations ( rpmRelocation  relocs,
int *  nrelocsp 
)

Duplicate a relocation array.

Parameters
relocsrelocation array
Return values
*nrelocspno. of elements
Returns
duplicate relocation array

Definition at line 1751 of file rpmfi.c.

References rpmRelocation_s::newPath, rpmRelocation_s::oldPath, xmalloc, and xstrdup().

Referenced by addTE().

§ rpmfiDX()

int rpmfiDX ( rpmfi  fi)

Return current directory index from file info set.

Parameters
fifile info set
Returns
current directory index

Definition at line 120 of file rpmfi.c.

Referenced by rpmfi_DX(), rpmfi_DX_get(), rpmfi_DX_set(), and rpmtsSkipFiles().

§ rpmfiExclude()

void* rpmfiExclude ( const rpmfi  fi)

Return file info exclude patterns.

Parameters
fifile info set
Returns
file info exclude patterns (NULL if not set)

Definition at line 489 of file rpmfi.c.

§ rpmfiFC()

int rpmfiFC ( rpmfi  fi)

§ rpmfiFClass()

const char* rpmfiFClass ( rpmfi  fi)

Return current file class from file info set.

Parameters
fifile info set
Returns
current file class, 0 on invalid

Definition at line 383 of file rpmfi.c.

Referenced by rpmfi_FClass(), rpmfi_FClass_get(), and rpmfiBuildFClasses().

§ rpmfiFColor()

rpmuint32_t rpmfiFColor ( rpmfi  fi)

Return current file color bits from file info set.

Parameters
fifile info set
Returns
current file color

Definition at line 371 of file rpmfi.c.

Referenced by handleInstInstalledFile(), handleOverlappedFiles(), rpmfi_FColor(), rpmfi_FColor_get(), rpmteColorDS(), and rpmtsSkipFiles().

§ rpmfiFContext()

const char* rpmfiFContext ( rpmfi  fi)

Return current file security context from file info set.

Parameters
fifile info set
Returns
current file context, 0 on invalid

Definition at line 395 of file rpmfi.c.

Referenced by rpmfiBuildFClasses().

§ rpmfiFDepends()

rpmuint32_t rpmfiFDepends ( rpmfi  fi,
const rpmuint32_t **  fddictp 
)

Return current file depends dictionary from file info set.

Parameters
fifile info set
Return values
*fddictpfile depends dictionary array (or NULL)
Returns
no. of file depends entries, 0 on invalid

Definition at line 406 of file rpmfi.c.

Referenced by rpmfiBuildFDeps(), and rpmteColorDS().

§ rpmfiFFlags()

rpmuint32_t rpmfiFFlags ( rpmfi  fi)

Return current file flags from file info set.

Parameters
fifile info set
Returns
current file flags, 0 on invalid

Definition at line 217 of file rpmfi.c.

Referenced by handleInstInstalledFile(), handleOverlappedFiles(), rpmfcGenerateDepends(), rpmfi_FFlags(), rpmfi_FFlags_get(), rpmfi_iternext(), rpmfiDecideFate(), rpmInstallSourcePackage(), rpmtsSkipFiles(), and showQueryPackage().

§ rpmfiFGroup()

const char* rpmfiFGroup ( rpmfi  fi)

Return current file group from file info set.

Parameters
fifile info set
Returns
current file group, NULL on invalid

Definition at line 470 of file rpmfi.c.

Referenced by rpmfi_FGroup(), rpmfi_FGroup_get(), rpmfi_iternext(), and showQueryPackage().

§ rpmfiFini()

static void rpmfiFini ( void *  _fi)
static

Definition at line 1287 of file rpmfi.c.

References _free(), freeFSM(), headerFree(), and mireFreeAll().

Referenced by rpmfiGetPool().

§ rpmfiFInode()

rpmuint32_t rpmfiFInode ( rpmfi  fi)

Return current file inode from file info set.

Parameters
fifile info set
Returns
current file inode, 0 on invalid

Definition at line 350 of file rpmfi.c.

Referenced by rpmfi_iternext().

§ rpmfiFLink()

const char* rpmfiFLink ( rpmfi  fi)

Return current file linkto (i.e.

symlink(2) target) from file info set.

Parameters
fifile info set
Returns
current file linkto, NULL on invalid

Definition at line 317 of file rpmfi.c.

Referenced by rpmfi_FLink(), rpmfi_FLink_get(), rpmfiCompare(), rpmfiDecideFate(), rpmtsAddFingerprints(), and showQueryPackage().

§ rpmfiFMode()

rpmuint16_t rpmfiFMode ( rpmfi  fi)

Return current file mode from file info set.

Parameters
fifile info set
Returns
current file mode, 0 on invalid

Definition at line 265 of file rpmfi.c.

Referenced by fiIntersect(), handleOverlappedFiles(), rpmfcGenerateDepends(), rpmfi_FMode(), rpmfi_FMode_get(), rpmfi_iternext(), rpmfiBuildFClasses(), rpmfiCompare(), rpmfiDecideFate(), rpmtsSkipFiles(), and showQueryPackage().

§ rpmfiFMtime()

rpmuint32_t rpmfiFMtime ( rpmfi  fi)

Return current file modify time from file info set.

Parameters
fifile info set
Returns
current file modify time, 0 on invalid

Definition at line 447 of file rpmfi.c.

Referenced by rpmfi_FMtime(), rpmfi_FMtime_get(), rpmfi_iternext(), and showQueryPackage().

§ rpmfiFN()

const char* rpmfiFN ( rpmfi  fi)

§ rpmfiFNBF()

void* rpmfiFNBF ( rpmfi  fi)

Return FN Bloom filter from file info set.

Parameters
fifile info set
Returns
FN Bloom filter, NULL on invalid

Definition at line 181 of file rpmfi.c.

References alloca(), stpcpy(), and urlPath().

Referenced by packagedDir(), and rpmalAdd().

§ rpmfiFNlink()

rpmuint32_t rpmfiFNlink ( rpmfi  fi)

Return (calculated) current file nlink count from file info set.

Parameters
fifile info set
Returns
current file nlink count, 0 on invalid

Definition at line 427 of file rpmfi.c.

Referenced by rpmfi_iternext(), rpmfiFStat(), rpmvfNew(), and showQueryPackage().

§ rpmfiFNMaxLen()

size_t rpmfiFNMaxLen ( rpmfi  fi)

Return maximum file name length from file info set.

Parameters
fifile info set
Returns
maximum file name length (not including '\0')

Definition at line 212 of file rpmfi.c.

Referenced by pkgUnpackagedSubdirs().

§ rpmfiFpLookup()

void rpmfiFpLookup ( rpmfi  fi,
fingerPrintCache  fpc 
)

Definition at line 518 of file rpmfi.c.

References fpLookupList(), and xcalloc().

Referenced by rpmtsAddFingerprints().

§ rpmfiFpsIndex()

struct fingerPrint_s* rpmfiFpsIndex ( rpmfi  fi,
int  ix 
)

Definition at line 509 of file rpmfi.c.

Referenced by handleOverlappedFiles(), and rpmtsAddFingerprints().

§ rpmfiFRdev()

rpmuint16_t rpmfiFRdev ( rpmfi  fi)

Return current file rdev from file info set.

Parameters
fifile info set
Returns
current file rdev, 0 on invalid

Definition at line 339 of file rpmfi.c.

Referenced by rpmfi_FRdev(), rpmfi_FRdev_get(), rpmfi_iternext(), and showQueryPackage().

§ rpmfiFreeRelocations()

rpmRelocation rpmfiFreeRelocations ( rpmRelocation  relocs)

Free relocation array.

Parameters
relocsrelocation array
Returns
NULL always

Definition at line 1738 of file rpmfi.c.

References _free(), rpmRelocation_s::newPath, and rpmRelocation_s::oldPath.

Referenced by delTE(), and main().

§ rpmfiFSize()

rpmuint32_t rpmfiFSize ( rpmfi  fi)

Return current file size from file info set.

Parameters
fifile info set
Returns
current file size, 0 on invalid

Definition at line 328 of file rpmfi.c.

Referenced by handleInstInstalledFile(), handleOverlappedFiles(), rpmfi_FSize(), rpmfi_FSize_get(), rpmfi_iternext(), and showQueryPackage().

§ rpmfiFStat()

int rpmfiFStat ( rpmfi  fi,
struct stat *  st 
)

Return current stat(2) data from file info set.

Parameters
fifile info set
Return values
*ststat(2) data
Returns
-1 on error, 0 on success

Definition at line 1776 of file rpmfi.c.

References gnameToGid(), rpmfiFNlink(), and unameToUid().

Referenced by rpmfiStat().

§ rpmfiFState()

rpmfileState rpmfiFState ( rpmfi  fi)

Return current file state from file info set.

Parameters
fifile info set
Returns
current file state, 0 on invalid

Definition at line 276 of file rpmfi.c.

References RPMFILE_STATE_MISSING.

Referenced by handleOverlappedFiles(), rpmfi_FState(), rpmfi_FState_get(), rpmfi_iternext(), and showQueryPackage().

§ rpmfiFtstring()

static const char* rpmfiFtstring ( rpmFileTypes  ft)
static

Identify a file type.

Parameters
ftfile type
Returns
string to identify a file type

Definition at line 602 of file rpmfi.c.

References BDEV, CDEV, LINK, PIPE, REG, SOCK, and XDIR.

Referenced by relocateFileList().

§ rpmfiFUser()

const char* rpmfiFUser ( rpmfi  fi)

Return current file owner from file info set.

Parameters
fifile info set
Returns
current file owner, NULL on invalid

Definition at line 458 of file rpmfi.c.

Referenced by rpmfi_FUser(), rpmfi_FUser_get(), rpmfi_iternext(), and showQueryPackage().

§ rpmfiFX()

int rpmfiFX ( rpmfi  fi)

Return current file index from file info set.

Parameters
fifile info set
Returns
current file index

Definition at line 103 of file rpmfi.c.

Referenced by handleInstInstalledFile(), rpmfi_FX(), rpmfi_FX_get(), and rpmfi_FX_set().

§ rpmfiGetPool()

static rpmfi rpmfiGetPool ( rpmioPool  pool)
static

Definition at line 1359 of file rpmfi.c.

References _rpmfiPool, rpmfiFini(), rpmioGetPool(), and rpmioNewPool().

Referenced by rpmfiNew().

§ rpmfiInclude()

void* rpmfiInclude ( const rpmfi  fi)

Return file info include patterns.

Parameters
fifile info set
Returns
file info include patterns (NULL if not set)

Definition at line 499 of file rpmfi.c.

§ rpmfiInit()

rpmfi rpmfiInit ( rpmfi  fi,
int  fx 
)

§ rpmfiInitD()

rpmfi rpmfiInitD ( rpmfi  fi,
int  dx 
)

Initialize directory iterator index.

Parameters
fifile info set
dxdirectory iterator index
Returns
file info set, NULL if dx is out of range

Definition at line 582 of file rpmfi.c.

Referenced by rpmtsSkipFiles().

§ rpmfiIsSource()

int rpmfiIsSource ( rpmfi  fi)

Return source rpm marker from file info set.

Parameters
fifile info set
Returns
source rpm?

Definition at line 136 of file rpmfi.c.

§ rpmfiNew()

rpmfi rpmfiNew ( const void *  _ts,
Header  h,
rpmTag  tagN,
int  flags 
)

Create and load a file info set.

Parameters
_tstransaction set (NULL skips path relocation)
hheader
tagNRPMTAG_BASENAMES
flagsscareMem(0x1), nofilter(0x2)
Returns
new file info set

Definition at line 1403 of file rpmfi.c.

References _fdupedata, _fdupestring, _free(), alloca(), rpmDataType_u::argv, argvFree(), _HE_s::c, FA_UNKNOWN, headerFree(), headerGet(), headerIsEntry(), headerLink(), headerMacrosLoad(), headerMacrosUnload(), headerSprintf(), IOSM_MAP_GID, IOSM_MAP_MODE, IOSM_MAP_PATH, IOSM_MAP_UID, newFSM(), rpmRelocation_s::newPath, nibble(), _HE_s::p, PGPHASHALGO_CRC32, PGPHASHALGO_ERROR, PGPHASHALGO_MD2, PGPHASHALGO_MD5, PGPHASHALGO_RIPEMD128, PGPHASHALGO_RIPEMD160, PGPHASHALGO_RIPEMD256, PGPHASHALGO_RIPEMD320, PGPHASHALGO_SHA1, PGPHASHALGO_SHA224, PGPHASHALGO_SHA256, PGPHASHALGO_SHA384, PGPHASHALGO_SHA512, rpmDataType_u::ptr, relocateFileList(), rpmfiGetPool(), RPMFILE_ICON, RPMFILE_PATCH, RPMFILE_SOURCE, RPMFILE_SPECFILE, rpmfiLink(), rpmGenPath(), rpmGetPath(), rpmHeaderFormats, RPMTAG_ARCH, RPMTAG_ARCHIVESIZE, RPMTAG_BASENAMES, RPMTAG_CLASSDICT, RPMTAG_DEPENDSDICT, RPMTAG_DIRINDEXES, RPMTAG_DIRNAMES, RPMTAG_FILECLASS, RPMTAG_FILECOLORS, RPMTAG_FILECONTEXTS, RPMTAG_FILEDEPENDSN, RPMTAG_FILEDEPENDSX, RPMTAG_FILEDIGESTALGO, RPMTAG_FILEDIGESTALGOS, RPMTAG_FILEDIGESTS, RPMTAG_FILEFLAGS, RPMTAG_FILEGROUPNAME, RPMTAG_FILEINODES, RPMTAG_FILELANGS, RPMTAG_FILELINKTOS, RPMTAG_FILEMODES, RPMTAG_FILEMTIMES, RPMTAG_FILERDEVS, RPMTAG_FILESIZES, RPMTAG_FILESTATES, RPMTAG_FILEUSERNAME, RPMTAG_FILEVERIFYFLAGS, RPMTAG_OLDFILENAMES, RPMTAG_ORIGBASENAMES, RPMTAG_POSTTRANS, RPMTAG_POSTTRANSPROG, RPMTAG_PRETRANS, RPMTAG_PRETRANSPROG, RPMTAG_REMOVETID, RPMTAG_RPMVERSION, RPMTAG_SOURCERPM, RPMTAG_VERIFYSCRIPT, RPMTAG_VERIFYSCRIPTPROG, rpmteType(), rpmtsRelocateElement(), rpmtsRootDir(), stpcpy(), _HE_s::tag, TR_ADDED, rpmDataType_u::ui32p, xcalloc(), xmalloc, xrealloc, and xstrdup().

Referenced by addTE(), checkDuplicateFiles(), checkUnpackagedFiles(), dsort(), genCpioListAndHeader(), hdr_fiFromHeader(), pkgUnpackagedSubdirs(), rpmfi_init(), rpmfi_new(), rpmfiBuildFClasses(), rpmfiBuildFDeps(), rpmhdr_fi(), rpmteOpen(), rpmtsCheckInstalledFiles(), rpmtsProcess(), showQueryPackage(), and showVerifyPackage().

§ rpmfiNExclude()

int rpmfiNExclude ( const rpmfi  fi)

Return no.

of file info exclude patterns.

Parameters
fifile info set
Returns
file info exclude patterns (0 if not set)

Definition at line 494 of file rpmfi.c.

§ rpmfiNext()

int rpmfiNext ( rpmfi  fi)

§ rpmfiNextD()

int rpmfiNextD ( rpmfi  fi)

Return next directory iterator index.

Parameters
fifile info set
Returns
directory iterator index, -1 on termination

Definition at line 562 of file rpmfi.c.

Referenced by rpmfi_DX_set(), and rpmtsSkipFiles().

§ rpmfiNInclude()

int rpmfiNInclude ( const rpmfi  fi)

Return no.

of file info include patterns.

Parameters
fifile info set
Returns
file info include patterns (0 if not set)

Definition at line 504 of file rpmfi.c.

§ rpmfiOpendir()

void* rpmfiOpendir ( rpmfi  fi,
const char *  name 
)

Return directory stream onto file info set.

Parameters
fifile info set
namedirectory path
Returns
NULL on error

Definition at line 1834 of file rpmfi.c.

References _free(), argvAdd(), argvFree(), name, rpmfiFN(), rpmfiInit(), rpmfiNext(), and xcalloc().

Referenced by dsort().

§ rpmfiSetDX()

int rpmfiSetDX ( rpmfi  fi,
int  dx 
)

Set current directory index in file info set.

Parameters
fifile info set
dxnew directory index
Returns
current directory index

Definition at line 125 of file rpmfi.c.

Referenced by rpmfi_DX_set().

§ rpmfiSetFFlags()

rpmuint32_t rpmfiSetFFlags ( rpmfi  fi,
rpmuint32_t  FFlags 
)

Set current file flags in file info set.

Parameters
fifile info set
FFlagsnew file flags
Returns
previous file flags, 0 on invalid

Definition at line 228 of file rpmfi.c.

§ rpmfiSetFState()

rpmfileState rpmfiSetFState ( rpmfi  fi,
rpmfileState  fstate 
)

Set current file state in file info set.

Parameters
fifile info set
fstatenew file state
Returns
previous file state, 0 on invalid

Definition at line 287 of file rpmfi.c.

§ rpmfiSetFX()

int rpmfiSetFX ( rpmfi  fi,
int  fx 
)

Set current file index in file info set.

Parameters
fifile info set
fxnew file index
Returns
current file index

Definition at line 108 of file rpmfi.c.

Referenced by handleOverlappedFiles(), rpmfi_FX_set(), rpmfi_subscript(), and rpmtsCheckInstalledFiles().

§ rpmfiSetHeader()

int rpmfiSetHeader ( rpmfi  fi,
Header  h 
)

Link a header to a file info set.

Parameters
fifile info set
hheader
Returns
0 always

Definition at line 1275 of file rpmfi.c.

References headerFree(), and headerLink().

Referenced by checkDuplicateFiles(), and showVerifyPackage().

§ rpmfiSetVFlags()

rpmuint32_t rpmfiSetVFlags ( rpmfi  fi,
rpmuint32_t  VFlags 
)

Set current file verify flags in file info set.

Parameters
fifile info set
VFlagsnew file verify flags
Returns
previous file verify flags, 0 on invalid

Definition at line 252 of file rpmfi.c.

§ rpmfiStat()

int rpmfiStat ( rpmfi  fi,
const char *  path,
struct stat *  st 
)

Return lstat(2) data of path from file info set.

Parameters
fifile info set
pathfile path
Return values
*ststat(2) data
Returns
-1 on error, 0 on success

Definition at line 1803 of file rpmfi.c.

References rpmfiFN(), rpmfiFStat(), rpmfiInit(), and rpmfiNext().

Referenced by dsort().

§ rpmfiTypeString()

const char* rpmfiTypeString ( rpmfi  fi)

Return formatted string representation of package disposition.

Parameters
fifile info set
Returns
formatted string

Definition at line 767 of file rpmfi.c.

References rpmteType(), TR_ADDED, and TR_REMOVED.

Referenced by fsmStage().

§ rpmfiVFlags()

rpmuint32_t rpmfiVFlags ( rpmfi  fi)

Return current file verify flags from file info set.

Parameters
fifile info set
Returns
current file verify flags, 0 on invalid

Definition at line 241 of file rpmfi.c.

Referenced by rpmfi_iternext(), rpmfi_VFlags(), and rpmfi_VFlags_get().

§ rpmfiWhatis()

static rpmFileTypes rpmfiWhatis ( rpmuint16_t  mode)
static

Return file type from mode_t.

Parameters
modefile mode bits (from header)
Returns
file type

Definition at line 623 of file rpmfi.c.

References BDEV, CDEV, LINK, PIPE, REG, S_ISLNK, S_ISSOCK, SOCK, and XDIR.

Referenced by relocateFileList(), rpmfiCompare(), and rpmfiDecideFate().

§ stripTrailingChar()

static char* stripTrailingChar ( char *  s,
char  c 
)
static

Remove occurrences of trailing character from string.

Parameters
sstring
ccharacter to strip
Returns
string

Definition at line 76 of file rpmfi.c.

Referenced by relocateFileList().

Variable Documentation

§ _rpmfi_debug

int _rpmfi_debug = 0

Definition at line 67 of file rpmfi.c.

Referenced by rpmfi_alloc(), rpmfi_Debug(), rpmfi_free(), rpmfi_init(), and rpmfi_new().

§ _rpmfiPool

rpmioPool _rpmfiPool

Definition at line 1357 of file rpmfi.c.

Referenced by rpmfiGetPool().