rpm 5.2.1

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

- File List
- Globals

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 <rpmtypes.h>
12 #include <mire.h>
13 #if defined(_RPMDB_INTERNAL)
14 #if defined(WITH_DB)
15 #include "db.h"
16 #else
17 #include "db_emu.h"
18 #endif
19 #endif
20
21 #if defined(_RPMDB_INTERNAL)
22 #define DBT_INIT /*@-fullinitblock@*/ {0} /*@-fullinitblock@*/ /* -Wno-missing-field-initializers */
23 #endif
24
25 /*@-exportlocal@*/
26 /*@unchecked@*/
27 extern int _rpmdb_debug;
28 /*@=exportlocal@*/
29
30 #ifdef NOTYET
31
34 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmdb_s * rpmdb;
35
39 typedef /*@abstract@*/ struct rpmmi_s * rpmmi;
40 #endif
41
44 typedef /*@abstract@*/ struct _dbiIndexItem * dbiIndexItem;
45
49 typedef /*@abstract@*/ struct _dbiIndexSet * dbiIndexSet;
50
53 typedef /*@abstract@*/ struct _dbiIndex * dbiIndex;
54
55 #if defined(_RPMDB_INTERNAL)
56 #include <rpmio.h>
57 #include <rpmsw.h>
58
59 #if !defined(SWIG) /* XXX inline dbiFoo() need */
60
63 struct _dbiIndexItem {
64 rpmuint32_t hdrNum;
65 rpmuint32_t tagNum;
66 rpmuint32_t fpNum;
67 };
68
72 struct _dbiIndexSet {
73 /*@owned@*/ struct _dbiIndexItem * recs;
74 int count;
75 };
76
80 struct _dbiVec {
81 int dbv_major;
82 int dbv_minor;
83 int dbv_patch;
91 int (*open) (rpmdb rpmdb, rpmTag tag, /*@out@*/ dbiIndex * dbip)
92 /*@globals fileSystem @*/
93 /*@modifies *dbip, fileSystem @*/;
94
101 int (*close) (/*@only@*/ dbiIndex dbi, unsigned int flags)
102 /*@globals fileSystem @*/
103 /*@modifies dbi, fileSystem @*/;
104
111 int (*sync) (dbiIndex dbi, unsigned int flags)
112 /*@globals fileSystem @*/
113 /*@modifies fileSystem @*/;
114
123 int (*associate) (dbiIndex dbi, dbiIndex dbisecondary,
124 int (*callback) (DB *, const DBT *, const DBT *, DBT *),
125 unsigned int flags)
126 /*@globals fileSystem @*/
127 /*@modifies dbi, fileSystem @*/;
128
137 int (*join) (dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
138 unsigned int flags)
139 /*@globals fileSystem @*/
140 /*@modifies dbi, *dbcp, fileSystem @*/;
141
150 int (*copen) (dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
151 /*@out@*/ DBC ** dbcp, unsigned int dbiflags)
152 /*@globals fileSystem @*/
153 /*@modifies dbi, *txnid, *dbcp, fileSystem @*/;
154
162 int (*cclose) (dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
163 /*@globals fileSystem @*/
164 /*@modifies dbi, *dbcursor, fileSystem @*/;
165
174 int (*cdup) (dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
175 unsigned int flags)
176 /*@globals fileSystem @*/
177 /*@modifies dbi, *dbcp, fileSystem @*/;
178
188 int (*cdel) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
189 unsigned int flags)
190 /*@globals fileSystem @*/
191 /*@modifies *dbcursor, fileSystem @*/;
192
202 int (*cget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
203 unsigned int flags)
204 /*@globals fileSystem @*/
205 /*@modifies *dbcursor, *key, *data, fileSystem @*/;
206
217 int (*cpget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor,
218 DBT * key, DBT * pkey, DBT * data, unsigned int flags)
219 /*@globals fileSystem @*/
220 /*@modifies *dbcursor, *key, *pkey, *data, fileSystem @*/;
221
231 int (*cput) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
232 unsigned int flags)
233 /*@globals fileSystem @*/
234 /*@modifies *dbcursor, fileSystem @*/;
235
244 int (*ccount) (dbiIndex dbi, DBC * dbcursor,
245 /*@out@*/ unsigned int * countp,
246 unsigned int flags)
247 /*@globals fileSystem @*/
248 /*@modifies *dbcursor, fileSystem @*/;
249
255 int (*byteswapped) (dbiIndex dbi)
256 /*@globals fileSystem @*/
257 /*@modifies fileSystem @*/;
258
265 int (*stat) (dbiIndex dbi, unsigned int flags)
266 /*@globals fileSystem @*/
267 /*@modifies dbi, fileSystem @*/;
268 };
269
273 struct _dbiIndex {
274 /*@relnull@*/
275 const char * dbi_root;
276 /*@null@*/
277 const char * dbi_home;
278 /*@relnull@*/
279 const char * dbi_file;
280 /*@relnull@*/
281 const char * dbi_subfile;
282 /*@null@*/
283 const char * dbi_tmpdir;
285 int dbi_ecflags;
286 int dbi_cflags;
287 int dbi_oeflags;
288 int dbi_eflags;
289 int dbi_oflags;
290 int dbi_tflags;
292 int dbi_type;
293 unsigned dbi_mode;
294 int dbi_perms;
295 long dbi_shmkey;
296 int dbi_api;
298 int dbi_verify_on_close;
299 int dbi_use_dbenv;
300 int dbi_permit_dups;
301 int dbi_no_fsync;
302 int dbi_no_dbsync;
303 int dbi_lockdbfd;
304 int dbi_temporary;
305 int dbi_noload;
306 int dbi_debug;
307 int dbi_byteswapped;
308
309 /*@null@*/
310 char * dbi_host;
311 unsigned long dbi_cl_timeout;
312 unsigned long dbi_sv_timeout;
313
314 /* dbenv parameters */
315 int dbi_lorder;
316 /*@unused@*/
317 /* XXX db-4.3.14 adds dbenv as 1st arg. */
318 void (*db_errcall) (void * dbenv, const char *db_errpfx, char *buffer)
319 /*@globals fileSystem @*/
320 /*@modifies fileSystem @*/;
321 /*@unused@*/ /*@shared@*/
322 FILE * dbi_errfile;
323 const char * dbi_errpfx;
324 int dbi_verbose;
325 int dbi_region_init;
326 unsigned int dbi_thread_count;
327 /* locking sub-system parameters */
328 unsigned int dbi_lk_max_lockers;
329 unsigned int dbi_lk_max_locks;
330 unsigned int dbi_lk_max_objects;
331 unsigned int dbi_lk_detect;
332 /*@unused@*/
333 int dbi_lk_nmodes;
334 /*@unused@*/
335 unsigned char * dbi_lk_conflicts;
336 /* logging sub-system parameters */
337 unsigned int dbi_lg_bsize;
338 /*@unused@*/
339 const char * dbi_lg_dir;
340 /*@unused@*/
341 unsigned int dbi_lg_filemode;
342 unsigned int dbi_lg_max;
343 unsigned int dbi_lg_regionmax;
344 /* mpool sub-system parameters */
345 int dbi_mmapsize;
346 int dbi_cachesize;
347 /* mutex sub-system parameters */
348 unsigned int dbi_mutex_align;
349 unsigned int dbi_mutex_increment;
350 unsigned int dbi_mutex_max;
351 unsigned int dbi_mutex_tas_spins;
352 /* replication sub-system parameters */
353 /* sequences sub-system parameters */
354 unsigned int dbi_seq_cachesize;
355 unsigned int dbi_seq_flags;
356 #if 0 /* needs signed 64 bit type */
357 int64_t dbi_seq_min;
358 int64_t dbi_seq_max;
359 #endif
360 /* transaction sub-system parameters */
361 unsigned int dbi_tx_max;
362 #if 0
363 int (*dbi_tx_recover) (DB_ENV *dbenv, DBT *log_rec,
364 DB_LSN *lsnp, int redo, void *info)
365 /*@globals fileSystem @*/
366 /*@modifies fileSystem @*/;
367 #endif
368 /* dbinfo parameters */
369 int dbi_pagesize;
370 /*@unused@*/ /*@null@*/
371 void * (*dbi_malloc) (size_t nbytes)
372 /*@*/;
373 /* hash access parameters */
374 unsigned int dbi_h_ffactor;
375 unsigned int (*dbi_h_hash_fcn) (DB *, const void *bytes,
376 unsigned int length)
377 /*@*/;
378 unsigned int dbi_h_nelem;
379 unsigned int dbi_h_flags;
380 int (*dbi_h_dup_compare_fcn) (DB *, const DBT *, const DBT *)
381 /*@*/;
382 /* btree access parameters */
383 int dbi_bt_flags;
384 int dbi_bt_minkey;
385 int (*dbi_bt_compare_fcn) (DB *, const DBT *, const DBT *)
386 /*@*/;
387 int (*dbi_bt_dup_compare_fcn) (DB *, const DBT *, const DBT *)
388 /*@*/;
389 size_t (*dbi_bt_prefix_fcn) (DB *, const DBT *, const DBT *)
390 /*@*/;
391 /* recno access parameters */
392 int dbi_re_flags;
393 int dbi_re_delim;
394 unsigned int dbi_re_len;
395 int dbi_re_pad;
396 const char * dbi_re_source;
397 /* queue access parameters */
398 unsigned int dbi_q_extentsize;
399
400 /*@refcounted@*/
401 rpmdb dbi_rpmdb;
402 rpmTag dbi_rpmtag;
403 size_t dbi_jlen;
405 /*@only@*//*@relnull@*/
406 DB * dbi_db;
407 /*@only@*//*@null@*/
408 DB_TXN * dbi_txnid;
409 /*@only@*//*@null@*/
410 void * dbi_stats;
412 /*@observer@*/
413 const struct _dbiVec * dbi_vec;
415 };
416 #endif /* !defined(SWIG) */
417
421 struct rpmdb_s {
422 struct rpmioItem_s _item;
423 /*@owned@*/ /*@relnull@*/
424 const char * db_root;
425 /*@owned@*/
426 const char * db_home;
427 int db_flags;
428 int db_mode;
429 int db_perms;
430 int db_api;
431 /*@owned@*/
432 const char * db_errpfx;
434 int db_remove_env;
435 int db_filter_dups;
436 int db_verifying;
437
438 int db_chrootDone;
439 void (*db_errcall) (const char * db_errpfx, char * buffer)
440 /*@*/;
441 /*@shared@*/
442 FILE * db_errfile;
443 /*@only@*/
444 void * (*db_malloc) (size_t nbytes)
445 /*@*/;
446 /*@only@*/
447 void * (*db_realloc) (/*@only@*//*@null@*/ void * ptr, size_t nbytes)
448 /*@*/;
449 void (*db_free) (/*@only@*/ void * ptr)
450 /*@modifies *ptr @*/;
451
452 int (*db_export) (rpmdb db, Header h, int adding);
453
454 /*@only@*/ /*@null@*/
455 unsigned char * db_bits;
456 int db_nbits;
457 rpmdb db_next;
458 int db_opens;
459 /*@only@*/ /*@null@*/
460 void * db_dbenv;
461 tagStore_t db_tags;
462 size_t db_ndbi;
463 /*@only@*/ /*@null@*/
464 dbiIndex * _dbi;
466 struct rpmop_s db_getops;
467 struct rpmop_s db_putops;
468 struct rpmop_s db_delops;
470 #if defined(__LCLINT__)
471 /*@refs@*/
472 int nrefs;
473 #endif
474 };
475 #endif /* defined(_RPMDB_INTERNAL) */
476
477 /* for RPM's internal use only */
478
481 enum rpmdbFlags {
482 RPMDB_FLAG_JUSTCHECK = (1 << 0),
483 RPMDB_FLAG_MINIMAL = (1 << 1),
484 /*@-enummemuse@*/
485 RPMDB_FLAG_CHROOT = (1 << 2)
486 /*@=enummemuse@*/
487 };
488
489 #ifdef __cplusplus
490 extern "C" {
491 #endif
492
493 #if defined(_RPMDB_INTERNAL)
494 /*@-exportlocal@*/
495 #if defined(WITH_DB) || defined(WITH_SQLITE)
496
502 /*@unused@*/ /*@only@*/ /*@null@*/
503 dbiIndex db3New(rpmdb rpmdb, rpmTag tag)
504 /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
505 /*@modifies rpmGlobalMacroContext, internalState @*/;
506
512 /*@null@*/
513 dbiIndex db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi)
514 /*@*/;
515
522 /*@-redecl@*/
523 /*@exposed@*/
524 extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
525 /*@*/;
526 /*@=redecl@*/
527 #endif
528
536 /*@only@*/ /*@null@*/ dbiIndex dbiOpen(/*@null@*/ rpmdb db, rpmTag tag,
537 unsigned int flags)
538 /*@globals rpmGlobalMacroContext, errno, h_errno, internalState @*/
539 /*@modifies db, rpmGlobalMacroContext, errno, internalState @*/;
540
547 void * dbiStatsAccumulator(dbiIndex dbi, int opx)
548 /*@*/;
549
550 #if !defined(SWIG)
551 /*@-globuse -mustmod @*/ /* FIX: vector annotations */
560 /*@unused@*/ static inline
561 int dbiCopen(dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
562 /*@out@*/ DBC ** dbcp, unsigned int flags)
563 /*@globals fileSystem @*/
564 /*@modifies dbi, *dbcp, fileSystem @*/
565 {
566 return (*dbi->dbi_vec->copen) (dbi, txnid, dbcp, flags);
567 }
568
576 /*@unused@*/ static inline
577 int dbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
578 /*@globals fileSystem @*/
579 /*@modifies dbi, *dbcursor, fileSystem @*/
580 {
581 return (*dbi->dbi_vec->cclose) (dbi, dbcursor, flags);
582 }
583
592 /*@unused@*/ static inline
593 int dbiCdup(dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
594 unsigned int flags)
595 /*@modifies dbi, *dbcp @*/
596 {
597 return (*dbi->dbi_vec->cdup) (dbi, dbcursor, dbcp, flags);
598 }
599
609 /*@unused@*/ static inline
610 int dbiDel(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
611 unsigned int flags)
612 /*@globals fileSystem, internalState @*/
613 /*@modifies dbi, *dbcursor, fileSystem, internalState @*/
614 {
615 rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 16); /* RPMTS_OP_DBDEL */
616 int rc;
617 assert(key->data != NULL && key->size > 0);
618 (void) rpmswEnter(sw, 0);
619 rc = (dbi->dbi_vec->cdel) (dbi, dbcursor, key, data, flags);
620 (void) rpmswExit(sw, data->size);
621 return rc;
622 }
623
633 /*@unused@*/ static inline
634 int dbiGet(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
635 unsigned int flags)
636 /*@globals fileSystem, internalState @*/
637 /*@modifies dbi, *dbcursor, *key, *data, fileSystem, internalState @*/
638 {
639 rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 14); /* RPMTS_OP_DBGET */
640 int rc;
641 assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
642 (void) rpmswEnter(sw, 0);
643 rc = (dbi->dbi_vec->cget) (dbi, dbcursor, key, data, flags);
644 (void) rpmswExit(sw, data->size);
645 return rc;
646 }
647
658 /*@unused@*/ static inline
659 int dbiPget(dbiIndex dbi, /*@null@*/ DBC * dbcursor,
660 DBT * key, DBT * pkey, DBT * data, unsigned int flags)
661 /*@globals fileSystem, internalState @*/
662 /*@modifies dbi, *dbcursor, *key, *pkey, *data, fileSystem, internalState @*/
663 {
664 rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 14); /* RPMTS_OP_DBGET */
665 int rc;
666 assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
667 (void) rpmswEnter(sw, 0);
668 rc = (dbi->dbi_vec->cpget) (dbi, dbcursor, key, pkey, data, flags);
669 (void) rpmswExit(sw, data->size);
670 return rc;
671 }
672
682 /*@unused@*/ static inline
683 int dbiPut(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
684 unsigned int flags)
685 /*@globals fileSystem, internalState @*/
686 /*@modifies dbi, *dbcursor, *key, fileSystem, internalState @*/
687 {
688 rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 15); /* RPMTS_OP_DBPUT */
689 int rc;
690 assert(key->data != NULL && key->size > 0 && data->data != NULL && data->size > 0);
691 (void) rpmswEnter(sw, 0);
692 rc = (dbi->dbi_vec->cput) (dbi, dbcursor, key, data, flags);
693 (void) rpmswExit(sw, data->size);
694 return rc;
695 }
696
705 /*@unused@*/ static inline
706 int dbiCount(dbiIndex dbi, DBC * dbcursor, /*@out@*/ unsigned int * countp,
707 unsigned int flags)
708 /*@globals fileSystem @*/
709 /*@modifies *dbcursor, fileSystem @*/
710 {
711 return (*dbi->dbi_vec->ccount) (dbi, dbcursor, countp, flags);
712 }
713
720 /*@unused@*/ static inline
721 int dbiVerify(/*@only@*/ dbiIndex dbi, unsigned int flags)
722 /*@globals fileSystem @*/
723 /*@modifies dbi, fileSystem @*/
724 {
725 dbi->dbi_verify_on_close = 1;
726 return (*dbi->dbi_vec->close) (dbi, flags);
727 }
728
735 /*@unused@*/ static inline
736 int dbiClose(/*@only@*/ dbiIndex dbi, unsigned int flags)
737 /*@globals fileSystem @*/
738 /*@modifies dbi, fileSystem @*/
739 {
740 return (*dbi->dbi_vec->close) (dbi, flags);
741 }
742
749 /*@unused@*/ static inline
750 int dbiSync (dbiIndex dbi, unsigned int flags)
751 /*@globals fileSystem @*/
752 /*@modifies fileSystem @*/
753 {
754 return (*dbi->dbi_vec->sync) (dbi, flags);
755 }
756
765 /*@unused@*/ static inline
766 int dbiAssociate(dbiIndex dbi, dbiIndex dbisecondary,
767 int (*callback) (DB *, const DBT *, const DBT *, DBT *),
768 unsigned int flags)
769 /*@globals fileSystem @*/
770 /*@modifies dbi, fileSystem @*/
771 {
772 return (*dbi->dbi_vec->associate) (dbi, dbisecondary, callback, flags);
773 }
774
783 /*@unused@*/ static inline
784 int dbiJoin(dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
785 unsigned int flags)
786 /*@globals fileSystem @*/
787 /*@modifies dbi, *dbcp, fileSystem @*/
788 {
789 return (*dbi->dbi_vec->join) (dbi, curslist, dbcp, flags);
790 }
791
797 /*@unused@*/ static inline
798 int dbiByteSwapped(dbiIndex dbi)
799 /*@modifies dbi @*/
800 {
801 if (dbi->dbi_byteswapped == -1)
802 dbi->dbi_byteswapped = (*dbi->dbi_vec->byteswapped) (dbi);
803 return dbi->dbi_byteswapped;
804 }
805
812 /*@unused@*/ static inline
813 int dbiStat(dbiIndex dbi, unsigned int flags)
814 /*@modifies dbi @*/
815 {
816 return (*dbi->dbi_vec->stat) (dbi, flags);
817 }
818
824 /*@unused@*/ static inline /*@observer@*/ /*@null@*/
825 DB_TXN * dbiTxnid(dbiIndex dbi)
826 /*@*/
827 {
828 return dbi->dbi_txnid;
829 }
830 /*@=globuse =mustmod @*/
831 #endif /* !defined(SWIG) */
832
833 /*@=exportlocal@*/
834
840 /*@null@*/
841 dbiIndexSet dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet set)
842 /*@modifies set @*/;
843
849 unsigned int dbiIndexSetCount(dbiIndexSet set)
850 /*@*/;
851
858 unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno)
859 /*@*/;
860
867 unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno)
868 /*@*/;
869 #endif /* defined(_RPMDB_INTERNAL) */
870
877 /*@unused@*/ /*@null@*/
878 rpmdb rpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg)
879 /*@modifies db @*/;
880 #define rpmdbUnlink(_db, _msg) \
881 ((rpmdb)rpmioUnlinkPoolItem((rpmioItem)(_db), _msg, __FILE__, __LINE__))
882
889 /*@unused@*/ /*@newref@*/
890 rpmdb rpmdbLink (rpmdb db, const char * msg)
891 /*@modifies db @*/;
892 #define rpmdbLink(_db, _msg) \
893 ((void *)rpmioLinkPoolItem((rpmioItem)(_db), _msg, __FILE__, __LINE__))
894
897 /*@only@*/ /*@null@*/
898 rpmdb rpmdbNew(/*@kept@*/ /*@null@*/ const char * root,
899 /*@kept@*/ /*@null@*/ const char * home,
900 int mode, int perms, int flags)
901 /*@globals fileSystem, internalState @*/
902 /*@modifies fileSystem, internalState @*/;
903
906 int rpmdbOpenDatabase(/*@null@*/ const char * prefix,
907 /*@null@*/ const char * dbpath,
908 int _dbapi, /*@null@*/ /*@out@*/ rpmdb *dbp,
909 int mode, int perms, int flags)
910 /*@globals rpmGlobalMacroContext, h_errno,
911 fileSystem, internalState @*/
912 /*@modifies *dbp, rpmGlobalMacroContext,
913 fileSystem, internalState @*/;
914
923 int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp,
924 int mode, int perms)
925 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
926 /*@modifies *dbp, rpmGlobalMacroContext, fileSystem, internalState @*/;
927
934 int rpmdbInit(/*@null@*/ const char * prefix, int perms)
935 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
936 /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
937
943 int rpmdbVerifyAllDBI(rpmdb db)
944 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
945 /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
946
952 int rpmdbVerify(/*@null@*/ const char * prefix)
953 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
954 /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
955
962 int rpmdbBlockDBI(/*@null@*/ rpmdb db, int tag)
963 /*@modifies db @*/;
964
971 int rpmdbCloseDBI(/*@null@*/ rpmdb db, int tag)
972 /*@globals fileSystem @*/
973 /*@modifies db, fileSystem @*/;
974
980 int rpmdbClose (/*@killref@*/ /*@only@*/ /*@null@*/ rpmdb db)
981 /*@globals fileSystem @*/
982 /*@modifies db, fileSystem @*/;
983
989 int rpmdbSync (/*@null@*/ rpmdb db)
990 /*@globals fileSystem @*/
991 /*@modifies fileSystem @*/;
992
998 /*@-exportlocal@*/
999 int rpmdbOpenAll (/*@null@*/ rpmdb db)
1000 /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
1001 /*@modifies db, rpmGlobalMacroContext, internalState @*/;
1002 /*@=exportlocal@*/
1003
1012 int rpmdbCount(/*@null@*/ rpmdb db, rpmTag tag,
1013 const void * keyp, size_t keylen)
1014 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1015 /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
1016
1023 int rpmdbCountPackages(/*@null@*/ rpmdb db, const char * name)
1024 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1025 /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
1026
1032 unsigned int rpmmiInstance(/*@null@*/ rpmmi mi)
1033 /*@*/;
1034
1039 unsigned int rpmmiFilenum(rpmmi mi)
1040 /*@*/;
1041
1047 int rpmmiCount(/*@null@*/ rpmmi mi)
1048 /*@*/;
1049
1057 int rpmmiGrow(/*@null@*/ rpmmi mi,
1058 /*@null@*/ const int * hdrNums, int nHdrNums)
1059 /*@modifies mi @*/;
1060
1070 int rpmmiPrune(/*@null@*/ rpmmi mi,
1071 /*@null@*/ int * hdrNums, int nHdrNums, int sorted)
1072 /*@modifies mi, hdrNums @*/;
1073
1082 int rpmmiAddPattern(/*@null@*/ rpmmi mi, rpmTag tag,
1083 rpmMireMode mode, /*@null@*/ const char * pattern)
1084 /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
1085 /*@modifies mi, mode, rpmGlobalMacroContext, internalState @*/;
1086
1094 int rpmmiSetRewrite(/*@null@*/ rpmmi mi, int rewrite)
1095 /*@modifies mi @*/;
1096
1103 int rpmmiSetModified(/*@null@*/ rpmmi mi, int modified)
1104 /*@modifies mi @*/;
1105
1112 int rpmmiSetHdrChk(/*@null@*/ rpmmi mi, /*@null@*/ rpmts ts)
1113 /*@modifies mi @*/;
1114
1123 /*@only@*/ /*@null@*/
1124 rpmmi rpmmiInit(/*@null@*/ rpmdb db, rpmTag tag,
1125 /*@null@*/ const void * keyp, size_t keylen)
1126 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1127 /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
1128
1134 /*@null@*/
1135 Header rpmmiNext(/*@null@*/ rpmmi mi)
1136 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1137 /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
1138
1148 /*@mayexit@*/
1149 int rpmdbCheckTerminate(int terminate)
1150 /*@globals fileSystem, internalState @*/
1151 /*@modifies fileSystem, internalState @*/;
1152
1156 /*@mayexit@*/
1157 int rpmdbCheckSignals(void)
1158 /*@globals fileSystem, internalState @*/
1159 /*@modifies fileSystem, internalState @*/;
1160
1166 /*@null@*/
1167 rpmmi rpmmiUnlink(/*@only@*/ /*@null@*/rpmmi mi)
1168 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1169 /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
1170 #define rpmmiUnlink(_mi) \
1171 ((rpmmi)rpmioUnlinkPoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))
1172
1178 /*@null@*/
1179 rpmmi rpmmiLink(/*@only@*/ /*@null@*/rpmmi mi)
1180 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1181 /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
1182 #define rpmmiLink(_mi) \
1183 ((rpmmi)rpmioLinkPoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))
1184
1190 /*@null@*/
1191 rpmmi rpmmiFree(/*@only@*/ /*@null@*/rpmmi mi)
1192 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1193 /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
1194 #define rpmmiFree(_mi) \
1195 ((rpmmi)rpmioFreePoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))
1196
1206 int rpmdbMireApply(rpmdb db, rpmTag tag, rpmMireMode mode, const char * pat,
1207 const char *** argvp)
1208 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1209 /*@modifies db, *argvp,
1210 rpmGlobalMacroContext, fileSystem, internalState @*/;
1211
1220 int rpmdbAdd(/*@null@*/ rpmdb db, int iid, Header h, /*@null@*/ rpmts ts)
1221 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1222 /*@modifies db, h, ts,
1223 rpmGlobalMacroContext, fileSystem, internalState @*/;
1224
1233 int rpmdbRemove(/*@null@*/ rpmdb db, /*@unused@*/ int rid, unsigned int hdrNum,
1234 /*@null@*/ rpmts ts)
1235 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1236 /*@modifies db, ts,
1237 rpmGlobalMacroContext, fileSystem, internalState @*/;
1238
1245 int rpmdbRebuild(/*@null@*/ const char * prefix, /*@null@*/ rpmts ts)
1246 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
1247 /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
1248
1252 /*@unused@*/
1253 int rpm_mergesort(void *base, size_t nmemb, size_t size,
1254 int (*cmp) (const void *, const void *))
1255 /*@globals errno @*/
1256 /*@modifies base, errno @*/;
1257
1258 #ifdef __cplusplus
1259 }
1260 #endif
1261
1262 /*@=bounds@*/
1263 #endif /* H_RPMDB */