rpm 5.2.1

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

- File List
- Globals

Macros | Typedefs | Enumerations | Functions | Variables
rpmdb.h File Reference
RPMDB Database API. | RPMDBI DataBase Index Element API. | Berkeley DB API.

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

`#include <assert.h>`
`#include <rpmtypes.h>`
`#include <mire.h>`
`#include "db_emu.h"`
`#include <rpmio.h>`
`#include <rpmsw.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.

## Macros
#define | rpmdbUnlink(_db, _msg) ((rpmdb)rpmioUnlinkPoolItem((rpmioItem)(_db), _msg, __FILE__, __LINE__))
#define | rpmdbLink(_db, _msg) ((void *)rpmioLinkPoolItem((rpmioItem)(_db), _msg, __FILE__, __LINE__))
#define | rpmmiUnlink(_mi) ((rpmmi)rpmioUnlinkPoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))
#define | rpmmiLink(_mi) ((rpmmi)rpmioLinkPoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))
#define | rpmmiFree(_mi) ((rpmmi)rpmioFreePoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))

## Typedefs
typedef struct _dbiIndexItem * | dbiIndexItem
typedef struct _dbiIndexSet * | dbiIndexSet
| A single element (i.e. More...
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. More...
rpmdb | rpmdbLink (rpmdb db, const char *msg)
| Reference a database instance. More...
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. More...
int | rpmdbInit (const char *prefix, int perms)
| Initialize database. More...
int | rpmdbVerifyAllDBI (rpmdb db)
| Verify all database components. More...
int | rpmdbVerify (const char *prefix)
| Open and verify all database components. More...
int | rpmdbBlockDBI (rpmdb db, int tag)
| Block access to a single database index. More...
int | rpmdbCloseDBI (rpmdb db, int tag)
| Close a single database index. More...
int | rpmdbClose (rpmdb db)
| Close all database indices and free rpmdb. More...
int | rpmdbSync (rpmdb db)
| Sync all database indices. More...
int | rpmdbOpenAll (rpmdb db)
| Open all database indices. More...
int | rpmdbCount (rpmdb db, rpmTag tag, const void *keyp, size_t keylen)
| Return number of instances of key in a tag index. More...
int | rpmdbCountPackages (rpmdb db, const char *name)
| Return number of instances of package in Name index. More...
unsigned int | rpmmiInstance (rpmmi mi)
| Return header instance join key for current position of rpmdb iterator. More...
unsigned int | rpmmiFilenum (rpmmi mi)
| Return header tag index join key for current position of rpmdb iterator. More...
int | rpmmiCount (rpmmi mi)
| Return number of elements in rpm database iterator. More...
int | rpmmiGrow (rpmmi mi, const int *hdrNums, int nHdrNums)
| Append items to set of package instances to iterate. More...
int | rpmmiPrune (rpmmi mi, int *hdrNums, int nHdrNums, int sorted)
| Remove items from set of package instances to iterate. More...
int | rpmmiAddPattern (rpmmi mi, rpmTag tag, rpmMireMode mode, const char *pattern)
| Add pattern to iterator selector. More...
int | rpmmiSetRewrite (rpmmi mi, int rewrite)
| Prepare iterator for lazy writes. More...
int | rpmmiSetModified (rpmmi mi, int modified)
| Modify iterator to mark header for lazy write on release. More...
int | rpmmiSetHdrChk (rpmmi mi, rpmts ts)
| Modify iterator to verify retrieved header blobs. More...
rpmmi | rpmmiInit (rpmdb db, rpmTag tag, const void *keyp, size_t keylen)
| Return database iterator. More...
Header | rpmmiNext (rpmmi mi)
| Return next package header from iteration. More...
int | rpmdbCheckTerminate (int terminate)
| Check rpmdb signal handler for trapped signal and/or requested exit. More...
int | rpmdbCheckSignals (void)
| Check for and exit on termination signals. More...
rpmmi | rpmmiUnlink (rpmmi mi)
| Unreference a rpm database iterator. More...
rpmmi | rpmmiLink (rpmmi mi)
| Reference a rpm database iterator. More...
rpmmi | rpmmiFree (rpmmi mi)
| Destroy rpm database iterator. More...
int | rpmdbMireApply (rpmdb db, rpmTag tag, rpmMireMode mode, const char *pat, const char ***argvp)
| Return array of keys matching a pattern. More...
int | rpmdbAdd (rpmdb db, int iid, Header h, rpmts ts)
| Add package header to rpm database and indices. More...
int | rpmdbRemove (rpmdb db, int rid, unsigned int hdrNum, rpmts ts)
| Remove package header from rpm database and indices. More...
int | rpmdbRebuild (const char *prefix, rpmts ts)
| Rebuild database indices from package headers. More...
int | rpm_mergesort (void *base, size_t nmemb, size_t size, int(*cmp)(const void *, const void *))
| Mergesort, same arguments as qsort(2). More...

## Variables
int | _rpmdb_debug

## Detailed Description

Access RPM indices using Berkeley DB interface(s).

Definition in file rpmdb.h.

## Macro Definition Documentation

#define rpmdbLink | ( |  | _db,
|  |  | _msg
| ) |  | ((void *)rpmioLinkPoolItem((rpmioItem)(_db), _msg, __FILE__, __LINE__))

Definition at line 892 of file rpmdb.h.

#define rpmdbUnlink | ( |  | _db,
|  |  | _msg
| ) |  | ((rpmdb)rpmioUnlinkPoolItem((rpmioItem)(_db), _msg, __FILE__, __LINE__))

Definition at line 880 of file rpmdb.h.

#define rpmmiFree | ( |  | _mi | ) | ((rpmmi)rpmioFreePoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))

Definition at line 1194 of file rpmdb.h.

#define rpmmiLink | ( |  | _mi | ) | ((rpmmi)rpmioLinkPoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))

Definition at line 1182 of file rpmdb.h.

#define rpmmiUnlink | ( |  | _mi | ) | ((rpmmi)rpmioUnlinkPoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))

Definition at line 1170 of file rpmdb.h.

## Typedef Documentation

typedef struct _dbiIndex* dbiIndex

Definition at line 53 of file rpmdb.h.

typedef struct _dbiIndexItem* dbiIndexItem

Definition at line 44 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 213 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 | tag
| ) |  |

Block access to a single database index.

Parameters

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

Returns
  0 on success

Definition at line 974 of file rpmdb.c.

Referenced by rpmgiNext().

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

Close a single database index.

Parameters

  db | rpm database
  tag | rpm tag

Returns
  0 on success

Definition at line 992 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 1171 of file rpmdb.c.

References _, _DB_ERRPFX, _db_filter_dups, _DB_FLAGS, _DB_HOME, _DB_MAJOR, _DB_MODE, _DB_PERMS, _DB_ROOT, _free(), _rpmdb_debug, dbiTagsInit(), rpmdbExportInfo(), rpmdbGetPool(), rpmdbLink(), rpmdbURIPath(), rpmExpand(), rpmExpandNumeric(), rpmioPutPool(), 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 1225 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, rpmsqEnable(), and RPMTAG_NAME.

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

## Variable Documentation

int _rpmdb_debug

Definition at line 61 of file rpmdb.c.