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

rpmdb.c File Reference

#include "system.h"
#include <sys/file.h>
#include <fnmatch.h>
#include <regex.h>
#include <rpmio_internal.h>
#include <rpmmacro.h>
#include <rpmsq.h>
#include "rpmdb.h"
#include "fprint.h"
#include "legacy.h"
#include "header_internal.h"
#include "debug.h"

Go to the source code of this file.

Data Structures

struct  pbm_set
union  _dbswap
struct  miRE_s
struct  _rpmdbMatchIterator
struct  skipDir_s

Defines

#define _USE_COPY_LOAD
#define _DBI_FLAGS   0
#define _DBI_PERMS   0644
#define _DBI_MAJOR   -1
#define __PBM_NBITS   (8 * sizeof (__pbm_bits))
#define __PBM_IX(d)   ((d) / __PBM_NBITS)
#define __PBM_MASK(d)   ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS))
#define __PBM_BITS(set)   ((set)->bits)
#define PBM_FREE(s)   _free(s);
#define PBM_SET(d, s)   (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d))
#define PBM_CLR(d, s)   (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d))
#define PBM_ISSET(d, s)   ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0)
#define PBM_ALLOC(d)   xcalloc(__PBM_IX (d) + 1, sizeof(__pbm_bits))
#define DB1vec   NULL
#define DB2vec   NULL
#define DB3vec   &db3vec
#define _DBSWAP(_a)
#define _DB_ROOT   "/"
#define _DB_HOME   "%{_dbpath}"
#define _DB_FLAGS   0
#define _DB_MODE   0
#define _DB_PERMS   0644
#define _DB_MAJOR   -1
#define _DB_ERRPFX   "rpmdb"
#define _skip(_dn)   { sizeof(_dn)-1, (_dn) }
#define _RECNUM   rpmdbGetIteratorOffset(mi)

Typedefs

typedef unsigned int __pbm_bits
typedef miRE_smiRE

Functions

pbm_setPBM_REALLOC (pbm_set **sp, int *odp, int nd)
 Reallocate a bit map.
unsigned char nibble (char c)
 Convert hex to binary nibble.
int dbiTagToDbix (int rpmtag)
 Return dbi index used for rpm tag.
void dbiTagsInit (void)
 Initialize database (index, tag) tuple from configuration.
dbiIndex dbiOpen (rpmdb db, rpmTag rpmtag, unsigned int flags)
dbiIndexItem dbiIndexNewItem (unsigned int hdrNum, unsigned int tagNum)
 Create and initialize item for index database set.
int dbt2set (dbiIndex dbi, DBT *data, dbiIndexSet *setp)
 Convert retrieved data to index set.
int set2dbt (dbiIndex dbi, DBT *data, dbiIndexSet set)
 Convert index set to database representation.
int hdrNumCmp (const void *one, const void *two)
int dbiAppendSet (dbiIndexSet set, const void *recs, int nrecs, size_t recsize, int sortset)
 Append element(s) to set of index database items.
int dbiPruneSet (dbiIndexSet set, void *recs, int nrecs, size_t recsize, int sorted)
 Remove element(s) from set of index database items.
unsigned int dbiIndexSetCount (dbiIndexSet set)
unsigned int dbiIndexRecordOffset (dbiIndexSet set, int recno)
unsigned int dbiIndexRecordFileNumber (dbiIndexSet set, int recno)
dbiIndexSet dbiFreeIndexSet (dbiIndexSet set)
int rpmdbCheckSignals (void)
int blockSignals (rpmdb db, sigset_t *oldMask)
 Block all signals, returning previous signal mask.
int unblockSignals (rpmdb db, sigset_t *oldMask)
 Restore signal mask.
int rpmdbOpenAll (rpmdb db)
int rpmdbCloseDBI (rpmdb db, int rpmtag)
 Close a single database index.
int rpmdbClose (rpmdb db)
int rpmdbSync (rpmdb db)
rpmdb newRpmdb (const char *root, const char *home, int mode, int perms, int flags)
int openDatabase (const char *prefix, const char *dbpath, int _dbapi, rpmdb *dbp, int mode, int perms, int flags)
rpmdb XrpmdbUnlink (rpmdb db, const char *msg, const char *fn, unsigned ln)
rpmdb XrpmdbLink (rpmdb db, const char *msg, const char *fn, unsigned ln)
int rpmdbOpen (const char *prefix, rpmdb *dbp, int mode, int perms)
int rpmdbInit (const char *prefix, int perms)
int rpmdbVerify (const char *prefix)
int rpmdbFindByFile (rpmdb db, const char *filespec, DBT *key, DBT *data, dbiIndexSet *matches)
 Find file matches in database.
int rpmdbCountPackages (rpmdb db, const char *name)
rpmRC dbiFindMatches (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, const char *name, const char *version, const char *release, dbiIndexSet *matches)
 Attempt partial matches on name[-version[-release]] strings.
rpmRC dbiFindByLabel (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, const char *arg, dbiIndexSet *matches)
 Lookup by name, name-version, and finally by name-version-release.
int miFreeHeader (rpmdbMatchIterator mi, dbiIndex dbi)
 Rewrite a header into packages (if necessary) and free the header.
rpmdbMatchIterator rpmdbFreeIterator (rpmdbMatchIterator mi)
unsigned int rpmdbGetIteratorOffset (rpmdbMatchIterator mi)
unsigned int rpmdbGetIteratorFileNum (rpmdbMatchIterator mi)
int rpmdbGetIteratorCount (rpmdbMatchIterator mi)
int miregexec (miRE mire, const char *val)
 Return pattern match.
int mireCmp (const void *a, const void *b)
 Compare iterator selectors by rpm tag (qsort/bsearch).
char * mireDup (rpmTag tag, rpmMireMode *modep, const char *pattern)
 Copy pattern, escaping for appropriate mode.
int rpmdbSetIteratorRE (rpmdbMatchIterator mi, rpmTag tag, rpmMireMode mode, const char *pattern)
int mireSkip (const rpmdbMatchIterator mi)
 Return iterator selector match.
int rpmdbSetIteratorRewrite (rpmdbMatchIterator mi, int rewrite)
int rpmdbSetIteratorModified (rpmdbMatchIterator mi, int modified)
int rpmdbSetHdrChk (rpmdbMatchIterator mi, rpmts ts, rpmRC(*hdrchk)(rpmts ts, const void *uh, size_t uc, const char **msg))
Header rpmdbNextIterator (rpmdbMatchIterator mi)
void rpmdbSortIterator (rpmdbMatchIterator mi)
int rpmdbGrowIterator (rpmdbMatchIterator mi, int fpNum)
int rpmdbPruneIterator (rpmdbMatchIterator mi, int *hdrNums, int nHdrNums, int sorted)
int rpmdbAppendIterator (rpmdbMatchIterator mi, const int *hdrNums, int nHdrNums)
rpmdbMatchIterator rpmdbInitIterator (rpmdb db, rpmTag rpmtag, const void *keyp, size_t keylen)
int rpmdbRemove (rpmdb db, int rid, unsigned int hdrNum, rpmts ts, rpmRC(*hdrchk)(rpmts ts, const void *uh, size_t uc, const char **msg))
int rpmdbAdd (rpmdb db, int iid, Header h, rpmts ts, rpmRC(*hdrchk)(rpmts ts, const void *uh, size_t uc, const char **msg))
int skipDir (const char *dn)
int rpmdbFindFpList (rpmdb db, fingerPrint *fpList, dbiIndexSet *matchList, int numItems)
int rpmioFileExists (const char *urlfn)
 Check if file esists using stat(2).
int rpmdbRemoveDatabase (const char *prefix, const char *dbpath, int _dbapi)
int rpmdbMoveDatabase (const char *prefix, const char *olddbpath, int _olddbapi, const char *newdbpath, int _newdbapi)
int rpmdbRebuild (const char *prefix, rpmts ts, rpmRC(*hdrchk)(rpmts ts, const void *uh, size_t uc, const char **msg))

Variables

int _rpmdb_debug = 0
int _rebuildinprogress = 0
int _db_filter_dups = 0
int * dbiTags = NULL
int dbiTagsMax = 0
_dbiVec db3vec
_dbiVecmydbvecs []
rpmdb rpmdbRock
rpmdbMatchIterator rpmmiRock
rpmdb_s dbTemplate
skipDir_s skipDirs []


Detailed Description

Definition in file rpmdb.c.


Define Documentation

#define __PBM_BITS set   )     ((set)->bits)
 

Definition at line 77 of file rpmdb.c.

Referenced by PBM_REALLOC().

#define __PBM_IX  )     ((d) / __PBM_NBITS)
 

Definition at line 70 of file rpmdb.c.

Referenced by PBM_REALLOC().

#define __PBM_MASK  )     ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS))
 

Definition at line 71 of file rpmdb.c.

#define __PBM_NBITS   (8 * sizeof (__pbm_bits))
 

Definition at line 69 of file rpmdb.c.

#define _DB_ERRPFX   "rpmdb"
 

Definition at line 754 of file rpmdb.c.

Referenced by newRpmdb().

#define _DB_FLAGS   0
 

Definition at line 749 of file rpmdb.c.

#define _DB_HOME   "%{_dbpath}"
 

Definition at line 748 of file rpmdb.c.

Referenced by newRpmdb().

#define _DB_MAJOR   -1
 

Definition at line 753 of file rpmdb.c.

#define _DB_MODE   0
 

Definition at line 750 of file rpmdb.c.

#define _DB_PERMS   0644
 

Definition at line 751 of file rpmdb.c.

#define _DB_ROOT   "/"
 

Definition at line 747 of file rpmdb.c.

Referenced by newRpmdb().

#define _DBI_FLAGS   0
 

Definition at line 56 of file rpmdb.c.

#define _DBI_MAJOR   -1
 

Definition at line 58 of file rpmdb.c.

#define _DBI_PERMS   0644
 

Definition at line 57 of file rpmdb.c.

#define _DBSWAP _a   ) 
 

Value:

{ unsigned char _b, *_c = (_a).uc; \
    _b = _c[3]; _c[3] = _c[0]; _c[0] = _b; \
    _b = _c[2]; _c[2] = _c[1]; _c[1] = _b; \
  }

Definition at line 372 of file rpmdb.c.

Referenced by dbt2set(), and set2dbt().

#define _RECNUM   rpmdbGetIteratorOffset(mi)
 

Referenced by main(), and rpmdbRebuild().

#define _skip _dn   )     { sizeof(_dn)-1, (_dn) }
 

Definition at line 3222 of file rpmdb.c.

#define _USE_COPY_LOAD
 

Definition at line 7 of file rpmdb.c.

#define DB1vec   NULL
 

Definition at line 227 of file rpmdb.c.

#define DB2vec   NULL
 

Definition at line 228 of file rpmdb.c.

#define DB3vec   &db3vec
 

Definition at line 234 of file rpmdb.c.

#define PBM_ALLOC  )     xcalloc(__PBM_IX (d) + 1, sizeof(__pbm_bits))
 

Definition at line 84 of file rpmdb.c.

Referenced by dbiOpen(), findNextArg(), and poptStripArg().

#define PBM_CLR d,
 )     (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d))
 

Definition at line 81 of file rpmdb.c.

#define PBM_FREE  )     _free(s);
 

Definition at line 79 of file rpmdb.c.

Referenced by cleanOSE(), poptFreeContext(), poptResetContext(), and rpmdbClose().

#define PBM_ISSET d,
 )     ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0)
 

Definition at line 82 of file rpmdb.c.

Referenced by findNextArg(), poptGetNextOpt(), poptStrippedArgv(), and rpmdbNextIterator().

#define PBM_SET d,
 )     (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d))
 

Definition at line 80 of file rpmdb.c.

Referenced by findNextArg(), poptStripArg(), and rpmdbNextIterator().


Typedef Documentation

typedef unsigned int __pbm_bits
 

Definition at line 67 of file rpmdb.c.

Referenced by PBM_REALLOC().

typedef struct miRE_s * miRE
 

Referenced by mireCmp(), miregexec(), mireSkip(), rpmdbFreeIterator(), and rpmdbSetIteratorRE().


Function Documentation

int blockSignals rpmdb  db,
sigset_t *  oldMask
[static]
 

Block all signals, returning previous signal mask.

Definition at line 719 of file rpmdb.c.

References rpmdb.

Referenced by miFreeHeader(), rpmdbAdd(), and rpmdbRemove().

int dbiAppendSet dbiIndexSet  set,
const void *  recs,
int  nrecs,
size_t  recsize,
int  sortset
[static]
 

Append element(s) to set of index database items.

Parameters:
set set of index database items
recs array of items to append to set
nrecs number of items
recsize size of an array item
sortset should resulting set be sorted?
Returns:
0 success, 1 failure (bad args)

Definition at line 530 of file rpmdb.c.

References _dbiIndexSet::count, dbiIndexSet, hdrNumCmp(), _dbiIndexSet::recs, and xrealloc().

Referenced by rpmdbAdd(), rpmdbAppendIterator(), rpmdbFindByFile(), and rpmdbFindFpList().

rpmRC dbiFindByLabel dbiIndex  dbi,
DBC *  dbcursor,
DBT *  key,
DBT *  data,
const char *  arg,
dbiIndexSet matches
[static]
 

Lookup by name, name-version, and finally by name-version-release.

Both version and release can be patterns.

Todo:
Name must be an exact match, as name is a db key.
Parameters:
dbi index database handle (always RPMTAG_NAME)
dbcursor index database cursor
key search key/length/flags
data search data/length/flags
arg name[-version[-release]] string
Return values:
matches set of header instances that match
Returns:
RPMRC_OK on match, RPMRC_NOMATCH or RPMRC_FAIL

Definition at line 1444 of file rpmdb.c.

References alloca(), dbiFindMatches(), dbiFreeIndexSet(), dbiIndex, dbiIndexSet, rpmRC, and stpcpy().

Referenced by rpmdbInitIterator().

rpmRC dbiFindMatches dbiIndex  dbi,
DBC *  dbcursor,
DBT *  key,
DBT *  data,
const char *  name,
const char *  version,
const char *  release,
dbiIndexSet matches
[static]
 

Attempt partial matches on name[-version[-release]] strings.

Parameters:
dbi index database handle (always RPMTAG_NAME)
dbcursor index database cursor
key search key/length/flags
data search data/length/flags
name package name
version package version (can be a pattern)
release package release (can be a pattern)
Return values:
matches set of header instances that match
Returns:
RPMRC_OK on match, RPMRC_NOMATCH or RPMRC_FAIL

Definition at line 1344 of file rpmdb.c.

References _, _dbiIndex::dbi_rpmdb, _dbiIndex::dbi_rpmtag, dbiFreeIndexSet(), dbiGet(), dbiIndex, dbiIndexRecordOffset(), dbiIndexSet, dbiIndexSetCount(), dbt2set(), Header, rpmdbFreeIterator(), RPMDBI_PACKAGES, rpmdbInitIterator(), rpmdbMatchIterator, rpmdbNextIterator(), rpmdbSetIteratorRE(), RPMERR_DBGETINDEX, rpmError, RPMMIRE_DEFAULT, rpmRC, RPMTAG_RELEASE, RPMTAG_VERSION, and tagName().

Referenced by dbiFindByLabel().

dbiIndexItem dbiIndexNewItem unsigned int  hdrNum,
unsigned int  tagNum
[static]
 

Create and initialize item for index database set.

Parameters:
hdrNum header instance in db
tagNum tag index in header
Returns:
new item

Definition at line 358 of file rpmdb.c.

References dbiIndexItem, _dbiIndexItem::hdrNum, _dbiIndexItem::tagNum, and xcalloc().

Referenced by rpmdbAdd(), rpmdbFindByFile(), and rpmdbRemove().

int dbiPruneSet dbiIndexSet  set,
void *  recs,
int  nrecs,
size_t  recsize,
int  sorted
[static]
 

Remove element(s) from set of index database items.

Parameters:
set set of index database items
recs array of items to remove from set
nrecs number of items
recsize size of an array item
sorted array is already sorted?
Returns:
0 success, 1 failure (no items found)

Definition at line 569 of file rpmdb.c.

References _dbiIndexSet::count, dbiIndexSet, hdrNumCmp(), and _dbiIndexSet::recs.

Referenced by rpmdbPruneIterator(), and rpmdbRemove().

void dbiTagsInit void   )  [static]
 

Initialize database (index, tag) tuple from configuration.

Definition at line 172 of file rpmdb.c.

References _, _free(), dbiTags, dbiTagsMax, dbiTagToDbix(), rpmExpand(), RPMMESS_WARNING, rpmMessage, tagValue(), xcalloc(), xisspace(), xrealloc(), and xstrdup().

Referenced by openDatabase().

int dbiTagToDbix int  rpmtag  )  [static]
 

Return dbi index used for rpm tag.

Parameters:
rpmtag rpm header tag
Returns:
dbi index, -1 on error

Definition at line 154 of file rpmdb.c.

References dbiTags.

Referenced by dbiOpen(), and dbiTagsInit().

int dbt2set dbiIndex  dbi,
DBT *  data,
dbiIndexSet setp
[static]
 

Convert retrieved data to index set.

Parameters:
dbi index database handle
data retrieved data
Return values:
setp (malloc'ed) index set
Returns:
0 on success

Definition at line 385 of file rpmdb.c.

References _DBSWAP, _dbiIndexSet::count, _dbiIndex::dbi_jlen, dbiByteSwapped(), dbiIndex, dbiIndexSet, _dbswap::ui, and xmalloc().

Referenced by dbiFindMatches(), rpmdbAdd(), rpmdbCountPackages(), rpmdbFindByFile(), rpmdbGrowIterator(), rpmdbInitIterator(), and rpmdbRemove().

int hdrNumCmp const void *  one,
const void *  two
[static]
 

Definition at line 514 of file rpmdb.c.

Referenced by dbiAppendSet(), dbiPruneSet(), and rpmdbSortIterator().

int miFreeHeader rpmdbMatchIterator  mi,
dbiIndex  dbi
[static]
 

Rewrite a header into packages (if necessary) and free the header.

Note: this is called from a markReplacedFiles iteration, and *must* preserve the "join key" (i.e. offset) for the header.

Parameters:
mi database iterator
dbi index database handle
Returns:
0 on success

Definition at line 1540 of file rpmdb.c.

References _, _free(), blockSignals(), _dbiIndex::dbi_rpmdb, _dbiIndex::dbi_rpmtag, dbiIndex, dbiPut(), dbiSync(), HEADER_MAGIC_NO, headerFree(), headerSizeof(), headerUnload(), _rpmdbMatchIterator::mi_data, _rpmdbMatchIterator::mi_dbc, _rpmdbMatchIterator::mi_h, _rpmdbMatchIterator::mi_hdrchk, _rpmdbMatchIterator::mi_key, _rpmdbMatchIterator::mi_modified, _rpmdbMatchIterator::mi_prevoffset, _rpmdbMatchIterator::mi_ts, rpmdbMatchIterator, RPMERR_DBPUTINDEX, rpmError, RPMMESS_ERROR, rpmMessage, rpmRC, RPMRC_FAIL, tagName(), and unblockSignals().

Referenced by rpmdbFreeIterator(), and rpmdbNextIterator().

int mireCmp const void *  a,
const void *  b
[static]
 

Compare iterator selectors by rpm tag (qsort/bsearch).

Parameters:
a 1st iterator selector
b 2nd iterator selector
Returns:
result of comparison

Definition at line 1711 of file rpmdb.c.

References miRE, and miRE_s::tag.

Referenced by rpmdbSetIteratorRE().

char* mireDup rpmTag  tag,
rpmMireMode modep,
const char *  pattern
[static]
 

Copy pattern, escaping for appropriate mode.

Parameters:
tag rpm tag
Return values:
modep type of pattern match
Parameters:
pattern pattern to duplicate
Returns:
duplicated pattern

Definition at line 1725 of file rpmdb.c.

References RPMMIRE_DEFAULT, RPMMIRE_GLOB, RPMMIRE_REGEX, RPMMIRE_STRCMP, RPMTAG_DIRNAMES, xmalloc(), and xstrdup().

Referenced by rpmdbSetIteratorRE().

int miregexec miRE  mire,
const char *  val
[static]
 

Return pattern match.

Parameters:
mire match iterator regex
val value to match
Returns:
0 if pattern matches, >0 on nomatch, <0 on error

Definition at line 1668 of file rpmdb.c.

References miRE_s::eflags, miRE_s::fnflags, miRE, miRE_s::mode, miRE_s::pattern, miRE_s::preg, RPMERR_REGEXEC, rpmError, RPMMIRE_DEFAULT, RPMMIRE_GLOB, RPMMIRE_REGEX, and RPMMIRE_STRCMP.

Referenced by mireSkip().

int mireSkip const rpmdbMatchIterator  mi  )  [static]
 

Return iterator selector match.

Parameters:
mi rpm database iterator
Returns:
1 if header should be skipped

Definition at line 1930 of file rpmdb.c.

References HFD_t, HGE_t, int_16, int_32, int_8, _rpmdbMatchIterator::mi_h, _rpmdbMatchIterator::mi_nre, _rpmdbMatchIterator::mi_re, miRE, miregexec(), miRE_s::notmatch, RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_I18NSTRING_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT8_TYPE, RPM_NULL_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, rpmdbMatchIterator, rpmTagType, and miRE_s::tag.

Referenced by rpmdbNextIterator().

rpmdb newRpmdb const char *  root,
const char *  home,
int  mode,
int  perms,
int  flags
[static]
 

Definition at line 883 of file rpmdb.c.

References _, _DB_ERRPFX, _db_filter_dups, _DB_HOME, _DB_ROOT, rpmdb_s::_dbi, _free(), rpmdb, rpmdbLink, RPMERR_DBOPEN, rpmError, rpmExpand(), rpmExpandNumeric(), rpmGetPath(), and xcalloc().

Referenced by openDatabase().

unsigned char nibble char  c  )  [inline, static]
 

Convert hex to binary nibble.

Parameters:
c hex character
Returns:
binary nibble

Definition at line 120 of file rpmdb.c.

Referenced by rpmdbAdd(), rpmdbRemove(), rpmfiNew(), rpmQueryVerify(), and verifyPGPSignature().

int openDatabase const char *  prefix,
const char *  dbpath,
int  _dbapi,
rpmdb dbp,
int  mode,
int  perms,
int  flags
[static]
 

Definition at line 935 of file rpmdb.c.

References rpmdb_s::db_api, rpmdb_s::db_next, dbiIndex, dbiOpen(), dbiTags, dbiTagsInit(), dbiTagsMax, newRpmdb(), rpmdb, rpmdbClose(), RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_PACKAGES, RPMDBI_REMOVED, rpmdbRock, rpmsqEnable(), and RPMTAG_NAME.

Referenced by rpmdbInit(), rpmdbOpen(), rpmdbRebuild(), and rpmdbVerify().

pbm_set* PBM_REALLOC pbm_set **  sp,
int *  odp,
int  nd
[inline, static]
 

Reallocate a bit map.

Return values:
sp address of bit map pointer
odp no. of bits in map
Parameters:
nd desired no. of bits

Definition at line 93 of file rpmdb.c.

References __PBM_BITS, __pbm_bits, __PBM_IX, and xrealloc().

Referenced by rpmdbNextIterator().

int rpmdbCloseDBI rpmdb  db,
int  rpmtag
 

Close a single database index.

Parameters:
db rpm database
rpmtag rpm tag
Returns:
0 on success

Definition at line 780 of file rpmdb.c.

References rpmdb_s::_dbi, dbiClose(), dbiTags, and rpmdb.

Referenced by rpmtsCheck().

int rpmdbFindByFile rpmdb  db,
const char *  filespec,
DBT *  key,
DBT *  data,
dbiIndexSet matches
[static]
 

Find file matches in database.

Parameters:
db rpm database
filespec 
key 
data 
matches 
Returns:
0 on success, 1 on not found, -2 on error

Definition at line 1132 of file rpmdb.c.

References _, _free(), alloca(), _dbiIndexSet::count, _dbiIndex::dbi_rpmtag, _dbiIndex::dbi_txnid, dbiAppendSet(), dbiCclose(), dbiCopen(), dbiFreeIndexSet(), dbiGet(), dbiIndex, dbiIndexItem, dbiIndexNewItem(), dbiIndexRecordFileNumber(), dbiIndexRecordOffset(), dbiIndexSet, dbiOpen(), dbt2set(), fingerPrint, fingerPrintCache, FP_EQUAL, fpCacheCreate(), fpCacheFree(), fpLookup(), _dbiIndexItem::hdrNum, Header, headerFree(), headerLink(), HFD_t, HGE_t, int_32, rpmdb, rpmdbFreeIterator(), RPMDBI_PACKAGES, rpmdbInitIterator(), rpmdbMatchIterator, rpmdbNextIterator(), RPMERR_DBGETINDEX, rpmError, RPMTAG_BASENAMES, RPMTAG_DIRINDEXES, RPMTAG_DIRNAMES, rpmTagType, tagName(), _dbiIndexItem::tagNum, and xcalloc().

Referenced by rpmdbInitIterator().

int rpmdbGrowIterator rpmdbMatchIterator  mi,
int  fpNum
[static]
 

Definition at line 2288 of file rpmdb.c.

References _, _dbiIndexSet::count, _dbiIndex::dbi_rpmtag, _dbiIndex::dbi_txnid, dbiCclose(), dbiCopen(), dbiFreeIndexSet(), dbiGet(), dbiIndex, dbiIndexSet, dbiOpen(), dbt2set(), _dbiIndexItem::fpNum, _rpmdbMatchIterator::mi_data, _rpmdbMatchIterator::mi_db, _rpmdbMatchIterator::mi_dbc, _rpmdbMatchIterator::mi_key, _rpmdbMatchIterator::mi_rpmtag, _rpmdbMatchIterator::mi_set, _dbiIndexSet::recs, rpmdbMatchIterator, RPMERR_DBGETINDEX, rpmError, tagName(), and xrealloc().

Referenced by rpmdbFindFpList().

int rpmdbMoveDatabase const char *  prefix,
const char *  olddbpath,
int  _olddbapi,
const char *  newdbpath,
int  _newdbapi
[static]
 

Definition at line 3478 of file rpmdb.c.

References _, alloca(), dbiTags, rpmCleanPath(), RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_REMOVED, rpmdbRemoveDatabase(), rpmioFileExists(), RPMMESS_DEBUG, rpmMessage, and tagName().

Referenced by rpmdbRebuild().

int rpmdbRemoveDatabase const char *  prefix,
const char *  dbpath,
int  _dbapi
[static]
 

Definition at line 3422 of file rpmdb.c.

References alloca(), dbiTags, rpmCleanPath(), rpmioFileExists(), and tagName().

Referenced by rpmdbMoveDatabase(), and rpmdbRebuild().

void rpmdbSortIterator rpmdbMatchIterator  mi  )  [static]
 

Definition at line 2266 of file rpmdb.c.

References _dbiIndexSet::count, hdrNumCmp(), mergesort(), _rpmdbMatchIterator::mi_set, _rpmdbMatchIterator::mi_sorted, _dbiIndexSet::recs, and rpmdbMatchIterator.

Referenced by rpmdbFindFpList().

int rpmioFileExists const char *  urlfn  )  [static]
 

Check if file esists using stat(2).

Parameters:
urlfn file name (may be URL)
Returns:
1 if file exists, 0 if not

Definition at line 3389 of file rpmdb.c.

References Stat(), URL_IS_DASH, URL_IS_FTP, URL_IS_HTTP, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), and urltype.

Referenced by rpmdbMoveDatabase(), and rpmdbRemoveDatabase().

int set2dbt dbiIndex  dbi,
DBT *  data,
dbiIndexSet  set
[static]
 

Convert index set to database representation.

Parameters:
dbi index database handle
data retrieved data
set index set
Returns:
0 on success

Definition at line 454 of file rpmdb.c.

References _DBSWAP, _dbiIndexSet::count, _dbiIndex::dbi_jlen, dbiByteSwapped(), dbiIndex, dbiIndexSet, _dbiIndexItem::hdrNum, _dbiIndexSet::recs, _dbiIndexItem::tagNum, _dbswap::ui, and xmalloc().

Referenced by rpmdbAdd(), and rpmdbRemove().

int skipDir const char *  dn  )  [static]
 

Definition at line 3242 of file rpmdb.c.

References skipDir_s::dn, and skipDir_s::dnlen.

Referenced by rpmdbFindFpList().

int unblockSignals rpmdb  db,
sigset_t *  oldMask
[static]
 

Restore signal mask.

Definition at line 739 of file rpmdb.c.

References rpmdb, and rpmdbCheckSignals().

Referenced by miFreeHeader(), rpmdbAdd(), and rpmdbRemove().

rpmdb XrpmdbLink rpmdb  db,
const char *  msg,
const char *  fn,
unsigned  ln
 

Todo:
Remove debugging entry from the ABI.

Definition at line 1049 of file rpmdb.c.

References rpmdb_s::nrefs, and rpmdb.

rpmdb XrpmdbUnlink rpmdb  db,
const char *  msg,
const char *  fn,
unsigned  ln
 

Todo:
Remove debugging entry from the ABI.

Definition at line 1039 of file rpmdb.c.

References rpmdb_s::nrefs, and rpmdb.


Variable Documentation

int _db_filter_dups = 0 [static]
 

Definition at line 54 of file rpmdb.c.

Referenced by newRpmdb(), and rpmdbRebuild().

int _rebuildinprogress = 0 [static]
 

Definition at line 52 of file rpmdb.c.

Referenced by dbiOpen(), and rpmdbRebuild().

int _rpmdb_debug = 0
 

Definition at line 49 of file rpmdb.c.

int dbiTagsMax = 0
 

Definition at line 63 of file rpmdb.c.

Referenced by dbiTagsInit(), and openDatabase().

struct rpmdb_s dbTemplate [static]
 

Initial value:

 {
     "/" ,       "%{_dbpath}" ,  0 ,  0 ,  0644 ,
     -1 ,        "rpmdb" 
}

Definition at line 758 of file rpmdb.c.

struct _dbiVec* mydbvecs[] [static]
 

Initial value:

 {
     NULL ,  NULL ,  NULL ,  &db3vec , NULL
}

Definition at line 239 of file rpmdb.c.

Referenced by dbiOpen().

rpmdb rpmdbRock [static]
 

Definition at line 666 of file rpmdb.c.

Referenced by openDatabase(), and rpmdbCheckSignals().

rpmdbMatchIterator rpmmiRock [static]
 

Definition at line 669 of file rpmdb.c.

Referenced by rpmdbCheckSignals(), and rpmdbInitIterator().

struct skipDir_s skipDirs[] [static]
 


Generated on Fri Sep 10 16:12:22 2010 for rpm by  doxygen 1.3.9.1