rpm 5.3.7
|
#include "system.h"
#include <rpmlog.h>
#include <rpmmacro.h>
#include <rpmbf.h>
#include <rpmpgp.h>
#include <rpmurl.h>
#include <rpmtag.h>
#include <rpmevr.h>
#include <rpmdb.h>
#include "debug.h"
Go to the source code of this file.
Data Structures | |
union | _dbswap |
struct | key_s |
struct | _events_s |
Defines | |
#define | _RPMTAG_INTERNAL |
#define | _RPMEVR_INTERNAL |
#define | _RPMDB_INTERNAL |
#define | DBIDEBUG(_dbi, _list) if ((_dbi)->dbi_debug) fprintf _list |
#define | _ENTRY(_v) { DB_##_v, #_v, } |
#define | _EFLAGS(_eflags) fmtDBeflags(_eflags) |
#define | _OFLAGS(_oflags) fmtDBoflags(_oflags) |
#define | _AFLAGS(_aflags) fmtDBaflags(_aflags) |
#define | _AFFLAGS(_afflags) fmtDBafflags(_afflags) |
#define | _DBCFLAGS(_flags) fmtDBCflags(_flags) |
#define | _DBT_ENTRY(_v) { DB_DBT_##_v, #_v, } |
#define | _KEYDATA(_K, _P, _D, _R) fmtKDR(_K, _P, _D, _R) |
#define | cvtdberr(_dbi, _msg, _error, _printit) Xcvtdberr(_dbi, _msg, _error, _printit, __FUNCTION__, __FILE__, __LINE__) |
#define | _TABLE(_v) { #_v, DB_EVENT_##_v } |
#define | _RPMDB_NLOCKS 8192 |
Typedefs | |
typedef struct key_s | KEY |
Functions | |
static uint64_t | _ntoh_ul (uint64_t ul) |
static uint64_t | _hton_ul (uint64_t ul) |
static uint32_t | _ntoh_ui (uint32_t ui) |
static uint32_t | _hton_ui (uint32_t ui) |
static uint16_t | _ntoh_us (uint16_t us) |
static uint16_t | _hton_us (uint16_t us) |
static const char * | tblName (uint32_t v, KEY *tbl, size_t ntbl) |
static const char * | fmtBits (uint32_t flags, KEY tbl[], size_t ntbl, char *t) |
static const char * | fmtDBeflags (uint32_t flags) |
static const char * | fmtDBoflags (uint32_t flags) |
static const char * | fmtDBaflags (uint32_t flags) |
static const char * | fmtDBafflags (uint32_t flags) |
static const char * | fmtDBCflags (uint32_t flags) |
static char * | fmtDBT (const DBT *K, char *te) |
static const char * | fmtKDR (const DBT *K, const DBT *P, const DBT *D, const DBT *R) |
static int | Xcvtdberr (dbiIndex dbi, const char *msg, int error, int printit, const char *func, const char *fn, unsigned ln) |
static const char * | mapTagName (rpmdb rpmdb, dbiIndex dbi) |
Return (possibly renamed) tagName. | |
static int | db_fini (dbiIndex dbi, const char *dbhome, const char *dbfile, const char *dbsubfile) |
static int | db3_fsync_disable (int fd) |
static uint64_t | physmem (void) |
static size_t | ncores (void) |
static void | rpmdbe_event_notify (DB_ENV *dbenv, u_int32_t event, void *event_info) |
static void | rpmdbe_feedback (DB_ENV *dbenv, int opcode, int percent) |
static int | db_init (dbiIndex dbi, const char *dbhome, const char *dbfile, const char *dbsubfile, DB_ENV **dbenvp) |
static int | db3sync (dbiIndex dbi, unsigned int flags) |
static int | db3exists (dbiIndex dbi, DBT *key, unsigned int flags) |
static int | db3seqno (dbiIndex dbi, int64_t *seqnop, unsigned int flags) |
static int | db3cdup (dbiIndex dbi, DBC *dbcursor, DBC **dbcp, unsigned int flags) |
static int | db3cclose (dbiIndex dbi, DBC *dbcursor, unsigned int flags) |
static int | db3copen (dbiIndex dbi, DB_TXN *txnid, DBC **dbcp, unsigned int dbiflags) |
static int | db3cput (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags) |
static int | db3cget (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags) |
static int | db3cpget (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *pkey, DBT *data, unsigned int flags) |
static int | db3cdel (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags) |
static int | db3ccount (dbiIndex dbi, DBC *dbcursor, unsigned int *countp, unsigned int flags) |
static int | db3byteswapped (dbiIndex dbi) |
static int | db3stat (dbiIndex dbi, unsigned int flags) |
static int | db3associate (dbiIndex dbi, dbiIndex dbisecondary, int(*callback)(DB *, const DBT *, const DBT *, DBT *), unsigned int flags) |
static int | db3associate_foreign (dbiIndex dbi, dbiIndex dbisecondary, int(*callback)(DB *, const DBT *, DBT *, const DBT *, int *), unsigned int flags) |
static int | db3join (dbiIndex dbi, DBC **curslist, DBC **dbcp, unsigned int flags) |
static int | db3close (dbiIndex dbi, unsigned int flags) |
static unsigned char | nibble (char c) |
Convert hex to binary nibble. | |
static int | loadDBT (DBT *_r, rpmTag tag, const void *_s, size_t ns) |
static int | uint32Cmp (const void *_a, const void *_b) |
static int | uint64Cmp (const void *_a, const void *_b) |
static int | db3Acallback (DB *db, const DBT *key, const DBT *data, DBT *_r) |
static int | seqid_init (dbiIndex dbi, const char *keyp, size_t keylen, DB_SEQUENCE **seqp) |
static int | db3open (rpmdb rpmdb, rpmTag rpmtag, dbiIndex *dbip) |
Return handle for an index database. | |
Variables | |
static int | _debug = 1 |
static union _dbswap | _endian = { .ui = 0x11223344 } |
static KEY | DBeflags [] |
static size_t | nDBeflags = sizeof(DBeflags) / sizeof(DBeflags[0]) |
static KEY | DBoflags [] |
static size_t | nDBoflags = sizeof(DBoflags) / sizeof(DBoflags[0]) |
static KEY | DBaflags [] |
static size_t | nDBaflags = sizeof(DBaflags) / sizeof(DBaflags[0]) |
static KEY | DBafflags [] |
static size_t | nDBafflags = sizeof(DBafflags) / sizeof(DBafflags[0]) |
static KEY | DBCflags [] |
static size_t | nDBCflags = sizeof(DBCflags) / sizeof(DBCflags[0]) |
static KEY | DBTflags [] |
static size_t | nDBTflags = sizeof(DBTflags) / sizeof(DBTflags[0]) |
static struct _events_s | _events [] |
struct _dbiVec | db3vec |
Definition in file db3.c.
#define _AFFLAGS | ( | _afflags | ) | fmtDBafflags(_afflags) |
Definition at line 337 of file db3.c.
Referenced by db3associate_foreign().
#define _AFLAGS | ( | _aflags | ) | fmtDBaflags(_aflags) |
Definition at line 317 of file db3.c.
Referenced by db3associate().
#define _DBCFLAGS | ( | _flags | ) | fmtDBCflags(_flags) |
#define _EFLAGS | ( | _eflags | ) | fmtDBeflags(_eflags) |
#define _KEYDATA | ( | _K, | |
_P, | |||
_D, | |||
_R | |||
) | fmtKDR(_K, _P, _D, _R) |
Definition at line 494 of file db3.c.
Referenced by db3Acallback(), db3cdel(), db3cget(), db3cpget(), db3cput(), db3exists(), and seqid_init().
#define _OFLAGS | ( | _oflags | ) | fmtDBoflags(_oflags) |
#define _RPMDB_NLOCKS 8192 |
Referenced by db_init().
#define cvtdberr | ( | _dbi, | |
_msg, | |||
_error, | |||
_printit | |||
) | Xcvtdberr(_dbi, _msg, _error, _printit, __FUNCTION__, __FILE__, __LINE__) |
Definition at line 517 of file db3.c.
Referenced by db3associate(), db3associate_foreign(), db3cclose(), db3ccount(), db3cdel(), db3cdup(), db3cget(), db3close(), db3copen(), db3cpget(), db3cput(), db3exists(), db3join(), db3open(), db3seqno(), db3stat(), db3sync(), db_fini(), db_init(), and seqid_init().
#define DBIDEBUG | ( | _dbi, | |
_list | |||
) | if ((_dbi)->dbi_debug) fprintf _list |
Definition at line 37 of file db3.c.
Referenced by db3Acallback(), db3cclose(), db3ccount(), db3cdel(), db3cdup(), db3cget(), db3close(), db3copen(), db3cpget(), db3cput(), db3exists(), db3join(), db3open(), db3seqno(), db3stat(), db3sync(), db_fini(), db_init(), and seqid_init().
static uint32_t _hton_ui | ( | uint32_t | ui | ) | [inline, static] |
static uint64_t _hton_ul | ( | uint64_t | ul | ) | [inline, static] |
static uint16_t _hton_us | ( | uint16_t | us | ) | [inline, static] |
Definition at line 103 of file db3.c.
References _ntoh_us().
static uint32_t _ntoh_ui | ( | uint32_t | ui | ) | [inline, static] |
Definition at line 74 of file db3.c.
References _dbswap::uc, and _dbswap::ui.
Referenced by _hton_ui(), and db3Acallback().
static uint64_t _ntoh_ul | ( | uint64_t | ul | ) | [inline, static] |
Definition at line 54 of file db3.c.
References _dbswap::uc, and _dbswap::ul.
Referenced by _hton_ul().
static uint16_t _ntoh_us | ( | uint16_t | us | ) | [inline, static] |
Definition at line 92 of file db3.c.
References _dbswap::uc, and _dbswap::us.
Referenced by _hton_us().
static int db3_fsync_disable | ( | int | fd | ) | [static] |
Definition at line 1683 of file db3.c.
References _, _free(), _hton_ui(), _hton_ul(), _KEYDATA, _ntoh_ui(), alloca(), __db::app_private, rpmDataType_u::argv, _HE_s::c, __db_dbt::data, DBIDEBUG, __db_dbt::flags, headerFree(), headerGet(), headerLink(), headerLoad(), loadDBT(), _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, rpmlog(), RPMLOG_ERR, __db_dbt::size, rpmDataType_u::str, _HE_s::t, _HE_s::tag, tagName(), rpmDataType_u::ui16p, rpmDataType_u::ui32p, rpmDataType_u::ui64p, rpmDataType_u::ui8p, uint32Cmp(), uint64Cmp(), xcalloc(), and xmalloc().
Referenced by db3open().
static int db3close | ( | dbiIndex | dbi, |
unsigned int | flags | ||
) | [static] |
Definition at line 1509 of file db3.c.
References _debug, _free(), cvtdberr, D_, db_fini(), DBIDEBUG, mapTagName(), rpmGenPath(), rpmlog(), RPMLOG_DEBUG, and urlPath().
Referenced by db3open().
Definition at line 1184 of file db3.c.
References _debug, cvtdberr, db3cclose(), DB_WRITECURSOR, and DBIDEBUG.
Return handle for an index database.
rpmdb | rpm database |
rpmtag | rpm tag |
*dbip | index database handle |
Definition at line 2012 of file db3.c.
References _, _debug, _free(), _OFLAGS, alloca(), __db::app_private, cvtdberr, D_, db3Acallback(), db3associate(), db3close(), db3vec, DB_EXCL, db_init(), DB_PRIVATE, DB_VERSION_MAJOR, DBIDEBUG, dbiOpen(), errno, EXIT_FAILURE, F_OK, mapTagName(), rpmCleanPath(), RPMDBI_PACKAGES, rpmGenPath(), rpmGetPath(), rpmioMkpath(), rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMLOG_NOTICE, RPMLOG_WARNING, seqid_init(), Stat(), stpcpy(), tagName(), tagValue(), Unlink(), urlPath(), and W_OK.
static int db3seqno | ( | dbiIndex | dbi, |
int64_t * | seqnop, | ||
unsigned int | flags | ||
) | [static] |
static int db3stat | ( | dbiIndex | dbi, |
unsigned int | flags | ||
) | [static] |
static int db3sync | ( | dbiIndex | dbi, |
unsigned int | flags | ||
) | [static] |
static int db_fini | ( | dbiIndex | dbi, |
const char * | dbhome, | ||
const char * | dbfile, | ||
const char * | dbsubfile | ||
) | [static] |
Definition at line 544 of file db3.c.
References _debug, cvtdberr, D_, DBIDEBUG, rpmlog(), and RPMLOG_DEBUG.
Referenced by db3close().
static int db_init | ( | dbiIndex | dbi, |
const char * | dbhome, | ||
const char * | dbfile, | ||
const char * | dbsubfile, | ||
DB_ENV ** | dbenvp | ||
) | [static] |
Definition at line 735 of file db3.c.
References _debug, _EFLAGS, _free(), _RPMDB_NLOCKS, cvtdberr, D_, db3_fsync_disable(), DBIDEBUG, ncores(), Open(), physmem(), rpmdbe_event_notify(), rpmdbe_feedback(), rpmGenPath(), rpmlog(), RPMLOG_DEBUG, and tagName().
Referenced by db3open().
static const char* fmtBits | ( | uint32_t | flags, |
KEY | tbl[], | ||
size_t | ntbl, | ||
char * | t | ||
) | [static] |
Definition at line 209 of file db3.c.
References name, stpcpy(), and tblName().
Referenced by fmtDBafflags(), fmtDBaflags(), fmtDBCflags(), fmtDBeflags(), fmtDBoflags(), and fmtDBT().
static const char* fmtDBafflags | ( | uint32_t | flags | ) | [static] |
static const char* fmtDBaflags | ( | uint32_t | flags | ) | [static] |
static const char* fmtDBCflags | ( | uint32_t | flags | ) | [static] |
static const char* fmtDBeflags | ( | uint32_t | flags | ) | [static] |
static const char* fmtDBoflags | ( | uint32_t | flags | ) | [static] |
static char* fmtDBT | ( | const DBT * | K, |
char * | te | ||
) | [static] |
Definition at line 421 of file db3.c.
References __db_dbt::data, __db_dbt::flags, fmtBits(), __db_dbt::size, and xisprint().
Referenced by fmtKDR().
Definition at line 1618 of file db3.c.
References _free(), __db_dbt::data, __db_dbt::flags, nibble(), pgpExtractPubkeyFingerprint(), __db_dbt::size, and xmalloc().
Referenced by db3Acallback().
Return (possibly renamed) tagName.
Handles arbitrary tags.
rpmdb | rpm database |
dbi | rpm database index |
Definition at line 527 of file db3.c.
References tagName().
Referenced by db3close(), and db3open().
static size_t ncores | ( | void | ) | [static] |
static unsigned char nibble | ( | char | c | ) | [inline, static] |
static uint64_t physmem | ( | void | ) | [static] |
static void rpmdbe_event_notify | ( | DB_ENV * | dbenv, |
u_int32_t | event, | ||
void * | event_info | ||
) | [static] |
Definition at line 712 of file db3.c.
References _events, and __db_env::app_private.
Referenced by db_init().
static void rpmdbe_feedback | ( | DB_ENV * | dbenv, |
int | opcode, | ||
int | percent | ||
) | [static] |
static int seqid_init | ( | dbiIndex | dbi, |
const char * | keyp, | ||
size_t | keylen, | ||
DB_SEQUENCE ** | seqp | ||
) | [static] |
Definition at line 1932 of file db3.c.
References _debug, _KEYDATA, cvtdberr, __db_dbt::data, DBIDEBUG, and __db_dbt::size.
Referenced by db3open().
static const char* tblName | ( | uint32_t | v, |
KEY * | tbl, | ||
size_t | ntbl | ||
) | [static] |
Definition at line 189 of file db3.c.
References key_s::n, and snprintf().
Referenced by fmtBits(), and fmtDBCflags().
static int uint32Cmp | ( | const void * | _a, |
const void * | _b | ||
) | [static] |
Definition at line 1664 of file db3.c.
Referenced by db3Acallback().
static int uint64Cmp | ( | const void * | _a, |
const void * | _b | ||
) | [static] |
Definition at line 1673 of file db3.c.
Referenced by db3Acallback().
static int Xcvtdberr | ( | dbiIndex | dbi, |
const char * | msg, | ||
int | error, | ||
int | printit, | ||
const char * | func, | ||
const char * | fn, | ||
unsigned | ln | ||
) | [static] |
Definition at line 499 of file db3.c.
References rpmlog(), and RPMLOG_ERR.
int _debug = 1 [static] |
Definition at line 7 of file db3.c.
Referenced by db3associate(), db3associate_foreign(), db3cclose(), db3ccount(), db3cdel(), db3cdup(), db3cget(), db3close(), db3copen(), db3cpget(), db3cput(), db3exists(), db3join(), db3open(), db3seqno(), db3stat(), db3sync(), db_fini(), db_init(), and seqid_init().
Referenced by rpmdbe_event_notify().
{ { DB_INIT_CDB , "INIT_CDB", }, { DB_INIT_LOCK , "INIT_LOCK", }, { DB_INIT_LOG , "INIT_LOG", }, { DB_INIT_MPOOL , "INIT_MPOOL", }, { DB_INIT_REP , "INIT_REP", }, { DB_INIT_TXN , "INIT_TXN", }, { DB_RECOVER , "RECOVER", }, { DB_RECOVER_FATAL , "RECOVER_FATAL", }, { DB_USE_ENVIRON , "USE_ENVIRON", }, { DB_USE_ENVIRON_ROOT , "USE_ENVIRON_ROOT", }, { DB_CREATE , "CREATE", }, { DB_LOCKDOWN , "LOCKDOWN", }, { DB_PRIVATE , "PRIVATE", }, { DB_REGISTER , "REGISTER", }, { DB_SYSTEM_MEM , "SYSTEM_MEM", }, { DB_THREAD , "THREAD", }, }
{ { DB_AUTO_COMMIT , "AUTO_COMMIT", }, { DB_CREATE , "CREATE", }, { DB_EXCL , "EXCL", }, { DB_MULTIVERSION , "MULTIVERSION", }, { DB_NOMMAP , "NOMMAP", }, { DB_RDONLY , "RDONLY", }, { DB_READ_UNCOMMITTED , "READ_UNCOMMITTED", }, { DB_THREAD , "THREAD", }, { DB_TRUNCATE , "TRUNCATE", }, }
{ { DB_DBT_MALLOC , "MALLOC", }, { DB_DBT_REALLOC , "REALLOC", }, { DB_DBT_USERMEM , "USERMEM", }, { DB_DBT_PARTIAL , "PARTIAL", }, { DB_DBT_APPMALLOC , "APPMALLOC", }, { DB_DBT_MULTIPLE , "MULTIPLE", }, }
size_t nDBafflags = sizeof(DBafflags) / sizeof(DBafflags[0]) [static] |