# rpmdb/db1.c File Reference

More...

`#include "system.h"`
`#include <rpmio_internal.h>`
`#include <rpmlib.h>`
`#include <rpmmacro.h>`
`#include <rpmurl.h>`
`#include "falloc.h"`
`#include "misc.h"`
`#include "rpmdb.h"`
`#include "debug.h"`

Go to the source code of this file.

## Data Structures

struct | _DBT1

## Defines

#define | _mymemset(_a, _b, _c)
#define | DB_VERSION_MAJOR 1
#define | DB_VERSION_MINOR 85
#define | DB_VERSION_PATCH 0
#define | DBT struct _DBT1

## Functions

int | db1sync (dbiIndex dbi, unsigned int flags)
void * | doGetRecord (dbiIndex dbi, unsigned int offset)
int | db1copen (dbiIndex dbi, void **dbcp, unsigned int flags)
int | db1cclose (dbiIndex dbi, void *dbcursor, unsigned int flags)
int | db1cget (dbiIndex dbi, void *dbcursor, void **keyp, size_t *keylen, void **datap, size_t *datalen, unsigned int flags)
int | db1cdel (dbiIndex dbi, void *dbcursor, const void *keyp, size_t keylen, unsigned int flags)
int | db1cput (dbiIndex dbi, void *dbcursor, const void *keyp, size_t keylen, const void *datap, size_t datalen, unsigned int flags)
int | db1ccount (dbiIndex dbi, void *dbcursor, unsigned int *countp, unsigned int flags)
int | db1byteswapped (dbiIndex dbi)
int | db1stat (dbiIndex dbi, unsigned int flags)
int | db1close (dbiIndex dbi, unsigned int flags)
int | db1open (rpmdb rpmdb, int rpmtag, dbiIndex *dbip)

## Variables

int | _debug = 1
_dbiVec | db1vec

## Detailed Description

Definition in file db1.c.

## Define Documentation

#define _mymemset | ( | _a,
|  | _b,
|  | _c |  | ) |

| Definition at line 10 of file db1.c.

#define DB_VERSION_MAJOR 1

| Definition at line 23 of file db1.c. Referenced by db1open(), and db3open().

#define DB_VERSION_MINOR 85

| Definition at line 24 of file db1.c.

#define DB_VERSION_PATCH 0

| Definition at line 25 of file db1.c.

#define DBT struct _DBT1

| Definition at line 33 of file db1.c. Referenced by db1cdel(), db1cget(), db1cput(), db3cdel(), db3cget(), and db3cput().

## Function Documentation

int db1byteswapped | ( | dbiIndex | dbi | ) | `[static]`

| Definition at line 464 of file db1.c. References dbiIndex.

int db1cclose | ( | dbiIndex | dbi,
|  | void * | dbcursor,
|  | unsigned int | flags
| ) | `[static]`

| Definition at line 257 of file db1.c. References _dbiIndex::dbi_lastoffset, and dbiIndex.

int db1ccount | ( | dbiIndex | dbi,
|  | void * | dbcursor,
|  | unsigned int * | countp,
|  | unsigned int | flags
| ) | `[static]`

| Definition at line 456 of file db1.c. References dbiIndex.

int db1cdel | ( | dbiIndex | dbi,
|  | void * | dbcursor,
|  | const void * | keyp,
|  | size_t | keylen,
|  | unsigned int | flags
| ) | `[static]`

| Definition at line 366 of file db1.c. References _debug, cvtdberr(), DB, _dbiIndex::dbi_db, _dbiIndex::dbi_rpmtag, dbiIndex, DBT, fadFree(), FD_t, and RPMDBI_PACKAGES.

int db1cget | ( | dbiIndex | dbi,
|  | void * | dbcursor,
|  | void ** | keyp,
|  | size_t * | keylen,
|  | void ** | datap,
|  | size_t * | datalen,
|  | unsigned int | flags
| ) | `[static]`

| Definition at line 266 of file db1.c. References _debug, cvtdberr(), DB, _dbiIndex::dbi_db, _dbiIndex::dbi_lastoffset, _dbiIndex::dbi_rpmtag, dbiIndex, DBT, doGetRecord(), fadAlloc(), fadFirstOffset(), fadNextOffset(), FD_t, RPMDBI_PACKAGES, and xmalloc().

int db1close | ( | dbiIndex | dbi,
|  | unsigned int | flags
| ) | `[static]`

| Definition at line 476 of file db1.c. References _, _debug, _free(), cvtdberr(), DB, db1basename(), db3Free(), rpmdb_s::db_home, rpmdb_s::db_root, _dbiIndex::dbi_db, _dbiIndex::dbi_rpmdb, _dbiIndex::dbi_rpmtag, _dbiIndex::dbi_temporary, dbiIndex, Fclose(), FD_t, rpmdb, RPMDBI_PACKAGES, rpmGenPath(), RPMMESS_DEBUG, rpmMessage, and urlPath(). Referenced by db1open().

int db1copen | ( | dbiIndex | dbi,
|  | void ** | dbcp,
|  | unsigned int | flags
| ) | `[static]`

| Definition at line 247 of file db1.c. References DBC, and dbiIndex.

int db1cput | ( | dbiIndex | dbi,
|  | void * | dbcursor,
|  | const void * | keyp,
|  | size_t | keylen,
|  | const void * | datap,
|  | size_t | datalen,
|  | unsigned int | flags
| ) | `[static]`

| Definition at line 400 of file db1.c. References _debug, cvtdberr(), DB, _dbiIndex::dbi_db, _dbiIndex::dbi_rpmtag, dbiIndex, DBT, FD_t, fdSetContentLength(), Fseek(), Header, HEADER_MAGIC_NO, headerFree(), headerLoad(), headerSizeof(), headerWrite(), RPMDBI_PACKAGES, and SEEK_SET.

int db1open | ( | rpmdb | rpmdb,
|  | int | rpmtag,
|  | dbiIndex * | dbip
| ) | `[static]`

Definition at line 522 of file db1.c.

References _, _free(), db1basename(), db1close(), db1vec, db3New(), rpmdb_s::db_home, rpmdb_s::db_root, DB_VERSION_MAJOR, _dbiIndex::dbi_api, _dbiIndex::dbi_db, _dbiIndex::dbi_eflags, _dbiIndex::dbi_lockdbfd, _dbiIndex::dbi_mode, _dbiIndex::dbi_perms, _dbiIndex::dbi_rpmtag, _dbiIndex::dbi_temporary, _dbiIndex::dbi_type, _dbiIndex::dbi_vec, dbiIndex, errno, fadOpen(), Fcntl(), FD_t, Ferror(), rpmdb, RPMDBI_PACKAGES, RPMERR_DBOPEN, RPMERR_FLOCK, rpmError, rpmGenPath(), RPMMESS_DEBUG, rpmMessage, and urlPath().

int db1stat | ( | dbiIndex | dbi,
|  | unsigned int | flags
| ) | `[static]`

| Definition at line 470 of file db1.c. References dbiIndex.

int db1sync | ( | dbiIndex | dbi,
|  | unsigned int | flags
| ) | `[static]`

| Definition at line 112 of file db1.c. References _debug, cvtdberr(), DB, _dbiIndex::dbi_db, _dbiIndex::dbi_rpmtag, dbiIndex, errno, FD_t, Fileno(), and RPMDBI_PACKAGES.

void* doGetRecord | ( | dbiIndex | dbi,
|  | unsigned int | offset
| ) | `[static]`

Definition at line 137 of file db1.c.

References _, alloca(), compressFilelist(), _dbiIndex::dbi_db, _dbiIndex::dbi_lastoffset, dbiIndex, fadGetFileSize(), fadNextOffset(), FD_t, Fseek(), Header, HEADER_MAGIC_NO, headerFree(), headerGetEntryMinMemory(), headerIsEntry(), headerModifyEntry(), headerRead(), headerUnload(), providePackageNVR(), RPM_STRING_ARRAY_TYPE, RPMMESS_WARNING, rpmMessage, RPMTAG_BUILDTIME, RPMTAG_NAME, RPMTAG_OLDFILENAMES, RPMTAG_RELEASE, RPMTAG_VERSION, and SEEK_SET.

Referenced by db1cget().

## Variable Documentation

int _debug = 1`[static]`

| Definition at line 8 of file db1.c. Referenced by db1cdel(), db1cget(), db1close(), db1cput(), and db1sync().