RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 27-Jun-2016 05:08:21 Branch: rpm-5_4 Handle: 2016062703082001 Modified files: (Branch: rpm-5_4) rpm CHANGES rpm/rpmdb db3.c dbconfig.c librpmdb.vers poptDB.c rpmdb.c rpmdb.h rpmmdb.c rpmrepo.c rpmtxn.c rpmwf.c sqlite.c Log: - rpmdb: add/use RPMIOPOOL_ macros where possible. - rpmdb: rename dbiIndex -> rpmdbi type, dbiFoo() -> rpmdbiFoo(). Summary: Revision Changes Path 1.3501.2.505+2 -0 rpm/CHANGES 1.156.2.29 +44 -44 rpm/rpmdb/db3.c 1.78.4.18 +10 -23 rpm/rpmdb/dbconfig.c 1.91.2.4 +10 -9 rpm/rpmdb/librpmdb.vers 1.19.2.3 +4 -4 rpm/rpmdb/poptDB.c 1.392.2.33 +110 -143 rpm/rpmdb/rpmdb.c 1.141.2.16 +98 -98 rpm/rpmdb/rpmdb.h 1.4.2.4 +2 -21 rpm/rpmdb/rpmmdb.c 1.4.2.6 +1 -18 rpm/rpmdb/rpmrepo.c 1.6.4.5 +0 -1 rpm/rpmdb/rpmtxn.c 1.29.2.4 +3 -16 rpm/rpmdb/rpmwf.c 1.44.4.20 +76 -93 rpm/rpmdb/sqlite.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.3501.2.504 -r1.3501.2.505 CHANGES --- rpm/CHANGES 27 Jun 2016 03:05:57 -0000 1.3501.2.504 +++ rpm/CHANGES 27 Jun 2016 03:08:20 -0000 1.3501.2.505 @@ -1,4 +1,6 @@ 5.4.17 -> 5.4.18: + - jbj: rpmdb: add/use RPMIOPOOL_ macros where possible. + - jbj: rpmdb: rename dbiIndex -> rpmdbi type, dbiFoo() -> rpmdbiFoo(). - jbj: rpmio: add/use RPMIOPOOL_ macros where possible. - jbj: rpmio: install <poptIO.h> and its prereqs. - jbj: build: sanitize public includes (with iwyu). @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/db3.c ============================================================================ $ cvs diff -u -r1.156.2.28 -r1.156.2.29 db3.c --- rpm/rpmdb/db3.c 10 May 2016 17:05:14 -0000 1.156.2.28 +++ rpm/rpmdb/db3.c 27 Jun 2016 03:08:20 -0000 1.156.2.29 @@ -39,8 +39,8 @@ #define DBIDEBUG(_dbi, _list) if ((_dbi)->dbi_debug) fprintf _list /*@access rpmdb @*/ -/*@access dbiIndex @*/ -/*@access dbiIndexSet @*/ +/*@access rpmdbi @*/ +/*@access rpmdbiIndexSet @*/ /*@-redef@*/ union _dbswap { @@ -560,7 +560,7 @@ #define _KEYDATA(_K, _P, _D, _R) fmtKDR(_K, _P, _D, _R) /*@-globuse -mustmod @*/ /* FIX: rpmError not annotated yet. */ -static int Xcvtdberr(/*@unused@*/ dbiIndex dbi, const char * msg, +static int Xcvtdberr(/*@unused@*/ rpmdbi dbi, const char * msg, int error, int printit, const char * func, const char * fn, unsigned ln) /*@globals fileSystem @*/ @@ -588,7 +588,7 @@ * @return tag string */ /*@observer@*/ -static const char * mapTagName(rpmdb rpmdb, dbiIndex dbi) +static const char * mapTagName(rpmdb rpmdb, rpmdbi dbi) /*@*/ { tagStore_t dbiTags = rpmdb->db_tags; @@ -605,7 +605,7 @@ return tagName(dbi->dbi_rpmtag); } -static int db_fini(dbiIndex dbi, const char * dbhome, +static int db_fini(rpmdbi dbi, const char * dbhome, /*@null@*/ const char * dbfile, /*@unused@*/ /*@null@*/ const char * dbsubfile) /*@globals fileSystem @*/ @@ -947,7 +947,7 @@ } /*@-moduncon@*/ /* FIX: annotate db3 methods */ -static int db_init(dbiIndex dbi, const char * dbhome, +static int db_init(rpmdbi dbi, const char * dbhome, /*@null@*/ const char * dbfile, /*@unused@*/ /*@null@*/ const char * dbsubfile, /*@out@*/ DB_ENV ** dbenvp) @@ -1246,7 +1246,7 @@ #ifdef NOTYET /*@-mustmod@*/ -static int db3remove(dbiIndex dbi, /*@null@*/ const char * dbfile, +static int db3remove(rpmdbi dbi, /*@null@*/ const char * dbfile, /*@unused@*/ /*@null@*/ const char * dbsubfile, unsigned int flags) /*@globals fileSystem @*/ @@ -1266,7 +1266,7 @@ /*@=mustmod@*/ /*@-mustmod@*/ -static int db3rename(dbiIndex dbi, /*@null@*/ const char * dbfile, +static int db3rename(rpmdbi dbi, /*@null@*/ const char * dbfile, /*@unused@*/ /*@null@*/ const char * dbsubfile, /*@unused@*/ /*@null@*/ const char * newname, unsigned int flags) @@ -1287,12 +1287,12 @@ /*@=mustmod@*/ /*@-mustmod@*/ -static int db3truncate(dbiIndex dbi, unsigned int * countp, unsigned int flags) +static int db3truncate(rpmdbi dbi, unsigned int * countp, unsigned int flags) /*@globals fileSystem @*/ /*@modifies *countp, fileSystem @*/ { DB * db = (DB *) dbi->dbi_db; - DB_TXN * _txnid = dbiTxnid(dbi); + DB_TXN * _txnid = rpmdbiTxnid(dbi); int rc; assert(db != NULL); @@ -1306,7 +1306,7 @@ /*@=mustmod@*/ /*@-mustmod@*/ -static int db3upgrade(dbiIndex dbi, /*@null@*/ const char * dbfile, +static int db3upgrade(rpmdbi dbi, /*@null@*/ const char * dbfile, unsigned int flags) /*@globals fileSystem @*/ /*@modifies fileSystem @*/ @@ -1325,7 +1325,7 @@ /*@=mustmod@*/ #endif /* NOTYET */ -static int db3sync(dbiIndex dbi, unsigned int flags) +static int db3sync(rpmdbi dbi, unsigned int flags) /*@globals fileSystem @*/ /*@modifies fileSystem @*/ { @@ -1344,12 +1344,12 @@ } /*@-mustmod@*/ -static int db3exists(dbiIndex dbi, DBT * key, unsigned int flags) +static int db3exists(rpmdbi dbi, DBT * key, unsigned int flags) /*@globals fileSystem @*/ /*@modifies fileSystem @*/ { DB * db = (DB *) dbi->dbi_db; - DB_TXN * _txnid = dbiTxnid(dbi); + DB_TXN * _txnid = rpmdbiTxnid(dbi); int _printit; int rc; @@ -1366,12 +1366,12 @@ /*@=mustmod@*/ /*@-mustmod@*/ -static int db3seqno(dbiIndex dbi, int64_t * seqnop, unsigned int flags) +static int db3seqno(rpmdbi dbi, int64_t * seqnop, unsigned int flags) /*@globals fileSystem @*/ /*@modifies *seqnop, fileSystem @*/ { DB * db = (DB *) dbi->dbi_db; - DB_TXN * _txnid = dbiTxnid(dbi); + DB_TXN * _txnid = rpmdbiTxnid(dbi); DB_SEQUENCE * seq = (DB_SEQUENCE *) dbi->dbi_seq; int32_t _delta = 1; db_seq_t seqno = 0; @@ -1397,7 +1397,7 @@ } /*@=mustmod@*/ -static int db3cdup(dbiIndex dbi, DBC * dbcursor, DBC ** dbcp, +static int db3cdup(rpmdbi dbi, DBC * dbcursor, DBC ** dbcp, unsigned int flags) /*@globals fileSystem @*/ /*@modifies *dbcp, fileSystem @*/ @@ -1419,7 +1419,7 @@ } /*@-mustmod@*/ -static int db3cclose(dbiIndex dbi, /*@only@*/ /*@null@*/ DBC * dbcursor, +static int db3cclose(rpmdbi dbi, /*@only@*/ /*@null@*/ DBC * dbcursor, /*@unused@*/ unsigned int flags) /*@globals fileSystem @*/ /*@modifies dbi, fileSystem @*/ @@ -1443,7 +1443,7 @@ } /*@=mustmod@*/ -static int db3copen(dbiIndex dbi, DB_TXN * txnid, +static int db3copen(rpmdbi dbi, DB_TXN * txnid, /*@null@*/ /*@out@*/ DBC ** dbcp, unsigned int dbiflags) /*@globals fileSystem @*/ /*@modifies dbi, *dbcp, fileSystem @*/ @@ -1478,13 +1478,13 @@ return rc; } -static int db3cput(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, +static int db3cput(rpmdbi dbi, DBC * dbcursor, DBT * key, DBT * data, /*@unused@*/ unsigned int flags) /*@globals fileSystem @*/ /*@modifies fileSystem @*/ { DB * db = (DB *) dbi->dbi_db; - DB_TXN * _txnid = dbiTxnid(dbi); + DB_TXN * _txnid = rpmdbiTxnid(dbi); int rc; assert(db != NULL); @@ -1508,13 +1508,13 @@ } /*@-mustmod@*/ -static int db3cget(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, +static int db3cget(rpmdbi dbi, DBC * dbcursor, DBT * key, DBT * data, unsigned int flags) /*@globals fileSystem @*/ /*@modifies *dbcursor, *key, *data, fileSystem @*/ { DB * db = (DB *) dbi->dbi_db; - DB_TXN * _txnid = dbiTxnid(dbi); + DB_TXN * _txnid = rpmdbiTxnid(dbi); int _printit; int rc; @@ -1549,13 +1549,13 @@ /*@=mustmod@*/ /*@-mustmod@*/ -static int db3cpget(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * pkey, +static int db3cpget(rpmdbi dbi, DBC * dbcursor, DBT * key, DBT * pkey, DBT * data, unsigned int flags) /*@globals fileSystem @*/ /*@modifies *dbcursor, *key, *data, fileSystem @*/ { DB * db = (DB *) dbi->dbi_db; - DB_TXN * _txnid = dbiTxnid(dbi); + DB_TXN * _txnid = rpmdbiTxnid(dbi); int _printit; int rc; @@ -1588,13 +1588,13 @@ /*@=mustmod@*/ /*@-mustmod@*/ -static int db3cdel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, +static int db3cdel(rpmdbi dbi, DBC * dbcursor, DBT * key, DBT * data, unsigned int flags) /*@globals fileSystem @*/ /*@modifies *dbcursor, fileSystem @*/ { DB * db = (DB *) dbi->dbi_db; - DB_TXN * _txnid = dbiTxnid(dbi); + DB_TXN * _txnid = rpmdbiTxnid(dbi); int rc; assert(db != NULL); @@ -1622,7 +1622,7 @@ } /*@=mustmod@*/ -static int db3ccount(dbiIndex dbi, DBC * dbcursor, +static int db3ccount(rpmdbi dbi, DBC * dbcursor, /*@null@*/ /*@out@*/ unsigned int * countp, /*@unused@*/ unsigned int flags) /*@globals fileSystem @*/ @@ -1646,7 +1646,7 @@ return rc; } -static int db3byteswapped(dbiIndex dbi) /*@*/ +static int db3byteswapped(rpmdbi dbi) /*@*/ { DB * db = (DB *) dbi->dbi_db; int rc = 0; @@ -1661,13 +1661,13 @@ return rc; } -static int db3stat(dbiIndex dbi, unsigned int flags) +static int db3stat(rpmdbi dbi, unsigned int flags) /*@globals fileSystem @*/ /*@modifies dbi, fileSystem @*/ { DB * db = (DB *) dbi->dbi_db; #if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3) || (DB_VERSION_MAJOR >= 5) - DB_TXN * _txnid = dbiTxnid(dbi); + DB_TXN * _txnid = rpmdbiTxnid(dbi); #endif int rc = 0; @@ -1693,7 +1693,7 @@ } /*@-mustmod@*/ -static int db3associate(dbiIndex dbi, dbiIndex dbisecondary, +static int db3associate(rpmdbi dbi, rpmdbi dbisecondary, int (*callback)(DB *, const DBT *, const DBT *, DBT *), unsigned int flags) /*@globals fileSystem @*/ @@ -1701,7 +1701,7 @@ { DB * db = (DB *) dbi->dbi_db; DB * secondary = (DB *) dbisecondary->dbi_db; - DB_TXN * _txnid = dbiTxnid(dbi); + DB_TXN * _txnid = rpmdbiTxnid(dbi); int rc; assert(db != NULL); @@ -1722,7 +1722,7 @@ /*@=mustmod@*/ /*@-mustmod@*/ -static int db3associate_foreign(dbiIndex dbi, dbiIndex dbisecondary, +static int db3associate_foreign(rpmdbi dbi, rpmdbi dbisecondary, int (*callback)(DB *, const DBT *, DBT *, const DBT *, int *), unsigned int flags) /*@globals fileSystem @*/ @@ -1753,7 +1753,7 @@ /*@=mustmod@*/ /*@-mustmod@*/ -static int db3join(dbiIndex dbi, DBC ** curslist, DBC ** dbcp, +static int db3join(rpmdbi dbi, DBC ** curslist, DBC ** dbcp, unsigned int flags) /*@globals fileSystem @*/ /*@modifies dbi, fileSystem @*/ @@ -1772,7 +1772,7 @@ /*@=mustmod@*/ /*@-moduncon@*/ /* FIX: annotate db3 methods */ -static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags) +static int db3close(/*@only@*/ rpmdbi dbi, /*@unused@*/ unsigned int flags) /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ /*@modifies dbi, fileSystem, internalState @*/ @@ -1956,7 +1956,7 @@ #ifdef NOTYET HE_t FMhe = (HE_t) memset(alloca(sizeof(*FMhe)), 0, sizeof(*FMhe)); #endif - dbiIndex dbi = db->app_private; + rpmdbi dbi = db->app_private; rpmdb rpmdb = NULL; Header h = NULL; uint32_t hdrNum; @@ -2195,7 +2195,7 @@ exit: if (!dbi->dbi_no_dbsync && rc != DB_DONOTINDEX) - xx = dbiSync(dbi, 0); + xx = rpmdbiSync(dbi, 0); #ifdef NOTYET FMhe->p.ptr = _free(FMhe->p.ptr); #endif @@ -2208,13 +2208,13 @@ return rc; } -static int seqid_init(dbiIndex dbi, const char * keyp, size_t keylen, +static int seqid_init(rpmdbi dbi, const char * keyp, size_t keylen, DB_SEQUENCE ** seqp) /*@modifies *seqp @*/ { DB * db = (DB *) dbi->dbi_db; DBT k = {0}; - DB_TXN * _txnid = dbiTxnid(dbi); + DB_TXN * _txnid = rpmdbiTxnid(dbi); DB_SEQUENCE * seq = NULL; db_seq_t _rangemin = -922337203685477600LL; db_seq_t _rangemax = 922337203685477600LL; @@ -2288,7 +2288,7 @@ * @retval *dbip index database handle * @return 0 on success */ -static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip) +static int db3open(rpmdb rpmdb, rpmTag rpmtag, rpmdbi * dbip) /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ /*@modifies *dbip, fileSystem, internalState @*/ @@ -2303,7 +2303,7 @@ const char * dbfile; const char * dbsubfile; const char * dbiBN; - dbiIndex dbi = NULL; + rpmdbi dbi = NULL; int rc = 0; int xx; @@ -2849,7 +2849,7 @@ *dbip = dbi; if (dbi->dbi_primary) { rpmTag Ptag = tagValue(dbi->dbi_primary); - dbiIndex Pdbi = NULL; + rpmdbi Pdbi = NULL; int (*_callback)(DB *, const DBT *, const DBT *, DBT *) = db3Acallback; #ifndef NOTYET /* XXX KISS for now */ @@ -2858,7 +2858,7 @@ int _flags = 0; #endif assert(Ptag == RPMDBI_PACKAGES && Ptag != rpmtag); - Pdbi = dbiOpen(rpmdb, Ptag, 0); + Pdbi = rpmdbiOpen(rpmdb, Ptag, 0); assert(Pdbi != NULL); if (oflags & (DB_CREATE|DB_TRUNCATE)) _flags |= DB_CREATE; xx = db3associate(Pdbi, dbi, _callback, _flags); @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/dbconfig.c ============================================================================ $ cvs diff -u -r1.78.4.17 -r1.78.4.18 dbconfig.c --- rpm/rpmdb/dbconfig.c 19 Apr 2016 13:13:52 -0000 1.78.4.17 +++ rpm/rpmdb/dbconfig.c 27 Jun 2016 03:08:21 -0000 1.78.4.18 @@ -15,17 +15,17 @@ #include "debug.h" /*@access rpmdb@*/ -/*@access dbiIndex@*/ -/*@access dbiIndexSet@*/ +/*@access rpmdbi@*/ +/*@access rpmdbiIndexSet@*/ /*@unchecked@*/ -int _dbi_debug; +int _rpmdbi_debug; #if defined(WITH_DB) || defined(WITH_SQLITE) /*@-exportlocal -exportheadervar@*/ /*@unchecked@*/ -struct _dbiIndex db3dbi; +struct rpmdbi_s db3dbi; /*@=exportlocal =exportheadervar@*/ /*@-compmempass -immediatetrans -exportlocal -exportheadervar -type@*/ @@ -452,10 +452,10 @@ }; /*@=compmempass =immediatetrans =exportlocal =exportheadervar =type@*/ -static void dbiFini(void * _dbi) +static void rpmdbiFini(void * _dbi) /*@*/ { - dbiIndex dbi = (dbiIndex) _dbi; + rpmdbi dbi = (rpmdbi) _dbi; if (dbi) { dbi->dbi_root = _free(dbi->dbi_root); dbi->dbi_home = _free(dbi->dbi_home); @@ -473,26 +473,13 @@ } } -/*@unchecked@*/ /*@only@*/ /*@null@*/ -rpmioPool _dbiPool; - -static dbiIndex dbiGetPool(rpmioPool pool) -{ - dbiIndex dbi; - - if (_dbiPool == NULL) { - _dbiPool = rpmioNewPool("dbi", sizeof(*dbi), -1, _dbi_debug, - NULL, NULL, dbiFini); - pool = _dbiPool; - } - return (dbiIndex) rpmioGetPool(pool, sizeof(*dbi)); -} +RPMIOPOOL_MODULE(dbi) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wswitch" -dbiIndex db3New(rpmdb rpmdb, rpmTag tag) +rpmdbi db3New(rpmdb rpmdb, rpmTag tag) { - dbiIndex dbi = dbiGetPool(_dbiPool); + rpmdbi dbi = rpmdbiGetPool(_rpmdbiPool); char * dbOpts = rpmExpand("%{?_dbi_config_", tagName(tag), "}", NULL); char *o, *oe; char *p, *pe; @@ -668,7 +655,7 @@ #endif /*@-globstate@*/ /* FIX: *(rdbOptions->arg) reachable */ - return (dbiIndex)rpmioLinkPoolItem((rpmioItem)dbi, __FUNCTION__, __FILE__, __LINE__); + return (rpmdbi)rpmioLinkPoolItem((rpmioItem)dbi, __FUNCTION__, __FILE__, __LINE__); /*@=globstate@*/ } #pragma GCC diagnostic pop @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/librpmdb.vers ============================================================================ $ cvs diff -u -r1.91.2.3 -r1.91.2.4 librpmdb.vers --- rpm/rpmdb/librpmdb.vers 5 Sep 2014 19:21:21 -0000 1.91.2.3 +++ rpm/rpmdb/librpmdb.vers 27 Jun 2016 03:08:21 -0000 1.91.2.4 @@ -1,17 +1,17 @@ LIBRPMDB_0 { global: - _dbi_debug; - _dbiPool; + _rpmdbi_debug; + _rpmdbiPool; db3dbi; db3New; db3vec; - dbiFreeIndexSet; - dbiIndexRecordFileNumber; - dbiIndexRecordOffset; - dbiIndexSetCount; - dbiOpen; - dbiStatsAccumulator; + rpmdbiFreeIndexSet; + rpmdbiIndexRecordFileNumber; + rpmdbiIndexRecordOffset; + rpmdbiIndexSetCount; + rpmdbiOpen; + rpmdbiStatsAccumulator; dodigest; dpkgEVRcmp; dpkgEVRcompare; @@ -272,7 +272,8 @@ rpmwfNextXAR; rpmwfPullXAR; rpmVerifySignature; - _scpPool; + _rpmscp_debug; + _rpmscpPool; sqlitevec; tagCanonicalize; tagClean; @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/poptDB.c ============================================================================ $ cvs diff -u -r1.19.2.2 -r1.19.2.3 poptDB.c --- rpm/rpmdb/poptDB.c 5 May 2012 13:18:14 -0000 1.19.2.2 +++ rpm/rpmdb/poptDB.c 27 Jun 2016 03:08:21 -0000 1.19.2.3 @@ -21,9 +21,9 @@ /*@-redecl@*/ /*@unchecked@*/ -extern int _dbi_debug; +extern int _rpmdbi_debug; /*@unchecked@*/ -extern int _scp_debug; +extern int _rpmscp_debug; /*@unchecked@*/ extern int _sqldb_debug; /*@=redecl@*/ @@ -41,7 +41,7 @@ { "rpmdbdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmdb_debug, -1, N_("Debug rpmdb DataBase"), NULL}, - { "rpmdbidebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_dbi_debug, -1, + { "rpmdbidebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmdbi_debug, -1, N_("Debug dbiIndex DataBase Index"), NULL}, { "rpmliodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmlio_debug, -1, N_("Debug rpmlio database Log I/O"), NULL}, @@ -52,7 +52,7 @@ { "rpmtxndebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmtxn_debug, -1, N_("Debug rpmtxn database Transaction"), NULL}, #if defined(HAVE_SQLITE3_H) /* XXX test --with-sqlite=external */ - { "scpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_scp_debug, -1, + { "scpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmscp_debug, -1, N_("Debug SQLDB cursors"), NULL}, { "sqldbdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_sqldb_debug, -1, N_("Debug SQLDB"), NULL}, @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmdb.c ============================================================================ $ cvs diff -u -r1.392.2.32 -r1.392.2.33 rpmdb.c --- rpm/rpmdb/rpmdb.c 11 May 2016 18:51:27 -0000 1.392.2.32 +++ rpm/rpmdb/rpmdb.c 27 Jun 2016 03:08:21 -0000 1.392.2.33 @@ -44,17 +44,17 @@ typedef rpmuint32_t u_int32_t; #endif -/*@access dbiIndexSet@*/ -/*@access dbiIndexItem@*/ +/*@access rpmdbiIndexSet@*/ +/*@access rpmdbiIndexItem@*/ /*@access miRE@*/ /*@access Header@*/ /* XXX compared with NULL */ /*@access rpmmi@*/ /*@access rpmts@*/ /* XXX compared with NULL */ #ifdef __cplusplus -GENfree(dbiIndex *) -GENfree(dbiIndexSet) -GENfree(dbiIndexItem) +GENfree(rpmdbi *) +GENfree(rpmdbiIndexSet) +GENfree(rpmdbiIndexItem) #endif /* __cplusplus */ /*@unchecked@*/ @@ -221,11 +221,11 @@ return ret; } -dbiIndex dbiOpen(rpmdb db, rpmTag tag, /*@unused@*/ unsigned int flags) +rpmdbi rpmdbiOpen(rpmdb db, rpmTag tag, /*@unused@*/ unsigned int flags) { static int _oneshot = 0; size_t dbix; - dbiIndex dbi = NULL; + rpmdbi dbi = NULL; int _dbapi; int rc = 0; @@ -281,7 +281,7 @@ /*@-modfilesys@*/ if (_rpmdb_debug) -fprintf(stderr, "<== dbiOpen(%p, %s(%u), 0x%x) dbi %p = %p[%u:%u]\n", db, tagName(tag), (unsigned)tag, flags, dbi, db->_dbi, (unsigned)dbix, (unsigned)db->db_ndbi); +fprintf(stderr, "<== rpmdbiOpen(%p, %s(%u), 0x%x) dbi %p = %p[%u:%u]\n", db, tagName(tag), (unsigned)tag, flags, dbi, db->_dbi, (unsigned)dbix, (unsigned)db->db_ndbi); /*@=modfilesys@*/ /*@-compdef -nullstate@*/ /* FIX: db->_dbi may be NULL */ @@ -362,7 +362,7 @@ uint32_t fp; } * setSwap; -/* XXX assumes hdrNum is first int in dbiIndexItem */ +/* XXX assumes hdrNum is first int in rpmdbiIndexItem */ static int hdrNumCmp(const void * one, const void * two) /*@*/ { @@ -380,7 +380,7 @@ * @param sortset should resulting set be sorted? * @return 0 success, 1 failure (bad args) */ -static int dbiAppendSet(dbiIndexSet set, const void * recs, +static int rpmdbiAppendSet(rpmdbiIndexSet set, const void * recs, int nrecs, size_t recsize, int sortset) /*@modifies *set @*/ { @@ -391,7 +391,7 @@ if (set == NULL || recs == NULL || nrecs <= 0 || recsize == 0) return 1; - set->recs = (dbiIndexItem) xrealloc(set->recs, + set->recs = (rpmdbiIndexItem) xrealloc(set->recs, (set->count + nrecs) * sizeof(*(set->recs))); memset(set->recs + set->count, 0, nrecs * sizeof(*(set->recs))); @@ -411,22 +411,22 @@ } /* XXX transaction.c */ -unsigned int dbiIndexSetCount(dbiIndexSet set) { +unsigned int rpmdbiIndexSetCount(rpmdbiIndexSet set) { return set->count; } /* XXX transaction.c */ -uint32_t dbiIndexRecordOffset(dbiIndexSet set, unsigned int recno) { +uint32_t rpmdbiIndexRecordOffset(rpmdbiIndexSet set, unsigned int recno) { return set->recs[recno].hdrNum; } /* XXX transaction.c */ -uint32_t dbiIndexRecordFileNumber(dbiIndexSet set, unsigned int recno) { +uint32_t rpmdbiIndexRecordFileNumber(rpmdbiIndexSet set, unsigned int recno) { return set->recs[recno].tagNum; } /* XXX transaction.c */ -dbiIndexSet dbiFreeIndexSet(dbiIndexSet set) { +rpmdbiIndexSet rpmdbiFreeIndexSet(rpmdbiIndexSet set) { if (set) { set->recs = _free(set->recs); set = _free(set); @@ -441,7 +441,7 @@ /*@refcounted@*/ rpmdb mi_db; rpmTag mi_rpmtag; - dbiIndexSet mi_set; + rpmdbiIndexSet mi_set; DBC * mi_dbc; unsigned int mi_count; uint32_t mi_setx; @@ -774,24 +774,8 @@ return rc; } -/*@unchecked@*/ /*@only@*/ /*@null@*/ -rpmioPool _rpmdbPool; - -static rpmdb rpmdbGetPool(/*@null@*/ rpmioPool pool) - /*@globals _rpmdbPool, fileSystem @*/ - /*@modifies pool, _rpmdbPool, fileSystem @*/ -{ - rpmdb db; - - if (_rpmdbPool == NULL) { - _rpmdbPool = rpmioNewPool("db", sizeof(*db), -1, _rpmdb_debug, - NULL, NULL, NULL); - pool = _rpmdbPool; - } - db = (rpmdb) rpmioGetPool(pool, sizeof(*db)); - memset(((char *)db)+sizeof(db->_item), 0, sizeof(*db)-sizeof(db->_item)); - return db; -} +#define rpmdbFini NULL /* XXX rpmdb deallocation is srewy */ +RPMIOPOOL_MODULE(db) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wswitch" @@ -823,7 +807,7 @@ default: /*@switchbreak@*/ break; } - (void) dbiOpen(db, db->db_tags[dbix].tag, db->db_flags); + (void) rpmdbiOpen(db, db->db_tags[dbix].tag, db->db_flags); } } return rc; @@ -863,7 +847,7 @@ if (db->_dbi[dbix] != NULL) { int xx; /*@-unqualifiedtrans@*/ /* FIX: double indirection. */ - xx = dbiClose(db->_dbi[dbix], 0); + xx = rpmdbiClose(db->_dbi[dbix], 0); if (xx && rc == 0) rc = xx; db->_dbi[dbix] = NULL; /*@=unqualifiedtrans@*/ @@ -902,7 +886,7 @@ if (db->_dbi[dbix] == NULL) continue; /*@-unqualifiedtrans@*/ /* FIX: double indirection. */ - xx = dbiClose(db->_dbi[dbix], 0); + xx = rpmdbiClose(db->_dbi[dbix], 0); if (xx && rc == 0) rc = xx; db->_dbi[dbix] = NULL; /*@=unqualifiedtrans@*/ @@ -1074,7 +1058,7 @@ db->db_mpf = NULL; dbiTagsInit(&db->db_tags, &db->db_ndbi); - db->_dbi = (dbiIndex *) xcalloc(db->db_ndbi, sizeof(*db->_dbi)); + db->_dbi = (rpmdbi *) xcalloc(db->db_ndbi, sizeof(*db->_dbi)); memset(&db->db_getops, 0, sizeof(db->db_getops)); memset(&db->db_putops, 0, sizeof(db->db_putops)); @@ -1139,7 +1123,7 @@ for (dbix = 0; rc == 0 && dbix < db->db_ndbi; dbix++) { tagStore_t dbiTag = db->db_tags + dbix; rpmTag tag = dbiTag->tag; - dbiIndex dbi; + rpmdbi dbi; /* Filter out temporary databases */ switch (tag) { @@ -1153,7 +1137,7 @@ /*@switchbreak@*/ break; } - dbi = dbiOpen(db, tag, 0); + dbi = rpmdbiOpen(db, tag, 0); if (dbi == NULL) { rc = -2; break; @@ -1210,14 +1194,14 @@ DBC * dbcursor = NULL; DBT k = DBT_INIT; DBT v = DBT_INIT; - dbiIndex dbi; + rpmdbi dbi; int rc; int xx; if (db == NULL || keyp == NULL) return 0; - dbi = dbiOpen(db, tag, 0); + dbi = rpmdbiOpen(db, tag, 0); if (dbi == NULL) return 0; @@ -1229,11 +1213,11 @@ /*@=temptrans@*/ k.size = (UINT32_T) keylen; - xx = dbiCopen(dbi, dbiTxnid(dbi), &dbcursor, 0); - rc = dbiGet(dbi, dbcursor, &k, &v, DB_SET); + xx = rpmdbiCopen(dbi, rpmdbiTxnid(dbi), &dbcursor, 0); + rc = rpmdbiGet(dbi, dbcursor, &k, &v, DB_SET); switch (rc) { case 0: - rc = dbiCount(dbi, dbcursor, &count, 0); + rc = rpmdbiCount(dbi, dbcursor, &count, 0); if (rc != 0) rc = -1; else @@ -1248,7 +1232,7 @@ rc = -1; break; } - xx = dbiCclose(dbi, dbcursor, 0); + xx = rpmdbiCclose(dbi, dbcursor, 0); dbcursor = NULL; return rc; } @@ -1325,7 +1309,7 @@ /** * Retrieve prinary/secondary keys for a pattern match. - * @todo Move to Berkeley DB db3.c when dbiIndexSet is eliminated. + * @todo Move to Berkeley DB db3.c when rpmdbiIndexSet is eliminated. * @param db rpm database * @param tag rpm tag * @param mode type of pattern match @@ -1333,9 +1317,9 @@ * @retval *matches array or primary keys that match (or NULL) * @retval *argvp array of secondary keys that match (or NULL) */ -static int dbiMireKeys(rpmdb db, rpmTag tag, rpmMireMode mode, +static int rpmdbiMireKeys(rpmdb db, rpmTag tag, rpmMireMode mode, /*@null@*/ const char * pat, - /*@null@*/ dbiIndexSet * matches, + /*@null@*/ rpmdbiIndexSet * matches, /*@null@*/ const char *** argvp) /*@globals internalState @*/ /*@modifies *matches, *argvp, internalState @*/ @@ -1344,18 +1328,18 @@ DBT k = DBT_INIT; DBT p = DBT_INIT; DBT v = DBT_INIT; - dbiIndex dbi; + rpmdbi dbi; miRE mire = NULL; uint32_t _flags = DB_NEXT; ARGV_t av = NULL; - dbiIndexSet set = NULL; + rpmdbiIndexSet set = NULL; const char * b = NULL; size_t nb = 0; int ret = 1; /* assume error */ int rc; int xx; - dbi = dbiOpen(db, tag, 0); + dbi = rpmdbiOpen(db, tag, 0); if (dbi == NULL) goto exit; @@ -1415,10 +1399,10 @@ doit: v.flags |= DB_DBT_PARTIAL; - xx = dbiCopen(dbi, dbiTxnid(dbi), &dbcursor, 0); + xx = rpmdbiCopen(dbi, rpmdbiTxnid(dbi), &dbcursor, 0); /* Iterate over matches, collecting primary/secondary keys. */ - while ((rc = dbiPget(dbi, dbcursor, &k, &p, &v, _flags)) == 0) { + while ((rc = rpmdbiPget(dbi, dbcursor, &k, &p, &v, _flags)) == 0) { uint32_t hdrNum; const char * s; size_t ns; @@ -1433,7 +1417,7 @@ /* Retrieve the full record after DB_SET_RANGE. */ if (_flags == DB_SET_RANGE) { memset (&k, 0, sizeof(k)); - xx = dbiPget(dbi, dbcursor, &k, &p, &v, DB_CURRENT); + xx = rpmdbiPget(dbi, dbcursor, &k, &p, &v, DB_CURRENT); _flags = DB_NEXT; } } @@ -1453,9 +1437,9 @@ /* Collect primary keys. */ if (matches) { if (set == NULL) - set = (dbiIndexSet) xcalloc(1, sizeof(*set)); + set = (rpmdbiIndexSet) xcalloc(1, sizeof(*set)); /* XXX TODO: sort/uniqify set? */ - (void) dbiAppendSet(set, &hdrNum, 1, sizeof(hdrNum), 0); + (void) rpmdbiAppendSet(set, &hdrNum, 1, sizeof(hdrNum), 0); } /* Collect secondary keys. */ @@ -1467,7 +1451,7 @@ } } - xx = dbiCclose(dbi, dbcursor, 0); + xx = rpmdbiCclose(dbi, dbcursor, 0); dbcursor = NULL; switch (rc) { @@ -1491,7 +1475,7 @@ if (argvp) xx = argvAppend(argvp, av); } - set = dbiFreeIndexSet(set); + set = rpmdbiFreeIndexSet(set); av = argvFree(av); b = _free(b); mire = mireFree(mire); @@ -1503,7 +1487,7 @@ int rpmdbMireApply(rpmdb db, rpmTag tag, rpmMireMode mode, const char * pat, const char *** argvp) { - int rc = dbiMireKeys(db, tag, mode, pat, NULL, argvp); + int rc = rpmdbiMireKeys(db, tag, mode, pat, NULL, argvp); if (_rpmmi_debug) fprintf(stderr, "<-- %s(%p, %s(%u), %d, \"%s\", %p) rc %d\n", __FUNCTION__, db, tagName(tag), (unsigned)tag, mode, pat, argvp, rc); return rc; @@ -1513,7 +1497,7 @@ { rpmTag _tag = RPMTAG_BASENAMES; rpmMireMode _mode = RPMMIRE_STRCMP; - dbiIndexSet set = NULL; + rpmdbiIndexSet set = NULL; unsigned int i; int rc = 1; /* assume error */ @@ -1524,22 +1508,22 @@ assert(mi->mi_rpmtag == _tag); #endif /* Retrieve set of headers that contain the base name. */ - rc = dbiMireKeys(mi->mi_db, _tag, _mode, bn, &set, NULL); + rc = rpmdbiMireKeys(mi->mi_db, _tag, _mode, bn, &set, NULL); if (rc == 0 && set != NULL) { rpmuint32_t tagNum = hashFunctionString(0, bn, 0); /* Set tagNum to the hash of the basename. */ for (i = 0; i < set->count; i++) set->recs[i].tagNum = tagNum; if (mi->mi_set == NULL) - mi->mi_set = (dbiIndexSet) xcalloc(1, sizeof(*mi->mi_set)); - (void) dbiAppendSet(mi->mi_set, set->recs, set->count, sizeof(*set->recs), 0); + mi->mi_set = (rpmdbiIndexSet) xcalloc(1, sizeof(*mi->mi_set)); + (void) rpmdbiAppendSet(mi->mi_set, set->recs, set->count, sizeof(*set->recs), 0); } rc = 0; exit: if (_rpmmi_debug) fprintf(stderr, "<-- %s(%p, \"%s\")\trc %d set %p %p[%u]\n", __FUNCTION__, mi, bn, rc, set, (set ? set->recs : NULL), (unsigned)(set ? set->count : 0)); - set = dbiFreeIndexSet(set); + set = rpmdbiFreeIndexSet(set); return rc; } @@ -1550,8 +1534,8 @@ * @retval matches set of header instances that match * @return RPMRC_OK on match, RPMRC_NOMATCH or RPMRC_FAIL */ -static rpmRC dbiFindMatches(dbiIndex dbi, - const char * pat, /*@out@*/ dbiIndexSet * matches) +static rpmRC dbiFindMatches(rpmdbi dbi, + const char * pat, /*@out@*/ rpmdbiIndexSet * matches) /*@*/ { const char * s = pat; @@ -1563,7 +1547,7 @@ if (ns == 0) goto exit; - xx = dbiCopen(dbi, dbiTxnid(dbi), &dbcursor, 0); + xx = rpmdbiCopen(dbi, rpmdbiTxnid(dbi), &dbcursor, 0); /* Add ^...$ *RE anchors. Escape pattern characters. */ { rpmTag tag = dbi->dbi_rpmtag; @@ -1596,7 +1580,7 @@ break; } - ret = dbiMireKeys(dbi->dbi_rpmdb, tag, mode, _pat, matches, NULL); + ret = rpmdbiMireKeys(dbi->dbi_rpmdb, tag, mode, _pat, matches, NULL); _pat = _free(_pat); } @@ -1610,18 +1594,18 @@ break; } - xx = dbiCclose(dbi, dbcursor, 0); + xx = rpmdbiCclose(dbi, dbcursor, 0); dbcursor = NULL; exit: /*@-unqualifiedtrans@*/ /* FIX: double indirection */ if (rc != RPMRC_OK && matches && *matches) - *matches = dbiFreeIndexSet(*matches); + *matches = rpmdbiFreeIndexSet(*matches); /*@=unqualifiedtrans@*/ return rc; } -void * dbiStatsAccumulator(dbiIndex dbi, int opx) +void * rpmdbiStatsAccumulator(rpmdbi dbi, int opx) { void * sw = NULL; switch (opx) { @@ -1647,7 +1631,7 @@ * @param dbi index database handle * @return 0 on success */ -static int miFreeHeader(rpmmi mi, dbiIndex dbi) +static int miFreeHeader(rpmmi mi, rpmdbi dbi) /*@globals fileSystem, internalState @*/ /*@modifies mi, dbi, fileSystem, internalState @*/ { @@ -1671,14 +1655,14 @@ if (v.data != NULL) { sigset_t signalMask; (void) blockSignals(dbi->dbi_rpmdb, &signalMask); - rc = dbiPut(dbi, mi->mi_dbc, &k, &v, DB_KEYLAST); + rc = rpmdbiPut(dbi, mi->mi_dbc, &k, &v, DB_KEYLAST); if (rc) { rpmlog(RPMLOG_ERR, _("error(%d) storing record h#%u into %s\n"), rc, (unsigned)_ntoh_ui(mi->mi_prevoffset), tagName(dbi->dbi_rpmtag)); } - xx = dbiSync(dbi, 0); + xx = rpmdbiSync(dbi, 0); (void) unblockSignals(dbi->dbi_rpmdb, &signalMask); } v.data = _free(v.data); /* headerUnload */ @@ -1699,7 +1683,7 @@ { rpmmi mi = (rpmmi) _mi; rpmmi * prev, next; - dbiIndex dbi; + rpmdbi dbi; int xx; RPM_GNUC_TM_ATOMIC { @@ -1714,13 +1698,13 @@ /* XXX NOTFOUND exits traverse here w mi->mi_db == NULL. b0rked imho. */ if (mi->mi_db) { - dbi = dbiOpen(mi->mi_db, RPMDBI_PACKAGES, 0); + dbi = rpmdbiOpen(mi->mi_db, RPMDBI_PACKAGES, 0); assert(dbi != NULL); /* XXX sanity */ xx = miFreeHeader(mi, dbi); if (mi->mi_dbc) - xx = dbiCclose(dbi, mi->mi_dbc, 0); + xx = rpmdbiCclose(dbi, mi->mi_dbc, 0); mi->mi_dbc = NULL; /* XXX rpmdbUnlink will not do. * NB: must be called after rpmmiRock cleanup. @@ -1734,7 +1718,7 @@ (void) rpmbfFree(mi->mi_bf); mi->mi_bf = NULL; - mi->mi_set = dbiFreeIndexSet(mi->mi_set); + mi->mi_set = rpmdbiFreeIndexSet(mi->mi_set); mi->mi_keyp = _free(mi->mi_keyp); mi->mi_keylen = 0; @@ -1744,24 +1728,7 @@ (void) rpmdbCheckSignals(); } -/*@unchecked@*/ /*@only@*/ /*@null@*/ -rpmioPool _rpmmiPool; - -static rpmmi rpmmiGetPool(/*@null@*/ rpmioPool pool) - /*@globals _rpmdbPool, fileSystem @*/ - /*@modifies pool, _rpmdbPool, fileSystem @*/ -{ - rpmmi mi; - - if (_rpmmiPool == NULL) { - _rpmmiPool = rpmioNewPool("mi", sizeof(*mi), -1, _rpmmi_debug, - NULL, NULL, rpmmiFini); - pool = _rpmmiPool; - } - mi = (rpmmi) rpmioGetPool(pool, sizeof(*mi)); - memset(((char *)mi)+sizeof(mi->_item), 0, sizeof(*mi)-sizeof(mi->_item)); - return mi; -} +RPMIOPOOL_MODULE(mi) uint32_t rpmmiInstance(rpmmi mi) { @@ -1786,20 +1753,20 @@ /* XXX Secondary db associated with Packages needs cursor record count */ if (mi && mi->mi_primary && (initDbc = (mi->mi_dbc == NULL) || mi->mi_count == 0)) { - dbiIndex dbi = dbiOpen(mi->mi_db, mi->mi_rpmtag, 0); + rpmdbi dbi = rpmdbiOpen(mi->mi_db, mi->mi_rpmtag, 0); DBT k = DBT_INIT; DBT v = DBT_INIT; int xx; if(initDbc) { assert(dbi != NULL); /* XXX dbiCopen doesn't handle dbi == NULL */ - xx = dbiCopen(dbi, dbiTxnid(dbi), &mi->mi_dbc, mi->mi_cflags); + xx = rpmdbiCopen(dbi, rpmdbiTxnid(dbi), &mi->mi_dbc, mi->mi_cflags); } k.data = mi->mi_keyp; k.size = (u_int32_t)mi->mi_keylen; if (k.data && k.size == 0) k.size = (UINT32_T) strlen((char *)k.data); if (k.data && k.size == 0) k.size++; /* XXX "/" fixup. */ - if (!dbiGet(dbi, mi->mi_dbc, &k, &v, DB_SET)) - xx = dbiCount(dbi, mi->mi_dbc, &mi->mi_count, 0); + if (!rpmdbiGet(dbi, mi->mi_dbc, &k, &v, DB_SET)) + xx = rpmdbiCount(dbi, mi->mi_dbc, &mi->mi_count, 0); if(initDbc) mi->mi_dbc = NULL; } @@ -2212,7 +2179,7 @@ /*@unchecked@*/ static int _rpmmi_usermem = 1; -static int rpmmiGet(dbiIndex dbi, DBC * dbcursor, DBT * kp, DBT * pk, DBT * vp, +static int rpmmiGet(rpmdbi dbi, DBC * dbcursor, DBT * kp, DBT * pk, DBT * vp, unsigned int flags) /*@globals internalState @*/ /*@modifies dbi, dbcursor, *kp, *pk, *vp, internalState @*/ @@ -2233,7 +2200,7 @@ memset(vp, 0, sizeof(*vp)); vp->flags |= DB_DBT_USERMEM; - rc = dbiGet(dbi, dbcursor, kp, vp, flags); + rc = rpmdbiGet(dbi, dbcursor, kp, vp, flags); if (rc == DB_BUFFER_SMALL) { size_t uhlen = vp->size; void * uh = mmap(NULL, uhlen, _prot, _flags, _fdno, _off); @@ -2246,9 +2213,9 @@ vp->ulen = (u_int32_t)uhlen; vp->data = uh; if (dbi->dbi_primary && pk) - rc = dbiPget(dbi, dbcursor, kp, pk, vp, flags); + rc = rpmdbiPget(dbi, dbcursor, kp, pk, vp, flags); else - rc = dbiGet(dbi, dbcursor, kp, vp, flags); + rc = rpmdbiGet(dbi, dbcursor, kp, vp, flags); if (rc == 0) { if (mprotect(uh, uhlen, PROT_READ) != 0) fprintf(stderr, "==> mprotect(%p[%u],0x%x) error(%d): %s\n", @@ -2261,7 +2228,7 @@ } } } else - rc = dbiGet(dbi, dbcursor, kp, vp, flags); + rc = rpmdbiGet(dbi, dbcursor, kp, vp, flags); if (_rpmmi_debug || dbi->dbi_debug) fprintf(stderr, "<-- %s(%p(%s),%p,%p,%p,0x%x) rc %d\n", __FUNCTION__, dbi, tagName(dbi->dbi_rpmtag), dbcursor, kp, vp, flags, rc); @@ -2270,7 +2237,7 @@ Header rpmmiNext(rpmmi mi) { - dbiIndex dbi; + rpmdbi dbi; DBT k = DBT_INIT; DBT p = DBT_INIT; DBT v = DBT_INIT; @@ -2288,7 +2255,7 @@ /* Find the tag to open. */ tag = (mi->mi_set == NULL && mi->mi_primary != NULL ? mi->mi_rpmtag : RPMDBI_PACKAGES); - dbi = dbiOpen(mi->mi_db, tag, 0); + dbi = rpmdbiOpen(mi->mi_db, tag, 0); if (dbi == NULL) return NULL; @@ -2307,7 +2274,7 @@ * marked with DB_WRITECURSOR as well. */ if (mi->mi_dbc == NULL) { - xx = dbiCopen(dbi, dbiTxnid(dbi), &mi->mi_dbc, mi->mi_cflags); + xx = rpmdbiCopen(dbi, rpmdbiTxnid(dbi), &mi->mi_dbc, mi->mi_cflags); k.data = mi->mi_keyp; k.size = (u_int32_t)mi->mi_keylen; if (k.data && k.size == 0) k.size = (UINT32_T) strlen((char *)k.data); @@ -2321,8 +2288,8 @@ /* The set of header instances is known in advance. */ if (!(mi->mi_setx < mi->mi_set->count)) return NULL; - mi->mi_offset = _hton_ui(dbiIndexRecordOffset(mi->mi_set, mi->mi_setx)); - mi->mi_bntag = dbiIndexRecordFileNumber(mi->mi_set, mi->mi_setx); + mi->mi_offset = _hton_ui(rpmdbiIndexRecordOffset(mi->mi_set, mi->mi_setx)); + mi->mi_bntag = rpmdbiIndexRecordFileNumber(mi->mi_set, mi->mi_setx); mi->mi_setx++; /* If next header is identical, return it now. */ @@ -2456,7 +2423,7 @@ } mi->mi_sorted = 1; #ifdef NOTNOW - { struct _dbiIndexItem * rec; + { struct _rpmdbiIndexItem * rec; int i; for (i = 0, rec = mi->mi_set->recs; i < mi->mi_set->count; i++, rec++) { fprintf(stderr, "\t%p[%u] = %p: %u %u %u\n", mi->mi_set->recs, @@ -2501,8 +2468,8 @@ if (!rc) { if (mi->mi_set == NULL) - mi->mi_set = (dbiIndexSet) xcalloc(1, sizeof(*mi->mi_set)); - (void) dbiAppendSet(mi->mi_set, hdrNums, nHdrNums, sizeof(*hdrNums), 0); + mi->mi_set = (rpmdbiIndexSet) xcalloc(1, sizeof(*mi->mi_set)); + (void) rpmdbiAppendSet(mi->mi_set, hdrNums, nHdrNums, sizeof(*hdrNums), 0); } if (_rpmmi_debug) @@ -2517,8 +2484,8 @@ { HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he)); rpmmi mi = NULL; - dbiIndexSet set = NULL; - dbiIndex dbi = NULL; + rpmdbiIndexSet set = NULL; + rpmdbi dbi = NULL; int usePatterns = 0; if (db == NULL) @@ -2561,7 +2528,7 @@ break; } - dbi = dbiOpen(db, tag, 0); + dbi = rpmdbiOpen(db, tag, 0); #ifdef NOTYET /* XXX non-configured tag indices force NULL return */ assert(dbi != NULL); /* XXX sanity */ #else @@ -2593,9 +2560,9 @@ assert(keylen == sizeof(hdrNum)); memcpy(&hdrNum, keyp, sizeof(hdrNum)); /* The set has only one element, which is hdrNum. */ - set = (dbiIndexSet) xcalloc(1, sizeof(*set)); + set = (rpmdbiIndexSet) xcalloc(1, sizeof(*set)); set->count = 1; - set->recs = (dbiIndexItem) xcalloc(1, sizeof(set->recs[0])); + set->recs = (rpmdbiIndexItem) xcalloc(1, sizeof(set->recs[0])); set->recs[0].hdrNum = hdrNum; } else if (keyp == NULL) { @@ -2629,7 +2596,7 @@ tmp++; if (i >= 3) { - dbiIndex pdbi; + rpmdbi pdbi; DBC *pdbc; const char *origkeyp = keyp; size_t klen = strlen(keyp)+1; @@ -2642,8 +2609,8 @@ *tmp = '\0'; rc = dbiFindMatches(dbi, keyp, &set); - pdbi = dbiOpen(db, RPMDBI_PACKAGES, 0); - xx = dbiCopen(pdbi, dbiTxnid(pdbi), &pdbc, 0); + pdbi = rpmdbiOpen(db, RPMDBI_PACKAGES, 0); + xx = rpmdbiCopen(pdbi, dbiTxnid(pdbi), &pdbc, 0); for(i = 0; set && i < set->count; i++) { DBT k = DBT_INIT; @@ -2659,7 +2626,7 @@ k.data = &offset; k.size = sizeof(offset); - xx = dbiGet(dbi, pdbc, &k, &v, DB_SET); + xx = rpmdbiGet(dbi, pdbc, &k, &v, DB_SET); h = headerLoad(v.data); tmp = (char*)((size_t)keyp + strlen(keyp) + 1); @@ -2690,13 +2657,13 @@ set->recs = xrealloc(set->recs, size * sizeof(*set->recs)); } - xx = dbiCclose(pdbi, pdbc, 0); + xx = rpmdbiCclose(pdbi, pdbc, 0); } } #endif if ((rc && rc != RPMRC_NOTFOUND) || set == NULL || set->count < 1) { /* error or empty set */ - set = dbiFreeIndexSet(set); + set = rpmdbiFreeIndexSet(set); RPM_GNUC_TM_ATOMIC { rpmmiRock = mi->mi_next; mi->mi_next = NULL; @@ -2807,7 +2774,7 @@ HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he)); Header h = NULL; sigset_t signalMask; - dbiIndex dbi; + rpmdbi dbi; int dbix; int rc = RPMRC_FAIL; /* XXX RPMRC */ int xx; @@ -2859,7 +2826,7 @@ if (!headerGet(h, he, 0)) /*@switchbreak@*/ break; - dbi = dbiOpen(db, he->tag, 0); + dbi = rpmdbiOpen(db, he->tag, 0); if (dbi == NULL) goto exit; he->p.ptr = _free(he->p.ptr); @@ -2881,21 +2848,21 @@ /* New h ref for use by associated secondary index callbacks. */ db->db_h = headerLink(h); - dbi = dbiOpen(db, he->tag, 0); + dbi = rpmdbiOpen(db, he->tag, 0); if (dbi == NULL) goto exit; - rc = dbiCopen(dbi, dbiTxnid(dbi), &dbcursor, DB_WRITECURSOR); - rc = dbiGet(dbi, dbcursor, &k, &v, DB_SET); + rc = rpmdbiCopen(dbi, rpmdbiTxnid(dbi), &dbcursor, DB_WRITECURSOR); + rc = rpmdbiGet(dbi, dbcursor, &k, &v, DB_SET); if (!rc) - rc = dbiDel(dbi, dbcursor, &k, &v, 0); - xx = dbiCclose(dbi, dbcursor, DB_WRITECURSOR); + rc = rpmdbiDel(dbi, dbcursor, &k, &v, 0); + xx = rpmdbiCclose(dbi, dbcursor, DB_WRITECURSOR); /* Unreference db_h used by associated secondary index callbacks. */ (void) headerFree(db->db_h); db->db_h = NULL; if (!dbi->dbi_no_dbsync) - xx = dbiSync(dbi, 0); + xx = rpmdbiSync(dbi, 0); /*@switchbreak@*/ break; } @@ -2920,7 +2887,7 @@ { HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he)); sigset_t signalMask; - dbiIndex dbi; + rpmdbi dbi; int dbix; uint32_t hdrNum = headerGetInstance(h); int rc = RPMRC_FAIL; /* XXX RPMRC */ @@ -2958,10 +2925,10 @@ if (hdrNum == 0) { int64_t seqno = 0; - dbi = dbiOpen(db, RPMDBI_SEQNO, 0); + dbi = rpmdbiOpen(db, RPMDBI_SEQNO, 0); if (dbi == NULL) goto exit; - if ((xx = dbiSeqno(dbi, &seqno, 0)) == 0) { + if ((xx = rpmdbiSeqno(dbi, &seqno, 0)) == 0) { hdrNum = seqno; (void) headerSetInstance(h, hdrNum); } else @@ -2974,7 +2941,7 @@ assert(hdrNum == headerGetInstance(h)); } - dbi = dbiOpen(db, RPMDBI_PACKAGES, 0); + dbi = rpmdbiOpen(db, RPMDBI_PACKAGES, 0); if (dbi == NULL) goto exit; dbix = db->db_ndbi - 1; @@ -2999,7 +2966,7 @@ if (!headerGet(h, he, 0)) /*@switchbreak@*/ break; - dbi = dbiOpen(db, he->tag, 0); + dbi = rpmdbiOpen(db, he->tag, 0); if (dbi == NULL) goto exit; he->p.ptr = _free(he->p.ptr); @@ -3027,19 +2994,19 @@ /* New h ref for use by associated secondary index callbacks. */ db->db_h = headerLink(h); - dbi = dbiOpen(db, he->tag, 0); + dbi = rpmdbiOpen(db, he->tag, 0); if (dbi == NULL) goto exit; - xx = dbiCopen(dbi, dbiTxnid(dbi), &dbcursor, DB_WRITECURSOR); - xx = dbiPut(dbi, dbcursor, &k, &v, DB_KEYLAST); - xx = dbiCclose(dbi, dbcursor, DB_WRITECURSOR); + xx = rpmdbiCopen(dbi, rpmdbiTxnid(dbi), &dbcursor, DB_WRITECURSOR); + xx = rpmdbiPut(dbi, dbcursor, &k, &v, DB_KEYLAST); + xx = rpmdbiCclose(dbi, dbcursor, DB_WRITECURSOR); /* Unreference db_h used by associated secondary index callbacks. */ (void) headerFree(db->db_h); db->db_h = NULL; if (!dbi->dbi_no_dbsync) - xx = dbiSync(dbi, 0); + xx = rpmdbiSync(dbi, 0); v.data = _free(v.data); /* headerUnload */ v.size = 0; @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmdb.h ============================================================================ $ cvs diff -u -r1.141.2.15 -r1.141.2.16 rpmdb.h --- rpm/rpmdb/rpmdb.h 25 Jun 2016 08:32:00 -0000 1.141.2.15 +++ rpm/rpmdb/rpmdb.h 27 Jun 2016 03:08:21 -0000 1.141.2.16 @@ -46,24 +46,24 @@ /** */ -typedef struct _dbiIndexItem * dbiIndexItem; +typedef struct _dbiIndexItem * rpmdbiIndexItem; /** \ingroup rpmdb * A single element (i.e. inverted list from tag values) of a database. */ -typedef struct _dbiIndexSet * dbiIndexSet; +typedef struct _dbiIndexSet * rpmdbiIndexSet; /** */ -typedef struct _dbiIndex * dbiIndex; +typedef struct rpmdbi_s * rpmdbi; #if defined(_RPMDB_INTERNAL) #include <rpmio.h> #include <rpmbf.h> #include <rpmsw.h> -#if !defined(SWIG) /* XXX inline dbiFoo() need */ -/** \ingroup dbi +#if !defined(SWIG) /* XXX inline rpmdbiFoo() need */ +/** \ingroup rpmdbi * A single item from an index database (i.e. the "data returned"). */ struct _dbiIndexItem { @@ -71,7 +71,7 @@ uint32_t tagNum; /*!< tag index in header */ }; -/** \ingroup dbi +/** \ingroup rpmdbi * Items retrieved from the index database. */ struct _dbiIndexSet { @@ -79,7 +79,7 @@ unsigned int count; /*!< number of records */ }; -/** \ingroup dbi +/** \ingroup rpmdbi * Private methods for accessing an index database. */ struct _dbiVec { @@ -88,31 +88,31 @@ int dbv_minor; /*!< DB version minor */ int dbv_patch; /*!< DB version patch */ -/** \ingroup dbi +/** \ingroup rpmdbi * Return handle for an index database. * @param rpmdb rpm database * @param tag rpm tag * @return 0 on success */ - int (*open) (rpmdb rpmdb, rpmTag tag, dbiIndex * dbip); + int (*open) (rpmdb rpmdb, rpmTag tag, rpmdbi * dbip); -/** \ingroup dbi +/** \ingroup rpmdbi * Close index database, and destroy database handle. * @param dbi index database handle * @param flags (unused) * @return 0 on success */ - int (*close) (dbiIndex dbi, unsigned int flags); + int (*close) (rpmdbi dbi, unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Flush pending operations to disk. * @param dbi index database handle * @param flags (unused) * @return 0 on success */ - int (*sync) (dbiIndex dbi, unsigned int flags); + int (*sync) (rpmdbi dbi, unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Associate secondary database with primary. * @param dbi index database handle * @param dbisecondary secondary index database handle @@ -120,11 +120,11 @@ * @param flags DB_CREATE or 0 * @return 0 on success */ - int (*associate) (dbiIndex dbi, dbiIndex dbisecondary, + int (*associate) (rpmdbi dbi, rpmdbi dbisecondary, int (*callback) (DB *, const DBT *, const DBT *, DBT *), unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Associate foreign secondary database with primary. * @param dbi index database handle * @param dbisecondary secondary index database handle @@ -132,11 +132,11 @@ * @param flags DB_CREATE or 0 * @return 0 on success */ - int (*associate_foreign) (dbiIndex dbi, dbiIndex dbisecondary, + int (*associate_foreign) (rpmdbi dbi, rpmdbi dbisecondary, int (*callback) (DB *, const DBT *, DBT *, const DBT *, int *), unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Return join cursor for list of cursors. * @param dbi index database handle * @param curslist NULL terminated list of database cursors @@ -144,28 +144,28 @@ * @param flags DB_JOIN_NOSORT or 0 * @return 0 on success */ - int (*join) (dbiIndex dbi, DBC ** curslist, DBC ** dbcp, + int (*join) (rpmdbi dbi, DBC ** curslist, DBC ** dbcp, unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Return whether key exists in a database. * @param dbi index database handle * @param key retrieve key value/length/flags * @param flags usually 0 * @return 0 if key exists, DB_NOTFOUND if not, else error */ - int (*exists) (dbiIndex dbi, DBT * key, unsigned int flags); + int (*exists) (rpmdbi dbi, DBT * key, unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Return next sequence number. * @param dbi index database handle (with attached sequence) * @retval *seqnop IN: delta (0 does seqno++) OUT: returned 64bit seqno * @param flags usually 0 * @return 0 on success */ - int (*seqno) (dbiIndex dbi, int64_t * seqnop, unsigned int flags); + int (*seqno) (rpmdbi dbi, int64_t * seqnop, unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Open database cursor. * @param dbi index database handle * @param txnid database transaction handle @@ -173,19 +173,19 @@ * @param dbiflags DB_WRITECURSOR or 0 * @return 0 on success */ - int (*copen) (dbiIndex dbi, DB_TXN * txnid, + int (*copen) (rpmdbi dbi, DB_TXN * txnid, DBC ** dbcp, unsigned int dbiflags); -/** \ingroup dbi +/** \ingroup rpmdbi * Close database cursor. * @param dbi index database handle * @param dbcursor database cursor * @param flags (unused) * @return 0 on success */ - int (*cclose) (dbiIndex dbi, DBC * dbcursor, unsigned int flags); + int (*cclose) (rpmdbi dbi, DBC * dbcursor, unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Duplicate a database cursor. * @param dbi index database handle * @param dbcursor database cursor @@ -193,9 +193,9 @@ * @param flags DB_POSITION for same position, 0 for uninitialized * @return 0 on success */ - int (*cdup) (dbiIndex dbi, DBC * dbcursor, DBC ** dbcp, unsigned int flags); + int (*cdup) (rpmdbi dbi, DBC * dbcursor, DBC ** dbcp, unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Delete (key,data) pair(s) using db->del or dbcursor->c_del. * @param dbi index database handle * @param dbcursor database cursor (NULL will use db->del) @@ -204,10 +204,10 @@ * @param flags (unused) * @return 0 on success */ - int (*cdel) (dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, + int (*cdel) (rpmdbi dbi, DBC * dbcursor, DBT * key, DBT * data, unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Retrieve (key,data) pair using db->get or dbcursor->c_get. * @param dbi index database handle * @param dbcursor database cursor (NULL will use db->get) @@ -216,10 +216,10 @@ * @param flags (unused) * @return 0 on success */ - int (*cget) (dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, + int (*cget) (rpmdbi dbi, DBC * dbcursor, DBT * key, DBT * data, unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Retrieve (key,data) pair using dbcursor->c_pget. * @param dbi index database handle * @param dbcursor database cursor @@ -229,10 +229,10 @@ * @param flags DB_NEXT, DB_SET, or 0 * @return 0 on success */ - int (*cpget) (dbiIndex dbi, DBC * dbcursor, + int (*cpget) (rpmdbi dbi, DBC * dbcursor, DBT * key, DBT * pkey, DBT * data, unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Store (key,data) pair using db->put or dbcursor->c_put. * @param dbi index database handle * @param dbcursor database cursor (NULL will use db->put) @@ -241,10 +241,10 @@ * @param flags (unused) * @return 0 on success */ - int (*cput) (dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, + int (*cput) (rpmdbi dbi, DBC * dbcursor, DBT * key, DBT * data, unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Retrieve count of (possible) duplicate items using dbcursor->c_count. * @param dbi index database handle * @param dbcursor database cursor @@ -252,29 +252,29 @@ * @param flags (unused) * @return 0 on success */ - int (*ccount) (dbiIndex dbi, DBC * dbcursor, unsigned int * countp, + int (*ccount) (rpmdbi dbi, DBC * dbcursor, unsigned int * countp, unsigned int flags); -/** \ingroup dbi +/** \ingroup rpmdbi * Is database byte swapped? * @param dbi index database handle * @return 0 no */ - int (*byteswapped) (dbiIndex dbi); + int (*byteswapped) (rpmdbi dbi); -/** \ingroup dbi +/** \ingroup rpmdbi * Save statistics in database handle. * @param dbi index database handle * @param flags retrieve statistics that don't require traversal? * @return 0 on success */ - int (*stat) (dbiIndex dbi, unsigned int flags); + int (*stat) (rpmdbi dbi, unsigned int flags); }; -/** \ingroup dbi +/** \ingroup rpmdbi * Describes an index database (implemented on Berkeley db3 functionality). */ -struct _dbiIndex { +struct rpmdbi_s { struct rpmioItem_s _item; /*!< usage mutex and pool identifier. */ const char * dbi_root; /*!< chroot(2) component of path */ const char * dbi_home; /*!< directory component of path */ @@ -421,7 +421,7 @@ tagStore_t db_tags; /*!< Tag name/value mappings. */ size_t db_ndbi; /*!< No. of tag indices. */ - dbiIndex * _dbi; /*!< Tag indices. */ + rpmdbi * _dbi; /*!< Tag indices. */ struct rpmop_s db_getops; /*!< dbiGet statistics. */ struct rpmop_s db_putops; /*!< dbiPut statistics. */ @@ -442,16 +442,16 @@ * @param tag rpm tag * @return index database handle */ -dbiIndex db3New(rpmdb rpmdb, rpmTag tag); +rpmdbi db3New(rpmdb rpmdb, rpmTag tag); /** \ingroup db3 * Destroy index database handle instance. * @param dbi index database handle * @return NULL always */ -dbiIndex db3Free(dbiIndex dbi); +rpmdbi db3Free(rpmdbi dbi); #define db3Free(_dbi) \ - ((dbiIndex)rpmioFreePoolItem((rpmioItem)(_dbi), __FUNCTION__, __FILE__, __LINE__)) + ((rpmdbi)rpmioFreePoolItem((rpmioItem)(_dbi), __FUNCTION__, __FILE__, __LINE__)) /** \ingroup db3 * Format db3 open flags for debugging print. @@ -462,14 +462,14 @@ extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags); #endif -/** \ingroup dbi +/** \ingroup rpmdbi * Return handle for an index database. * @param db rpm database * @param tag rpm tag * @param flags (unused) * @return index database handle */ -dbiIndex dbiOpen(rpmdb db, rpmTag tag, unsigned int flags); +rpmdbi rpmdbiOpen(rpmdb db, rpmTag tag, unsigned int flags); /** * Return dbiStats accumulator structure. @@ -477,11 +477,11 @@ * @param opx per-rpmdb accumulator index (aka rpmtsOpX) * @return per-rpmdb accumulator pointer */ -void * dbiStatsAccumulator(dbiIndex dbi, int opx) +void * rpmdbiStatsAccumulator(rpmdbi dbi, int opx) RPM_GNUC_PURE; #if !defined(SWIG) -/** \ingroup dbi +/** \ingroup rpmdbi * Open a database cursor. * @param dbi index database handle * @param txnid database transaction handle @@ -490,12 +490,12 @@ * @return 0 on success */ static inline -int dbiCopen(dbiIndex dbi, DB_TXN * txnid, DBC ** dbcp, unsigned int flags) +int rpmdbiCopen(rpmdbi dbi, DB_TXN * txnid, DBC ** dbcp, unsigned int flags) { return (*dbi->dbi_vec->copen) (dbi, txnid, dbcp, flags); } -/** \ingroup dbi +/** \ingroup rpmdbi * Close a database cursor. * @param dbi index database handle * @param dbcursor database cursor @@ -503,12 +503,12 @@ * @return 0 on success */ static inline -int dbiCclose(dbiIndex dbi, DBC * dbcursor, unsigned int flags) +int rpmdbiCclose(rpmdbi dbi, DBC * dbcursor, unsigned int flags) { return (*dbi->dbi_vec->cclose) (dbi, dbcursor, flags); } -/** \ingroup dbi +/** \ingroup rpmdbi * Duplicate a database cursor. * @param dbi index database handle * @param dbcursor database cursor @@ -517,12 +517,12 @@ * @return 0 on success */ static inline -int dbiCdup(dbiIndex dbi, DBC * dbcursor, DBC ** dbcp, unsigned int flags) +int rpmdbiCdup(rpmdbi dbi, DBC * dbcursor, DBC ** dbcp, unsigned int flags) { return (*dbi->dbi_vec->cdup) (dbi, dbcursor, dbcp, flags); } -/** \ingroup dbi +/** \ingroup rpmdbi * Delete (key,data) pair(s) from index database. * @param dbi index database handle * @param dbcursor database cursor (NULL will use db->del) @@ -532,10 +532,10 @@ * @return 0 on success */ static inline -int dbiDel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, +int rpmdbiDel(rpmdbi dbi, DBC * dbcursor, DBT * key, DBT * data, unsigned int flags) { - rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 16); /* RPMTS_OP_DBDEL */ + rpmop sw = (rpmop)rpmdbiStatsAccumulator(dbi, 16); /* RPMTS_OP_DBDEL */ int rc; assert(key->data != NULL && key->size > 0); (void) rpmswEnter(sw, 0); @@ -544,7 +544,7 @@ return rc; } -/** \ingroup dbi +/** \ingroup rpmdbi * Retrieve (key,data) pair from index database. * @param dbi index database handle * @param dbcursor database cursor (NULL will use db->get) @@ -554,10 +554,10 @@ * @return 0 on success */ static inline -int dbiGet(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, +int rpmdbiGet(rpmdbi dbi, DBC * dbcursor, DBT * key, DBT * data, unsigned int flags) { - rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 14); /* RPMTS_OP_DBGET */ + rpmop sw = (rpmop)rpmdbiStatsAccumulator(dbi, 14); /* RPMTS_OP_DBGET */ int rc; (void) rpmswEnter(sw, 0); rc = (dbi->dbi_vec->cget) (dbi, dbcursor, key, data, flags); @@ -565,7 +565,7 @@ return rc; } -/** \ingroup dbi +/** \ingroup rpmdbi * Retrieve (key,data) pair using dbcursor->c_pget. * @param dbi index database handle * @param dbcursor database cursor (NULL will use db->get) @@ -576,10 +576,10 @@ * @return 0 on success */ static inline -int dbiPget(dbiIndex dbi, DBC * dbcursor, +int rpmdbiPget(rpmdbi dbi, DBC * dbcursor, DBT * key, DBT * pkey, DBT * data, unsigned int flags) { - rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 14); /* RPMTS_OP_DBGET */ + rpmop sw = (rpmop)rpmdbiStatsAccumulator(dbi, 14); /* RPMTS_OP_DBGET */ int rc; (void) rpmswEnter(sw, 0); rc = (dbi->dbi_vec->cpget) (dbi, dbcursor, key, pkey, data, flags); @@ -587,7 +587,7 @@ return rc; } -/** \ingroup dbi +/** \ingroup rpmdbi * Store (key,data) pair in index database. * @param dbi index database handle * @param dbcursor database cursor (NULL will use db->put) @@ -597,10 +597,10 @@ * @return 0 on success */ static inline -int dbiPut(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, +int rpmdbiPut(rpmdbi dbi, DBC * dbcursor, DBT * key, DBT * data, unsigned int flags) { - rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 15); /* RPMTS_OP_DBPUT */ + rpmop sw = (rpmop)rpmdbiStatsAccumulator(dbi, 15); /* RPMTS_OP_DBPUT */ int rc; assert(key->data != NULL && key->size > 0 && data->data != NULL && data->size > 0); (void) rpmswEnter(sw, 0); @@ -609,7 +609,7 @@ return rc; } -/** \ingroup dbi +/** \ingroup rpmdbi * Retrieve count of (possible) duplicate items. * @param dbi index database handle * @param dbcursor database cursor @@ -618,37 +618,37 @@ * @return 0 on success */ static inline -int dbiCount(dbiIndex dbi, DBC * dbcursor, unsigned int * countp, +int rpmdbiCount(rpmdbi dbi, DBC * dbcursor, unsigned int * countp, unsigned int flags) { return (*dbi->dbi_vec->ccount) (dbi, dbcursor, countp, flags); } -/** \ingroup dbi +/** \ingroup rpmdbi * Close index database. * @param dbi index database handle * @param flags (unused) * @return 0 on success */ static inline -int dbiClose(dbiIndex dbi, unsigned int flags) +int rpmdbiClose(rpmdbi dbi, unsigned int flags) { return (*dbi->dbi_vec->close) (dbi, flags); } -/** \ingroup dbi +/** \ingroup rpmdbi * Flush pending operations to disk. * @param dbi index database handle * @param flags (unused) * @return 0 on success */ static inline -int dbiSync (dbiIndex dbi, unsigned int flags) +int rpmdbiSync (rpmdbi dbi, unsigned int flags) { return (*dbi->dbi_vec->sync) (dbi, flags); } -/** \ingroup dbi +/** \ingroup rpmdbi * Return whether key exists in a database. * @param dbi index database handle * @param key retrieve key value/length/flags @@ -656,12 +656,12 @@ * @return 0 if key exists, DB_NOTFOUND if not, else error */ static inline -int dbiExists(dbiIndex dbi, DBT * key, unsigned int flags) +int rpmdbiExists(rpmdbi dbi, DBT * key, unsigned int flags) { return (*dbi->dbi_vec->exists) (dbi, key, flags); } -/** \ingroup dbi +/** \ingroup rpmdbi * Return next sequence number. * @param dbi index database handle (with attached sequence) * @retval *seqnop IN: delta (0 does seqno++) OUT: returned 64bit seqno @@ -669,12 +669,12 @@ * @return 0 on success */ static inline -int dbiSeqno(dbiIndex dbi, int64_t * seqnop, unsigned int flags) +int rpmdbiSeqno(rpmdbi dbi, int64_t * seqnop, unsigned int flags) { return (*dbi->dbi_vec->seqno) (dbi, seqnop, flags); } -/** \ingroup dbi +/** \ingroup rpmdbi * Associate secondary database with primary. * @param dbi index database handle * @param dbisecondary secondary index database handle @@ -683,14 +683,14 @@ * @return 0 on success */ static inline -int dbiAssociate(dbiIndex dbi, dbiIndex dbisecondary, +int rpmdbiAssociate(rpmdbi dbi, rpmdbi dbisecondary, int (*callback) (DB *, const DBT *, const DBT *, DBT *), unsigned int flags) { return (*dbi->dbi_vec->associate) (dbi, dbisecondary, callback, flags); } -/** \ingroup dbi +/** \ingroup rpmdbi * Return join cursor for list of cursors. * @param dbi index database handle * @param curslist NULL terminated list of database cursors @@ -699,42 +699,42 @@ * @return 0 on success */ static inline -int dbiJoin(dbiIndex dbi, DBC ** curslist, DBC ** dbcp, +int rpmdbiJoin(rpmdbi dbi, DBC ** curslist, DBC ** dbcp, unsigned int flags) { return (*dbi->dbi_vec->join) (dbi, curslist, dbcp, flags); } -/** \ingroup dbi +/** \ingroup rpmdbi * Is database byte swapped? * @param dbi index database handle * @return 0 same order, 1 swapped order */ static inline -int dbiByteSwapped(dbiIndex dbi) +int rpmdbiByteSwapped(rpmdbi dbi) { return (*dbi->dbi_vec->byteswapped) (dbi); } -/** \ingroup dbi +/** \ingroup rpmdbi * Return dbi statistics. * @param dbi index database handle * @param flags DB_FAST_STAT or 0 * @return 0 on success */ static inline -int dbiStat(dbiIndex dbi, unsigned int flags) +int rpmdbiStat(rpmdbi dbi, unsigned int flags) { return (*dbi->dbi_vec->stat) (dbi, flags); } -/** \ingroup dbi +/** \ingroup rpmdbi * Return dbi transaction id. * @param dbi index database handle * @return transaction id */ static inline -DB_TXN * dbiTxnid(dbiIndex dbi) +DB_TXN * rpmdbiTxnid(rpmdbi dbi) { rpmdb rpmdb = (dbi ? dbi->dbi_rpmdb : NULL); DB_TXN * _txn = (DB_TXN*)(rpmdb ? rpmdb->db_txn : NULL); @@ -978,37 +978,37 @@ #endif /* _RPMDB_INTERNAL */ #endif /* !defined(SWIG) */ -/** \ingroup dbi +/** \ingroup rpmdbi * Destroy set of index database items. * @param set set of index database items * @return NULL always */ -dbiIndexSet dbiFreeIndexSet(dbiIndexSet set); +rpmdbiIndexSet rpmdbiFreeIndexSet(rpmdbiIndexSet set); -/** \ingroup dbi +/** \ingroup rpmdbi * Count items in index database set. * @param set set of index database items * @return number of items */ -unsigned int dbiIndexSetCount(dbiIndexSet set) +unsigned int rpmdbiIndexSetCount(rpmdbiIndexSet set) RPM_GNUC_PURE; -/** \ingroup dbi +/** \ingroup rpmdbi * Return record offset of header from element in index database set. * @param set set of index database items * @param recno index of item in set * @return record offset of header */ -uint32_t dbiIndexRecordOffset(dbiIndexSet set, unsigned int recno) +uint32_t rpmdbiIndexRecordOffset(rpmdbiIndexSet set, unsigned int recno) RPM_GNUC_PURE; -/** \ingroup dbi +/** \ingroup rpmdbi * Return file index from element in index database set. * @param set set of index database items * @param recno index of item in set * @return file index */ -uint32_t dbiIndexRecordFileNumber(dbiIndexSet set, unsigned int recno) +uint32_t rpmdbiIndexRecordFileNumber(rpmdbiIndexSet set, unsigned int recno) RPM_GNUC_PURE; #endif /* defined(_RPMDB_INTERNAL) */ @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmmdb.c ============================================================================ $ cvs diff -u -r1.4.2.3 -r1.4.2.4 rpmmdb.c --- rpm/rpmdb/rpmmdb.c 17 Aug 2014 14:30:48 -0000 1.4.2.3 +++ rpm/rpmdb/rpmmdb.c 27 Jun 2016 03:08:21 -0000 1.4.2.4 @@ -14,10 +14,6 @@ #include "debug.h" -/*@unchecked@*/ -int _rpmmdb_debug = 0; - -/*@unchecked@*/ /*@relnull@*/ rpmmdb _rpmmdbI; /*==============================================================*/ @@ -31,24 +27,9 @@ mdb->fn = _free(mdb->fn); } -/*@unchecked@*/ /*@only@*/ /*@null@*/ -rpmioPool _rpmmdbPool = NULL; - -static rpmmdb rpmmdbGetPool(/*@null@*/ rpmioPool pool) - /*@globals _rpmmdbPool, fileSystem @*/ - /*@modifies pool, _rpmmdbPool, fileSystem @*/ -{ - rpmmdb mdb; +int _rpmmdb_debug = 0; - if (_rpmmdbPool == NULL) { - _rpmmdbPool = rpmioNewPool("mdb", sizeof(*mdb), -1, _rpmmdb_debug, - NULL, NULL, rpmmdbFini); - pool = _rpmmdbPool; - } - mdb = (rpmmdb) rpmioGetPool(pool, sizeof(*mdb)); - memset(((char *)mdb)+sizeof(mdb->_item), 0, sizeof(*mdb)-sizeof(mdb->_item)); - return mdb; -} +RPMIOPOOL_MODULE(mdb) rpmmdb rpmmdbNew(const char * fn, int flags) { @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmrepo.c ============================================================================ $ cvs diff -u -r1.4.2.5 -r1.4.2.6 rpmrepo.c --- rpm/rpmdb/rpmrepo.c 11 May 2015 21:10:17 -0000 1.4.2.5 +++ rpm/rpmdb/rpmrepo.c 27 Jun 2016 03:08:21 -0000 1.4.2.6 @@ -1933,24 +1933,7 @@ } -/*@unchecked@*/ /*@only@*/ /*@null@*/ -rpmioPool _rpmrepoPool = NULL; - -static rpmrepo rpmrepoGetPool(/*@null@*/ rpmioPool pool) - /*@globals _rpmrepoPool, fileSystem @*/ - /*@modifies pool, _rpmrepoPool, fileSystem @*/ -{ - rpmrepo repo; - - if (_rpmrepoPool == NULL) { - _rpmrepoPool = rpmioNewPool("repo", sizeof(*repo), -1, _rpmrepo_debug, - NULL, NULL, rpmrepoFini); - pool = _rpmrepoPool; - } - repo = (rpmrepo) rpmioGetPool(pool, sizeof(*repo)); - memset(((char *)repo)+sizeof(repo->_item), 0, sizeof(*repo)-sizeof(repo->_item)); - return repo; -} +RPMIOPOOL_MODULE(repo) rpmrepo rpmrepoNew(char ** av, int flags) { @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmtxn.c ============================================================================ $ cvs diff -u -r1.6.4.4 -r1.6.4.5 rpmtxn.c --- rpm/rpmdb/rpmtxn.c 5 Mar 2016 21:39:56 -0000 1.6.4.4 +++ rpm/rpmdb/rpmtxn.c 27 Jun 2016 03:08:21 -0000 1.6.4.5 @@ -15,7 +15,6 @@ #include "debug.h" /*@access rpmdb @*/ -/*@access dbiIndex @*/ int _rpmtxn_debug = 0; @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmwf.c ============================================================================ $ cvs diff -u -r1.29.2.3 -r1.29.2.4 rpmwf.c --- rpm/rpmdb/rpmwf.c 29 Jun 2013 17:35:31 -0000 1.29.2.3 +++ rpm/rpmdb/rpmwf.c 27 Jun 2016 03:08:21 -0000 1.29.2.4 @@ -210,22 +210,9 @@ } /*@=mustmod@*/ -/*@unchecked@*/ /*@only@*/ /*@null@*/ -rpmioPool _rpmwfPool; - -static rpmwf rpmwfGetPool(/*@null@*/ rpmioPool pool) - /*@globals _rpmwfPool, fileSystem @*/ - /*@modifies pool, _rpmwfPool, fileSystem @*/ -{ - rpmwf wf; - - if (_rpmwfPool == NULL) { - _rpmwfPool = rpmioNewPool("wf", sizeof(*wf), -1, _rpmwf_debug, - NULL, NULL, rpmwfScrub); - pool = _rpmwfPool; - } - return (rpmwf) rpmioGetPool(pool, sizeof(*wf)); -} +#define rpmwfFini rpmwfScrub +RPMIOPOOL_MODULE(wf) +#undef rpmwfFini rpmwf rpmwfNew(const char * fn) { @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/sqlite.c ============================================================================ $ cvs diff -u -r1.44.4.19 -r1.44.4.20 sqlite.c --- rpm/rpmdb/sqlite.c 29 Mar 2016 16:40:31 -0000 1.44.4.19 +++ rpm/rpmdb/sqlite.c 27 Jun 2016 03:08:21 -0000 1.44.4.20 @@ -62,7 +62,7 @@ #endif /*@access rpmdb @*/ -/*@access dbiIndex @*/ +/*@access rpmdbi @*/ /*@unchecked@*/ int _sqldb_debug = 0; @@ -219,7 +219,7 @@ #define _KEYDATA(_K, _P, _D, _R) fmtKDR(_K, _P, _D, _R) /* =================================================================== */ -static int Xcvtdberr(/*@unused@*/ dbiIndex dbi, const char * msg, +static int Xcvtdberr(/*@unused@*/ rpmdbi dbi, const char * msg, int error, int printit, const char * func, const char * fn, unsigned ln) /*@globals fileSystem @*/ @@ -247,7 +247,7 @@ Xcvtdberr(_dbi, _msg, _error, _sqldb_debug, __FUNCTION__, __FILE__, __LINE__) /* =================================================================== */ -struct _sql_dbcursor_s; typedef struct _sql_dbcursor_s *SCP_t; +struct _sql_dbcursor_s; typedef struct _sql_dbcursor_s * rpmscp; struct _sql_dbcursor_s { struct rpmioItem_s _item; /*!< usage mutex and pool identifier. */ /* XXX FIXME: chain back to the sqlite3 * handle. */ @@ -289,9 +289,9 @@ }; /*==============================================================*/ -int _scp_debug = 0; +int _rpmscp_debug = 0; -#define SCPDEBUG(_dbi, _list) if (_scp_debug) fprintf _list +#define SCPDEBUG(_dbi, _list) if (_rpmscp_debug) fprintf _list /** * Unreference a SCP wrapper instance. @@ -299,10 +299,10 @@ * @return NULL on last dereference */ /*@unused@*/ /*@null@*/ -SCP_t scpUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ SCP_t scp) +rpmscp rpmscpUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmscp scp) /*@modifies scp @*/; -#define scpUnlink(_scp) \ - ((SCP_t)rpmioUnlinkPoolItem((rpmioItem)(_scp), __FUNCTION__, __FILE__, __LINE__)) +#define rpmscpUnlink(_scp) \ + ((rpmscp)rpmioUnlinkPoolItem((rpmioItem)(_scp), __FUNCTION__, __FILE__, __LINE__)) /** * Reference a SCP wrapper instance. @@ -310,10 +310,10 @@ * @return new SCP wrapper reference */ /*@unused@*/ /*@newref@*/ /*@null@*/ -SCP_t scpLink (/*@null@*/ SCP_t scp) +rpmscp rpmscpLink (/*@null@*/ rpmscp scp) /*@modifies scp @*/; -#define scpLink(_scp) \ - ((SCP_t)rpmioLinkPoolItem((rpmioItem)(_scp), __FUNCTION__, __FILE__, __LINE__)) +#define rpmscpLink(_scp) \ + ((rpmscp)rpmioLinkPoolItem((rpmioItem)(_scp), __FUNCTION__, __FILE__, __LINE__)) /** * Destroy a SCP wrapper. @@ -321,30 +321,30 @@ * @return NULL on last dereference */ /*@null@*/ -SCP_t scpFree(/*@killref@*/ /*@null@*/SCP_t scp) +rpmscp rpmscpFree(/*@killref@*/ /*@null@*/rpmscp scp) /*@globals fileSystem @*/ /*@modifies scp, fileSystem @*/; -#define scpFree(_scp) \ - ((SCP_t)rpmioFreePoolItem((rpmioItem)(_scp), __FUNCTION__, __FILE__, __LINE__)) +#define rpmscpFree(_scp) \ + ((rpmscp)rpmioFreePoolItem((rpmioItem)(_scp), __FUNCTION__, __FILE__, __LINE__)) static void dbg_scp(void *ptr) /*@globals stderr, fileSystem @*/ /*@modifies stderr, fileSystem @*/ { - SCP_t scp = ptr; + rpmscp scp = ptr; -if (_scp_debug) +if (_rpmscp_debug) fprintf(stderr, "\tscp %p [%d:%d] av %p avlen %p nr [%d:%d] nc %d all %d\n", scp, scp->ac, scp->nalloc, scp->av, scp->avlen, scp->rx, scp->nr, scp->nc, scp->all); } -static void dbg_keyval(const char * msg, dbiIndex dbi, /*@null@*/ DBC * dbcursor, +static void dbg_keyval(const char * msg, rpmdbi dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data, unsigned int flags) /*@globals stderr, fileSystem @*/ /*@modifies stderr, fileSystem @*/ { -if (!_scp_debug) return; +if (!_rpmscp_debug) return; fprintf(stderr, "%s on %s (%p,%p,%p,0x%x)", msg, dbi->dbi_subfile, dbcursor, key, data, flags); @@ -363,7 +363,7 @@ } /*@only@*/ -static SCP_t scpResetKeys(/*@only@*/ SCP_t scp) +static rpmscp rpmscpResetKeys(/*@only@*/ rpmscp scp) /*@modifies scp @*/ { int ix; @@ -386,7 +386,7 @@ } /*@only@*/ -static SCP_t scpResetAv(/*@only@*/ SCP_t scp) +static rpmscp rpmscpResetAv(/*@only@*/ rpmscp scp) /*@modifies scp @*/ { int xx; @@ -398,12 +398,12 @@ if (scp->av != NULL) { if (scp->nalloc <= 0) { - /* Clean up SCP_t used by sqlite3_get_table(). */ + /* Clean up rpmscp used by sqlite3_get_table(). */ sqlite3_free_table(scp->av); scp->av = NULL; scp->nalloc = 0; } else { - /* Clean up SCP_t used by sql_step(). */ + /* Clean up rpmscp used by sql_step(). */ for (xx = 0; xx < scp->ac; xx++) scp->av[xx] = _free(scp->av[xx]); if (scp->av != NULL) @@ -424,7 +424,7 @@ } /*@only@*/ -static SCP_t scpReset(/*@only@*/ SCP_t scp) +static rpmscp rpmscpReset(/*@only@*/ rpmscp scp) /*@modifies scp @*/ { int xx; @@ -451,47 +451,30 @@ scp->pStmt = NULL; } - scp = scpResetAv(scp); + scp = rpmscpResetAv(scp); scp->rx = 0; return scp; } -static void scpFini(void * _scp) +static void rpmscpFini(void * _scp) /*@globals fileSystem @*/ /*@modifies *_scp, fileSystem @*/ { - SCP_t scp = (SCP_t) _scp; + rpmscp scp = (rpmscp) _scp; SCPDEBUG(NULL, (stderr, "==> %s(%p)\n", __FUNCTION__, scp)); - scp = scpReset(scp); - scp = scpResetKeys(scp); + scp = rpmscpReset(scp); + scp = rpmscpResetKeys(scp); scp->av = _free(scp->av); scp->avlen = _free(scp->avlen); } -/*@unchecked@*/ /*@only@*/ /*@null@*/ -rpmioPool _scpPool = NULL; +RPMIOPOOL_MODULE(scp) -static SCP_t scpGetPool(/*@null@*/ rpmioPool pool) - /*@globals _rpmscpPool, fileSystem @*/ - /*@modifies pool, _scpPool, fileSystem @*/ -{ - SCP_t scp; - - if (_scpPool == NULL) { - _scpPool = rpmioNewPool("scp", sizeof(*scp), -1, _scp_debug, - NULL, NULL, scpFini); - pool = _scpPool; - } - scp = (SCP_t) rpmioGetPool(pool, sizeof(*scp)); - memset(((char *)scp)+sizeof(scp->_item), 0, sizeof(*scp)-sizeof(scp->_item)); - return scp; -} - -static SCP_t scpNew(/*@unsed@*/ void * dbp) +static rpmscp rpmscpNew(/*@unsed@*/ void * dbp) { - SCP_t scp = scpGetPool(_scpPool); + rpmscp scp = rpmscpGetPool(_rpmscpPool); #ifdef NOTYET /* XXX FIXME: chain back to the sqlite3 * handle. */ /*@-temptrans@*/ @@ -503,14 +486,14 @@ scp->lkey = NULL; scp->ldata = NULL; - return scpLink(scp); + return rpmscpLink(scp); } /* ============================================================== */ -static int sql_step(dbiIndex dbi, SCP_t scp) +static int sql_step(rpmdbi dbi, rpmscp scp) /*@modifies dbi, scp @*/ { - int swapped = dbiByteSwapped(dbi); + int swapped = rpmdbiByteSwapped(dbi); const char * cname; const char * vtype; size_t nb; @@ -660,7 +643,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wswitch" -static int sql_bind_key(dbiIndex dbi, SCP_t scp, int pos, DBT * key) +static int sql_bind_key(rpmdbi dbi, rpmscp scp, int pos, DBT * key) /*@modifies dbi, scp @*/ { int rc = 0; @@ -730,7 +713,7 @@ } #pragma GCC diagnostic pop -static int sql_bind_data(/*@unused@*/ dbiIndex dbi, SCP_t scp, +static int sql_bind_data(/*@unused@*/ rpmdbi dbi, rpmscp scp, int pos, DBT * data) /*@modifies scp @*/ { @@ -745,7 +728,7 @@ } /* =================================================================== */ -static int sql_exec(dbiIndex dbi, const char * cmd, +static int sql_exec(rpmdbi dbi, const char * cmd, int (*callback)(void*,int,char**,char**), void * context) { @@ -763,7 +746,7 @@ static int sql_busy_handler(void * _dbi, int time) /*@*/ { - dbiIndex dbi = (dbiIndex) _dbi; + rpmdbi dbi = (rpmdbi) _dbi; int rc = 1; /* assume retry */ #ifdef DYING @@ -896,7 +879,7 @@ static int sql_initDB_cb(void * _dbi, int argc, char ** argv, char ** cols) { - dbiIndex dbi = (dbiIndex) _dbi; + rpmdbi dbi = (rpmdbi) _dbi; int rc = -1; if (dbi && argc == 1) { char * end = NULL; @@ -914,7 +897,7 @@ */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wswitch" -static int sql_initDB(dbiIndex dbi) +static int sql_initDB(rpmdbi dbi) /*@globals rpmGlobalMacroContext, h_errno, internalState @*/ /*@modifies internalState @*/ { @@ -1064,12 +1047,12 @@ * @param flags (unused) * @return 0 on success */ -static int sql_cclose (dbiIndex dbi, /*@only@*/ DBC * dbcursor, +static int sql_cclose (rpmdbi dbi, /*@only@*/ DBC * dbcursor, unsigned int flags) /*@globals fileSystem, internalState @*/ /*@modifies dbi, *dbcursor, fileSystem, internalState @*/ { - SCP_t scp = (SCP_t) dbcursor; + rpmscp scp = (rpmscp) dbcursor; int rc = 0; SQLDBDEBUG(dbi, (stderr, "==> sql_cclose(%p)\n", scp)); @@ -1080,7 +1063,7 @@ if (scp->ldata) scp->ldata = _free(scp->ldata); - scp = scpFree(scp); + scp = rpmscpFree(scp); SQLDBDEBUG(dbi, (stderr, "<-- %s(%p,%p,0x%x) rc %d\n", __FUNCTION__, dbi, dbcursor, flags, rc)); return rc; @@ -1092,7 +1075,7 @@ * @param flags (unused) * @return 0 on success */ -static int sql_close(/*@only@*/ dbiIndex dbi, unsigned int flags) +static int sql_close(/*@only@*/ rpmdbi dbi, unsigned int flags) /*@globals fileSystem, internalState @*/ /*@modifies dbi, fileSystem, internalState @*/ { @@ -1134,7 +1117,7 @@ * @retval *dbip index database handle * @return 0 on success */ -static int sql_open(rpmdb rpmdb, rpmTag rpmtag, /*@out@*/ dbiIndex * dbip) +static int sql_open(rpmdb rpmdb, rpmTag rpmtag, /*@out@*/ rpmdbi * dbip) /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ /*@modifies *dbip, rpmGlobalMacroContext, fileSystem, internalState @*/ { @@ -1145,7 +1128,7 @@ const char * urlfn = NULL; const char * dbhome = NULL; const char * dbfname = NULL; - dbiIndex dbi = NULL; + rpmdbi dbi = NULL; rpmsql sql = NULL; int rc = -1; /* assume failure */ int xx; @@ -1240,7 +1223,7 @@ * @param flags (unused) * @return 0 on success */ -static int sql_sync (dbiIndex dbi, /*@unused@*/ unsigned int flags) +static int sql_sync (rpmdbi dbi, /*@unused@*/ unsigned int flags) /*@globals fileSystem, internalState @*/ /*@modifies fileSystem, internalState @*/ { @@ -1259,7 +1242,7 @@ * @param flags usually 0 * @return 0 if key exists, DB_NOTFOUND if not, else error */ -static int sql_exists(dbiIndex dbi, DBT * key, unsigned int flags) +static int sql_exists(rpmdbi dbi, DBT * key, unsigned int flags) /*@globals fileSystem @*/ /*@modifies fileSystem @*/ { @@ -1281,7 +1264,7 @@ static int sql_seqno_cb(void * _dbi, int argc, char ** argv, char ** cols) { - dbiIndex dbi = (dbiIndex) _dbi; + rpmdbi dbi = (rpmdbi) _dbi; int rc = -1; if (dbi && argc == 1) { char * end = NULL; @@ -1300,7 +1283,7 @@ * @param flags usually 0 * @return 0 on success */ -static int sql_seqno(dbiIndex dbi, int64_t * seqnop, unsigned int flags) +static int sql_seqno(rpmdbi dbi, int64_t * seqnop, unsigned int flags) { int rc = EINVAL; if (dbi && seqnop) { @@ -1320,14 +1303,14 @@ * @param flags DB_WRITECURSOR or 0 * @return 0 on success */ -static int sql_copen (dbiIndex dbi, +static int sql_copen (rpmdbi dbi, /*@unused@*/ /*@null@*/ DB_TXN * txnid, /*@out@*/ DBC ** dbcp, unsigned int flags) /*@globals fileSystem, internalState @*/ /*@modifies dbi, *txnid, *dbcp, fileSystem, internalState @*/ { rpmsql sql = (rpmsql) dbi->dbi_db; - SCP_t scp = scpNew(sql); + rpmscp scp = rpmscpNew(sql); DBC * dbcursor = (DBC *)scp; int rc = 0; @@ -1351,14 +1334,14 @@ * @param flags (unused) * @return 0 on success */ -static int sql_cdel (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, +static int sql_cdel (rpmdbi dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data, unsigned int flags) /*@globals fileSystem, internalState @*/ /*@modifies dbi, *dbcursor, fileSystem, internalState @*/ { rpmsql sql = (rpmsql) dbi->dbi_db; sqlite3 * sqlI = (sqlite3 *) sql->I; - SCP_t scp = scpLink(dbcursor); /* XXX scpNew() instead? */ + rpmscp scp = rpmscpLink(dbcursor); /* XXX rpmscpNew() instead? */ int rc = 0; dbg_keyval(__FUNCTION__, dbi, dbcursor, key, data, flags); @@ -1382,7 +1365,7 @@ sql_step(dbi, scp)); if (rc) rpmlog(RPMLOG_WARNING, "cdel(%s) sql_step rc %d\n", dbi->dbi_subfile, rc); - scp = scpFree(scp); + scp = rpmscpFree(scp); SQLDBDEBUG(dbi, (stderr, "<-- %s(%p,%p,%p,%p,0x%x) rc %d subfile %s %s\n", __FUNCTION__, dbi, dbcursor, key, data, flags, rc, dbi->dbi_subfile, _KEYDATA(key, NULL, data, NULL))); return rc; @@ -1399,14 +1382,14 @@ */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wswitch" -static int sql_cget (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, +static int sql_cget (rpmdbi dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data, unsigned int flags) /*@globals fileSystem, internalState @*/ /*@modifies dbi, dbcursor, *key, *data, fileSystem, internalState @*/ { rpmsql sql = (rpmsql) dbi->dbi_db; sqlite3 * sqlI = (sqlite3 *) sql->I; - SCP_t scp = (SCP_t)dbcursor; + rpmscp scp = (rpmscp)dbcursor; int rc = 0; int ix; @@ -1419,7 +1402,7 @@ dbi->dbi_subfile, scp, rc, flags, scp->av)); if (flags == DB_SET || scp->used == 0) { scp->used = 1; /* Signal this scp as now in use... */ - scp = scpReset(scp); /* Free av and avlen, reset counters.*/ + scp = rpmscpReset(scp); /* Free av and avlen, reset counters.*/ /* XXX: Should we also reset the key table here? Can you re-use a cursor? */ @@ -1454,7 +1437,7 @@ rc = sql_step(dbi, scp); if (rc) rpmlog(RPMLOG_WARNING, "cget(%s) sequential sql_step rc %d\n", dbi->dbi_subfile, rc); - scp = scpResetKeys(scp); + scp = rpmscpResetKeys(scp); scp->nkeys = scp->nr; scp->keys = (DBT **) xcalloc(scp->nkeys, sizeof(*scp->keys)); for (ix = 0; ix < scp->nkeys; ix++) { @@ -1465,7 +1448,7 @@ } } else { /* We're only scanning ONE element */ - scp = scpResetKeys(scp); + scp = rpmscpResetKeys(scp); scp->nkeys = 1; scp->keys = (DBT **) xcalloc(scp->nkeys, sizeof(*scp->keys)); scp->keys[0] = (DBT *) xmalloc(sizeof(*scp->keys[0])); @@ -1474,7 +1457,7 @@ memcpy(scp->keys[0]->data, key->data, key->size); } - scp = scpReset(scp); + scp = rpmscpReset(scp); /* Prepare SQL statement to retrieve the value for the current key */ assert(scp->cmd == NULL); /* XXX memleak prevention */ @@ -1486,7 +1469,7 @@ if (rc) rpmlog(RPMLOG_WARNING, "cget(%s) prepare %s (%d)\n", dbi->dbi_subfile, sqlite3_errmsg(sqlI), rc); } - scp = scpResetAv(scp); + scp = rpmscpResetAv(scp); /* Now continue with a normal retrive based on key */ if ((scp->rx + 1) > scp->nkeys ) @@ -1574,14 +1557,14 @@ * @param flags (unused) * @return 0 on success */ -static int sql_cput (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, +static int sql_cput (rpmdbi dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data, unsigned int flags) /*@globals fileSystem, internalState @*/ /*@modifies dbi, *dbcursor, fileSystem, internalState @*/ { rpmsql sql = (rpmsql) dbi->dbi_db; sqlite3 * sqlI = (sqlite3 *) sql->I; - SCP_t scp = scpLink(dbcursor); /* XXX scpNew() instead? */ + rpmscp scp = rpmscpLink(dbcursor); /* XXX scpNew() instead? */ int rc = 0; dbg_keyval("sql_cput", dbi, dbcursor, key, data, flags); @@ -1606,7 +1589,7 @@ break; } - scp = scpFree(scp); + scp = rpmscpFree(scp); SQLDBDEBUG(dbi, (stderr, "<-- %s(%p,%p,%p,%p,0x%x) rc %d subfile %s %s\n", __FUNCTION__, dbi, dbcursor, key, data, flags, rc, dbi->dbi_subfile, _KEYDATA(key, NULL, data, NULL))); return rc; @@ -1617,7 +1600,7 @@ * @param dbi index database handle * @return 0 no */ -static int sql_byteswapped (dbiIndex dbi) +static int sql_byteswapped (rpmdbi dbi) /*@globals fileSystem, internalState @*/ /*@modifies fileSystem, internalState @*/ { @@ -1636,8 +1619,8 @@ * @param flags DB_CREATE or 0 * @return 0 on success */ -static int sql_associate (/*@unused@*/ dbiIndex dbi, - /*@unused@*/ dbiIndex dbisecondary, +static int sql_associate (/*@unused@*/ rpmdbi dbi, + /*@unused@*/ rpmdbi dbisecondary, /*@unused@*/int (*callback) (DB *, const DBT *, const DBT *, DBT *), /*@unused@*/ unsigned int flags) /*@*/ @@ -1655,8 +1638,8 @@ * @param flags DB_CREATE or 0 * @return 0 on success */ -static int sql_associate_foreign (/*@unused@*/ dbiIndex dbi, - /*@unused@*/ dbiIndex dbisecondary, +static int sql_associate_foreign (/*@unused@*/ rpmdbi dbi, + /*@unused@*/ rpmdbi dbisecondary, /*@unused@*/int (*callback) (DB *, const DBT *, DBT *, const DBT *, int *), /*@unused@*/ unsigned int flags) /*@*/ @@ -1674,7 +1657,7 @@ * @param flags DB_JOIN_NOSORT or 0 * @return 0 on success */ -static int sql_join (/*@unused@*/ dbiIndex dbi, +static int sql_join (/*@unused@*/ rpmdbi dbi, /*@unused@*/ DBC ** curslist, /*@unused@*/ /*@out@*/ DBC ** dbcp, /*@unused@*/ unsigned int flags) @@ -1694,7 +1677,7 @@ * @param flags DB_POSITION for same position, 0 for uninitialized * @return 0 on success */ -static int sql_cdup (/*@unused@*/ dbiIndex dbi, +static int sql_cdup (/*@unused@*/ rpmdbi dbi, /*@unused@*/ DBC * dbcursor, /*@unused@*/ /*@out@*/ DBC ** dbcp, /*@unused@*/ unsigned int flags) @@ -1716,7 +1699,7 @@ * @param flags DB_NEXT, DB_SET, or 0 * @return 0 on success */ -static int sql_cpget (/*@unused@*/ dbiIndex dbi, +static int sql_cpget (/*@unused@*/ rpmdbi dbi, /*@unused@*/ /*@null@*/ DBC * dbcursor, /*@unused@*/ DBT * key, /*@unused@*/ DBT * pkey, @@ -1738,7 +1721,7 @@ * @param flags (unused) * @return 0 on success */ -static int sql_ccount (/*@unused@*/ dbiIndex dbi, +static int sql_ccount (/*@unused@*/ rpmdbi dbi, /*@unused@*/ DBC * dbcursor, /*@unused@*/ /*@out@*/ unsigned int * countp, /*@unused@*/ unsigned int flags) @@ -1752,7 +1735,7 @@ static int sql_stat_cb(void * _dbi, int argc, char ** argv, char ** cols) { - dbiIndex dbi = (dbiIndex) _dbi; + rpmdbi dbi = (rpmdbi) _dbi; int rc = -1; if (dbi && argc == 1) { char * end = NULL; @@ -1769,7 +1752,7 @@ * @param flags retrieve statistics that don't require traversal? * @return 0 on success */ -static int sql_stat (dbiIndex dbi, /*@unused@*/ unsigned int flags) +static int sql_stat (rpmdbi dbi, /*@unused@*/ unsigned int flags) /*@globals fileSystem, internalState @*/ /*@modifies dbi, fileSystem, internalState @*/ { @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org