db3.c File Reference
Berkeley DB API.
`#include "system.h"`
`#include <rpmlog.h>`
`#include <rpmmacro.h>`
`#include <rpmurl.h>`
`#include <rpmtag.h>`
`#include <rpmdb.h>`
`#include "debug.h"`
Include dependency graph for db3.c:

Go to the source code of this file.

## Data Structures

struct | dbiHStats_s
| Hash database statistics. More...
struct | dbiBStats_s
| B-tree database statistics. More...

## Macros

#define | _RPMTAG_INTERNAL
#define | _RPMDB_INTERNAL
#define | DB_CLIENT DB_RPCCLIENT
#define | PLD_CHROOT

## Functions

static int | cvtdberr (dbiIndex dbi, const char *msg, int error, int printit)
static const char * | mapTagName (rpmdb rpmdb, dbiIndex dbi)
| Return (possibly renamed) tagName. More...
static int | db_fini (dbiIndex dbi, const char *dbhome, const char *dbfile, const char *dbsubfile)
static int | db3_fsync_disable (int fd)
static int | db_init (dbiIndex dbi, const char *dbhome, const char *dbfile, const char *dbsubfile, DB_ENV **dbenvp)
static int | db3sync (dbiIndex dbi, unsigned int flags)
static int | db3cdup (dbiIndex dbi, DBC *dbcursor, DBC **dbcp, unsigned int flags)
static int | db3cclose (dbiIndex dbi, DBC *dbcursor, unsigned int flags)
static int | db3copen (dbiIndex dbi, DB_TXN *txnid, DBC **dbcp, unsigned int dbiflags)
static int | db3cput (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags)
static int | db3cdel (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags)
static int | db3cget (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags)
static int | db3cpget (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *pkey, DBT *data, unsigned int flags)
static int | db3ccount (dbiIndex dbi, DBC *dbcursor, unsigned int *countp, unsigned int flags)
static int | db3byteswapped (dbiIndex dbi)
static int | db3stat (dbiIndex dbi, unsigned int flags)
static int | db3associate (dbiIndex dbi, dbiIndex dbisecondary, int(*callback)(DB *, const DBT *, const DBT *, DBT *), unsigned int flags)
static int | db3join (dbiIndex dbi, DBC **curslist, DBC **dbcp, unsigned int flags)
static int | db3close (dbiIndex dbi, unsigned int flags)
static int | db3open (rpmdb rpmdb, rpmTag rpmtag, dbiIndex *dbip)
| Return handle for an index database. More...

## Variables

static int | _debug = 1
struct _dbiVec | db3vec

## Macro Definition Documentation

#define _RPMDB_INTERNAL

Definition at line 21 of file db3.c.

#define _RPMTAG_INTERNAL

Definition at line 19 of file db3.c.

#define DB_CLIENT DB_RPCCLIENT

Definition at line 27 of file db3.c.

Referenced by db3open(), and db_init().

#define PLD_CHROOT

## Function Documentation

static int cvtdberr | ( | dbiIndex | dbi,
|  | const char * | msg,
|  | int | error,
|  | int | printit
| ) |  |

static

Definition at line 155 of file db3.c.

References _, DB_VERSION_MAJOR, rpmlog(), and RPMLOG_ERR.

Referenced by db3associate(), db3cclose(), db3ccount(), db3cdel(), db3cdup(), db3cget(), db3close(), db3copen(), db3cpget(), db3cput(), db3join(), db3open(), db3stat(), db3sync(), db_fini(), and db_init().

static int db3_fsync_disable | ( | int | fd | ) |

static

Definition at line 245 of file db3.c.

Referenced by db_init().

static int db3associate | ( | dbiIndex | dbi,
|  | dbiIndex | dbisecondary,
|  | int(*)(DB *, const DBT *, const DBT *, DBT *) | callback,
|  | unsigned int | flags
| ) |  |

static

Definition at line 891 of file db3.c.

References _debug, and cvtdberr().

static int db3byteswapped | ( | dbiIndex | dbi | ) |

static

Definition at line 838 of file db3.c.

static int db3cclose | ( | dbiIndex | dbi,
|  | DBC * | dbcursor,
|  | unsigned int | flags
| ) |  |

static

Definition at line 625 of file db3.c.

References _debug, and cvtdberr().

Referenced by db3copen().

static int db3ccount | ( | dbiIndex | dbi,
|  | DBC * | dbcursor,
|  | unsigned int * | countp,
|  | unsigned int | flags
| ) |  |

static

Definition at line 815 of file db3.c.

References _debug, and cvtdberr().

static int db3cdel | ( | dbiIndex | dbi,
|  | DBC * | dbcursor,
|  | DBT * | key,
|  | DBT * | data,
|  | unsigned int | flags
| ) |  |

static

Definition at line 702 of file db3.c.

References _debug, cvtdberr(), DB_NOTFOUND, and DB_SET.

static int db3cdup | ( | dbiIndex | dbi,
|  | DBC * | dbcursor,
|  | DBC ** | dbcp,
|  | unsigned int | flags
| ) |  |

static

Definition at line 604 of file db3.c.

References _debug, and cvtdberr().

static int db3cget | ( | dbiIndex | dbi,
|  | DBC * | dbcursor,
|  | DBT * | key,
|  | DBT * | data,
|  | unsigned int | flags
| ) |  |

static

Definition at line 746 of file db3.c.

References _debug, cvtdberr(), and DB_NOTFOUND.

static int db3close | ( | dbiIndex | dbi,
|  | unsigned int | flags
| ) |  |

static

Definition at line 936 of file db3.c.

References _debug, _free(), cvtdberr(), D_, db_fini(), DB_PRIVATE, mapTagName(), rpmGenPath(), rpmGetPath(), rpmlog(), RPMLOG_DEBUG, and urlPath().

Referenced by db3open().

static int db3copen | ( | dbiIndex | dbi,
|  | DB_TXN * | txnid,
|  | DBC ** | dbcp,
|  | unsigned int | dbiflags
| ) |  |

static

Definition at line 646 of file db3.c.

References _debug, cvtdberr(), db3cclose(), and DB_WRITECURSOR.

static int db3cpget | ( | dbiIndex | dbi,
|  | DBC * | dbcursor,
|  | DBT * | key,
|  | DBT * | pkey,
|  | DBT * | data,
|  | unsigned int | flags
| ) |  |

static

Definition at line 785 of file db3.c.

References _debug, cvtdberr(), and DB_NOTFOUND.

static int db3cput | ( | dbiIndex | dbi,
|  | DBC * | dbcursor,
|  | DBT * | key,
|  | DBT * | data,
|  | unsigned int | flags
| ) |  |

static

Definition at line 676 of file db3.c.

References _debug, cvtdberr(), and DB_KEYLAST.

static int db3join | ( | dbiIndex | dbi,
|  | DBC ** | curslist,
|  | DBC ** | dbcp,
|  | unsigned int | flags
| ) |  |

static

Definition at line 918 of file db3.c.

References _debug, and cvtdberr().

static int db3open | ( | rpmdb | rpmdb,
|  | rpmTag | rpmtag,
|  | dbiIndex * | dbip
| ) |  |

static

Return handle for an index database.

Parameters

  rpmdb | rpm database
  rpmtag | rpm tag

Return values

  *dbip | index database handle

Returns
  0 on success

Definition at line 1097 of file db3.c.

References _, _debug, _free(), alloca(), cvtdberr(), D_, db3close(), db3vec, DB_CLIENT, DB_EXCL, db_init(), DB_PRIVATE, DB_VERSION_MAJOR, errno, EXIT_FAILURE, F_OK, mapTagName(), rpmCleanPath(), rpmdbLink(), rpmdbVerifyAllDBI(), rpmGenPath(), rpmGetPath(), rpmioMkpath(), rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMLOG_WARNING, Stat(), stpcpy(), Unlink(), urlPath(), and W_OK.

static int db3stat | ( | dbiIndex | dbi,
|  | unsigned int | flags
| ) |  |

static

Definition at line 858 of file db3.c.

References _debug, _free(), cvtdberr(), and DB_FAST_STAT.

static int db3sync | ( | dbiIndex | dbi,
|  | unsigned int | flags
| ) |  |

static

Definition at line 584 of file db3.c.

References _debug, and cvtdberr().

static int db_fini | ( | dbiIndex | dbi,
|  | const char * | dbhome,
|  | const char * | dbfile,
|  | const char * | dbsubfile
| ) |  |

static

Definition at line 201 of file db3.c.

References _debug, cvtdberr(), D_, rpmlog(), and RPMLOG_DEBUG.

Referenced by db3close().

static int db_init | ( | dbiIndex | dbi,
|  | const char * | dbhome,
|  | const char * | dbfile,
|  | const char * | dbsubfile,
|  | DB_ENV ** | dbenvp
| ) |  |

static

Definition at line 279 of file db3.c.

References _debug, _free(), cvtdberr(), D_, db3_fsync_disable(), DB_CLIENT, Open(), rpmGenPath(), rpmlog(), and RPMLOG_DEBUG.

Referenced by db3open().

static const char* mapTagName | ( | rpmdb | rpmdb,
|  | dbiIndex | dbi
| ) |  |

static

Return (possibly renamed) tagName.

Handles arbitrary tags.

Parameters

  rpmdb | rpm database
  dbi | rpm database index

Returns
  tag string

Definition at line 184 of file db3.c.

References tagName().

Referenced by db3close(), and db3open().

## Variable Documentation

int _debug = 1

static

Definition at line 7 of file db3.c.

Referenced by db3associate(), db3cclose(), db3ccount(), db3cdel(), db3cdup(), db3cget(), db3close(), db3copen(), db3cpget(), db3cput(), db3join(), db3open(), db3stat(), db3sync(), db_fini(), and db_init().