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 #include "db.h"
00014 
00015 /*@-exportlocal@*/
00016 /*@unchecked@*/
00017 extern int _rpmdb_debug;
00018 /*@=exportlocal@*/
00019 
00020 /*@unchecked@*/
00021 extern int _rsegfault;
00022 /*@unchecked@*/
00023 extern int _wsegfault;
00024 
00025 #if defined(__LCLINT__)
00026 #define RSEGFAULT
00027 #define WSEGFAULT
00028 #else
00029 #define RSEGFAULT       { if (_rsegfault > 0) assert(--_rsegfault); }
00030 #define WSEGFAULT       { if (_wsegfault > 0) assert(--_wsegfault); }
00031 #endif
00032 
00033 #ifdef  NOTYET
00034 
00037 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmdb_s * rpmdb;
00038 
00042 typedef /*@abstract@*/ struct _rpmdbMatchIterator * rpmdbMatchIterator;
00043 #endif
00044 
00047 typedef /*@abstract@*/ struct _dbiIndexItem * dbiIndexItem;
00048 
00052 typedef /*@abstract@*/ struct _dbiIndexSet * dbiIndexSet;
00053 
00056 typedef /*@abstract@*/ struct _dbiIndex * dbiIndex;
00057 
00058 #if defined(_RPMDB_INTERNAL)
00059 #include "rpmsw.h"
00060 #if !defined(SWIG)      /* XXX inline dbiFoo() need */
00061 
00066 struct _dbiIndexItem {
00067     unsigned int hdrNum;                
00068     unsigned int tagNum;                
00069     unsigned int fpNum;                 
00070 };
00071 
00075 struct _dbiIndexSet {
00076 /*@owned@*/ struct _dbiIndexItem * recs; 
00077     int count;                          
00078 };
00079 
00083 struct _dbiVec {
00084     int dbv_major;                      
00085     int dbv_minor;                      
00086     int dbv_patch;                      
00094     int (*open) (rpmdb rpmdb, rpmTag rpmtag, /*@out@*/ dbiIndex * dbip)
00095         /*@globals fileSystem @*/
00096         /*@modifies *dbip, fileSystem @*/;
00097 
00104     int (*close) (/*@only@*/ dbiIndex dbi, unsigned int flags)
00105         /*@globals fileSystem @*/
00106         /*@modifies dbi, fileSystem @*/;
00107 
00114     int (*sync) (dbiIndex dbi, unsigned int flags)
00115         /*@globals fileSystem @*/
00116         /*@modifies fileSystem @*/;
00117 
00126     int (*associate) (dbiIndex dbi, dbiIndex dbisecondary,
00127                 int (*callback) (DB *, const DBT *, const DBT *, DBT *),
00128                 unsigned int flags)
00129         /*@globals fileSystem @*/
00130         /*@modifies dbi, fileSystem @*/;
00131 
00140     int (*join) (dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
00141                 unsigned int flags)
00142         /*@globals fileSystem @*/
00143         /*@modifies dbi, *dbcp, fileSystem @*/;
00144 
00153     int (*copen) (dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
00154                         /*@out@*/ DBC ** dbcp, unsigned int dbiflags)
00155         /*@globals fileSystem @*/
00156         /*@modifies dbi, *txnid, *dbcp, fileSystem @*/;
00157 
00165     int (*cclose) (dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
00166         /*@globals fileSystem @*/
00167         /*@modifies dbi, *dbcursor, fileSystem @*/;
00168 
00177     int (*cdup) (dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
00178                 unsigned int flags)
00179         /*@globals fileSystem @*/
00180         /*@modifies dbi, *dbcp, fileSystem @*/;
00181 
00191     int (*cdel) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
00192                         unsigned int flags)
00193         /*@globals fileSystem @*/
00194         /*@modifies *dbcursor, fileSystem @*/;
00195 
00205     int (*cget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
00206                         unsigned int flags)
00207         /*@globals fileSystem @*/
00208         /*@modifies *dbcursor, *key, *data, fileSystem @*/;
00209 
00220     int (*cpget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor,
00221                 DBT * key, DBT * pkey, DBT * data, unsigned int flags)
00222         /*@globals fileSystem @*/
00223         /*@modifies *dbcursor, *key, *pkey, *data, fileSystem @*/;
00224 
00234     int (*cput) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
00235                         unsigned int flags)
00236         /*@globals fileSystem @*/
00237         /*@modifies *dbcursor, fileSystem @*/;
00238 
00247     int (*ccount) (dbiIndex dbi, DBC * dbcursor,
00248                         /*@out@*/ unsigned int * countp,
00249                         unsigned int flags)
00250         /*@globals fileSystem @*/
00251         /*@modifies *dbcursor, fileSystem @*/;
00252 
00258     int (*byteswapped) (dbiIndex dbi)
00259         /*@globals fileSystem @*/
00260         /*@modifies fileSystem @*/;
00261 
00268     int (*stat) (dbiIndex dbi, unsigned int flags)
00269         /*@globals fileSystem @*/
00270         /*@modifies dbi, fileSystem @*/;
00271 };
00272 
00276 struct _dbiIndex {
00277 /*@relnull@*/
00278     const char * dbi_root;      
00279 /*@null@*/
00280     const char * dbi_home;      
00281 /*@relnull@*/
00282     const char * dbi_file;      
00283 /*@relnull@*/
00284     const char * dbi_subfile;
00285 /*@null@*/
00286     const char * dbi_tmpdir;    
00288     int dbi_ecflags;            
00289     int dbi_cflags;             
00290     int dbi_oeflags;            
00291     int dbi_eflags;             
00292     int dbi_oflags;             
00293     int dbi_tflags;             
00295     int dbi_type;               
00296     unsigned dbi_mode;          
00297     int dbi_perms;              
00298     long dbi_shmkey;            
00299     int dbi_api;                
00301     int dbi_verify_on_close;
00302     int dbi_use_dbenv;          
00303     int dbi_permit_dups;        
00304     int dbi_no_fsync;           
00305     int dbi_no_dbsync;          
00306     int dbi_lockdbfd;           
00307     int dbi_temporary;          
00308     int dbi_debug;
00309     int dbi_byteswapped;
00310 
00311 /*@null@*/
00312     char * dbi_host;
00313     unsigned long dbi_cl_timeout;
00314     unsigned long dbi_sv_timeout;
00315 
00316         /* dbenv parameters */
00317     int dbi_lorder;
00318 /*@unused@*/
00319     /* XXX db-4.3.14 adds dbenv as 1st arg. */
00320     void (*db_errcall) (void * dbenv, const char *db_errpfx, char *buffer)
00321         /*@globals fileSystem @*/
00322         /*@modifies fileSystem @*/;
00323 /*@unused@*/ /*@shared@*/
00324     FILE *      dbi_errfile;
00325     const char * dbi_errpfx;
00326     int dbi_verbose;
00327     int dbi_region_init;
00328     unsigned int dbi_thread_count;
00329         /* locking sub-system parameters */
00330     unsigned int dbi_lk_max_lockers;
00331     unsigned int dbi_lk_max_locks;
00332     unsigned int dbi_lk_max_objects;
00333     unsigned int dbi_lk_detect;
00334 /*@unused@*/
00335     int dbi_lk_nmodes;
00336 /*@unused@*/
00337     unsigned char * dbi_lk_conflicts;
00338         /* logging sub-system parameters */
00339     unsigned int dbi_lg_bsize;
00340 /*@unused@*/
00341     const char * dbi_lg_dir;
00342 /*@unused@*/
00343     unsigned int dbi_lg_filemode;
00344     unsigned int dbi_lg_max;
00345     unsigned int dbi_lg_regionmax;
00346         /* mpool sub-system parameters */
00347     int dbi_mmapsize;           
00348     int dbi_cachesize;          
00349         /* mutex sub-system parameters */
00350     unsigned int dbi_mutex_align;
00351     unsigned int dbi_mutex_increment;
00352     unsigned int dbi_mutex_max;
00353     unsigned int dbi_mutex_tas_spins;
00354         /* replication sub-system parameters */
00355         /* sequences sub-system parameters */
00356     unsigned int dbi_seq_cachesize;
00357     unsigned int dbi_seq_flags;
00358 #if 0   /* needs signed 64 bit type */
00359     int64_t dbi_seq_min;
00360     int64_t dbi_seq_max;
00361 #endif
00362         /* transaction sub-system parameters */
00363     unsigned int dbi_tx_max;
00364 #if 0
00365     int (*dbi_tx_recover) (DB_ENV *dbenv, DBT *log_rec,
00366                                 DB_LSN *lsnp, int redo, void *info)
00367         /*@globals fileSystem @*/
00368         /*@modifies fileSystem @*/;
00369 #endif
00370         /* dbinfo parameters */
00371     int dbi_pagesize;           
00372 /*@unused@*/ /*@null@*/
00373     void * (*dbi_malloc) (size_t nbytes)
00374         /*@*/;
00375         /* hash access parameters */
00376     unsigned int dbi_h_ffactor; 
00377     unsigned int (*dbi_h_hash_fcn) (DB *, const void *bytes,
00378                                 unsigned int length)
00379         /*@*/;
00380     unsigned int dbi_h_nelem;   
00381     unsigned int dbi_h_flags;   
00382     int (*dbi_h_dup_compare_fcn) (DB *, const DBT *, const DBT *)
00383         /*@*/;
00384         /* btree access parameters */
00385     int dbi_bt_flags;
00386     int dbi_bt_minkey;
00387     int (*dbi_bt_compare_fcn) (DB *, const DBT *, const DBT *)
00388         /*@*/;
00389     int (*dbi_bt_dup_compare_fcn) (DB *, const DBT *, const DBT *)
00390         /*@*/;
00391     size_t (*dbi_bt_prefix_fcn) (DB *, const DBT *, const DBT *)
00392         /*@*/;
00393         /* recno access parameters */
00394     int dbi_re_flags;
00395     int dbi_re_delim;
00396     unsigned int dbi_re_len;
00397     int dbi_re_pad;
00398     const char * dbi_re_source;
00399         /* queue access parameters */
00400     unsigned int dbi_q_extentsize;
00401 
00402 /*@refcounted@*/
00403     rpmdb dbi_rpmdb;            
00404     rpmTag dbi_rpmtag;          
00405     int dbi_jlen;               
00407 /*@only@*//*@relnull@*/
00408     DB * dbi_db;                
00409 /*@only@*//*@null@*/
00410     DB_TXN * dbi_txnid;         
00411 /*@only@*//*@null@*/
00412     void * dbi_stats;           
00414 /*@observer@*/
00415     const struct _dbiVec * dbi_vec;     
00417 };
00418 #endif  /* !defined(SWIG) */
00419 
00423 struct rpmdb_s {
00424 /*@owned@*/ /*@relnull@*/
00425     const char * db_root;       
00426 /*@owned@*/
00427     const char * db_home;       
00428     int         db_flags;
00429     int         db_mode;        
00430     int         db_perms;       
00431     int         db_api;         
00432 /*@owned@*/
00433     const char * db_errpfx;     
00435     int         db_remove_env;  
00436     int         db_filter_dups; 
00437     int         db_verifying;
00438 
00439     int         db_chrootDone;  
00440     void (*db_errcall) (const char * db_errpfx, char * buffer)
00441         /*@*/;
00442 /*@shared@*/
00443     FILE *      db_errfile;     
00444 /*@only@*/
00445     void * (*db_malloc) (size_t nbytes)
00446         /*@*/;
00447 /*@only@*/
00448     void * (*db_realloc) (/*@only@*//*@null@*/ void * ptr, size_t nbytes)
00449         /*@*/;
00450     void (*db_free) (/*@only@*/ void * ptr)
00451         /*@modifies *ptr @*/;
00452 
00453     int (*db_export) (rpmdb db, Header h, int adding);
00454 
00455 /*@only@*/ /*@null@*/
00456     unsigned char * db_bits;    
00457     int         db_nbits;       
00458     rpmdb       db_next;        
00459     int         db_opens;       
00460 /*@only@*/ /*@null@*/
00461     void *      db_dbenv;       
00462     int *       db_tagn;        
00463     int         db_ndbi;        
00464 /*@only@*/ /*@null@*/
00465     dbiIndex * _dbi;            
00467     struct rpmop_s db_getops;   
00468     struct rpmop_s db_putops;   
00469     struct rpmop_s db_delops;   
00471 /*@refs@*/
00472     int nrefs;                  
00473 };
00474 #endif  /* defined(_RPMDB_INTERNAL) */
00475 
00476 /* for RPM's internal use only */
00477 
00480 enum rpmdbFlags {
00481         RPMDB_FLAG_JUSTCHECK    = (1 << 0),
00482         RPMDB_FLAG_MINIMAL      = (1 << 1),
00483 /*@-enummemuse@*/
00484         RPMDB_FLAG_CHROOT       = (1 << 2)
00485 /*@=enummemuse@*/
00486 };
00487 
00488 #ifdef __cplusplus
00489 extern "C" {
00490 #endif
00491 
00492 #if defined(_RPMDB_INTERNAL)
00493 /*@-exportlocal@*/
00500 /*@unused@*/ /*@only@*/ /*@null@*/
00501 dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
00502         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
00503         /*@modifies rpmGlobalMacroContext, internalState @*/;
00504 
00510 /*@null@*/
00511 dbiIndex db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi)
00512         /*@*/;
00513 
00520 /*@-redecl@*/
00521 /*@exposed@*/
00522 extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
00523         /*@*/;
00524 /*@=redecl@*/
00525 
00533 /*@only@*/ /*@null@*/ dbiIndex dbiOpen(/*@null@*/ rpmdb db, rpmTag rpmtag,
00534                 unsigned int flags)
00535         /*@globals rpmGlobalMacroContext, errno, h_errno @*/
00536         /*@modifies db, rpmGlobalMacroContext, errno @*/;
00537 
00544 void * dbiStatsAccumulator(dbiIndex dbi, int opx)
00545         /*@*/;
00546 
00547 #if !defined(SWIG)
00548 /*@-globuse -mustmod @*/ /* FIX: vector annotations */
00557 /*@unused@*/ static inline
00558 int dbiCopen(dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
00559                 /*@out@*/ DBC ** dbcp, unsigned int flags)
00560         /*@globals fileSystem @*/
00561         /*@modifies dbi, *dbcp, fileSystem @*/
00562 {
00563     return (*dbi->dbi_vec->copen) (dbi, txnid, dbcp, flags);
00564 }
00565 
00573 /*@unused@*/ static inline
00574 int dbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
00575         /*@globals fileSystem @*/
00576         /*@modifies dbi, *dbcursor, fileSystem @*/
00577 {
00578     return (*dbi->dbi_vec->cclose) (dbi, dbcursor, flags);
00579 }
00580 
00589 /*@unused@*/ static inline
00590 int dbiCdup(dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
00591                 unsigned int flags)
00592         /*@modifies dbi, *dbcp @*/
00593 {
00594     return (*dbi->dbi_vec->cdup) (dbi, dbcursor, dbcp, flags);
00595 }
00596 
00606 /*@unused@*/ static inline
00607 int dbiDel(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
00608                 unsigned int flags)
00609         /*@globals fileSystem, internalState @*/
00610         /*@modifies dbi, *dbcursor, fileSystem, internalState @*/
00611 {
00612     void * sw = dbiStatsAccumulator(dbi, 16);   /* RPMTS_OP_DBDEL */
00613     int rc;
00614     assert(key->data != NULL && key->size > 0);
00615     (void) rpmswEnter(sw, 0);
00616     rc = (dbi->dbi_vec->cdel) (dbi, dbcursor, key, data, flags);
00617     (void) rpmswExit(sw, data->size);
00618 WSEGFAULT;
00619     return rc;
00620 }
00621 
00631 /*@unused@*/ static inline
00632 int dbiGet(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
00633                 unsigned int flags)
00634         /*@globals fileSystem, internalState @*/
00635         /*@modifies dbi, *dbcursor, *key, *data, fileSystem, internalState @*/
00636 {
00637     void * sw = dbiStatsAccumulator(dbi, 14);   /* RPMTS_OP_DBGET */
00638     int rc;
00639     assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
00640     (void) rpmswEnter(sw, 0);
00641     rc = (dbi->dbi_vec->cget) (dbi, dbcursor, key, data, flags);
00642     (void) rpmswExit(sw, data->size);
00643 RSEGFAULT;
00644     return rc;
00645 }
00646 
00657 /*@unused@*/ static inline
00658 int dbiPget(dbiIndex dbi, /*@null@*/ DBC * dbcursor,
00659                 DBT * key, DBT * pkey, DBT * data, unsigned int flags)
00660         /*@globals fileSystem, internalState @*/
00661         /*@modifies dbi, *dbcursor, *key, *pkey, *data, fileSystem, internalState @*/
00662 {
00663     void * sw = dbiStatsAccumulator(dbi, 14);   /* RPMTS_OP_DBGET */
00664     int rc;
00665     assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
00666     (void) rpmswEnter(sw, 0);
00667     rc = (dbi->dbi_vec->cpget) (dbi, dbcursor, key, pkey, data, flags);
00668     (void) rpmswExit(sw, data->size);
00669     return rc;
00670 }
00671 
00681 /*@unused@*/ static inline
00682 int dbiPut(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
00683                 unsigned int flags)
00684         /*@globals fileSystem, internalState @*/
00685         /*@modifies dbi, *dbcursor, *key, fileSystem, internalState @*/
00686 {
00687     void * sw = dbiStatsAccumulator(dbi, 15);   /* RPMTS_OP_DBPUT */
00688     int rc;
00689     assert(key->data != NULL && key->size > 0 && data->data != NULL && data->size > 0);
00690     (void) rpmswEnter(sw, 0);
00691     rc = (dbi->dbi_vec->cput) (dbi, dbcursor, key, data, flags);
00692     (void) rpmswExit(sw, data->size);
00693 WSEGFAULT;
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 
00837 unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi)
00838         /*@*/;
00839 
00845 /*@null@*/
00846 dbiIndexSet dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet set)
00847         /*@modifies set @*/;
00848 
00854 unsigned int dbiIndexSetCount(dbiIndexSet set)
00855         /*@*/;
00856 
00863 unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno)
00864         /*@*/;
00865 
00872 unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno)
00873         /*@*/;
00874 #endif  /* defined(_RPMDB_INTERNAL) */
00875 
00882 /*@unused@*/ /*@null@*/
00883 rpmdb rpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg)
00884         /*@modifies db @*/;
00885 
00887 /*@-exportlocal@*/
00888 /*@null@*/
00889 rpmdb XrpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg,
00890                 const char * fn, unsigned ln)
00891         /*@modifies db @*/;
00892 /*@=exportlocal@*/
00893 #define rpmdbUnlink(_db, _msg)  XrpmdbUnlink(_db, _msg, __FILE__, __LINE__)
00894 
00901 /*@unused@*/
00902 rpmdb rpmdbLink (rpmdb db, const char * msg)
00903         /*@modifies db @*/;
00904 
00906 /*@-exportlocal@*/
00907 rpmdb XrpmdbLink (rpmdb db, const char * msg,
00908                 const char * fn, unsigned ln)
00909         /*@modifies db @*/;
00910 /*@=exportlocal@*/
00911 #define rpmdbLink(_db, _msg)    XrpmdbLink(_db, _msg, __FILE__, __LINE__)
00912 
00921 int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp,
00922                 int mode, int perms)
00923         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00924         /*@modifies *dbp, rpmGlobalMacroContext, fileSystem, internalState @*/;
00925 
00932 int rpmdbInit(/*@null@*/ const char * prefix, int perms)
00933         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00934         /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
00935 
00941 int rpmdbVerifyAllDBI(rpmdb db)
00942         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00943         /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
00944 
00950 int rpmdbVerify(/*@null@*/ const char * prefix)
00951         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00952         /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
00953 
00960 int rpmdbBlockDBI(/*@null@*/ rpmdb db, int rpmtag)
00961         /*@modifies db @*/;
00962 
00969 int rpmdbCloseDBI(/*@null@*/ rpmdb db, int rpmtag)
00970         /*@globals fileSystem @*/
00971         /*@modifies db, fileSystem @*/;
00972 
00978 int rpmdbClose (/*@killref@*/ /*@only@*/ /*@null@*/ rpmdb db)
00979         /*@globals fileSystem @*/
00980         /*@modifies db, fileSystem @*/;
00981 
00987 int rpmdbSync (/*@null@*/ rpmdb db)
00988         /*@globals fileSystem @*/
00989         /*@modifies fileSystem @*/;
00990 
00996 /*@-exportlocal@*/
00997 int rpmdbOpenAll (/*@null@*/ rpmdb db)
00998         /*@globals rpmGlobalMacroContext, h_errno @*/
00999         /*@modifies db, rpmGlobalMacroContext @*/;
01000 /*@=exportlocal@*/
01001 
01008 int rpmdbCountPackages(/*@null@*/ rpmdb db, const char * name)
01009         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
01010         /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
01011 
01017 unsigned int rpmdbGetIteratorOffset(/*@null@*/ rpmdbMatchIterator mi)
01018         /*@*/;
01019 
01025 int rpmdbGetIteratorCount(/*@null@*/ rpmdbMatchIterator mi)
01026         /*@*/;
01027 
01035 int rpmdbAppendIterator(/*@null@*/ rpmdbMatchIterator mi,
01036                 /*@null@*/ const int * hdrNums, int nHdrNums)
01037         /*@modifies mi @*/;
01038 
01048 int rpmdbPruneIterator(/*@null@*/ rpmdbMatchIterator mi,
01049                 /*@null@*/ int * hdrNums, int nHdrNums, int sorted)
01050         /*@modifies mi, hdrNums @*/;
01051 
01060 int rpmdbSetIteratorRE(/*@null@*/ rpmdbMatchIterator mi, rpmTag tag,
01061                 rpmMireMode mode, /*@null@*/ const char * pattern)
01062         /*@globals rpmGlobalMacroContext, h_errno @*/
01063         /*@modifies mi, mode, rpmGlobalMacroContext @*/;
01064 
01072 int rpmdbSetIteratorRewrite(/*@null@*/ rpmdbMatchIterator mi, int rewrite)
01073         /*@modifies mi @*/;
01074 
01081 int rpmdbSetIteratorModified(/*@null@*/ rpmdbMatchIterator mi, int modified)
01082         /*@modifies mi @*/;
01083 
01091 int rpmdbSetHdrChk(/*@null@*/ rpmdbMatchIterator mi, /*@null@*/ rpmts ts,
01092                 /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void * uh, size_t uc, const char ** msg))
01093         /*@modifies mi @*/;
01094 
01103 /*@only@*/ /*@null@*/
01104 rpmdbMatchIterator rpmdbInitIterator(/*@null@*/ rpmdb db, rpmTag rpmtag,
01105                         /*@null@*/ const void * keyp, size_t keylen)
01106         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
01107         /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
01108 
01114 /*@null@*/
01115 Header rpmdbNextIterator(/*@null@*/ rpmdbMatchIterator mi)
01116         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
01117         /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
01118 
01122 /*@mayexit@*/
01123 int rpmdbCheckSignals(void)
01124         /*@globals fileSystem, internalState @*/
01125         /*@modifies fileSystem, internalState @*/;
01126 
01132 /*@null@*/
01133 rpmdbMatchIterator rpmdbFreeIterator(/*@only@*/ /*@null@*/rpmdbMatchIterator mi)
01134         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
01135         /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
01136 
01146 int rpmdbAdd(/*@null@*/ rpmdb db, int iid, Header h, /*@null@*/ rpmts ts,
01147                 /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
01148         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
01149         /*@modifies db, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
01150 
01160 int rpmdbRemove(/*@null@*/ rpmdb db, /*@unused@*/ int rid, unsigned int hdrNum,
01161                 /*@null@*/ rpmts ts,
01162                 /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
01163         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
01164         /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
01165 
01173 int rpmdbRebuild(/*@null@*/ const char * prefix, /*@null@*/ rpmts ts,
01174                 /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
01175         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
01176         /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
01177 
01178 #ifndef __APPLE__
01179 
01182 /*@unused@*/
01183 int mergesort(void *base, size_t nmemb, size_t size,
01184                 int (*cmp) (const void *, const void *))
01185         /*@globals errno @*/
01186         /*@modifies base, errno @*/;
01187 #else
01188 /* mergesort is defined in stdlib.h on Mac OS X */
01189 #endif /* __APPLE__ */
01190 
01191 #ifdef __cplusplus
01192 }
01193 #endif
01194 
01195 /*@=bounds@*/
01196 #endif  /* H_RPMDB */

Generated on Thu Feb 7 03:43:21 2008 for rpm by  doxygen 1.5.1