rpm  4.5
rpmdb.h
Go to the documentation of this file.
1 #ifndef H_RPMDB
2 #define H_RPMDB
3 /*@-bounds@*/
4 
10 #include <assert.h>
11 #include <rpmlib.h>
12 #include <mire.h>
13 #include "db.h"
14 
15 /*@-exportlocal@*/
16 /*@unchecked@*/
17 extern int _rpmdb_debug;
18 /*@=exportlocal@*/
19 
20 #ifdef NOTYET
21 
24 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmdb_s * rpmdb;
25 
29 typedef /*@abstract@*/ struct _rpmdbMatchIterator * rpmdbMatchIterator;
30 #endif
31 
34 typedef /*@abstract@*/ struct _dbiIndexItem * dbiIndexItem;
35 
39 typedef /*@abstract@*/ struct _dbiIndexSet * dbiIndexSet;
40 
43 typedef /*@abstract@*/ struct _dbiIndex * dbiIndex;
44 
45 #if defined(_RPMDB_INTERNAL)
46 #include "rpmsw.h"
47 #if !defined(SWIG) /* XXX inline dbiFoo() need */
48 
53 struct _dbiIndexItem {
54  unsigned int hdrNum;
55  unsigned int tagNum;
56  unsigned int fpNum;
57 };
58 
62 struct _dbiIndexSet {
63 /*@owned@*/ struct _dbiIndexItem * recs;
64  int count;
65 };
66 
70 struct _dbiVec {
71  int dbv_major;
72  int dbv_minor;
73  int dbv_patch;
81  int (*open) (rpmdb rpmdb, rpmTag rpmtag, /*@out@*/ dbiIndex * dbip)
82  /*@globals fileSystem @*/
83  /*@modifies *dbip, fileSystem @*/;
84 
91  int (*close) (/*@only@*/ dbiIndex dbi, unsigned int flags)
92  /*@globals fileSystem @*/
93  /*@modifies dbi, fileSystem @*/;
94 
101  int (*sync) (dbiIndex dbi, unsigned int flags)
102  /*@globals fileSystem @*/
103  /*@modifies fileSystem @*/;
104 
113  int (*associate) (dbiIndex dbi, dbiIndex dbisecondary,
114  int (*callback) (DB *, const DBT *, const DBT *, DBT *),
115  unsigned int flags)
116  /*@globals fileSystem @*/
117  /*@modifies dbi, fileSystem @*/;
118 
127  int (*join) (dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
128  unsigned int flags)
129  /*@globals fileSystem @*/
130  /*@modifies dbi, *dbcp, fileSystem @*/;
131 
140  int (*copen) (dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
141  /*@out@*/ DBC ** dbcp, unsigned int dbiflags)
142  /*@globals fileSystem @*/
143  /*@modifies dbi, *txnid, *dbcp, fileSystem @*/;
144 
152  int (*cclose) (dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
153  /*@globals fileSystem @*/
154  /*@modifies dbi, *dbcursor, fileSystem @*/;
155 
164  int (*cdup) (dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
165  unsigned int flags)
166  /*@globals fileSystem @*/
167  /*@modifies dbi, *dbcp, fileSystem @*/;
168 
178  int (*cdel) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
179  unsigned int flags)
180  /*@globals fileSystem @*/
181  /*@modifies *dbcursor, fileSystem @*/;
182 
192  int (*cget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
193  unsigned int flags)
194  /*@globals fileSystem @*/
195  /*@modifies *dbcursor, *key, *data, fileSystem @*/;
196 
207  int (*cpget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor,
208  DBT * key, DBT * pkey, DBT * data, unsigned int flags)
209  /*@globals fileSystem @*/
210  /*@modifies *dbcursor, *key, *pkey, *data, fileSystem @*/;
211 
221  int (*cput) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
222  unsigned int flags)
223  /*@globals fileSystem @*/
224  /*@modifies *dbcursor, fileSystem @*/;
225 
234  int (*ccount) (dbiIndex dbi, DBC * dbcursor,
235  /*@out@*/ unsigned int * countp,
236  unsigned int flags)
237  /*@globals fileSystem @*/
238  /*@modifies *dbcursor, fileSystem @*/;
239 
245  int (*byteswapped) (dbiIndex dbi)
246  /*@globals fileSystem @*/
247  /*@modifies fileSystem @*/;
248 
255  int (*stat) (dbiIndex dbi, unsigned int flags)
256  /*@globals fileSystem @*/
257  /*@modifies dbi, fileSystem @*/;
258 };
259 
263 struct _dbiIndex {
264 /*@relnull@*/
265  const char * dbi_root;
266 /*@null@*/
267  const char * dbi_home;
268 /*@relnull@*/
269  const char * dbi_file;
270 /*@relnull@*/
271  const char * dbi_subfile;
272 /*@null@*/
273  const char * dbi_tmpdir;
275  int dbi_ecflags;
276  int dbi_cflags;
277  int dbi_oeflags;
278  int dbi_eflags;
279  int dbi_oflags;
280  int dbi_tflags;
282  int dbi_type;
283  unsigned dbi_mode;
284  int dbi_perms;
285  long dbi_shmkey;
286  int dbi_api;
288  int dbi_verify_on_close;
289  int dbi_use_dbenv;
290  int dbi_permit_dups;
291  int dbi_no_fsync;
292  int dbi_no_dbsync;
293  int dbi_lockdbfd;
294  int dbi_temporary;
295  int dbi_debug;
296  int dbi_byteswapped;
297 
298 /*@null@*/
299  char * dbi_host;
300  unsigned long dbi_cl_timeout;
301  unsigned long dbi_sv_timeout;
302 
303  /* dbenv parameters */
304  int dbi_lorder;
305 /*@unused@*/
306  /* XXX db-4.3.14 adds dbenv as 1st arg. */
307  void (*db_errcall) (void * dbenv, const char *db_errpfx, char *buffer)
308  /*@globals fileSystem @*/
309  /*@modifies fileSystem @*/;
310 /*@unused@*/ /*@shared@*/
311  FILE * dbi_errfile;
312  const char * dbi_errpfx;
313  int dbi_verbose;
314  int dbi_region_init;
315  unsigned int dbi_thread_count;
316  /* locking sub-system parameters */
317  unsigned int dbi_lk_max_lockers;
318  unsigned int dbi_lk_max_locks;
319  unsigned int dbi_lk_max_objects;
320  unsigned int dbi_lk_detect;
321 /*@unused@*/
322  int dbi_lk_nmodes;
323 /*@unused@*/
324  unsigned char * dbi_lk_conflicts;
325  /* logging sub-system parameters */
326  unsigned int dbi_lg_bsize;
327 /*@unused@*/
328  const char * dbi_lg_dir;
329 /*@unused@*/
330  unsigned int dbi_lg_filemode;
331  unsigned int dbi_lg_max;
332  unsigned int dbi_lg_regionmax;
333  /* mpool sub-system parameters */
334  int dbi_mmapsize;
335  int dbi_cachesize;
336  /* mutex sub-system parameters */
337  unsigned int dbi_mutex_align;
338  unsigned int dbi_mutex_increment;
339  unsigned int dbi_mutex_max;
340  unsigned int dbi_mutex_tas_spins;
341  /* replication sub-system parameters */
342  /* sequences sub-system parameters */
343  unsigned int dbi_seq_cachesize;
344  unsigned int dbi_seq_flags;
345 #if 0 /* needs signed 64 bit type */
346  int64_t dbi_seq_min;
347  int64_t dbi_seq_max;
348 #endif
349  /* transaction sub-system parameters */
350  unsigned int dbi_tx_max;
351 #if 0
352  int (*dbi_tx_recover) (DB_ENV *dbenv, DBT *log_rec,
353  DB_LSN *lsnp, int redo, void *info)
354  /*@globals fileSystem @*/
355  /*@modifies fileSystem @*/;
356 #endif
357  /* dbinfo parameters */
358  int dbi_pagesize;
359 /*@unused@*/ /*@null@*/
360  void * (*dbi_malloc) (size_t nbytes)
361  /*@*/;
362  /* hash access parameters */
363  unsigned int dbi_h_ffactor;
364  unsigned int (*dbi_h_hash_fcn) (DB *, const void *bytes,
365  unsigned int length)
366  /*@*/;
367  unsigned int dbi_h_nelem;
368  unsigned int dbi_h_flags;
369  int (*dbi_h_dup_compare_fcn) (DB *, const DBT *, const DBT *)
370  /*@*/;
371  /* btree access parameters */
372  int dbi_bt_flags;
373  int dbi_bt_minkey;
374  int (*dbi_bt_compare_fcn) (DB *, const DBT *, const DBT *)
375  /*@*/;
376  int (*dbi_bt_dup_compare_fcn) (DB *, const DBT *, const DBT *)
377  /*@*/;
378  size_t (*dbi_bt_prefix_fcn) (DB *, const DBT *, const DBT *)
379  /*@*/;
380  /* recno access parameters */
381  int dbi_re_flags;
382  int dbi_re_delim;
383  unsigned int dbi_re_len;
384  int dbi_re_pad;
385  const char * dbi_re_source;
386  /* queue access parameters */
387  unsigned int dbi_q_extentsize;
388 
389 /*@refcounted@*/
390  rpmdb dbi_rpmdb;
391  rpmTag dbi_rpmtag;
392  int dbi_jlen;
394 /*@only@*//*@relnull@*/
395  DB * dbi_db;
396 /*@only@*//*@null@*/
397  DB_TXN * dbi_txnid;
398 /*@only@*//*@null@*/
399  void * dbi_stats;
401 /*@observer@*/
402  const struct _dbiVec * dbi_vec;
404 };
405 #endif /* !defined(SWIG) */
406 
410 struct rpmdb_s {
411 /*@owned@*/ /*@relnull@*/
412  const char * db_root;
413 /*@owned@*/
414  const char * db_home;
415  int db_flags;
416  int db_mode;
417  int db_perms;
418  int db_api;
419 /*@owned@*/
420  const char * db_errpfx;
422  int db_remove_env;
423  int db_filter_dups;
424  int db_verifying;
425 
426  int db_chrootDone;
427  void (*db_errcall) (const char * db_errpfx, char * buffer)
428  /*@*/;
429 /*@shared@*/
430  FILE * db_errfile;
431 /*@only@*/
432  void * (*db_malloc) (size_t nbytes)
433  /*@*/;
434 /*@only@*/
435  void * (*db_realloc) (/*@only@*//*@null@*/ void * ptr, size_t nbytes)
436  /*@*/;
437  void (*db_free) (/*@only@*/ void * ptr)
438  /*@modifies *ptr @*/;
439 
440  int (*db_export) (rpmdb db, Header h, int adding);
441 
442 /*@only@*/ /*@null@*/
443  unsigned char * db_bits;
444  int db_nbits;
445  rpmdb db_next;
446  int db_opens;
447 /*@only@*/ /*@null@*/
448  void * db_dbenv;
449  int * db_tagn;
450  int db_ndbi;
451 /*@only@*/ /*@null@*/
452  dbiIndex * _dbi;
454  struct rpmop_s db_getops;
455  struct rpmop_s db_putops;
456  struct rpmop_s db_delops;
458 /*@refs@*/
459  int nrefs;
460 };
461 #endif /* defined(_RPMDB_INTERNAL) */
462 
463 /* for RPM's internal use only */
464 
469  RPMDB_FLAG_MINIMAL = (1 << 1),
470 /*@-enummemuse@*/
471  RPMDB_FLAG_CHROOT = (1 << 2)
472 /*@=enummemuse@*/
473 };
474 
475 #ifdef __cplusplus
476 extern "C" {
477 #endif
478 
479 #if defined(_RPMDB_INTERNAL)
480 /*@-exportlocal@*/
487 /*@unused@*/ /*@only@*/ /*@null@*/
488 dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
489  /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
490  /*@modifies rpmGlobalMacroContext, internalState @*/;
491 
497 /*@null@*/
498 dbiIndex db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi)
499  /*@*/;
500 
507 /*@-redecl@*/
508 /*@exposed@*/
509 extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
510  /*@*/;
511 /*@=redecl@*/
512 
520 /*@only@*/ /*@null@*/ dbiIndex dbiOpen(/*@null@*/ rpmdb db, rpmTag rpmtag,
521  unsigned int flags)
522  /*@globals rpmGlobalMacroContext, errno, h_errno @*/
523  /*@modifies db, rpmGlobalMacroContext, errno @*/;
524 
531 void * dbiStatsAccumulator(dbiIndex dbi, int opx)
532  /*@*/;
533 
534 #if !defined(SWIG)
535 /*@-globuse -mustmod @*/ /* FIX: vector annotations */
544 /*@unused@*/ static inline
545 int dbiCopen(dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
546  /*@out@*/ DBC ** dbcp, unsigned int flags)
547  /*@globals fileSystem @*/
548  /*@modifies dbi, *dbcp, fileSystem @*/
549 {
550  return (*dbi->dbi_vec->copen) (dbi, txnid, dbcp, flags);
551 }
552 
560 /*@unused@*/ static inline
561 int dbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
562  /*@globals fileSystem @*/
563  /*@modifies dbi, *dbcursor, fileSystem @*/
564 {
565  return (*dbi->dbi_vec->cclose) (dbi, dbcursor, flags);
566 }
567 
576 /*@unused@*/ static inline
577 int dbiCdup(dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
578  unsigned int flags)
579  /*@modifies dbi, *dbcp @*/
580 {
581  return (*dbi->dbi_vec->cdup) (dbi, dbcursor, dbcp, flags);
582 }
583 
593 /*@unused@*/ static inline
594 int dbiDel(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
595  unsigned int flags)
596  /*@globals fileSystem, internalState @*/
597  /*@modifies dbi, *dbcursor, fileSystem, internalState @*/
598 {
599  rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 16); /* RPMTS_OP_DBDEL */
600  int rc;
601  assert(key->data != NULL && key->size > 0);
602  (void) rpmswEnter(sw, 0);
603  rc = (dbi->dbi_vec->cdel) (dbi, dbcursor, key, data, flags);
604  (void) rpmswExit(sw, data->size);
605  return rc;
606 }
607 
617 /*@unused@*/ static inline
618 int dbiGet(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
619  unsigned int flags)
620  /*@globals fileSystem, internalState @*/
621  /*@modifies dbi, *dbcursor, *key, *data, fileSystem, internalState @*/
622 {
623  rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 14); /* RPMTS_OP_DBGET */
624  int rc;
625  assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
626  (void) rpmswEnter(sw, 0);
627  rc = (dbi->dbi_vec->cget) (dbi, dbcursor, key, data, flags);
628  (void) rpmswExit(sw, data->size);
629  return rc;
630 }
631 
642 /*@unused@*/ static inline
643 int dbiPget(dbiIndex dbi, /*@null@*/ DBC * dbcursor,
644  DBT * key, DBT * pkey, DBT * data, unsigned int flags)
645  /*@globals fileSystem, internalState @*/
646  /*@modifies dbi, *dbcursor, *key, *pkey, *data, fileSystem, internalState @*/
647 {
648  rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 14); /* RPMTS_OP_DBGET */
649  int rc;
650  assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
651  (void) rpmswEnter(sw, 0);
652  rc = (dbi->dbi_vec->cpget) (dbi, dbcursor, key, pkey, data, flags);
653  (void) rpmswExit(sw, data->size);
654  return rc;
655 }
656 
666 /*@unused@*/ static inline
667 int dbiPut(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
668  unsigned int flags)
669  /*@globals fileSystem, internalState @*/
670  /*@modifies dbi, *dbcursor, *key, fileSystem, internalState @*/
671 {
672  rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 15); /* RPMTS_OP_DBPUT */
673  int rc;
674  assert(key->data != NULL && key->size > 0 && data->data != NULL && data->size > 0);
675  (void) rpmswEnter(sw, 0);
676  rc = (dbi->dbi_vec->cput) (dbi, dbcursor, key, data, flags);
677  (void) rpmswExit(sw, data->size);
678  return rc;
679 }
680 
689 /*@unused@*/ static inline
690 int dbiCount(dbiIndex dbi, DBC * dbcursor, /*@out@*/ unsigned int * countp,
691  unsigned int flags)
692  /*@globals fileSystem @*/
693  /*@modifies *dbcursor, fileSystem @*/
694 {
695  return (*dbi->dbi_vec->ccount) (dbi, dbcursor, countp, flags);
696 }
697 
704 /*@unused@*/ static inline
705 int dbiVerify(/*@only@*/ dbiIndex dbi, unsigned int flags)
706  /*@globals fileSystem @*/
707  /*@modifies dbi, fileSystem @*/
708 {
709  dbi->dbi_verify_on_close = 1;
710  return (*dbi->dbi_vec->close) (dbi, flags);
711 }
712 
719 /*@unused@*/ static inline
720 int dbiClose(/*@only@*/ dbiIndex dbi, unsigned int flags)
721  /*@globals fileSystem @*/
722  /*@modifies dbi, fileSystem @*/
723 {
724  return (*dbi->dbi_vec->close) (dbi, flags);
725 }
726 
733 /*@unused@*/ static inline
734 int dbiSync (dbiIndex dbi, unsigned int flags)
735  /*@globals fileSystem @*/
736  /*@modifies fileSystem @*/
737 {
738  return (*dbi->dbi_vec->sync) (dbi, flags);
739 }
740 
749 /*@unused@*/ static inline
750 int dbiAssociate(dbiIndex dbi, dbiIndex dbisecondary,
751  int (*callback) (DB *, const DBT *, const DBT *, DBT *),
752  unsigned int flags)
753  /*@globals fileSystem @*/
754  /*@modifies dbi, fileSystem @*/
755 {
756  return (*dbi->dbi_vec->associate) (dbi, dbisecondary, callback, flags);
757 }
758 
767 /*@unused@*/ static inline
768 int dbiJoin(dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
769  unsigned int flags)
770  /*@globals fileSystem @*/
771  /*@modifies dbi, *dbcp, fileSystem @*/
772 {
773  return (*dbi->dbi_vec->join) (dbi, curslist, dbcp, flags);
774 }
775 
781 /*@unused@*/ static inline
782 int dbiByteSwapped(dbiIndex dbi)
783  /*@modifies dbi @*/
784 {
785  if (dbi->dbi_byteswapped == -1)
786  dbi->dbi_byteswapped = (*dbi->dbi_vec->byteswapped) (dbi);
787  return dbi->dbi_byteswapped;
788 }
789 
796 /*@unused@*/ static inline
797 int dbiStat(dbiIndex dbi, unsigned int flags)
798  /*@modifies dbi @*/
799 {
800  return (*dbi->dbi_vec->stat) (dbi, flags);
801 }
802 
808 /*@unused@*/ static inline /*@observer@*/ /*@null@*/
809 DB_TXN * dbiTxnid(dbiIndex dbi)
810  /*@*/
811 {
812  return dbi->dbi_txnid;
813 }
814 /*@=globuse =mustmod @*/
815 #endif /* !defined(SWIG) */
816 
817 /*@=exportlocal@*/
818 
821 unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi)
822  /*@*/;
823 
829 /*@null@*/
830 dbiIndexSet dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet set)
831  /*@modifies set @*/;
832 
838 unsigned int dbiIndexSetCount(dbiIndexSet set)
839  /*@*/;
840 
847 unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno)
848  /*@*/;
849 
856 unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno)
857  /*@*/;
858 #endif /* defined(_RPMDB_INTERNAL) */
859 
866 /*@unused@*/ /*@null@*/
867 rpmdb rpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg)
868  /*@modifies db @*/;
869 
871 /*@-exportlocal@*/
872 /*@null@*/
873 rpmdb XrpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg,
874  const char * fn, unsigned ln)
875  /*@modifies db @*/;
876 /*@=exportlocal@*/
877 #define rpmdbUnlink(_db, _msg) XrpmdbUnlink(_db, _msg, __FILE__, __LINE__)
878 
885 /*@unused@*/
886 rpmdb rpmdbLink (rpmdb db, const char * msg)
887  /*@modifies db @*/;
888 
890 /*@-exportlocal@*/
891 rpmdb XrpmdbLink (rpmdb db, const char * msg,
892  const char * fn, unsigned ln)
893  /*@modifies db @*/;
894 /*@=exportlocal@*/
895 #define rpmdbLink(_db, _msg) XrpmdbLink(_db, _msg, __FILE__, __LINE__)
896 
905 int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp,
906  int mode, int perms)
907  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
908  /*@modifies *dbp, rpmGlobalMacroContext, fileSystem, internalState @*/;
909 
916 int rpmdbInit(/*@null@*/ const char * prefix, int perms)
917  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
918  /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
919 
925 int rpmdbVerifyAllDBI(rpmdb db)
926  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
927  /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
928 
934 int rpmdbVerify(/*@null@*/ const char * prefix)
935  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
936  /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
937 
944 int rpmdbBlockDBI(/*@null@*/ rpmdb db, int rpmtag)
945  /*@modifies db @*/;
946 
953 int rpmdbCloseDBI(/*@null@*/ rpmdb db, int rpmtag)
954  /*@globals fileSystem @*/
955  /*@modifies db, fileSystem @*/;
956 
962 int rpmdbClose (/*@killref@*/ /*@only@*/ /*@null@*/ rpmdb db)
963  /*@globals fileSystem @*/
964  /*@modifies db, fileSystem @*/;
965 
971 int rpmdbSync (/*@null@*/ rpmdb db)
972  /*@globals fileSystem @*/
973  /*@modifies fileSystem @*/;
974 
980 /*@-exportlocal@*/
981 int rpmdbOpenAll (/*@null@*/ rpmdb db)
982  /*@globals rpmGlobalMacroContext, h_errno @*/
983  /*@modifies db, rpmGlobalMacroContext @*/;
984 /*@=exportlocal@*/
985 
994 int rpmdbCount(/*@null@*/ rpmdb db, rpmTag tag,
995  const void * keyp, size_t keylen)
996  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
997  /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
998 
1005 int rpmdbCountPackages(/*@null@*/ rpmdb db, const char * name)
1006  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1007  /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
1008 
1014 unsigned int rpmdbGetIteratorOffset(/*@null@*/ rpmdbMatchIterator mi)
1015  /*@*/;
1016 
1022 int rpmdbGetIteratorCount(/*@null@*/ rpmdbMatchIterator mi)
1023  /*@*/;
1024 
1032 int rpmdbAppendIterator(/*@null@*/ rpmdbMatchIterator mi,
1033  /*@null@*/ const int * hdrNums, int nHdrNums)
1034  /*@modifies mi @*/;
1035 
1045 int rpmdbPruneIterator(/*@null@*/ rpmdbMatchIterator mi,
1046  /*@null@*/ int * hdrNums, int nHdrNums, int sorted)
1047  /*@modifies mi, hdrNums @*/;
1048 
1057 int rpmdbSetIteratorRE(/*@null@*/ rpmdbMatchIterator mi, rpmTag tag,
1058  rpmMireMode mode, /*@null@*/ const char * pattern)
1059  /*@globals rpmGlobalMacroContext, h_errno @*/
1060  /*@modifies mi, mode, rpmGlobalMacroContext @*/;
1061 
1069 int rpmdbSetIteratorRewrite(/*@null@*/ rpmdbMatchIterator mi, int rewrite)
1070  /*@modifies mi @*/;
1071 
1078 int rpmdbSetIteratorModified(/*@null@*/ rpmdbMatchIterator mi, int modified)
1079  /*@modifies mi @*/;
1080 
1088 int rpmdbSetHdrChk(/*@null@*/ rpmdbMatchIterator mi, /*@null@*/ rpmts ts,
1089  /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void * uh, size_t uc, const char ** msg))
1090  /*@modifies mi @*/;
1091 
1100 /*@only@*/ /*@null@*/
1101 rpmdbMatchIterator rpmdbInitIterator(/*@null@*/ rpmdb db, rpmTag rpmtag,
1102  /*@null@*/ const void * keyp, size_t keylen)
1103  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1104  /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
1105 
1111 /*@null@*/
1112 Header rpmdbNextIterator(/*@null@*/ rpmdbMatchIterator mi)
1113  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1114  /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
1115 
1125 /*@mayexit@*/
1126 int rpmdbCheckTerminate(int terminate)
1127  /*@globals fileSystem, internalState @*/
1128  /*@modifies fileSystem, internalState @*/;
1129 
1133 /*@mayexit@*/
1134 int rpmdbCheckSignals(void)
1135  /*@globals fileSystem, internalState @*/
1136  /*@modifies fileSystem, internalState @*/;
1137 
1143 /*@null@*/
1144 rpmdbMatchIterator rpmdbFreeIterator(/*@only@*/ /*@null@*/rpmdbMatchIterator mi)
1145  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1146  /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
1147 
1157 int rpmdbAdd(/*@null@*/ rpmdb db, int iid, Header h, /*@null@*/ rpmts ts,
1158  /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
1159  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1160  /*@modifies db, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
1161 
1171 int rpmdbRemove(/*@null@*/ rpmdb db, /*@unused@*/ int rid, unsigned int hdrNum,
1172  /*@null@*/ rpmts ts,
1173  /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
1174  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1175  /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
1176 
1184 int rpmdbRebuild(/*@null@*/ const char * prefix, /*@null@*/ rpmts ts,
1185  /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
1186  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1187  /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
1188 
1189 #ifndef __APPLE__
1190 
1193 /*@unused@*/
1194 int mergesort(void *base, size_t nmemb, size_t size,
1195  int (*cmp) (const void *, const void *))
1196  /*@globals errno @*/
1197  /*@modifies base, errno @*/;
1198 #else
1199 /* mergesort is defined in stdlib.h on Mac OS X */
1200 #endif /* __APPLE__ */
1201 
1202 #ifdef __cplusplus
1203 }
1204 #endif
1205 
1206 /*@=bounds@*/
1207 #endif /* H_RPMDB */