rpm 5.2.1

- 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 <rpmtypes.h>
    00012 #include <mire.h>
    00013 #if defined(_RPMDB_INTERNAL)
    00014 #if defined(WITH_DB)
    00015 #include "db.h"
    00016 #else
    00017 #include "db_emu.h"
    00018 #endif
    00019 #endif
    00020
    00021 #if defined(_RPMDB_INTERNAL)
    00022 #define DBT_INIT /*@-fullinitblock@*/ {0} /*@-fullinitblock@*/  /* -Wno-missing-field-initializers */
    00023 #endif
    00024
    00025 /*@-exportlocal@*/
    00026 /*@unchecked@*/
    00027 extern int _rpmdb_debug;
    00028 /*@=exportlocal@*/
    00029
    00030 #ifdef  NOTYET
    00031
    00034 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmdb_s * rpmdb;
    00035
    00039 typedef /*@abstract@*/ struct rpmmi_s * rpmmi;
    00040 #endif
    00041
    00044 typedef /*@abstract@*/ struct _dbiIndexItem * dbiIndexItem;
    00045
    00049 typedef /*@abstract@*/ struct _dbiIndexSet * dbiIndexSet;
    00050
    00053 typedef /*@abstract@*/ struct _dbiIndex * dbiIndex;
    00054
    00055 #if defined(_RPMDB_INTERNAL)
    00056 #include <rpmio.h>
    00057 #include <rpmsw.h>
    00058
    00059 #if !defined(SWIG)      /* XXX inline dbiFoo() need */
    00060
    00063 struct _dbiIndexItem {
    00064     rpmuint32_t hdrNum;
    00065     rpmuint32_t tagNum;
    00066     rpmuint32_t fpNum;
    00067 };
    00068
    00072 struct _dbiIndexSet {
    00073 /*@owned@*/ struct _dbiIndexItem * recs;
    00074     int count;
    00075 };
    00076
    00080 struct _dbiVec {
    00081     int dbv_major;
    00082     int dbv_minor;
    00083     int dbv_patch;
    00091     int (*open) (rpmdb rpmdb, rpmTag tag, /*@out@*/ dbiIndex * dbip)
    00092         /*@globals fileSystem @*/
    00093         /*@modifies *dbip, fileSystem @*/;
    00094
    00101     int (*close) (/*@only@*/ dbiIndex dbi, unsigned int flags)
    00102         /*@globals fileSystem @*/
    00103         /*@modifies dbi, fileSystem @*/;
    00104
    00111     int (*sync) (dbiIndex dbi, unsigned int flags)
    00112         /*@globals fileSystem @*/
    00113         /*@modifies fileSystem @*/;
    00114
    00123     int (*associate) (dbiIndex dbi, dbiIndex dbisecondary,
    00124                 int (*callback) (DB *, const DBT *, const DBT *, DBT *),
    00125                 unsigned int flags)
    00126         /*@globals fileSystem @*/
    00127         /*@modifies dbi, fileSystem @*/;
    00128
    00137     int (*join) (dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
    00138                 unsigned int flags)
    00139         /*@globals fileSystem @*/
    00140         /*@modifies dbi, *dbcp, fileSystem @*/;
    00141
    00150     int (*copen) (dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
    00151                         /*@out@*/ DBC ** dbcp, unsigned int dbiflags)
    00152         /*@globals fileSystem @*/
    00153         /*@modifies dbi, *txnid, *dbcp, fileSystem @*/;
    00154
    00162     int (*cclose) (dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
    00163         /*@globals fileSystem @*/
    00164         /*@modifies dbi, *dbcursor, fileSystem @*/;
    00165
    00174     int (*cdup) (dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
    00175                 unsigned int flags)
    00176         /*@globals fileSystem @*/
    00177         /*@modifies dbi, *dbcp, fileSystem @*/;
    00178
    00188     int (*cdel) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
    00189                         unsigned int flags)
    00190         /*@globals fileSystem @*/
    00191         /*@modifies *dbcursor, fileSystem @*/;
    00192
    00202     int (*cget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
    00203                         unsigned int flags)
    00204         /*@globals fileSystem @*/
    00205         /*@modifies *dbcursor, *key, *data, fileSystem @*/;
    00206
    00217     int (*cpget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor,
    00218                 DBT * key, DBT * pkey, DBT * data, unsigned int flags)
    00219         /*@globals fileSystem @*/
    00220         /*@modifies *dbcursor, *key, *pkey, *data, fileSystem @*/;
    00221
    00231     int (*cput) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
    00232                         unsigned int flags)
    00233         /*@globals fileSystem @*/
    00234         /*@modifies *dbcursor, fileSystem @*/;
    00235
    00244     int (*ccount) (dbiIndex dbi, DBC * dbcursor,
    00245                         /*@out@*/ unsigned int * countp,
    00246                         unsigned int flags)
    00247         /*@globals fileSystem @*/
    00248         /*@modifies *dbcursor, fileSystem @*/;
    00249
    00255     int (*byteswapped) (dbiIndex dbi)
    00256         /*@globals fileSystem @*/
    00257         /*@modifies fileSystem @*/;
    00258
    00265     int (*stat) (dbiIndex dbi, unsigned int flags)
    00266         /*@globals fileSystem @*/
    00267         /*@modifies dbi, fileSystem @*/;
    00268 };
    00269
    00273 struct _dbiIndex {
    00274 /*@relnull@*/
    00275     const char * dbi_root;
    00276 /*@null@*/
    00277     const char * dbi_home;
    00278 /*@relnull@*/
    00279     const char * dbi_file;
    00280 /*@relnull@*/
    00281     const char * dbi_subfile;
    00282 /*@null@*/
    00283     const char * dbi_tmpdir;
    00285     int dbi_ecflags;
    00286     int dbi_cflags;
    00287     int dbi_oeflags;
    00288     int dbi_eflags;
    00289     int dbi_oflags;
    00290     int dbi_tflags;
    00292     int dbi_type;
    00293     unsigned dbi_mode;
    00294     int dbi_perms;
    00295     long dbi_shmkey;
    00296     int dbi_api;
    00298     int dbi_verify_on_close;
    00299     int dbi_use_dbenv;
    00300     int dbi_permit_dups;
    00301     int dbi_no_fsync;
    00302     int dbi_no_dbsync;
    00303     int dbi_lockdbfd;
    00304     int dbi_temporary;
    00305     int dbi_noload;
    00306     int dbi_debug;
    00307     int dbi_byteswapped;
    00308
    00309 /*@null@*/
    00310     char * dbi_host;
    00311     unsigned long dbi_cl_timeout;
    00312     unsigned long dbi_sv_timeout;
    00313
    00314         /* dbenv parameters */
    00315     int dbi_lorder;
    00316 /*@unused@*/
    00317     /* XXX db-4.3.14 adds dbenv as 1st arg. */
    00318     void (*db_errcall) (void * dbenv, const char *db_errpfx, char *buffer)
    00319         /*@globals fileSystem @*/
    00320         /*@modifies fileSystem @*/;
    00321 /*@unused@*/ /*@shared@*/
    00322     FILE *      dbi_errfile;
    00323     const char * dbi_errpfx;
    00324     int dbi_verbose;
    00325     int dbi_region_init;
    00326     unsigned int dbi_thread_count;
    00327         /* locking sub-system parameters */
    00328     unsigned int dbi_lk_max_lockers;
    00329     unsigned int dbi_lk_max_locks;
    00330     unsigned int dbi_lk_max_objects;
    00331     unsigned int dbi_lk_detect;
    00332 /*@unused@*/
    00333     int dbi_lk_nmodes;
    00334 /*@unused@*/
    00335     unsigned char * dbi_lk_conflicts;
    00336         /* logging sub-system parameters */
    00337     unsigned int dbi_lg_bsize;
    00338 /*@unused@*/
    00339     const char * dbi_lg_dir;
    00340 /*@unused@*/
    00341     unsigned int dbi_lg_filemode;
    00342     unsigned int dbi_lg_max;
    00343     unsigned int dbi_lg_regionmax;
    00344         /* mpool sub-system parameters */
    00345     int dbi_mmapsize;
    00346     int dbi_cachesize;
    00347         /* mutex sub-system parameters */
    00348     unsigned int dbi_mutex_align;
    00349     unsigned int dbi_mutex_increment;
    00350     unsigned int dbi_mutex_max;
    00351     unsigned int dbi_mutex_tas_spins;
    00352         /* replication sub-system parameters */
    00353         /* sequences sub-system parameters */
    00354     unsigned int dbi_seq_cachesize;
    00355     unsigned int dbi_seq_flags;
    00356 #if 0   /* needs signed 64 bit type */
    00357     int64_t dbi_seq_min;
    00358     int64_t dbi_seq_max;
    00359 #endif
    00360         /* transaction sub-system parameters */
    00361     unsigned int dbi_tx_max;
    00362 #if 0
    00363     int (*dbi_tx_recover) (DB_ENV *dbenv, DBT *log_rec,
    00364                                 DB_LSN *lsnp, int redo, void *info)
    00365         /*@globals fileSystem @*/
    00366         /*@modifies fileSystem @*/;
    00367 #endif
    00368         /* dbinfo parameters */
    00369     int dbi_pagesize;
    00370 /*@unused@*/ /*@null@*/
    00371     void * (*dbi_malloc) (size_t nbytes)
    00372         /*@*/;
    00373         /* hash access parameters */
    00374     unsigned int dbi_h_ffactor;
    00375     unsigned int (*dbi_h_hash_fcn) (DB *, const void *bytes,
    00376                                 unsigned int length)
    00377         /*@*/;
    00378     unsigned int dbi_h_nelem;
    00379     unsigned int dbi_h_flags;
    00380     int (*dbi_h_dup_compare_fcn) (DB *, const DBT *, const DBT *)
    00381         /*@*/;
    00382         /* btree access parameters */
    00383     int dbi_bt_flags;
    00384     int dbi_bt_minkey;
    00385     int (*dbi_bt_compare_fcn) (DB *, const DBT *, const DBT *)
    00386         /*@*/;
    00387     int (*dbi_bt_dup_compare_fcn) (DB *, const DBT *, const DBT *)
    00388         /*@*/;
    00389     size_t (*dbi_bt_prefix_fcn) (DB *, const DBT *, const DBT *)
    00390         /*@*/;
    00391         /* recno access parameters */
    00392     int dbi_re_flags;
    00393     int dbi_re_delim;
    00394     unsigned int dbi_re_len;
    00395     int dbi_re_pad;
    00396     const char * dbi_re_source;
    00397         /* queue access parameters */
    00398     unsigned int dbi_q_extentsize;
    00399
    00400 /*@refcounted@*/
    00401     rpmdb dbi_rpmdb;
    00402     rpmTag dbi_rpmtag;
    00403     size_t dbi_jlen;
    00405 /*@only@*//*@relnull@*/
    00406     DB * dbi_db;
    00407 /*@only@*//*@null@*/
    00408     DB_TXN * dbi_txnid;
    00409 /*@only@*//*@null@*/
    00410     void * dbi_stats;
    00412 /*@observer@*/
    00413     const struct _dbiVec * dbi_vec;
    00415 };
    00416 #endif  /* !defined(SWIG) */
    00417
    00421 struct rpmdb_s {
    00422     struct rpmioItem_s _item;
    00423 /*@owned@*/ /*@relnull@*/
    00424     const char * db_root;
    00425 /*@owned@*/
    00426     const char * db_home;
    00427     int         db_flags;
    00428     int         db_mode;
    00429     int         db_perms;
    00430     int         db_api;
    00431 /*@owned@*/
    00432     const char * db_errpfx;
    00434     int         db_remove_env;
    00435     int         db_filter_dups;
    00436     int         db_verifying;
    00437
    00438     int         db_chrootDone;
    00439     void (*db_errcall) (const char * db_errpfx, char * buffer)
    00440         /*@*/;
    00441 /*@shared@*/
    00442     FILE *      db_errfile;
    00443 /*@only@*/
    00444     void * (*db_malloc) (size_t nbytes)
    00445         /*@*/;
    00446 /*@only@*/
    00447     void * (*db_realloc) (/*@only@*//*@null@*/ void * ptr, size_t nbytes)
    00448         /*@*/;
    00449     void (*db_free) (/*@only@*/ void * ptr)
    00450         /*@modifies *ptr @*/;
    00451
    00452     int (*db_export) (rpmdb db, Header h, int adding);
    00453
    00454 /*@only@*/ /*@null@*/
    00455     unsigned char * db_bits;
    00456     int         db_nbits;
    00457     rpmdb       db_next;
    00458     int         db_opens;
    00459 /*@only@*/ /*@null@*/
    00460     void *      db_dbenv;
    00461     tagStore_t  db_tags;
    00462     size_t      db_ndbi;
    00463 /*@only@*/ /*@null@*/
    00464     dbiIndex * _dbi;
    00466     struct rpmop_s db_getops;
    00467     struct rpmop_s db_putops;
    00468     struct rpmop_s db_delops;
    00470 #if defined(__LCLINT__)
    00471 /*@refs@*/
    00472     int nrefs;
    00473 #endif
    00474 };
    00475 #endif  /* defined(_RPMDB_INTERNAL) */
    00476
    00477 /* for RPM's internal use only */
    00478
    00481 enum rpmdbFlags {
    00482         RPMDB_FLAG_JUSTCHECK    = (1 << 0),
    00483         RPMDB_FLAG_MINIMAL      = (1 << 1),
    00484 /*@-enummemuse@*/
    00485         RPMDB_FLAG_CHROOT       = (1 << 2)
    00486 /*@=enummemuse@*/
    00487 };
    00488
    00489 #ifdef __cplusplus
    00490 extern "C" {
    00491 #endif
    00492
    00493 #if defined(_RPMDB_INTERNAL)
    00494 /*@-exportlocal@*/
    00495 #if defined(WITH_DB) || defined(WITH_SQLITE)
    00496
    00502 /*@unused@*/ /*@only@*/ /*@null@*/
    00503 dbiIndex db3New(rpmdb rpmdb, rpmTag tag)
    00504         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
    00505         /*@modifies rpmGlobalMacroContext, internalState @*/;
    00506
    00512 /*@null@*/
    00513 dbiIndex db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi)
    00514         /*@*/;
    00515
    00522 /*@-redecl@*/
    00523 /*@exposed@*/
    00524 extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
    00525         /*@*/;
    00526 /*@=redecl@*/
    00527 #endif
    00528
    00536 /*@only@*/ /*@null@*/ dbiIndex dbiOpen(/*@null@*/ rpmdb db, rpmTag tag,
    00537                 unsigned int flags)
    00538         /*@globals rpmGlobalMacroContext, errno, h_errno, internalState @*/
    00539         /*@modifies db, rpmGlobalMacroContext, errno, internalState @*/;
    00540
    00547 void * dbiStatsAccumulator(dbiIndex dbi, int opx)
    00548         /*@*/;
    00549
    00550 #if !defined(SWIG)
    00551 /*@-globuse -mustmod @*/ /* FIX: vector annotations */
    00560 /*@unused@*/ static inline
    00561 int dbiCopen(dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
    00562                 /*@out@*/ DBC ** dbcp, unsigned int flags)
    00563         /*@globals fileSystem @*/
    00564         /*@modifies dbi, *dbcp, fileSystem @*/
    00565 {
    00566     return (*dbi->dbi_vec->copen) (dbi, txnid, dbcp, flags);
    00567 }
    00568
    00576 /*@unused@*/ static inline
    00577 int dbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
    00578         /*@globals fileSystem @*/
    00579         /*@modifies dbi, *dbcursor, fileSystem @*/
    00580 {
    00581     return (*dbi->dbi_vec->cclose) (dbi, dbcursor, flags);
    00582 }
    00583
    00592 /*@unused@*/ static inline
    00593 int dbiCdup(dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
    00594                 unsigned int flags)
    00595         /*@modifies dbi, *dbcp @*/
    00596 {
    00597     return (*dbi->dbi_vec->cdup) (dbi, dbcursor, dbcp, flags);
    00598 }
    00599
    00609 /*@unused@*/ static inline
    00610 int dbiDel(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
    00611                 unsigned int flags)
    00612         /*@globals fileSystem, internalState @*/
    00613         /*@modifies dbi, *dbcursor, fileSystem, internalState @*/
    00614 {
    00615     rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 16);     /* RPMTS_OP_DBDEL */
    00616     int rc;
    00617     assert(key->data != NULL && key->size > 0);
    00618     (void) rpmswEnter(sw, 0);
    00619     rc = (dbi->dbi_vec->cdel) (dbi, dbcursor, key, data, flags);
    00620     (void) rpmswExit(sw, data->size);
    00621     return rc;
    00622 }
    00623
    00633 /*@unused@*/ static inline
    00634 int dbiGet(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
    00635                 unsigned int flags)
    00636         /*@globals fileSystem, internalState @*/
    00637         /*@modifies dbi, *dbcursor, *key, *data, fileSystem, internalState @*/
    00638 {
    00639     rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 14);     /* RPMTS_OP_DBGET */
    00640     int rc;
    00641     assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
    00642     (void) rpmswEnter(sw, 0);
    00643     rc = (dbi->dbi_vec->cget) (dbi, dbcursor, key, data, flags);
    00644     (void) rpmswExit(sw, data->size);
    00645     return rc;
    00646 }
    00647
    00658 /*@unused@*/ static inline
    00659 int dbiPget(dbiIndex dbi, /*@null@*/ DBC * dbcursor,
    00660                 DBT * key, DBT * pkey, DBT * data, unsigned int flags)
    00661         /*@globals fileSystem, internalState @*/
    00662         /*@modifies dbi, *dbcursor, *key, *pkey, *data, fileSystem, internalState @*/
    00663 {
    00664     rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 14);     /* RPMTS_OP_DBGET */
    00665     int rc;
    00666     assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
    00667     (void) rpmswEnter(sw, 0);
    00668     rc = (dbi->dbi_vec->cpget) (dbi, dbcursor, key, pkey, data, flags);
    00669     (void) rpmswExit(sw, data->size);
    00670     return rc;
    00671 }
    00672
    00682 /*@unused@*/ static inline
    00683 int dbiPut(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
    00684                 unsigned int flags)
    00685         /*@globals fileSystem, internalState @*/
    00686         /*@modifies dbi, *dbcursor, *key, fileSystem, internalState @*/
    00687 {
    00688     rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 15);     /* RPMTS_OP_DBPUT */
    00689     int rc;
    00690     assert(key->data != NULL && key->size > 0 && data->data != NULL && data->size > 0);
    00691     (void) rpmswEnter(sw, 0);
    00692     rc = (dbi->dbi_vec->cput) (dbi, dbcursor, key, data, flags);
    00693     (void) rpmswExit(sw, data->size);
    00694     return rc;
    00695 }
    00696
    00705 /*@unused@*/ static inline
    00706 int dbiCount(dbiIndex dbi, DBC * dbcursor, /*@out@*/ unsigned int * countp,
    00707                 unsigned int flags)
    00708         /*@globals fileSystem @*/
    00709         /*@modifies *dbcursor, fileSystem @*/
    00710 {
    00711     return (*dbi->dbi_vec->ccount) (dbi, dbcursor, countp, flags);
    00712 }
    00713
    00720 /*@unused@*/ static inline
    00721 int dbiVerify(/*@only@*/ dbiIndex dbi, unsigned int flags)
    00722         /*@globals fileSystem @*/
    00723         /*@modifies dbi, fileSystem @*/
    00724 {
    00725     dbi->dbi_verify_on_close = 1;
    00726     return (*dbi->dbi_vec->close) (dbi, flags);
    00727 }
    00728
    00735 /*@unused@*/ static inline
    00736 int dbiClose(/*@only@*/ dbiIndex dbi, unsigned int flags)
    00737         /*@globals fileSystem @*/
    00738         /*@modifies dbi, fileSystem @*/
    00739 {
    00740     return (*dbi->dbi_vec->close) (dbi, flags);
    00741 }
    00742
    00749 /*@unused@*/ static inline
    00750 int dbiSync (dbiIndex dbi, unsigned int flags)
    00751         /*@globals fileSystem @*/
    00752         /*@modifies fileSystem @*/
    00753 {
    00754     return (*dbi->dbi_vec->sync) (dbi, flags);
    00755 }
    00756
    00765 /*@unused@*/ static inline
    00766 int dbiAssociate(dbiIndex dbi, dbiIndex dbisecondary,
    00767                 int (*callback) (DB *, const DBT *, const DBT *, DBT *),
    00768                 unsigned int flags)
    00769         /*@globals fileSystem @*/
    00770         /*@modifies dbi, fileSystem @*/
    00771 {
    00772     return (*dbi->dbi_vec->associate) (dbi, dbisecondary, callback, flags);
    00773 }
    00774
    00783 /*@unused@*/ static inline
    00784 int dbiJoin(dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
    00785                 unsigned int flags)
    00786         /*@globals fileSystem @*/
    00787         /*@modifies dbi, *dbcp, fileSystem @*/
    00788 {
    00789     return (*dbi->dbi_vec->join) (dbi, curslist, dbcp, flags);
    00790 }
    00791
    00797 /*@unused@*/ static inline
    00798 int dbiByteSwapped(dbiIndex dbi)
    00799         /*@modifies dbi @*/
    00800 {
    00801     if (dbi->dbi_byteswapped == -1)
    00802         dbi->dbi_byteswapped = (*dbi->dbi_vec->byteswapped) (dbi);
    00803     return dbi->dbi_byteswapped;
    00804 }
    00805
    00812 /*@unused@*/ static inline
    00813 int dbiStat(dbiIndex dbi, unsigned int flags)
    00814         /*@modifies dbi @*/
    00815 {
    00816     return (*dbi->dbi_vec->stat) (dbi, flags);
    00817 }
    00818
    00824 /*@unused@*/ static inline /*@observer@*/ /*@null@*/
    00825 DB_TXN * dbiTxnid(dbiIndex dbi)
    00826         /*@*/
    00827 {
    00828     return dbi->dbi_txnid;
    00829 }
    00830 /*@=globuse =mustmod @*/
    00831 #endif  /* !defined(SWIG) */
    00832
    00833 /*@=exportlocal@*/
    00834
    00840 /*@null@*/
    00841 dbiIndexSet dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet set)
    00842         /*@modifies set @*/;
    00843
    00849 unsigned int dbiIndexSetCount(dbiIndexSet set)
    00850         /*@*/;
    00851
    00858 unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno)
    00859         /*@*/;
    00860
    00867 unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno)
    00868         /*@*/;
    00869 #endif  /* defined(_RPMDB_INTERNAL) */
    00870
    00877 /*@unused@*/ /*@null@*/
    00878 rpmdb rpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg)
    00879         /*@modifies db @*/;
    00880 #define rpmdbUnlink(_db, _msg)  \
    00881         ((rpmdb)rpmioUnlinkPoolItem((rpmioItem)(_db), _msg, __FILE__, __LINE__))
    00882
    00889 /*@unused@*/ /*@newref@*/
    00890 rpmdb rpmdbLink (rpmdb db, const char * msg)
    00891         /*@modifies db @*/;
    00892 #define rpmdbLink(_db, _msg)    \
    00893         ((void *)rpmioLinkPoolItem((rpmioItem)(_db), _msg, __FILE__, __LINE__))
    00894
    00897 /*@only@*/ /*@null@*/
    00898 rpmdb rpmdbNew(/*@kept@*/ /*@null@*/ const char * root,
    00899                 /*@kept@*/ /*@null@*/ const char * home,
    00900                 int mode, int perms, int flags)
    00901         /*@globals fileSystem, internalState @*/
    00902         /*@modifies fileSystem, internalState @*/;
    00903
    00906 int rpmdbOpenDatabase(/*@null@*/ const char * prefix,
    00907                 /*@null@*/ const char * dbpath,
    00908                 int _dbapi, /*@null@*/ /*@out@*/ rpmdb *dbp,
    00909                 int mode, int perms, int flags)
    00910         /*@globals rpmGlobalMacroContext, h_errno,
    00911                 fileSystem, internalState @*/
    00912         /*@modifies *dbp, rpmGlobalMacroContext,
    00913                 fileSystem, internalState @*/;
    00914
    00923 int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp,
    00924                 int mode, int perms)
    00925         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00926         /*@modifies *dbp, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00927
    00934 int rpmdbInit(/*@null@*/ const char * prefix, int perms)
    00935         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00936         /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
    00937
    00943 int rpmdbVerifyAllDBI(rpmdb db)
    00944         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00945         /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00946
    00952 int rpmdbVerify(/*@null@*/ const char * prefix)
    00953         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00954         /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
    00955
    00962 int rpmdbBlockDBI(/*@null@*/ rpmdb db, int tag)
    00963         /*@modifies db @*/;
    00964
    00971 int rpmdbCloseDBI(/*@null@*/ rpmdb db, int tag)
    00972         /*@globals fileSystem @*/
    00973         /*@modifies db, fileSystem @*/;
    00974
    00980 int rpmdbClose (/*@killref@*/ /*@only@*/ /*@null@*/ rpmdb db)
    00981         /*@globals fileSystem @*/
    00982         /*@modifies db, fileSystem @*/;
    00983
    00989 int rpmdbSync (/*@null@*/ rpmdb db)
    00990         /*@globals fileSystem @*/
    00991         /*@modifies fileSystem @*/;
    00992
    00998 /*@-exportlocal@*/
    00999 int rpmdbOpenAll (/*@null@*/ rpmdb db)
    01000         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
    01001         /*@modifies db, rpmGlobalMacroContext, internalState @*/;
    01002 /*@=exportlocal@*/
    01003
    01012 int rpmdbCount(/*@null@*/ rpmdb db, rpmTag tag,
    01013                 const void * keyp, size_t keylen)
    01014         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01015         /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
    01016
    01023 int rpmdbCountPackages(/*@null@*/ rpmdb db, const char * name)
    01024         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01025         /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
    01026
    01032 unsigned int rpmmiInstance(/*@null@*/ rpmmi mi)
    01033         /*@*/;
    01034
    01039 unsigned int rpmmiFilenum(rpmmi mi)
    01040         /*@*/;
    01041
    01047 int rpmmiCount(/*@null@*/ rpmmi mi)
    01048         /*@*/;
    01049
    01057 int rpmmiGrow(/*@null@*/ rpmmi mi,
    01058                 /*@null@*/ const int * hdrNums, int nHdrNums)
    01059         /*@modifies mi @*/;
    01060
    01070 int rpmmiPrune(/*@null@*/ rpmmi mi,
    01071                 /*@null@*/ int * hdrNums, int nHdrNums, int sorted)
    01072         /*@modifies mi, hdrNums @*/;
    01073
    01082 int rpmmiAddPattern(/*@null@*/ rpmmi mi, rpmTag tag,
    01083                 rpmMireMode mode, /*@null@*/ const char * pattern)
    01084         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
    01085         /*@modifies mi, mode, rpmGlobalMacroContext, internalState @*/;
    01086
    01094 int rpmmiSetRewrite(/*@null@*/ rpmmi mi, int rewrite)
    01095         /*@modifies mi @*/;
    01096
    01103 int rpmmiSetModified(/*@null@*/ rpmmi mi, int modified)
    01104         /*@modifies mi @*/;
    01105
    01112 int rpmmiSetHdrChk(/*@null@*/ rpmmi mi, /*@null@*/ rpmts ts)
    01113         /*@modifies mi @*/;
    01114
    01123 /*@only@*/ /*@null@*/
    01124 rpmmi rpmmiInit(/*@null@*/ rpmdb db, rpmTag tag,
    01125                         /*@null@*/ const void * keyp, size_t keylen)
    01126         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01127         /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
    01128
    01134 /*@null@*/
    01135 Header rpmmiNext(/*@null@*/ rpmmi mi)
    01136         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01137         /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
    01138
    01148 /*@mayexit@*/
    01149 int rpmdbCheckTerminate(int terminate)
    01150         /*@globals fileSystem, internalState @*/
    01151         /*@modifies fileSystem, internalState @*/;
    01152
    01156 /*@mayexit@*/
    01157 int rpmdbCheckSignals(void)
    01158         /*@globals fileSystem, internalState @*/
    01159         /*@modifies fileSystem, internalState @*/;
    01160
    01166 /*@null@*/
    01167 rpmmi rpmmiUnlink(/*@only@*/ /*@null@*/rpmmi mi)
    01168         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01169         /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
    01170 #define rpmmiUnlink(_mi)  \
    01171     ((rpmmi)rpmioUnlinkPoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))
    01172
    01178 /*@null@*/
    01179 rpmmi rpmmiLink(/*@only@*/ /*@null@*/rpmmi mi)
    01180         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01181         /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
    01182 #define rpmmiLink(_mi)  \
    01183     ((rpmmi)rpmioLinkPoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))
    01184
    01190 /*@null@*/
    01191 rpmmi rpmmiFree(/*@only@*/ /*@null@*/rpmmi mi)
    01192         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01193         /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
    01194 #define rpmmiFree(_mi)  \
    01195     ((rpmmi)rpmioFreePoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))
    01196
    01206 int rpmdbMireApply(rpmdb db, rpmTag tag, rpmMireMode mode, const char * pat,
    01207                 const char *** argvp)
    01208         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01209         /*@modifies db, *argvp,
    01210                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    01211
    01220 int rpmdbAdd(/*@null@*/ rpmdb db, int iid, Header h, /*@null@*/ rpmts ts)
    01221         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01222         /*@modifies db, h, ts,
    01223                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    01224
    01233 int rpmdbRemove(/*@null@*/ rpmdb db, /*@unused@*/ int rid, unsigned int hdrNum,
    01234                 /*@null@*/ rpmts ts)
    01235         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01236         /*@modifies db, ts,
    01237                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    01238
    01245 int rpmdbRebuild(/*@null@*/ const char * prefix, /*@null@*/ rpmts ts)
    01246         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    01247         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    01248
    01252 /*@unused@*/
    01253 int rpm_mergesort(void *base, size_t nmemb, size_t size,
    01254                 int (*cmp) (const void *, const void *))
    01255         /*@globals errno @*/
    01256         /*@modifies base, errno @*/;
    01257
    01258 #ifdef __cplusplus
    01259 }
    01260 #endif
    01261
    01262 /*@=bounds@*/
    01263 #endif  /* H_RPMDB */