Defines | Typedefs | Enumerations | Functions | Variables

# rpmdb/rpmdb.h File Reference

Access RPM indices using Berkeley DB interface(s). More...

`#include <assert.h>`
`#include <rpmlib.h>`
`#include <mire.h>`
`#include "db_emu.h"`
Include dependency graph for rpmdb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
#define | rpmdbUnlink(_db, _msg) XrpmdbUnlink(_db, _msg, __FILE__, __LINE__)
#define | rpmdbLink(_db, _msg) XrpmdbLink(_db, _msg, __FILE__, __LINE__)
## Typedefs
typedef struct _dbiIndexItem * | dbiIndexItem
typedef struct _dbiIndexSet * | dbiIndexSet
| A single element (i.e.
typedef struct _dbiIndex * | dbiIndex
## Enumerations
enum | rpmdbFlags { RPMDB_FLAG_JUSTCHECK = (1 << 0), RPMDB_FLAG_MINIMAL = (1 << 1), RPMDB_FLAG_CHROOT = (1 << 2) }
## Functions
rpmdb | rpmdbUnlink (rpmdb db, const char *msg)
| Unreference a database instance.
rpmdb | XrpmdbUnlink (rpmdb db, const char *msg, const char *fn, unsigned ln)
rpmdb | rpmdbLink (rpmdb db, const char *msg)
| Reference a database instance.
rpmdb | XrpmdbLink (rpmdb db, const char *msg, const char *fn, unsigned ln)
rpmdb | rpmdbNew (const char *root, const char *home, int mode, int perms, int flags)
int | rpmdbOpenDatabase (const char *prefix, const char *dbpath, int _dbapi, rpmdb *dbp, int mode, int perms, int flags)
int | rpmdbOpen (const char *prefix, rpmdb *dbp, int mode, int perms)
| Open rpm database.
int | rpmdbInit (const char *prefix, int perms)
| Initialize database.
int | rpmdbVerifyAllDBI (rpmdb db)
| Verify all database components.
int | rpmdbVerify (const char *prefix)
| Open and verify all database components.
int | rpmdbBlockDBI (rpmdb db, int rpmtag)
| Block access to a single database index.
int | rpmdbCloseDBI (rpmdb db, int rpmtag)
| Close a single database index.
int | rpmdbClose (rpmdb db)
| Close all database indices and free rpmdb.
int | rpmdbSync (rpmdb db)
| Sync all database indices.
int | rpmdbOpenAll (rpmdb db)
| Open all database indices.
int | rpmdbCountPackages (rpmdb db, const char *name)
| Return number of instances of package in rpm database.
unsigned int | rpmdbGetIteratorOffset (rpmdbMatchIterator mi)
| Return header instance join key for current position of rpmdb iterator.
unsigned int | rpmdbGetIteratorFileNum (rpmdbMatchIterator mi)
| Return header tag index join key for current position of rpmdb iterator.
int | rpmdbGetIteratorCount (rpmdbMatchIterator mi)
| Return number of elements in rpm database iterator.
int | rpmdbAppendIterator (rpmdbMatchIterator mi, const int *hdrNums, int nHdrNums)
| Append items to set of package instances to iterate.
int | rpmdbPruneIterator (rpmdbMatchIterator mi, int *hdrNums, int nHdrNums, int sorted)
| Remove items from set of package instances to iterate.
int | rpmdbSetIteratorRE (rpmdbMatchIterator mi, rpmTag tag, rpmMireMode mode, const char *pattern)
| Add pattern to iterator selector.
int | rpmdbSetIteratorRewrite (rpmdbMatchIterator mi, int rewrite)
| Prepare iterator for lazy writes.
int | rpmdbSetIteratorModified (rpmdbMatchIterator mi, int modified)
| Modify iterator to mark header for lazy write on release.
int | rpmdbSetHdrChk (rpmdbMatchIterator mi, rpmts ts)
| Modify iterator to verify retrieved header blobs.
rpmdbMatchIterator | rpmdbInitIterator (rpmdb db, rpmTag rpmtag, const void *keyp, size_t keylen)
| Return database iterator.
Header | rpmdbNextIterator (rpmdbMatchIterator mi)
| Return next package header from iteration.
int | rpmdbCheckTerminate (int terminate)
| Check rpmdb signal handler for trapped signal and/or requested exit.
int | rpmdbCheckSignals (void)
| Check for and exit on termination signals.
rpmdbMatchIterator | rpmdbFreeIterator (rpmdbMatchIterator mi)
| Destroy rpm database iterator.
int | rpmdbAdd (rpmdb db, int iid, Header h, rpmts ts)
| Add package header to rpm database and indices.
int | rpmdbRemove (rpmdb db, int rid, unsigned int hdrNum, rpmts ts)
| Remove package header from rpm database and indices.
int | rpmdbRebuild (const char *prefix, rpmts ts)
| Rebuild database indices from package headers.
int | rpm_mergesort (void *base, size_t nmemb, size_t size, int(*cmp)(const void *, const void *))
| Mergesort, same arguments as qsort(2).
## Variables
int | _rpmdb_debug

## Detailed Description

Access RPM indices using Berkeley DB interface(s).

Definition in file rpmdb.h.

## Define Documentation

#define rpmdbLink | ( |  | _db,
|  |  | _msg
| ) |  | XrpmdbLink(_db, _msg, __FILE__, __LINE__)

Definition at line 897 of file rpmdb.h.

#define rpmdbUnlink | ( |  | _db,
|  |  | _msg
| ) |  | XrpmdbUnlink(_db, _msg, __FILE__, __LINE__)

Definition at line 879 of file rpmdb.h.

## Typedef Documentation

typedef struct _dbiIndex* dbiIndex

Definition at line 47 of file rpmdb.h.

typedef struct _dbiIndexItem* dbiIndexItem

Definition at line 38 of file rpmdb.h.

## Function Documentation

int rpm_mergesort | ( | void * | base,
|  | size_t | nmemb,
|  | size_t | size,
|  | int(*)(const void *, const void *) | cmp
| ) |  |

Mergesort, same arguments as qsort(2).

Definition at line 211 of file merge.c.

References CCOPY_ELT, CCOPY_LIST, errno, EVAL, ICOPY_ELT, ICOPY_LIST, ISIZE, PSIZE, and setup().

Referenced by rpmdbSortIterator().

int rpmdbBlockDBI | ( | rpmdb | db,
|  | int | rpmtag
| ) |  |

Block access to a single database index.

Parameters:

  db | rpm database
  rpmtag | rpm tag (negative to block)

Returns:
  0 on success

Definition at line 953 of file rpmdb.c.

Referenced by rpmgiNext().

int rpmdbCloseDBI | ( | rpmdb | db,
|  | int | rpmtag
| ) |  |

Close a single database index.

Parameters:

  db | rpm database
  rpmtag | rpm tag

Returns:
  0 on success

Definition at line 971 of file rpmdb.c.

Referenced by rpmtsCheck().

rpmdb rpmdbNew | ( | const char * | root,
|  | const char * | home,
|  | int | mode,
|  | int | perms,
|  | int | flags
| ) |  |

Todo:
  document rpmdbNew

Definition at line 1132 of file rpmdb.c.

References _, _DB_ERRPFX, _db_filter_dups, _DB_HOME, _DB_ROOT, _free(), _rpmdb_debug, dbiTagsInit(), dbTemplate, rpmdbExportInfo(), rpmdbLink(), rpmdbURIPath(), rpmExpand(), rpmExpandNumeric(), rpmlog(), RPMLOG_ERR, and xcalloc().

Referenced by rpmdbOpenDatabase().

int rpmdbOpenDatabase | ( | const char * | prefix,
|  | const char * | dbpath,
|  | int | _dbapi,
|  | rpmdb * | dbp,
|  | int | mode,
|  | int | perms,
|  | int | flags
| ) |  |

Todo:
  document rpmdbOpenDatabase

Definition at line 1190 of file rpmdb.c.

References dbiOpen(), RPMDB_FLAG_JUSTCHECK, RPMDB_FLAG_MINIMAL, rpmdbClose(), RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_PACKAGES, RPMDBI_REMOVED, rpmdbNew(), rpmdbRock, and rpmsqEnable().

Referenced by rpmdbInit(), rpmdbOpen(), rpmdbRebuild(), and rpmdbVerify().

rpmdb XrpmdbLink | ( | rpmdb | db,
|  | const char * | msg,
|  | const char * | fn,
|  | unsigned | ln
| ) |  |

Todo:
  Remove debugging entry from the ABI.

Definition at line 1299 of file rpmdb.c.

References _rpmdb_debug.

rpmdb XrpmdbUnlink | ( | rpmdb | db,
|  | const char * | msg,
|  | const char * | fn,
|  | unsigned | ln
| ) |  |

Todo:
  Remove debugging entry from the ABI.

Definition at line 1289 of file rpmdb.c.

References _rpmdb_debug.

## Variable Documentation

int _rpmdb_debug

Definition at line 49 of file rpmdb.c.