- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# rpmdb/rpmdb.h

Go to the documentation of this file.

    00001 #ifndef H_RPMDB
    00002 #define H_RPMDB
    00003 /*@-bounds@*/
    00004
    00010 #include <assert.h>
    00011 #include <rpmlib.h>
    00012 #include <mire.h>
    00013 #if defined(WITH_DB)
    00014 #include "db.h"
    00015 #else
    00016 #include "db_emu.h"
    00017 #endif
    00018
    00019 /*@-exportlocal@*/
    00020 /*@unchecked@*/
    00021 extern int _rpmdb_debug;
    00022 /*@=exportlocal@*/
    00023
    00024 #ifdef  NOTYET
    00025
    00028 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmdb_s * rpmdb;
    00029
    00033 typedef /*@abstract@*/ struct rpmdbMatchIterator_s * rpmdbMatchIterator;
    00034 #endif
    00035
    00038 typedef /*@abstract@*/ struct _dbiIndexItem * dbiIndexItem;
    00039
    00043 typedef /*@abstract@*/ struct _dbiIndexSet * dbiIndexSet;
    00044
    00047 typedef /*@abstract@*/ struct _dbiIndex * dbiIndex;
    00048
    00049 #if defined(_RPMDB_INTERNAL)
    00050 #include <rpmsw.h>
    00051 #if !defined(SWIG)      /* XXX inline dbiFoo() need */
    00052
    00057 struct _dbiIndexItem {
    00058     uint32_t hdrNum;
    00059     uint32_t tagNum;
    00060     uint32_t fpNum;
    00061 };
    00062
    00066 struct _dbiIndexSet {
    00067 /*@owned@*/ struct _dbiIndexItem * recs;
    00068     int count;
    00069 };
    00070
    00074 struct _dbiVec {
    00075     int dbv_major;
    00076     int dbv_minor;
    00077     int dbv_patch;
    00085     int (*open) (rpmdb rpmdb, rpmTag rpmtag, /*@out@*/ dbiIndex * dbip)
    00086         /*@globals fileSystem @*/
    00087         /*@modifies *dbip, fileSystem @*/;
    00088
    00095     int (*close) (/*@only@*/ dbiIndex dbi, unsigned int flags)
    00096         /*@globals fileSystem @*/
    00097         /*@modifies dbi, fileSystem @*/;
    00098
    00105     int (*sync) (dbiIndex dbi, unsigned int flags)
    00106         /*@globals fileSystem @*/
    00107         /*@modifies fileSystem @*/;
    00108
    00117     int (*associate) (dbiIndex dbi, dbiIndex dbisecondary,
    00118                 int (*callback) (DB *, const DBT *, const DBT *, DBT *),
    00119                 unsigned int flags)
    00120         /*@globals fileSystem @*/
    00121         /*@modifies dbi, fileSystem @*/;
    00122
    00131     int (*join) (dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
    00132                 unsigned int flags)
    00133         /*@globals fileSystem @*/
    00134         /*@modifies dbi, *dbcp, fileSystem @*/;
    00135
    00144     int (*copen) (dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
    00145                         /*@out@*/ DBC ** dbcp, unsigned int dbiflags)
    00146         /*@globals fileSystem @*/
    00147         /*@modifies dbi, *txnid, *dbcp, fileSystem @*/;
    00148
    00156     int (*cclose) (dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
    00157         /*@globals fileSystem @*/
    00158         /*@modifies dbi, *dbcursor, fileSystem @*/;
    00159
    00168     int (*cdup) (dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
    00169                 unsigned int flags)
    00170         /*@globals fileSystem @*/
    00171         /*@modifies dbi, *dbcp, fileSystem @*/;
    00172
    00182     int (*cdel) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
    00183                         unsigned int flags)
    00184         /*@globals fileSystem @*/
    00185         /*@modifies *dbcursor, fileSystem @*/;
    00186
    00196     int (*cget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
    00197                         unsigned int flags)
    00198         /*@globals fileSystem @*/
    00199         /*@modifies *dbcursor, *key, *data, fileSystem @*/;
    00200
    00211     int (*cpget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor,
    00212                 DBT * key, DBT * pkey, DBT * data, unsigned int flags)
    00213         /*@globals fileSystem @*/
    00214         /*@modifies *dbcursor, *key, *pkey, *data, fileSystem @*/;
    00215
    00225     int (*cput) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
    00226                         unsigned int flags)
    00227         /*@globals fileSystem @*/
    00228         /*@modifies *dbcursor, fileSystem @*/;
    00229
    00238     int (*ccount) (dbiIndex dbi, DBC * dbcursor,
    00239                         /*@out@*/ unsigned int * countp,
    00240                         unsigned int flags)
    00241         /*@globals fileSystem @*/
    00242         /*@modifies *dbcursor, fileSystem @*/;
    00243
    00249     int (*byteswapped) (dbiIndex dbi)
    00250         /*@globals fileSystem @*/
    00251         /*@modifies fileSystem @*/;
    00252
    00259     int (*stat) (dbiIndex dbi, unsigned int flags)
    00260         /*@globals fileSystem @*/
    00261         /*@modifies dbi, fileSystem @*/;
    00262 };
    00263
    00267 struct _dbiIndex {
    00268 /*@relnull@*/
    00269     const char * dbi_root;
    00270 /*@null@*/
    00271     const char * dbi_home;
    00272 /*@relnull@*/
    00273     const char * dbi_file;
    00274 /*@relnull@*/
    00275     const char * dbi_subfile;
    00276 /*@null@*/
    00277     const char * dbi_tmpdir;
    00279     int dbi_ecflags;
    00280     int dbi_cflags;
    00281     int dbi_oeflags;
    00282     int dbi_eflags;
    00283     int dbi_oflags;
    00284     int dbi_tflags;
    00286     int dbi_type;
    00287     unsigned dbi_mode;
    00288     int dbi_perms;
    00289     long dbi_shmkey;
    00290     int dbi_api;
    00292     int dbi_verify_on_close;
    00293     int dbi_use_dbenv;
    00294     int dbi_permit_dups;
    00295     int dbi_no_fsync;
    00296     int dbi_no_dbsync;
    00297     int dbi_lockdbfd;
    00298     int dbi_temporary;
    00299     int dbi_noload;
    00300     int dbi_debug;
    00301     int dbi_byteswapped;
    00302
    00303 /*@null@*/
    00304     char * dbi_host;
    00305     unsigned long dbi_cl_timeout;
    00306     unsigned long dbi_sv_timeout;
    00307
    00308         /* dbenv parameters */
    00309     int dbi_lorder;
    00310 /*@unused@*/
    00311     /* XXX db-4.3.14 adds dbenv as 1st arg. */
    00312     void (*db_errcall) (void * dbenv, const char *db_errpfx, char *buffer)
    00313         /*@globals fileSystem @*/
    00314         /*@modifies fileSystem @*/;
    00315 /*@unused@*/ /*@shared@*/
    00316     FILE *      dbi_errfile;
    00317     const char * dbi_errpfx;
    00318     int dbi_verbose;
    00319     int dbi_region_init;
    00320     unsigned int dbi_thread_count;
    00321         /* locking sub-system parameters */
    00322     unsigned int dbi_lk_max_lockers;
    00323     unsigned int dbi_lk_max_locks;
    00324     unsigned int dbi_lk_max_objects;
    00325     unsigned int dbi_lk_detect;
    00326 /*@unused@*/
    00327     int dbi_lk_nmodes;
    00328 /*@unused@*/
    00329     unsigned char * dbi_lk_conflicts;
    00330         /* logging sub-system parameters */
    00331     unsigned int dbi_lg_bsize;
    00332 /*@unused@*/
    00333     const char * dbi_lg_dir;
    00334 /*@unused@*/
    00335     unsigned int dbi_lg_filemode;
    00336     unsigned int dbi_lg_max;
    00337     unsigned int dbi_lg_regionmax;
    00338         /* mpool sub-system parameters */
    00339     int dbi_mmapsize;
    00340     int dbi_cachesize;
    00341         /* mutex sub-system parameters */
    00342     unsigned int dbi_mutex_align;
    00343     unsigned int dbi_mutex_increment;
    00344     unsigned int dbi_mutex_max;
    00345     unsigned int dbi_mutex_tas_spins;
    00346         /* replication sub-system parameters */
    00347         /* sequences sub-system parameters */
    00348     unsigned int dbi_seq_cachesize;
    00349     unsigned int dbi_seq_flags;
    00350 #if 0   /* needs signed 64 bit type */
    00351     int64_t dbi_seq_min;
    00352     int64_t dbi_seq_max;
    00353 #endif
    00354         /* transaction sub-system parameters */
    00355     unsigned int dbi_tx_max;
    00356 #if 0
    00357     int (*dbi_tx_recover) (DB_ENV *dbenv, DBT *log_rec,
    00358                                 DB_LSN *lsnp, int redo, void *info)
    00359         /*@globals fileSystem @*/
    00360         /*@modifies fileSystem @*/;
    00361 #endif
    00362         /* dbinfo parameters */
    00363     int dbi_pagesize;
    00364 /*@unused@*/ /*@null@*/
    00365     void * (*dbi_malloc) (size_t nbytes)
    00366         /*@*/;
    00367         /* hash access parameters */
    00368     unsigned int dbi_h_ffactor;
    00369     unsigned int (*dbi_h_hash_fcn) (DB *, const void *bytes,
    00370                                 unsigned int length)
    00371         /*@*/;
    00372     unsigned int dbi_h_nelem;
    00373     unsigned int dbi_h_flags;
    00374     int (*dbi_h_dup_compare_fcn) (DB *, const DBT *, const DBT *)
    00375         /*@*/;
    00376         /* btree access parameters */
    00377     int dbi_bt_flags;
    00378     int dbi_bt_minkey;
    00379     int (*dbi_bt_compare_fcn) (DB *, const DBT *, const DBT *)
    00380         /*@*/;
    00381     int (*dbi_bt_dup_compare_fcn) (DB *, const DBT *, const DBT *)
    00382         /*@*/;
    00383     size_t (*dbi_bt_prefix_fcn) (DB *, const DBT *, const DBT *)
    00384         /*@*/;
    00385         /* recno access parameters */
    00386     int dbi_re_flags;
    00387     int dbi_re_delim;
    00388     unsigned int dbi_re_len;
    00389     int dbi_re_pad;
    00390     const char * dbi_re_source;
    00391         /* queue access parameters */
    00392     unsigned int dbi_q_extentsize;
    00393
    00394 /*@refcounted@*/
    00395     rpmdb dbi_rpmdb;
    00396     rpmTag dbi_rpmtag;
    00397     size_t dbi_jlen;
    00399 /*@only@*//*@relnull@*/
    00400     DB * dbi_db;
    00401 /*@only@*//*@null@*/
    00402     DB_TXN * dbi_txnid;
    00403 /*@only@*//*@null@*/
    00404     void * dbi_stats;
    00406 /*@observer@*/
    00407     const struct _dbiVec * dbi_vec;
    00409 };
    00410 #endif  /* !defined(SWIG) */
    00411
    00415 struct rpmdb_s {
    00416 /*@owned@*/ /*@relnull@*/
    00417     const char * db_root;
    00418 /*@owned@*/
    00419     const char * db_home;
    00420     int         db_flags;
    00421     int         db_mode;
    00422     int         db_perms;
    00423     int         db_api;
    00424 /*@owned@*/
    00425     const char * db_errpfx;
    00427     int         db_remove_env;
    00428     int         db_filter_dups;
    00429     int         db_verifying;
    00430
    00431     int         db_chrootDone;
    00432     void (*db_errcall) (const char * db_errpfx, char * buffer)
    00433         /*@*/;
    00434 /*@shared@*/
    00435     FILE *      db_errfile;
    00436 /*@only@*/
    00437     void * (*db_malloc) (size_t nbytes)
    00438         /*@*/;
    00439 /*@only@*/
    00440     void * (*db_realloc) (/*@only@*//*@null@*/ void * ptr, size_t nbytes)
    00441         /*@*/;
    00442     void (*db_free) (/*@only@*/ void * ptr)
    00443         /*@modifies *ptr @*/;
    00444
    00445     int (*db_export) (rpmdb db, Header h, int adding);
    00446
    00447 /*@only@*/ /*@null@*/
    00448     unsigned char * db_bits;
    00449     int         db_nbits;
    00450     rpmdb       db_next;
    00451     int         db_opens;
    00452 /*@only@*/ /*@null@*/
    00453     void *      db_dbenv;
    00454     tagStore_t  db_tags;
    00455     size_t      db_ndbi;
    00456 /*@only@*/ /*@null@*/
    00457     dbiIndex * _dbi;
    00459     struct rpmop_s db_getops;
    00460     struct rpmop_s db_putops;
    00461     struct rpmop_s db_delops;
    00463 /*@refs@*/
    00464     int nrefs;
    00465 };
    00466 #endif  /* defined(_RPMDB_INTERNAL) */
    00467
    00468 /* for RPM's internal use only */
    00469
    00472 enum rpmdbFlags {
    00473         RPMDB_FLAG_JUSTCHECK    = (1 << 0),
    00474         RPMDB_FLAG_MINIMAL      = (1 << 1),
    00475 /*@-enummemuse@*/
    00476         RPMDB_FLAG_CHROOT       = (1 << 2)
    00477 /*@=enummemuse@*/
    00478 };
    00479
    00480 #ifdef __cplusplus
    00481 extern "C" {
    00482 #endif
    00483
    00484 #if defined(_RPMDB_INTERNAL)
    00485 /*@-exportlocal@*/
    00486 #if defined(WITH_DB) || defined(WITH_SQLITE)
    00487
    00493 /*@unused@*/ /*@only@*/ /*@null@*/
    00494 dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
    00495         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
    00496         /*@modifies rpmGlobalMacroContext, internalState @*/;
    00497
    00503 /*@null@*/
    00504 dbiIndex db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi)
    00505         /*@*/;
    00506
    00513 /*@-redecl@*/
    00514 /*@exposed@*/
    00515 extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
    00516         /*@*/;
    00517 /*@=redecl@*/
    00518 #endif
    00519
    00527 /*@only@*/ /*@null@*/ dbiIndex dbiOpen(/*@null@*/ rpmdb db, rpmTag rpmtag,
    00528                 unsigned int flags)
    00529         /*@globals rpmGlobalMacroContext, errno, h_errno @*/
    00530         /*@modifies db, rpmGlobalMacroContext, errno @*/;
    00531
    00538 void * dbiStatsAccumulator(dbiIndex dbi, int opx)
    00539         /*@*/;
    00540
    00541 #if !defined(SWIG)
    00542 /*@-globuse -mustmod @*/ /* FIX: vector annotations */
    00551 /*@unused@*/ static inline
    00552 int dbiCopen(dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
    00553                 /*@out@*/ DBC ** dbcp, unsigned int flags)
    00554         /*@globals fileSystem @*/
    00555         /*@modifies dbi, *dbcp, fileSystem @*/
    00556 {
    00557     return (*dbi->dbi_vec->copen) (dbi, txnid, dbcp, flags);
    00558 }
    00559
    00567 /*@unused@*/ static inline
    00568 int dbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
    00569         /*@globals fileSystem @*/
    00570         /*@modifies dbi, *dbcursor, fileSystem @*/
    00571 {
    00572     return (*dbi->dbi_vec->cclose) (dbi, dbcursor, flags);
    00573 }
    00574
    00583 /*@unused@*/ static inline
    00584 int dbiCdup(dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
    00585                 unsigned int flags)
    00586         /*@modifies dbi, *dbcp @*/
    00587 {
    00588     return (*dbi->dbi_vec->cdup) (dbi, dbcursor, dbcp, flags);
    00589 }
    00590
    00600 /*@unused@*/ static inline
    00601 int dbiDel(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
    00602                 unsigned int flags)
    00603         /*@globals fileSystem, internalState @*/
    00604         /*@modifies dbi, *dbcursor, fileSystem, internalState @*/
    00605 {
    00606     rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 16);     /* RPMTS_OP_DBDEL */
    00607     int rc;
    00608     assert(key->data != NULL && key->size > 0);
    00609     (void) rpmswEnter(sw, 0);
    00610     rc = (dbi->dbi_vec->cdel) (dbi, dbcursor, key, data, flags);
    00611     (void) rpmswExit(sw, data->size);
    00612     return rc;
    00613 }
    00614
    00624 /*@unused@*/ static inline
    00625 int dbiGet(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
    00626                 unsigned int flags)
    00627         /*@globals fileSystem, internalState @*/
    00628         /*@modifies dbi, *dbcursor, *key, *data, fileSystem, internalState @*/
    00629 {
    00630     rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 14);     /* RPMTS_OP_DBGET */
    00631     int rc;
    00632     assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
    00633     (void) rpmswEnter(sw, 0);
    00634     rc = (dbi->dbi_vec->cget) (dbi, dbcursor, key, data, flags);
    00635     (void) rpmswExit(sw, data->size);
    00636     return rc;
    00637 }
    00638
    00649 /*@unused@*/ static inline
    00650 int dbiPget(dbiIndex dbi, /*@null@*/ DBC * dbcursor,
    00651                 DBT * key, DBT * pkey, DBT * data, unsigned int flags)
    00652         /*@globals fileSystem, internalState @*/
    00653         /*@modifies dbi, *dbcursor, *key, *pkey, *data, fileSystem, internalState @*/
    00654 {
    00655     rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 14);     /* RPMTS_OP_DBGET */
    00656     int rc;
    00657     assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
    00658     (void) rpmswEnter(sw, 0);
    00659     rc = (dbi->dbi_vec->cpget) (dbi, dbcursor, key, pkey, data, flags);
    00660     (void) rpmswExit(sw, data->size);
    00661     return rc;
    00662 }
    00663
    00673 /*@unused@*/ static inline
    00674 int dbiPut(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
    00675                 unsigned int flags)
    00676         /*@globals fileSystem, internalState @*/
    00677         /*@modifies dbi, *dbcursor, *key, fileSystem, internalState @*/
    00678 {
    00679     rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 15);     /* RPMTS_OP_DBPUT */
    00680     int rc;
    00681     assert(key->data != NULL && key->size > 0 && data->data != NULL && data->size > 0);
    00682     (void) rpmswEnter(sw, 0);
    00683     rc = (dbi->dbi_vec->cput) (dbi, dbcursor, key, data, flags);
    00684     (void) rpmswExit(sw, data->size);
    00685     return rc;
    00686 }
    00687
    00696 /*@unused@*/ static inline
    00697 int dbiCount(dbiIndex dbi, DBC * dbcursor, /*@out@*/ unsigned int * countp,
    00698                 unsigned int flags)
    00699         /*@globals fileSystem @*/
    00700         /*@modifies *dbcursor, fileSystem @*/
    00701 {
    00702     return (*dbi->dbi_vec->ccount) (dbi, dbcursor, countp, flags);
    00703 }
    00704
    00711 /*@unused@*/ static inline
    00712 int dbiVerify(/*@only@*/ dbiIndex dbi, unsigned int flags)
    00713         /*@globals fileSystem @*/
    00714         /*@modifies dbi, fileSystem @*/
    00715 {
    00716     dbi->dbi_verify_on_close = 1;
    00717     return (*dbi->dbi_vec->close) (dbi, flags);
    00718 }
    00719
    00726 /*@unused@*/ static inline
    00727 int dbiClose(/*@only@*/ dbiIndex dbi, unsigned int flags)
    00728         /*@globals fileSystem @*/
    00729         /*@modifies dbi, fileSystem @*/
    00730 {
    00731     return (*dbi->dbi_vec->close) (dbi, flags);
    00732 }
    00733
    00740 /*@unused@*/ static inline
    00741 int dbiSync (dbiIndex dbi, unsigned int flags)
    00742         /*@globals fileSystem @*/
    00743         /*@modifies fileSystem @*/
    00744 {
    00745     return (*dbi->dbi_vec->sync) (dbi, flags);
    00746 }
    00747
    00756 /*@unused@*/ static inline
    00757 int dbiAssociate(dbiIndex dbi, dbiIndex dbisecondary,
    00758                 int (*callback) (DB *, const DBT *, const DBT *, DBT *),
    00759                 unsigned int flags)
    00760         /*@globals fileSystem @*/
    00761         /*@modifies dbi, fileSystem @*/
    00762 {
    00763     return (*dbi->dbi_vec->associate) (dbi, dbisecondary, callback, flags);
    00764 }
    00765
    00774 /*@unused@*/ static inline
    00775 int dbiJoin(dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
    00776                 unsigned int flags)
    00777         /*@globals fileSystem @*/
    00778         /*@modifies dbi, *dbcp, fileSystem @*/
    00779 {
    00780     return (*dbi->dbi_vec->join) (dbi, curslist, dbcp, flags);
    00781 }
    00782
    00788 /*@unused@*/ static inline
    00789 int dbiByteSwapped(dbiIndex dbi)
    00790         /*@modifies dbi @*/
    00791 {
    00792     if (dbi->dbi_byteswapped == -1)
    00793         dbi->dbi_byteswapped = (*dbi->dbi_vec->byteswapped) (dbi);
    00794     return dbi->dbi_byteswapped;
    00795 }
    00796
    00803 /*@unused@*/ static inline
    00804 int dbiStat(dbiIndex dbi, unsigned int flags)
    00805         /*@modifies dbi @*/
    00806 {
    00807     return (*dbi->dbi_vec->stat) (dbi, flags);
    00808 }
    00809
    00815 /*@unused@*/ static inline /*@observer@*/ /*@null@*/
    00816 DB_TXN * dbiTxnid(dbiIndex dbi)
    00817         /*@*/
    00818 {
    00819     return dbi->dbi_txnid;
    00820 }
    00821 /*@=globuse =mustmod @*/
    00822 #endif  /* !defined(SWIG) */
    00823
    00824 /*@=exportlocal@*/
    00825
    00831 /*@null@*/
    00832 dbiIndexSet dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet set)
    00833         /*@modifies set @*/;
    00834
    00840 unsigned int dbiIndexSetCount(dbiIndexSet set)
    00841         /*@*/;
    00842
    00849 unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno)
    00850         /*@*/;
    00851
    00858 unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno)
    00859         /*@*/;
    00860 #endif  /* defined(_RPMDB_INTERNAL) */
    00861
    00868 /*@unused@*/ /*@null@*/
    00869 rpmdb rpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg)
    00870         /*@modifies db @*/;
    00871
    00873 /*@-exportlocal@*/
    00874 /*@null@*/
    00875 rpmdb XrpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg,
    00876                 const char * fn, unsigned ln)
    00877         /*@modifies db @*/;
    00878 /*@=exportlocal@*/
    00879 #define rpmdbUnlink(_db, _msg)  XrpmdbUnlink(_db, _msg, __FILE__, __LINE__)
    00880
    00887 /*@unused@*/
    00888 rpmdb rpmdbLink (rpmdb db, const char * msg)
    00889         /*@modifies db @*/;
    00890
    00892 /*@-exportlocal@*/
    00893 rpmdb XrpmdbLink (rpmdb db, const char * msg,
    00894                 const char * fn, unsigned ln)
    00895         /*@modifies db @*/;
    00896 /*@=exportlocal@*/
    00897 #define rpmdbLink(_db, _msg)    XrpmdbLink(_db, _msg, __FILE__, __LINE__)
    00898
    00901 /*@only@*/ /*@null@*/
    00902 rpmdb rpmdbNew(/*@kept@*/ /*@null@*/ const char * root,
    00903                 /*@kept@*/ /*@null@*/ const char * home,
    00904                 int mode, int perms, int flags);
    00905
    00908 int rpmdbOpenDatabase(/*@null@*/ const char * prefix,
    00909                 /*@null@*/ const char * dbpath,
    00910                 int _dbapi, /*@null@*/ /*@out@*/ rpmdb *dbp,
    00911                 int mode, int perms, int flags)
    00912         /*@globals rpmGlobalMacroContext, h_errno,
    00913                 fileSystem, internalState @*/
    00914         /*@modifies *dbp, rpmGlobalMacroContext,
    00915                 fileSystem, internalState @*/;
    00916
    00925 int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp,
    00926                 int mode, int perms)
    00927         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00928         /*@modifies *dbp, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00929
    00936 int rpmdbInit(/*@null@*/ const char * prefix, int perms)
    00937         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00938         /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
    00939
    00945 int rpmdbVerifyAllDBI(rpmdb db)
    00946         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00947         /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00948
    00954 int rpmdbVerify(/*@null@*/ const char * prefix)
    00955         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00956         /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
    00957
    00964 int rpmdbBlockDBI(/*@null@*/ rpmdb db, int rpmtag)
    00965         /*@modifies db @*/;
    00966
    00973 int rpmdbCloseDBI(/*@null@*/ rpmdb db, int rpmtag)
    00974         /*@globals fileSystem @*/
    00975         /*@modifies db, fileSystem @*/;
    00976
    00982 int rpmdbClose (/*@killref@*/ /*@only@*/ /*@null@*/ rpmdb db)
    00983         /*@globals fileSystem @*/
    00984         /*@modifies db, fileSystem @*/;
    00985
    00991 int rpmdbSync (/*@null@*/ rpmdb db)
    00992         /*@globals fileSystem @*/
    00993         /*@modifies fileSystem @*/;
    00994
    01000 /*@-exportlocal@*/
    01001 int rpmdbOpenAll (/*@null@*/ rpmdb db)
    01002         /*@globals rpmGlobalMacroContext, h_errno @*/
    01003         /*@modifies db, rpmGlobalMacroContext @*/;
    01004 /*@=exportlocal@*/
    01005
    01012 int rpmdbCountPackages(/*@null@*/ rpmdb db, const char * name)
    01013         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01014         /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
    01015
    01021 unsigned int rpmdbGetIteratorOffset(/*@null@*/ rpmdbMatchIterator mi)
    01022         /*@*/;
    01023
    01028 unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi)
    01029         /*@*/;
    01030
    01036 int rpmdbGetIteratorCount(/*@null@*/ rpmdbMatchIterator mi)
    01037         /*@*/;
    01038
    01046 int rpmdbAppendIterator(/*@null@*/ rpmdbMatchIterator mi,
    01047                 /*@null@*/ const int * hdrNums, int nHdrNums)
    01048         /*@modifies mi @*/;
    01049
    01059 int rpmdbPruneIterator(/*@null@*/ rpmdbMatchIterator mi,
    01060                 /*@null@*/ int * hdrNums, int nHdrNums, int sorted)
    01061         /*@modifies mi, hdrNums @*/;
    01062
    01071 int rpmdbSetIteratorRE(/*@null@*/ rpmdbMatchIterator mi, rpmTag tag,
    01072                 rpmMireMode mode, /*@null@*/ const char * pattern)
    01073         /*@globals rpmGlobalMacroContext, h_errno @*/
    01074         /*@modifies mi, mode, rpmGlobalMacroContext @*/;
    01075
    01083 int rpmdbSetIteratorRewrite(/*@null@*/ rpmdbMatchIterator mi, int rewrite)
    01084         /*@modifies mi @*/;
    01085
    01092 int rpmdbSetIteratorModified(/*@null@*/ rpmdbMatchIterator mi, int modified)
    01093         /*@modifies mi @*/;
    01094
    01101 int rpmdbSetHdrChk(/*@null@*/ rpmdbMatchIterator mi, /*@null@*/ rpmts ts)
    01102         /*@modifies mi @*/;
    01103
    01112 /*@only@*/ /*@null@*/
    01113 rpmdbMatchIterator rpmdbInitIterator(/*@null@*/ rpmdb db, rpmTag rpmtag,
    01114                         /*@null@*/ const void * keyp, size_t keylen)
    01115         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01116         /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
    01117
    01123 /*@null@*/
    01124 Header rpmdbNextIterator(/*@null@*/ rpmdbMatchIterator mi)
    01125         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01126         /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
    01127
    01137 /*@mayexit@*/
    01138 int rpmdbCheckTerminate(int terminate)
    01139         /*@globals fileSystem, internalState @*/
    01140         /*@modifies fileSystem, internalState @*/;
    01141
    01145 /*@mayexit@*/
    01146 int rpmdbCheckSignals(void)
    01147         /*@globals fileSystem, internalState @*/
    01148         /*@modifies fileSystem, internalState @*/;
    01149
    01155 /*@null@*/
    01156 rpmdbMatchIterator rpmdbFreeIterator(/*@only@*/ /*@null@*/rpmdbMatchIterator mi)
    01157         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01158         /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
    01159
    01168 int rpmdbAdd(/*@null@*/ rpmdb db, int iid, Header h, /*@null@*/ rpmts ts)
    01169         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01170         /*@modifies db, h, ts,
    01171                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    01172
    01181 int rpmdbRemove(/*@null@*/ rpmdb db, /*@unused@*/ int rid, unsigned int hdrNum,
    01182                 /*@null@*/ rpmts ts)
    01183         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01184         /*@modifies db, ts,
    01185                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    01186
    01193 int rpmdbRebuild(/*@null@*/ const char * prefix, /*@null@*/ rpmts ts)
    01194         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01195         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    01196
    01200 /*@unused@*/
    01201 int rpm_mergesort(void *base, size_t nmemb, size_t size,
    01202                 int (*cmp) (const void *, const void *))
    01203         /*@globals errno @*/
    01204         /*@modifies base, errno @*/;
    01205
    01206 #ifdef __cplusplus
    01207 }
    01208 #endif
    01209
    01210 /*@=bounds@*/
    01211 #endif  /* H_RPMDB */