rpm  5.4.14
Macros | Functions
fprint.c File Reference
#include "system.h"
#include <rpmiotypes.h>
#include <rpmio.h>
#include <rpmmacro.h>
#include <rpmtag.h>
#include <rpmdb.h>
#include "fprint.h"
#include "debug.h"
#include "rpmfi.h"
#include "rpmte.h"
Include dependency graph for fprint.c:

Go to the source code of this file.

Macros

#define _FPRINT_INTERNAL
 
#define _RPMFI_INTERNAL
 
#define _RPMTE_INTERNAL
 

Functions

fingerPrintCache fpCacheCreate (int sizeHint)
 Create finger print cache. More...
 
fingerPrintCache fpCacheFree (fingerPrintCache cache)
 Destroy finger print cache. More...
 
static struct fprintCacheEntry_s * cacheContainsDirectory (fingerPrintCache cache, const char *dirName)
 Find directory name entry in cache. More...
 
static fingerPrint doLookup (fingerPrintCache cache, const char *dirName, const char *baseName, int scareMem)
 Return finger print of a file path. More...
 
fingerPrint fpLookup (fingerPrintCache cache, const char *dirName, const char *baseName, int scareMem)
 Return finger print of a file path. More...
 
rpmuint32_t fpHashFunction (rpmuint32_t h, const void *data, size_t size)
 
int fpEqual (const void *key1, const void *key2)
 Compare two finger print entries. More...
 
void fpLookupList (fingerPrintCache cache, const char **dirNames, const char **baseNames, const rpmuint32_t *dirIndexes, rpmuint32_t fileCount, fingerPrint *fpList)
 Return finger prints of an array of file paths. More...
 
void fpLookupSubdir (hashTable symlinks, hashTable fphash, fingerPrintCache fpc, void *_p, int filenr)
 Check file for to be installed symlinks in their path, correct their fingerprint and add it to newht. More...
 

Macro Definition Documentation

#define _FPRINT_INTERNAL

Definition at line 14 of file fprint.c.

#define _RPMFI_INTERNAL

Definition at line 294 of file fprint.c.

#define _RPMTE_INTERNAL

Definition at line 296 of file fprint.c.

Function Documentation

static struct fprintCacheEntry_s* cacheContainsDirectory ( fingerPrintCache  cache,
const char *  dirName 
)
static

Find directory name entry in cache.

Parameters
cachepointer to fingerprint cache
dirNamestring to locate in cache
Returns
pointer to directory name entry (or NULL if not found).

Definition at line 44 of file fprint.c.

References htGetEntry(), and NULL.

Referenced by doLookup().

static fingerPrint doLookup ( fingerPrintCache  cache,
const char *  dirName,
const char *  baseName,
int  scareMem 
)
static

Return finger print of a file path.

Parameters
cachepointer to fingerprint cache
dirNameleading directory name of path
baseNamefile name of path
scareMem
Returns
pointer to the finger print associated with a file path.

Definition at line 64 of file fprint.c.

References alloca(), fingerPrint_s::baseName, buf, cacheContainsDirectory(), dirName, fingerPrint_s::entry, htAddEntry(), if(), nb, NULL, PATH_MAX, Realpath(), rpmCleanPath(), stpncpy(), fingerPrint_s::subDir, void, xmalloc, and xstrdup().

Referenced by fpLookup(), and fpLookupList().

fingerPrintCache fpCacheCreate ( int  sizeHint)

Create finger print cache.

Parameters
sizeHintnumber of elements expected
Returns
pointer to initialized fingerprint cache

Definition at line 21 of file fprint.c.

References assert(), htCreate(), NULL, and xmalloc.

Referenced by rpmtsPrepare().

fingerPrintCache fpCacheFree ( fingerPrintCache  cache)

Destroy finger print cache.

Parameters
cachepointer to fingerprint cache
Returns
NULL always

Definition at line 31 of file fprint.c.

References htFree(), and NULL.

Referenced by rpmtsPrepare().

int fpEqual ( const void key1,
const void key2 
)

Compare two finger print entries.

This routine is exactly equivalent to the FP_EQUAL macro.

Parameters
key1finger print 1
key2finger print 2
Returns
result of comparing key1 and key2

Definition at line 212 of file fprint.c.

References FP_EQUAL.

Referenced by rpmtsAddFingerprints(), and rpmtsPrepare().

rpmuint32_t fpHashFunction ( rpmuint32_t  h,
const void data,
size_t  size 
)

Definition at line 196 of file fprint.c.

References fingerPrint_s::baseName, fingerPrint_s::entry, h, and unsigned.

Referenced by rpmtsAddFingerprints(), and rpmtsPrepare().

fingerPrint fpLookup ( fingerPrintCache  cache,
const char *  dirName,
const char *  baseName,
int  scareMem 
)

Return finger print of a file path.

Parameters
cachepointer to fingerprint cache
dirNameleading directory name of file path
baseNamebase name of file path
scareMem
Returns
pointer to the finger print associated with a file path.

Definition at line 190 of file fprint.c.

References doLookup().

Referenced by fpLookupSubdir(), and rpmtsCheckInstalledFiles().

void fpLookupList ( fingerPrintCache  cache,
const char **  dirNames,
const char **  baseNames,
const rpmuint32_t dirIndexes,
rpmuint32_t  fileCount,
fingerPrint fpList 
)

Return finger prints of an array of file paths.

Warning
: scareMem is assumed!
Parameters
cachepointer to fingerprint cache
dirNamesdirectory names
baseNamesfile base names
dirIndexesindex into dirNames for each baseNames
fileCountnumber of file entries
Return values
*fpListarray of finger prints

Definition at line 230 of file fprint.c.

References fingerPrint_s::baseName, doLookup(), fingerPrint_s::entry, i, fingerPrint_s::subDir, and unsigned.

Referenced by rpmfiFpLookup().

void fpLookupSubdir ( hashTable  symlinks,
hashTable  fphash,
fingerPrintCache  fpc,
void _p,
int  filenr 
)

Check file for to be installed symlinks in their path, correct their fingerprint and add it to newht.

Parameters
hthash table containing all files fingerprints
newhthash table to add the corrected fingerprints
fpcfingerprint cache
_ptransaction element
filenrthe number of the file we are dealing with

Definition at line 299 of file fprint.c.

References _free(), assert(), fingerPrint_s::baseName, exit, fi, fpLookup(), htAddEntry(), htGetEntry(), i, ns, NULL, p, recs, rpmGetPath(), s, se, t, te, void, xmalloc, and xstrdup().

Referenced by rpmtsAddFingerprints().