#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 NULL | 
| #define | SQLITEvec NULL | 
| #define | SQLITE_HACK | 
| #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_s * | miRE | 
Functions | |
| static pbm_set * | PBM_REALLOC (pbm_set **sp, int *odp, int nd) | 
| Reallocate a bit map.   | |
| static unsigned char | nibble (char c) | 
| Convert hex to binary nibble.   | |
| static int | dbiTagToDbix (int rpmtag) | 
| Return dbi index used for rpm tag.   | |
| static void | dbiTagsInit (void) | 
| Initialize database (index, tag) tuple from configuration.   | |
| dbiIndex | dbiOpen (rpmdb db, rpmTag rpmtag, unsigned int flags) | 
| Return handle for an index database.   | |
| static dbiIndexItem | dbiIndexNewItem (unsigned int hdrNum, unsigned int tagNum) | 
| Create and initialize item for index database set.   | |
| static int | dbt2set (dbiIndex dbi, DBT *data, dbiIndexSet *setp) | 
| Convert retrieved data to index set.   | |
| static int | set2dbt (dbiIndex dbi, DBT *data, dbiIndexSet set) | 
| Convert index set to database representation.   | |
| static int | hdrNumCmp (const void *one, const void *two) | 
| static int | dbiAppendSet (dbiIndexSet set, const void *recs, int nrecs, size_t recsize, int sortset) | 
| Append element(s) to set of index database items.   | |
| static 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) | 
| Count items in index database set.   | |
| unsigned int | dbiIndexRecordOffset (dbiIndexSet set, int recno) | 
| Return record offset of header from element in index database set.   | |
| unsigned int | dbiIndexRecordFileNumber (dbiIndexSet set, int recno) | 
| Return file index from element in index database set.   | |
| dbiIndexSet | dbiFreeIndexSet (dbiIndexSet set) | 
| Destroy set of index database items.   | |
| int | rpmdbCheckTerminate (int terminate) | 
| Check rpmdb signal handler for trapped signal and/or requested exit, clean up any open iterators and databases on termination condition.   | |
| int | rpmdbCheckSignals (void) | 
| Check for and exit on termination signals.   | |
| static int | blockSignals (rpmdb db, sigset_t *oldMask) | 
| Block all signals, returning previous signal mask.   | |
| static int | unblockSignals (rpmdb db, sigset_t *oldMask) | 
| Restore signal mask.   | |
| static int | isTemporaryDB (int rpmtag) | 
| int | rpmdbOpenAll (rpmdb db) | 
| Open all database indices.   | |
| int | rpmdbCloseDBI (rpmdb db, int rpmtag) | 
| Close a single database index.   | |
| int | rpmdbClose (rpmdb db) | 
| Close all database indices and free rpmdb.   | |
| int | rpmdbSync (rpmdb db) | 
| Sync all database indices.   | |
| static rpmdb | newRpmdb (const char *root, const char *home, int mode, int perms, int flags) | 
| static 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) | 
| Open rpm database.   | |
| int | rpmdbInit (const char *prefix, int perms) | 
| Initialize database.   | |
| int | rpmdbVerify (const char *prefix) | 
| Verify database components.   | |
| static 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) | 
| Return number of instances of package in rpm database.   | |
| static 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.   | |
| static 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.   | |
| static int | miFreeHeader (rpmdbMatchIterator mi, dbiIndex dbi) | 
| Rewrite a header into packages (if necessary) and free the header.   | |
| rpmdbMatchIterator | rpmdbFreeIterator (rpmdbMatchIterator mi) | 
| Destroy rpm database iterator.   | |
| unsigned int | rpmdbGetIteratorOffset (rpmdbMatchIterator mi) | 
| Return header join key for current position of rpm database iterator.   | |
| unsigned int | rpmdbGetIteratorFileNum (rpmdbMatchIterator mi) | 
| int | rpmdbGetIteratorCount (rpmdbMatchIterator mi) | 
| Return number of elements in rpm database iterator.   | |
| static int | miregexec (miRE mire, const char *val) | 
| Return pattern match.   | |
| static int | mireCmp (const void *a, const void *b) | 
| Compare iterator selectors by rpm tag (qsort/bsearch).   | |
| static 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) | 
| Add pattern to iterator selector.   | |
| static int | mireSkip (const rpmdbMatchIterator mi) | 
| Return iterator selector match.   | |
| int | rpmdbSetIteratorRewrite (rpmdbMatchIterator mi, int rewrite) | 
| Prepare iterator for lazy writes.   | |
| int | rpmdbSetIteratorModified (rpmdbMatchIterator mi, int modified) | 
| Modify iterator to mark header for lazy write on release.   | |
| int | rpmdbSetHdrChk (rpmdbMatchIterator mi, rpmts ts, rpmRC(*hdrchk)(rpmts ts, const void *uh, size_t uc, const char **msg)) | 
| Modify iterator to verify retrieved header blobs.   | |
| Header | rpmdbNextIterator (rpmdbMatchIterator mi) | 
| Return next package header from iteration.   | |
| static void | rpmdbSortIterator (rpmdbMatchIterator mi) | 
| static int | rpmdbGrowIterator (rpmdbMatchIterator mi, int fpNum) | 
| int | rpmdbPruneIterator (rpmdbMatchIterator mi, int *hdrNums, int nHdrNums, int sorted) | 
| Remove items from set of package instances to iterate.   | |
| int | rpmdbAppendIterator (rpmdbMatchIterator mi, const int *hdrNums, int nHdrNums) | 
| Append items to set of package instances to iterate.   | |
| rpmdbMatchIterator | rpmdbInitIterator (rpmdb db, rpmTag rpmtag, const void *keyp, size_t keylen) | 
| Return database iterator.   | |
| int | rpmdbRemove (rpmdb db, int rid, unsigned int hdrNum, rpmts ts, rpmRC(*hdrchk)(rpmts ts, const void *uh, size_t uc, const char **msg)) | 
| Remove package header from rpm database and indices.   | |
| int | rpmdbAdd (rpmdb db, int iid, Header h, rpmts ts, rpmRC(*hdrchk)(rpmts ts, const void *uh, size_t uc, const char **msg)) | 
| Add package header to rpm database and indices.   | |
| static int | skipDir (const char *dn) | 
| int | rpmdbFindFpList (rpmdb db, fingerPrint *fpList, dbiIndexSet *matchList, int numItems) | 
| Find fingerprint matches in database.   | |
| static int | rpmioFileExists (const char *urlfn) | 
| Check if file esists using stat(2).   | |
| static int | rpmdbRemoveDatabase (const char *prefix, const char *dbpath, int _dbapi) | 
| static 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)) | 
| Rebuild database indices from package headers.   | |
Variables | |
| int | _rpmdb_debug = 0 | 
| static int | _rebuildinprogress = 0 | 
| static int | _db_filter_dups = 0 | 
| int * | dbiTags = NULL | 
| Tags for which rpmdb indices will be built.   | |
| int | dbiTagsMax = 0 | 
| unsigned int | myinstall_instance = 0 | 
| static struct _dbiVec * | mydbvecs [] | 
| static rpmdb | rpmdbRock | 
| static rpmdbMatchIterator | rpmmiRock | 
| static struct rpmdb_s | dbTemplate | 
| static struct skipDir_s | skipDirs [] | 
Definition in file rpmdb.c.
| #define __PBM_BITS | ( | set | ) | ((set)->bits) | 
| #define __PBM_IX | ( | d | ) | ((d) / __PBM_NBITS) | 
| #define __PBM_MASK | ( | d | ) | ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS)) | 
| #define __PBM_NBITS (8 * sizeof (__pbm_bits)) | 
| #define _DB_ERRPFX "rpmdb" | 
| #define _DB_HOME "%{_dbpath}" | 
| #define _DB_ROOT "/" | 
| #define _DBSWAP | ( | _a | ) | 
Value:
/*@-bounds@*/ \ { 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; \ /*@=bounds@*/ \ }
Definition at line 402 of file rpmdb.c.
Referenced by dbt2set(), rpmdbAdd(), rpmdbInitIterator(), rpmdbNextIterator(), rpmdbRemove(), and set2dbt().
| #define _RECNUM rpmdbGetIteratorOffset(mi) | 
Referenced by main(), and rpmdbRebuild().
| #define _USE_COPY_LOAD | 
| #define PBM_ALLOC | ( | d | ) | xcalloc(__PBM_IX (d) + 1, sizeof(__pbm_bits)) | 
| #define PBM_CLR | ( | d, | |||
| s | ) | (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d)) | 
| #define PBM_FREE | ( | s | ) | _free(s); | 
| #define PBM_ISSET | ( | d, | |||
| s | ) | ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0) | 
| #define PBM_SET | ( | d, | |||
| s | ) | (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d)) | 
| #define SQLITE_HACK | 
Referenced by rpmdbGrowIterator().
| typedef unsigned int __pbm_bits | 
| static int blockSignals | ( | rpmdb | db, | |
| sigset_t * | oldMask | |||
| ) |  [static] | 
        
Block all signals, returning previous signal mask.
Definition at line 761 of file rpmdb.c.
Referenced by miFreeHeader(), rpmdbAdd(), and rpmdbRemove().
| static int dbiAppendSet | ( | dbiIndexSet | set, | |
| const void * | recs, | |||
| int | nrecs, | |||
| size_t | recsize, | |||
| int | sortset | |||
| ) |  [static] | 
        
Append element(s) to set of index database items.
| 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? | 
Definition at line 562 of file rpmdb.c.
References _dbiIndexSet::count, hdrNumCmp(), _dbiIndexSet::recs, and xrealloc().
Referenced by rpmdbAdd(), rpmdbAppendIterator(), rpmdbFindByFile(), and rpmdbFindFpList().
| static 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.
| 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 | 
| matches | set of header instances that match | 
Definition at line 1525 of file rpmdb.c.
References alloca(), dbiFindMatches(), dbiFreeIndexSet(), RPMRC_NOTFOUND, and stpcpy().
Referenced by rpmdbInitIterator().
| static 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.
| 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) | 
| matches | set of header instances that match | 
Definition at line 1425 of file rpmdb.c.
References _, _dbiIndex::dbi_rpmdb, _dbiIndex::dbi_rpmtag, dbiFreeIndexSet(), dbiGet(), dbiIndexRecordOffset(), dbiIndexSetCount(), dbt2set(), rpmdbFreeIterator(), RPMDBI_PACKAGES, rpmdbInitIterator(), rpmdbNextIterator(), rpmdbSetIteratorRE(), RPMERR_DBGETINDEX, rpmError, RPMMIRE_DEFAULT, RPMRC_FAIL, RPMRC_NOTFOUND, RPMRC_OK, RPMTAG_RELEASE, RPMTAG_VERSION, and tagName().
Referenced by dbiFindByLabel().
| static dbiIndexItem dbiIndexNewItem | ( | unsigned int | hdrNum, | |
| unsigned int | tagNum | |||
| ) |  [static] | 
        
Create and initialize item for index database set.
| hdrNum | header instance in db | |
| tagNum | tag index in header | 
Definition at line 388 of file rpmdb.c.
References xcalloc().
Referenced by rpmdbAdd(), rpmdbFindByFile(), and rpmdbRemove().
| static int dbiPruneSet | ( | dbiIndexSet | set, | |
| void * | recs, | |||
| int | nrecs, | |||
| size_t | recsize, | |||
| int | sorted | |||
| ) |  [static] | 
        
Remove element(s) from set of index database items.
| 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? | 
Definition at line 601 of file rpmdb.c.
References _dbiIndexSet::count, hdrNumCmp(), and _dbiIndexSet::recs.
Referenced by rpmdbPruneIterator(), and rpmdbRemove().
| static void dbiTagsInit | ( | void | ) |  [static] | 
        
Initialize database (index, tag) tuple from configuration.
Definition at line 178 of file rpmdb.c.
References _, _free(), dbiTags, dbiTagsMax, dbiTagToDbix(), RPMDBI_PACKAGES, rpmExpand(), RPMMESS_WARNING, rpmMessage, tagValue(), xcalloc(), xisspace(), xrealloc(), and xstrdup().
Referenced by openDatabase().
| static int dbiTagToDbix | ( | int | rpmtag | ) |  [static] | 
        
Return dbi index used for rpm tag.
| rpmtag | rpm header tag | 
Definition at line 160 of file rpmdb.c.
References dbiTags, and dbiTagsMax.
Referenced by dbiOpen(), and dbiTagsInit().
| static int dbt2set | ( | dbiIndex | dbi, | |
| DBT * | data, | |||
| dbiIndexSet * | setp | |||
| ) |  [static] | 
        
Convert retrieved data to index set.
| dbi | index database handle | |
| data | retrieved data | 
| setp | (malloc'ed) index set | 
Definition at line 417 of file rpmdb.c.
References _DBSWAP, _dbiIndex::dbi_jlen, dbiByteSwapped(), _dbswap::ui, and xmalloc().
Referenced by dbiFindMatches(), rpmdbAdd(), rpmdbCountPackages(), rpmdbFindByFile(), rpmdbGrowIterator(), rpmdbInitIterator(), and rpmdbRemove().
| static int hdrNumCmp | ( | const void * | one, | |
| const void * | two | |||
| ) |  [static] | 
        
Definition at line 546 of file rpmdb.c.
Referenced by dbiAppendSet(), dbiPruneSet(), and rpmdbSortIterator().
| static int isTemporaryDB | ( | int | rpmtag | ) |  [static] | 
        
Definition at line 806 of file rpmdb.c.
References RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, and RPMDBI_REMOVED.
Referenced by openDatabase(), rpmdbAdd(), rpmdbMoveDatabase(), rpmdbOpenAll(), and rpmdbRemove().
| static 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.
| mi | database iterator | |
| dbi | index database handle | 
Definition at line 1621 of file rpmdb.c.
References _, _free(), blockSignals(), _dbiIndex::dbi_rpmdb, _dbiIndex::dbi_rpmtag, 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, RPMERR_DBPUTINDEX, rpmError, RPMMESS_DEBUG, RPMMESS_ERROR, rpmMessage, RPMRC_FAIL, RPMRC_NOTFOUND, tagName(), and unblockSignals().
Referenced by rpmdbFreeIterator(), and rpmdbNextIterator().
| static int mireCmp | ( | const void * | a, | |
| const void * | b | |||
| ) |  [static] | 
        
Compare iterator selectors by rpm tag (qsort/bsearch).
| a | 1st iterator selector | |
| b | 2nd iterator selector | 
Definition at line 1792 of file rpmdb.c.
References miRE_s::tag.
Referenced by rpmdbSetIteratorRE().
| static char* mireDup | ( | rpmTag | tag, | |
| rpmMireMode * | modep, | |||
| const char * | pattern | |||
| ) |  [static] | 
        
Copy pattern, escaping for appropriate mode.
| tag | rpm tag | 
| modep | type of pattern match | 
| pattern | pattern to duplicate | 
Definition at line 1806 of file rpmdb.c.
References RPMMIRE_DEFAULT, RPMMIRE_GLOB, RPMMIRE_REGEX, RPMMIRE_STRCMP, RPMTAG_BASENAMES, RPMTAG_DIRNAMES, xmalloc(), and xstrdup().
Referenced by rpmdbSetIteratorRE().
| static int miregexec | ( | miRE | mire, | |
| const char * | val | |||
| ) |  [static] | 
        
Return pattern match.
| mire | match iterator regex | |
| val | value to match | 
Definition at line 1749 of file rpmdb.c.
References miRE_s::eflags, miRE_s::fnflags, miRE_s::mode, miRE_s::pattern, miRE_s::preg, RPMERR_REGEXEC, rpmError, RPMMIRE_DEFAULT, RPMMIRE_GLOB, RPMMIRE_REGEX, and RPMMIRE_STRCMP.
| static int mireSkip | ( | const rpmdbMatchIterator | mi | ) |  [static] | 
        
Return iterator selector match.
| mi | rpm database iterator | 
Definition at line 2011 of file rpmdb.c.
References argv, headerFreeData(), headerGetEntryMinMemory(), _rpmdbMatchIterator::mi_h, _rpmdbMatchIterator::mi_nre, _rpmdbMatchIterator::mi_re, RPM_INT32_TYPE, RPMTAG_EPOCH, and miRE_s::tag.
Referenced by rpmdbNextIterator().
| static rpmdb newRpmdb | ( | const char * | root, | |
| const char * | home, | |||
| int | mode, | |||
| int | perms, | |||
| int | flags | |||
| ) |  [static] | 
        
Definition at line 946 of file rpmdb.c.
References _, _DB_ERRPFX, _db_filter_dups, _DB_HOME, _DB_ROOT, rpmdb_s::_dbi, _free(), dbiTagsMax, dbTemplate, rpmdbLink, RPMERR_DBOPEN, rpmError, rpmExpand(), rpmExpandNumeric(), rpmGetPath(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), and xcalloc().
Referenced by openDatabase().
| static unsigned char nibble | ( | char | c | ) |  [inline, static] | 
        
| static int openDatabase | ( | const char * | prefix, | |
| const char * | dbpath, | |||
| int | _dbapi, | |||
| rpmdb * | dbp, | |||
| int | mode, | |||
| int | perms, | |||
| int | flags | |||
| ) |  [static] | 
        
Definition at line 1017 of file rpmdb.c.
References rpmdb_s::db_api, rpmdb_s::db_next, dbiOpen(), dbiTags, dbiTagsInit(), dbiTagsMax, isTemporaryDB(), newRpmdb(), RPMDB_FLAG_JUSTCHECK, RPMDB_FLAG_MINIMAL, rpmdbClose(), RPMDBI_PACKAGES, rpmdbRock, rpmsqEnable(), and RPMTAG_NAME.
Referenced by rpmdbInit(), rpmdbOpen(), rpmdbRebuild(), and rpmdbVerify().
Reallocate a bit map.
| sp | address of bit map pointer | |
| odp | no. of bits in map | 
| nd | desired no. of bits | 
Definition at line 99 of file rpmdb.c.
References __PBM_BITS, __PBM_IX, and xrealloc().
Referenced by rpmdbNextIterator().
| int rpmdbCloseDBI | ( | rpmdb | db, | |
| int | rpmtag | |||
| ) | 
Close a single database index.
| db | rpm database | |
| rpmtag | rpm tag | 
Definition at line 841 of file rpmdb.c.
References rpmdb_s::_dbi, dbiClose(), dbiTags, and dbiTagsMax.
Referenced by rpmtsCheck().
| static int rpmdbFindByFile | ( | rpmdb | db, | |
| const char * | filespec, | |||
| DBT * | key, | |||
| DBT * | data, | |||
| dbiIndexSet * | matches | |||
| ) |  [static] | 
        
Find file matches in database.
| db | rpm database | |
| filespec | ||
| key | ||
| data | ||
| matches | 
Definition at line 1206 of file rpmdb.c.
References _, _free(), alloca(), _dbiIndex::dbi_rpmtag, _dbiIndex::dbi_txnid, dbiAppendSet(), dbiCclose(), dbiCopen(), dbiFreeIndexSet(), dbiGet(), dbiIndexNewItem(), dbiIndexRecordFileNumber(), dbiIndexRecordOffset(), dbiOpen(), dbt2set(), dirName, FP_EQUAL, fpCacheCreate(), fpCacheFree(), fpLookup(), _dbiIndexItem::hdrNum, headerFree(), headerFreeData(), headerGetEntryMinMemory(), headerLink(), rpmdbFreeIterator(), RPMDBI_PACKAGES, rpmdbInitIterator(), rpmdbNextIterator(), RPMERR_DBGETINDEX, rpmError, RPMTAG_BASENAMES, RPMTAG_DIRINDEXES, RPMTAG_DIRNAMES, tagName(), _dbiIndexItem::tagNum, and xcalloc().
Referenced by rpmdbInitIterator().
| static int rpmdbGrowIterator | ( | rpmdbMatchIterator | mi, | |
| int | fpNum | |||
| ) |  [static] | 
        
Definition at line 2393 of file rpmdb.c.
References _, _dbiIndex::dbi_rpmtag, _dbiIndex::dbi_txnid, dbiCclose(), dbiCopen(), dbiGet(), dbiOpen(), dbt2set(), _rpmdbMatchIterator::mi_data, _rpmdbMatchIterator::mi_db, _rpmdbMatchIterator::mi_dbc, _rpmdbMatchIterator::mi_key, _rpmdbMatchIterator::mi_rpmtag, _rpmdbMatchIterator::mi_set, RPMERR_DBGETINDEX, rpmError, SQLITE_HACK, and tagName().
Referenced by rpmdbFindFpList().
| static int rpmdbMoveDatabase | ( | const char * | prefix, | |
| const char * | olddbpath, | |||
| int | _olddbapi, | |||
| const char * | newdbpath, | |||
| int | _newdbapi | |||
| ) |  [static] | 
        
Definition at line 3633 of file rpmdb.c.
References _, alloca(), dbiTags, dbiTagsMax, isTemporaryDB(), rpmCleanPath(), rpmdbRemoveDatabase(), rpmioFileExists(), RPMMESS_DEBUG, rpmMessage, and tagName().
Referenced by rpmdbRebuild().
| static int rpmdbRemoveDatabase | ( | const char * | prefix, | |
| const char * | dbpath, | |||
| int | _dbapi | |||
| ) |  [static] | 
        
Definition at line 3575 of file rpmdb.c.
References alloca(), dbiTags, dbiTagsMax, rpmCleanPath(), rpmioFileExists(), and tagName().
Referenced by rpmdbMoveDatabase(), and rpmdbRebuild().
| static void rpmdbSortIterator | ( | rpmdbMatchIterator | mi | ) |  [static] | 
        
Definition at line 2371 of file rpmdb.c.
References _dbiIndexSet::count, hdrNumCmp(), mergesort(), _rpmdbMatchIterator::mi_set, _rpmdbMatchIterator::mi_sorted, and _dbiIndexSet::recs.
Referenced by rpmdbFindFpList().
| static int rpmioFileExists | ( | const char * | urlfn | ) |  [static] | 
        
Check if file esists using stat(2).
| urlfn | file name (may be URL) | 
Definition at line 3540 of file rpmdb.c.
References errno, Stat(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().
Referenced by rpmdbMoveDatabase(), and rpmdbRemoveDatabase().
| static int set2dbt | ( | dbiIndex | dbi, | |
| DBT * | data, | |||
| dbiIndexSet | set | |||
| ) |  [static] | 
        
Convert index set to database representation.
| dbi | index database handle | |
| data | retrieved data | |
| set | index set | 
Definition at line 486 of file rpmdb.c.
References _DBSWAP, _dbiIndex::dbi_jlen, dbiByteSwapped(), and xmalloc().
Referenced by rpmdbAdd(), and rpmdbRemove().
| static int skipDir | ( | const char * | dn | ) |  [static] | 
        
Definition at line 3393 of file rpmdb.c.
References skipDir_s::dn, skipDir_s::dnlen, and skipDirs.
Referenced by rpmdbFindFpList().
| static int unblockSignals | ( | rpmdb | db, | |
| sigset_t * | oldMask | |||
| ) |  [static] | 
        
Restore signal mask.
Definition at line 781 of file rpmdb.c.
References rpmdbCheckSignals().
Referenced by miFreeHeader().
Definition at line 1123 of file rpmdb.c.
References _rpmdb_debug, and rpmdb_s::nrefs.
Definition at line 1113 of file rpmdb.c.
References _rpmdb_debug, and rpmdb_s::nrefs.
int _db_filter_dups = 0 [static]           | 
        
int _rebuildinprogress = 0 [static]           | 
        
| int _rpmdb_debug = 0 | 
| int dbiTagsMax = 0 | 
Definition at line 63 of file rpmdb.c.
Referenced by dbiOpen(), dbiTagsInit(), dbiTagToDbix(), newRpmdb(), openDatabase(), rpmdbAdd(), rpmdbCloseDBI(), rpmdbMoveDatabase(), rpmdbOpenAll(), rpmdbRemove(), and rpmdbRemoveDatabase().
struct rpmdb_s dbTemplate [static]           | 
        
Initial value:
 {
     "/" ,       "%{_dbpath}" ,  0 ,  0 ,  0644 ,
     -1 ,        "rpmdb" 
}
Definition at line 800 of file rpmdb.c.
Referenced by newRpmdb().
| unsigned int myinstall_instance = 0 | 
Definition at line 698 of file rpmdb.c.
Referenced by openDatabase(), rpmdbCheckTerminate(), and rpmdbClose().
rpmdbMatchIterator rpmmiRock [static]           | 
        
Definition at line 701 of file rpmdb.c.
Referenced by rpmdbCheckTerminate(), rpmdbFreeIterator(), and rpmdbInitIterator().
 1.5.2