rpm
5.2.1
|
#include "system.h"
#include <sys/file.h>
#include <rpmiotypes.h>
#include <rpmlog.h>
#include <rpmpgp.h>
#include <rpmurl.h>
#include <rpmmacro.h>
#include <rpmsq.h>
#include <argv.h>
#include <rpmtypes.h>
#include "header_internal.h"
#include <rpmevr.h>
#include "rpmdb.h"
#include "pkgio.h"
#include "fprint.h"
#include "legacy.h"
#include "debug.h"
Go to the source code of this file.
Data Structures | |
struct | pbm_set |
union | _dbswap |
struct | rpmmi_s |
Defines | |
#define | _MIRE_INTERNAL |
#define | _RPMTAG_INTERNAL |
#define | _RPMEVR_INTERNAL |
#define | _RPMDB_INTERNAL |
#define | UINT32_T rpmuint32_t |
#define | _DB_TAGGED_FILE_INDICES 1 |
#define | _DB_TAGGED_FINDBYFILE 1 |
#define | _DBI_FLAGS 0 |
#define | _DBI_PERMS 0644 |
#define | _DBI_MAJOR -1 |
#define | __PBM_NBITS /*@-sizeoftype@*/(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, __PBM_NBITS/8) |
#define | DB1vec NULL |
#define | DB2vec NULL |
#define | DB3vec NULL |
#define | SQLITEvec NULL |
#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 | _RECNUM rpmmiInstance(mi) |
Typedefs | |
typedef unsigned int | __pbm_bits |
Functions | |
pgpDig | rpmtsDig (void *ts) |
void | rpmtsCleanDig (void *ts) |
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 char * | bin2hex (const void *data, size_t size) |
Convert binary blob to printable hex string. | |
static size_t | dbiTagToDbix (rpmdb db, rpmTag tag) |
Return dbi index used for rpm tag. | |
static void | dbiTagsInit (tagStore_t *dbiTagsP, size_t *dbiNTagsP) |
Initialize database (index, tag) tuple from configuration. | |
static int | checkfd (const char *devnull, int fdno, int flags) |
dbiIndex | dbiOpen (rpmdb db, rpmTag tag, unsigned int flags) |
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) |
unsigned int | dbiIndexRecordOffset (dbiIndexSet set, int recno) |
unsigned int | dbiIndexRecordFileNumber (dbiIndexSet set, int recno) |
dbiIndexSet | dbiFreeIndexSet (dbiIndexSet set) |
int | rpmdbCheckTerminate (int terminate) |
Check rpmdb signal handler for trapped signal and/or requested exit. | |
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 const char * | queryHeader (Header h, const char *qfmt) |
Return header query string. | |
static int | rpmdbExportInfo (rpmdb db, Header h, int adding) |
Write added/removed header info. | |
static rpmdb | rpmdbGetPool (rpmioPool pool) |
int | rpmdbOpenAll (rpmdb db) |
Open all database indices. | |
int | rpmdbBlockDBI (rpmdb db, int tag) |
Block access to a single database index. | |
int | rpmdbCloseDBI (rpmdb db, int tag) |
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 const char * | rpmdbURIPath (const char *uri) |
Return macro expanded absolute path to rpmdb. | |
rpmdb | rpmdbNew (const char *root, const char *home, int mode, int perms, int flags) |
int | rpmdbOpenDatabase (const char *prefix, const char *dbpath, int _dbapi, rpmdb *dbp, int mode, int perms, int flags) |
int | rpmdbOpen (const char *prefix, rpmdb *dbp, int mode, int perms) |
Open rpm database. | |
int | rpmdbInit (const char *prefix, int perms) |
Initialize database. | |
int | rpmdbVerifyAllDBI (rpmdb db) |
Verify all database components. | |
int | rpmdbVerify (const char *prefix) |
Open and verify all database components. | |
static unsigned | taghash (const char *s) |
Return a tagnum with hash on the (directory) path in upper 16 bits. | |
static int | dbiIntersect (unsigned int tag, dbiIndexSet dnset, dbiIndexSet bnset, dbiIndexSet *matches) |
Return the intersection of dirName <=> baseName index sets. | |
static int | rpmdbFindByFile (rpmdb db, const char *filespec, DBT *key, DBT *data, dbiIndexSet *matches) |
Find file matches in database. | |
int | rpmdbCount (rpmdb db, rpmTag tag, const void *keyp, size_t keylen) |
Return number of instances of key in a tag index. | |
int | rpmdbCountPackages (rpmdb db, const char *name) |
Return number of instances of package in Name index. | |
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. | |
void * | dbiStatsAccumulator (dbiIndex dbi, int opx) |
static int | miFreeHeader (rpmmi mi, dbiIndex dbi) |
Rewrite a header into packages (if necessary) and free the header. | |
static void | rpmmiFini (void *_mi) |
static rpmmi | rpmmiGetPool (rpmioPool pool) |
unsigned int | rpmmiInstance (rpmmi mi) |
Return header instance join key for current position of rpmdb iterator. | |
unsigned int | rpmmiFilenum (rpmmi mi) |
Return header tag index join key for current position of rpmdb iterator. | |
int | rpmmiCount (rpmmi mi) |
Return number of elements in rpm database iterator. | |
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 | rpmmiAddPattern (rpmmi mi, rpmTag tag, rpmMireMode mode, const char *pattern) |
Add pattern to iterator selector. | |
static int | mireSkip (const rpmmi mi) |
Return iterator selector match. | |
int | rpmmiSetRewrite (rpmmi mi, int rewrite) |
Prepare iterator for lazy writes. | |
int | rpmmiSetModified (rpmmi mi, int modified) |
Modify iterator to mark header for lazy write on release. | |
int | rpmmiSetHdrChk (rpmmi mi, rpmts ts) |
Modify iterator to verify retrieved header blobs. | |
static int | rpmmiGet (dbiIndex dbi, DBC *dbcursor, DBT *kp, DBT *vp, unsigned int flags) |
Header | rpmmiNext (rpmmi mi) |
Return next package header from iteration. | |
static void | rpmdbSortIterator (rpmmi mi) |
static int | rpmdbGrowIterator (rpmmi mi, int fpNum, unsigned int exclude, unsigned int tag) |
int | rpmmiPrune (rpmmi mi, int *hdrNums, int nHdrNums, int sorted) |
Remove items from set of package instances to iterate. | |
int | rpmmiGrow (rpmmi mi, const int *hdrNums, int nHdrNums) |
Append items to set of package instances to iterate. | |
rpmmi | rpmmiInit (rpmdb db, rpmTag tag, const void *keyp, size_t keylen) |
Return database iterator. | |
int | rpmdbMireApply (rpmdb db, rpmTag tag, rpmMireMode mode, const char *pat, const char ***argvp) |
Return array of keys matching a pattern. | |
int | rpmdbRemove (rpmdb db, int rid, unsigned int hdrNum, rpmts ts) |
Remove package header from rpm database and indices. | |
int | rpmdbAdd (rpmdb db, int iid, Header h, rpmts ts) |
Add package header to rpm database and indices. | |
int | rpmdbFindFpList (void *_db, fingerPrint *fpList, void *_matchList, int numItems, unsigned int exclude) |
Find fingerprint matches in database. | |
static int | rpmioFileExists (const char *urlfn) |
Check if file exists using stat(2). | |
static int | rpmdbRemoveDatabase (const char *prefix, const char *dbpath, int _dbapi, const tagStore_t dbiTags, size_t dbiNTags) |
static int | rpmdbMoveDatabase (const char *prefix, const char *olddbpath, int _olddbapi, const char *newdbpath, int _newdbapi, const tagStore_t dbiTags, size_t dbiNTags) |
int | rpmdbRebuild (const char *prefix, rpmts ts) |
Rebuild database indices from package headers. | |
Variables | |
int | _rpmdb_debug = 0 |
static int | _rebuildinprogress = 0 |
static int | _db_filter_dups = 0 |
static int | _db_tagged_file_indices = 1 |
static int | _db_tagged_findbyfile = 1 |
static struct _dbiVec * | mydbvecs [] |
static rpmdb | rpmdbRock |
static rpmmi | rpmmiRock |
rpmioPool | _rpmdbPool |
int | _rpmmi_debug = 0 |
rpmioPool | _rpmmiPool |
static int | _rpmmi_usermem = 1 |
Definition in file rpmdb.c.
#define __PBM_BITS | ( | set | ) | ((set)->bits) |
Definition at line 95 of file rpmdb.c.
Referenced by PBM_REALLOC().
#define __PBM_IX | ( | d | ) | ((d) / __PBM_NBITS) |
Definition at line 88 of file rpmdb.c.
Referenced by PBM_REALLOC().
#define __PBM_MASK | ( | d | ) | ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS)) |
#define __PBM_NBITS /*@-sizeoftype@*/(8 * sizeof(__pbm_bits)) |
Definition at line 87 of file rpmdb.c.
Referenced by PBM_REALLOC().
#define _DB_ERRPFX "rpmdb" |
Definition at line 1167 of file rpmdb.c.
Referenced by rpmdbNew().
#define _DB_FLAGS 0 |
Definition at line 1162 of file rpmdb.c.
Referenced by rpmdbNew().
#define _DB_HOME "%{?_dbpath}" |
Definition at line 1161 of file rpmdb.c.
Referenced by rpmdbNew().
#define _DB_MAJOR -1 |
Definition at line 1166 of file rpmdb.c.
Referenced by rpmdbNew().
#define _DB_MODE 0 |
Definition at line 1163 of file rpmdb.c.
Referenced by rpmdbNew().
#define _DB_PERMS 0644 |
Definition at line 1164 of file rpmdb.c.
Referenced by rpmdbNew().
#define _DB_ROOT "/" |
Definition at line 1160 of file rpmdb.c.
Referenced by rpmdbNew().
#define _DBSWAP | ( | _a | ) |
{ 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 474 of file rpmdb.c.
Referenced by dbt2set(), rpmdbAdd(), rpmdbRemove(), rpmmiNext(), and set2dbt().
#define _RECNUM rpmmiInstance(mi) |
Referenced by rpmdbRebuild().
#define PBM_ALLOC | ( | d | ) | xcalloc(__PBM_IX (d) + 1, __PBM_NBITS/8) |
#define PBM_CLR | ( | d, | |
s | |||
) | (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d)) |
#define PBM_FREE | ( | s | ) | _free(s); |
Definition at line 97 of file rpmdb.c.
Referenced by rpmdbClose().
#define PBM_ISSET | ( | d, | |
s | |||
) | ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0) |
Definition at line 100 of file rpmdb.c.
Referenced by rpmmiNext().
#define PBM_SET | ( | d, | |
s | |||
) | (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d)) |
Definition at line 98 of file rpmdb.c.
Referenced by rpmmiNext().
#define UINT32_T rpmuint32_t |
Definition at line 45 of file rpmdb.c.
Referenced by dbiFindMatches(), miFreeHeader(), rpmdbAdd(), rpmdbCount(), rpmdbFindByFile(), rpmdbFindFpList(), rpmdbRemove(), rpmmiInit(), and set2dbt().
typedef unsigned int __pbm_bits |
static char* bin2hex | ( | const void * | data, |
size_t | size | ||
) | [static] |
Convert binary blob to printable hex string.
data | binary data |
size | size of data in bytes |
Definition at line 155 of file rpmdb.c.
References xmalloc().
Referenced by mireSkip().
static int blockSignals | ( | rpmdb | db, |
sigset_t * | oldMask | ||
) | [static] |
Block all signals, returning previous signal mask.
db | rpm database |
*oldMask | previous sigset |
Definition at line 822 of file rpmdb.c.
Referenced by miFreeHeader(), rpmdbAdd(), rpmdbMoveDatabase(), and rpmdbRemove().
static int checkfd | ( | const char * | devnull, |
int | fdno, | ||
int | flags | ||
) | [inline, static] |
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 634 of file rpmdb.c.
References hdrNumCmp(), recs, set(), and xrealloc().
Referenced by dbiIntersect(), rpmdbAdd(), rpmdbFindByFile(), rpmdbFindFpList(), and rpmmiGrow().
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 1849 of file rpmdb.c.
References alloca(), dbiFindMatches(), dbiFreeIndexSet(), RPMRC_NOTFOUND, and stpcpy().
Referenced by rpmmiInit().
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 1753 of file rpmdb.c.
References _, __db_dbt::data, DB_NOTFOUND, DB_SET, dbiFreeIndexSet(), dbiIndexRecordOffset(), dbiIndexSetCount(), dbt2set(), RPMDBI_PACKAGES, rpmlog(), RPMLOG_ERR, rpmmiAddPattern(), rpmmiFree(), rpmmiInit(), rpmmiNext(), RPMMIRE_DEFAULT, RPMRC_FAIL, RPMRC_NOTFOUND, RPMRC_OK, __db_dbt::size, tagName(), and UINT32_T.
Referenced by dbiFindByLabel().
dbiIndexSet dbiFreeIndexSet | ( | dbiIndexSet | set | ) |
Definition at line 715 of file rpmdb.c.
References _free(), and set().
Referenced by dbiFindByLabel(), dbiFindMatches(), rpmdbAdd(), rpmdbCount(), rpmdbFindByFile(), rpmdbGrowIterator(), rpmdbRemove(), rpmmiFini(), rpmmiInit(), and rpmtsRun().
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 460 of file rpmdb.c.
References xcalloc().
Referenced by rpmdbAdd(), and rpmdbRemove().
unsigned int dbiIndexRecordFileNumber | ( | dbiIndexSet | set, |
int | recno | ||
) |
Definition at line 710 of file rpmdb.c.
Referenced by rpmdbFindByFile(), rpmmiNext(), and rpmtsRun().
unsigned int dbiIndexRecordOffset | ( | dbiIndexSet | set, |
int | recno | ||
) |
Definition at line 705 of file rpmdb.c.
Referenced by dbiFindMatches(), rpmmiNext(), and rpmtsRun().
unsigned int dbiIndexSetCount | ( | dbiIndexSet | set | ) |
Definition at line 700 of file rpmdb.c.
Referenced by dbiFindMatches(), rpmdbCount(), and rpmtsRun().
static int dbiIntersect | ( | unsigned int | tag, |
dbiIndexSet | dnset, | ||
dbiIndexSet | bnset, | ||
dbiIndexSet * | matches | ||
) | [static] |
Return the intersection of dirName <=> baseName index sets.
tag | dirName hash tag. |
dnset | dirName's set. bnset baseName's set. |
*matches | intersection of dnset and bnset (NULL if disjoint). |
Definition at line 1430 of file rpmdb.c.
References alloca(), dbiAppendSet(), and xcalloc().
Referenced by rpmdbFindByFile().
Definition at line 331 of file rpmdb.c.
References _, _rebuildinprogress, _rpmdb_debug, checkfd(), D_, DB_FAST_STAT, dbiTagToDbix(), errno, __db_h_stat::hash_nkeys, PBM_ALLOC, RPMDBI_PACKAGES, rpmExpandNumeric(), rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, and tagName().
Referenced by rpmdbAdd(), rpmdbCount(), rpmdbFindByFile(), rpmdbGrowIterator(), rpmdbMireApply(), rpmdbOpenAll(), rpmdbOpenDatabase(), rpmdbRemove(), rpmmiFini(), rpmmiInit(), rpmmiNext(), rpmpsmStage(), and unsatisfiedDepend().
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 673 of file rpmdb.c.
References hdrNumCmp(), and set().
Referenced by rpmdbRemove(), and rpmmiPrune().
static void dbiTagsInit | ( | tagStore_t * | dbiTagsP, |
size_t * | dbiNTagsP | ||
) | [static] |
Initialize database (index, tag) tuple from configuration.
Definition at line 214 of file rpmdb.c.
References _free(), RPMDBI_PACKAGES, rpmExpand(), tagStoreFree(), tagValue(), xcalloc(), xisspace(), xrealloc(), and xstrdup().
Referenced by rpmdbNew(), and rpmdbRebuild().
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 487 of file rpmdb.c.
References _DBSWAP, __db_dbt::data, set(), __db_dbt::size, _dbswap::ui, and xmalloc().
Referenced by dbiFindMatches(), rpmdbAdd(), rpmdbCount(), rpmdbFindByFile(), rpmdbGrowIterator(), rpmdbRemove(), and rpmmiInit().
static int hdrNumCmp | ( | const void * | one, |
const void * | two | ||
) | [static] |
Definition at line 618 of file rpmdb.c.
Referenced by dbiAppendSet(), dbiPruneSet(), and rpmdbSortIterator().
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 1959 of file rpmdb.c.
References _, _free(), blockSignals(), __db_dbt::data, DB_KEYLAST, headerCheck(), headerFree(), headerUnload(), rpmmi_s::mi_dbc, rpmmi_s::mi_h, rpmmi_s::mi_modified, rpmmi_s::mi_prevoffset, rpmmi_s::mi_ts, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMRC_FAIL, RPMRC_NOTFOUND, rpmtsCleanDig(), rpmtsDig(), __db_dbt::size, tagName(), UINT32_T, and unblockSignals().
Referenced by rpmmiFini(), and rpmmiNext().
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 2100 of file rpmdb.c.
Referenced by rpmmiAddPattern().
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 2116 of file rpmdb.c.
References RPMMIRE_DEFAULT, RPMMIRE_GLOB, RPMMIRE_REGEX, RPMMIRE_STRCMP, xmalloc(), and xstrdup().
Referenced by rpmmiAddPattern().
static int mireSkip | ( | const rpmmi | mi | ) | [static] |
Return iterator selector match.
mi | rpm database iterator |
Definition at line 2297 of file rpmdb.c.
References _free(), alloca(), rpmDataType_u::argv, bin2hex(), _HE_s::c, headerGet(), rpmmi_s::mi_h, rpmmi_s::mi_nre, rpmmi_s::mi_re, mireRegexec(), _HE_s::p, rpmDataType_u::ptr, RPM_BIN_TYPE, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, RPM_UINT16_TYPE, RPM_UINT32_TYPE, RPM_UINT64_TYPE, RPM_UINT8_TYPE, rpmDataType_u::str, _HE_s::t, _HE_s::tag, rpmDataType_u::ui16p, rpmDataType_u::ui32p, rpmDataType_u::ui64p, rpmDataType_u::ui8p, and xcalloc().
Referenced by rpmmiNext().
static unsigned char nibble | ( | char | c | ) | [inline, static] |
Convert hex to binary nibble.
c | hex character |
Definition at line 136 of file rpmdb.c.
Referenced by rpmdbAdd(), and rpmdbRemove().
Reallocate a bit map.
sp | address of bit map pointer |
odp | no. of bits in map |
nd | desired no. of bits |
Definition at line 111 of file rpmdb.c.
References __PBM_BITS, __PBM_IX, __PBM_NBITS, and xrealloc().
Referenced by rpmmiNext().
static const char* queryHeader | ( | Header | h, |
const char * | qfmt | ||
) | [inline, static] |
Return header query string.
h | header |
qfmt | header sprintf format |
Definition at line 860 of file rpmdb.c.
References _, headerCompoundFormats, headerSprintf(), rpmlog(), and RPMLOG_ERR.
Referenced by rpmdbExportInfo().
int rpmdbBlockDBI | ( | rpmdb | db, |
int | tag | ||
) |
Block access to a single database index.
db | rpm database |
tag | rpm tag (negative to block) |
Definition at line 974 of file rpmdb.c.
Referenced by rpmgiNext().
int rpmdbCloseDBI | ( | rpmdb | db, |
int | tag | ||
) |
Close a single database index.
db | rpm database |
tag | rpm tag |
Definition at line 992 of file rpmdb.c.
Referenced by rpmtsCheck().
Write added/removed header info.
db | rpm database |
h | header |
adding | adding an rpmdb header? |
Definition at line 882 of file rpmdb.c.
References _free(), alloca(), Fclose(), Fopen(), headerGet(), _HE_s::p, rpmDataType_u::ptr, queryHeader(), rpmGetPath(), rpmlog(), RPMLOG_DEBUG, _HE_s::tag, rpmDataType_u::ui32p, Unlink(), and Utime().
Referenced by rpmdbNew().
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 1478 of file rpmdb.c.
References _, _db_tagged_file_indices, _db_tagged_findbyfile, _free(), alloca(), rpmDataType_u::argv, _HE_s::c, __db_dbt::data, DB_SET, dbiAppendSet(), dbiFreeIndexSet(), dbiIndexRecordFileNumber(), dbiIntersect(), dbiOpen(), dbt2set(), dirName, FP_EQUAL, fpCacheCreate(), fpCacheFree(), fpLookup(), headerGet(), rpmmi_s::mi_set, rpmmi_s::mi_setx, _HE_s::p, rpmDataType_u::ptr, RPMDBI_PACKAGES, rpmlog(), RPMLOG_ERR, rpmmiFree(), rpmmiInit(), rpmmiInstance(), rpmmiNext(), __db_dbt::size, _HE_s::tag, taghash(), tagName(), rpmDataType_u::ui32p, UINT32_T, and xcalloc().
Referenced by rpmmiInit().
Definition at line 930 of file rpmdb.c.
References _rpmdb_debug, _rpmdbPool, rpmioGetPool(), and rpmioNewPool().
Referenced by rpmdbNew().
static int rpmdbGrowIterator | ( | rpmmi | mi, |
int | fpNum, | ||
unsigned int | exclude, | ||
unsigned int | tag | ||
) | [static] |
Definition at line 2690 of file rpmdb.c.
References _, _db_tagged_file_indices, __db_dbt::data, DB_NOTFOUND, DB_SET, dbiFreeIndexSet(), dbiOpen(), dbt2set(), rpmmi_s::mi_data, rpmmi_s::mi_db, rpmmi_s::mi_dbc, rpmmi_s::mi_key, rpmmi_s::mi_rpmtag, rpmmi_s::mi_set, rpmlog(), RPMLOG_ERR, set(), tagName(), and xrealloc().
Referenced by rpmdbFindFpList().
static int rpmdbMoveDatabase | ( | const char * | prefix, |
const char * | olddbpath, | ||
int | _olddbapi, | ||
const char * | newdbpath, | ||
int | _newdbapi, | ||
const tagStore_t | dbiTags, | ||
size_t | dbiNTags | ||
) | [static] |
Definition at line 3952 of file rpmdb.c.
References _free(), blockSignals(), Chmod(), Chown(), D_, freecon, is_selinux_enabled, matchpathcon, matchpathcon_fini, matchpathcon_init, Rename(), RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_REMOVED, rpmGetPath(), rpmioFileExists(), rpmlog(), RPMLOG_DEBUG, setfilecon, snprintf(), Stat(), tagName(), unblockSignals(), Unlink(), and Utime().
Referenced by rpmdbRebuild().
rpmdb rpmdbNew | ( | const char * | root, |
const char * | home, | ||
int | mode, | ||
int | perms, | ||
int | flags | ||
) |
Definition at line 1171 of file rpmdb.c.
References _, _DB_ERRPFX, _db_filter_dups, _DB_FLAGS, _DB_HOME, _DB_MAJOR, _DB_MODE, _DB_PERMS, _DB_ROOT, _free(), _rpmdb_debug, dbiTagsInit(), rpmdbExportInfo(), rpmdbGetPool(), rpmdbLink(), rpmdbURIPath(), rpmExpand(), rpmExpandNumeric(), rpmioPutPool(), rpmlog(), RPMLOG_ERR, and xcalloc().
Referenced by rpmdbOpenDatabase().
int rpmdbOpenDatabase | ( | const char * | prefix, |
const char * | dbpath, | ||
int | _dbapi, | ||
rpmdb * | dbp, | ||
int | mode, | ||
int | perms, | ||
int | flags | ||
) |
Definition at line 1225 of file rpmdb.c.
References dbiOpen(), RPMDB_FLAG_JUSTCHECK, RPMDB_FLAG_MINIMAL, rpmdbClose(), RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_PACKAGES, RPMDBI_REMOVED, rpmdbNew(), rpmdbRock, and rpmsqEnable().
Referenced by rpmdbInit(), rpmdbOpen(), rpmdbRebuild(), and rpmdbVerify().
static int rpmdbRemoveDatabase | ( | const char * | prefix, |
const char * | dbpath, | ||
int | _dbapi, | ||
const tagStore_t | dbiTags, | ||
size_t | dbiNTags | ||
) | [static] |
Definition at line 3902 of file rpmdb.c.
References _free(), Rmdir(), rpmGetPath(), rpmioFileExists(), snprintf(), tagName(), and Unlink().
Referenced by rpmdbRebuild().
static void rpmdbSortIterator | ( | rpmmi | mi | ) | [static] |
Definition at line 2671 of file rpmdb.c.
References hdrNumCmp(), rpmmi_s::mi_set, rpmmi_s::mi_sorted, and rpm_mergesort().
Referenced by rpmdbFindFpList().
static const char* rpmdbURIPath | ( | const char * | uri | ) | [static] |
Return macro expanded absolute path to rpmdb.
uri | desired path |
Definition at line 1113 of file rpmdb.c.
References _free(), PATH_MAX, Realpath(), rpmGetPath(), stpncpy(), 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 rpmdbNew().
static int rpmioFileExists | ( | const char * | urlfn | ) | [static] |
Check if file exists using stat(2).
urlfn | file name (may be URL) |
Definition at line 3873 of file rpmdb.c.
References 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 void rpmmiFini | ( | void * | _mi | ) | [static] |
Definition at line 2020 of file rpmdb.c.
References dbiFreeIndexSet(), dbiOpen(), rpmmi_s::mi_db, rpmmi_s::mi_dbc, rpmmi_s::mi_next, rpmmi_s::mi_nre, rpmmi_s::mi_re, rpmmi_s::mi_set, miFreeHeader(), mireFreeAll(), rpmdbCheckSignals(), rpmdbClose(), RPMDBI_PACKAGES, and rpmmiRock.
Referenced by rpmmiGetPool().
static int rpmmiGet | ( | dbiIndex | dbi, |
DBC * | dbcursor, | ||
DBT * | kp, | ||
DBT * | vp, | ||
unsigned int | flags | ||
) | [static] |
Definition at line 2454 of file rpmdb.c.
References _rpmmi_usermem, __db_dbt::data, DB_SET, errno, __db_dbt::flags, and __db_dbt::size.
Referenced by rpmmiNext().
Definition at line 2068 of file rpmdb.c.
References _rpmmiPool, rpmioGetPool(), rpmioNewPool(), and rpmmiFini().
Referenced by rpmmiInit().
void rpmtsCleanDig | ( | void * | ts | ) |
pgpDig rpmtsDig | ( | void * | ts | ) |
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 557 of file rpmdb.c.
References _DBSWAP, __db_dbt::data, set(), __db_dbt::size, _dbswap::ui, UINT32_T, and xmalloc().
Referenced by rpmdbAdd(), and rpmdbRemove().
static unsigned taghash | ( | const char * | s | ) | [inline, static] |
Return a tagnum with hash on the (directory) path in upper 16 bits.
s | (directory) path |
Definition at line 1409 of file rpmdb.c.
Referenced by rpmdbAdd(), rpmdbFindByFile(), and rpmdbFindFpList().
static int unblockSignals | ( | rpmdb | db, |
sigset_t * | oldMask | ||
) | [static] |
Restore signal mask.
db | rpm database |
oldMask | previous sigset |
Definition at line 845 of file rpmdb.c.
References rpmdbCheckSignals().
Referenced by miFreeHeader(), rpmdbAdd(), rpmdbMoveDatabase(), and rpmdbRemove().
int _db_filter_dups = 0 [static] |
Definition at line 66 of file rpmdb.c.
Referenced by rpmdbNew(), and rpmdbRebuild().
int _db_tagged_file_indices = 1 [static] |
Definition at line 72 of file rpmdb.c.
Referenced by rpmdbAdd(), rpmdbFindByFile(), rpmdbFindFpList(), and rpmdbGrowIterator().
int _db_tagged_findbyfile = 1 [static] |
Definition at line 77 of file rpmdb.c.
Referenced by rpmdbFindByFile().
int _rebuildinprogress = 0 [static] |
Definition at line 64 of file rpmdb.c.
Referenced by dbiOpen(), and rpmdbRebuild().
int _rpmdb_debug = 0 |
Definition at line 61 of file rpmdb.c.
Referenced by dbiOpen(), rpmdbClose(), rpmdbGetPool(), and rpmdbNew().
Definition at line 928 of file rpmdb.c.
Referenced by rpmcliFini(), and rpmdbGetPool().
int _rpmmi_debug = 0 |
int _rpmmi_usermem = 1 [static] |
Definition at line 2452 of file rpmdb.c.
Referenced by rpmmiGet(), and rpmmiNext().
Definition at line 2066 of file rpmdb.c.
Referenced by rpmcliFini(), and rpmmiGetPool().
struct _dbiVec* mydbvecs[] [static] |
Definition at line 752 of file rpmdb.c.
Referenced by rpmdbClose(), and rpmdbOpenDatabase().
Definition at line 755 of file rpmdb.c.
Referenced by rpmmiFini(), and rpmmiInit().