#include "system.h"
#include <rpmdb.h>
#include <rpmmacro.h>
#include "fprint.h"
#include "debug.h"
Go to the source code of this file.
Functions | |
fingerPrintCache | fpCacheCreate (int sizeHint) |
Create finger print cache. | |
fingerPrintCache | fpCacheFree (fingerPrintCache cache) |
Destroy finger print cache. | |
static struct fprintCacheEntry_s * | cacheContainsDirectory (fingerPrintCache cache, const char *dirName) |
Find directory name entry in cache. | |
static fingerPrint | doLookup (fingerPrintCache cache, const char *dirName, const char *baseName, int scareMemory) |
Return finger print of a file path. | |
fingerPrint | fpLookup (fingerPrintCache cache, const char *dirName, const char *baseName, int scareMemory) |
Return finger print of a file path. | |
unsigned int | fpHashFunction (const void *key) |
Return hash value for a finger print. | |
int | fpEqual (const void *key1, const void *key2) |
Compare two finger print entries. | |
void | fpLookupList (fingerPrintCache cache, const char **dirNames, const char **baseNames, const int *dirIndexes, int fileCount, fingerPrint *fpList) |
Return finger prints of an array of file paths. |
Definition in file fprint.c.
static struct fprintCacheEntry_s* cacheContainsDirectory | ( | fingerPrintCache | cache, | |
const char * | dirName | |||
) | [static, read] |
Find directory name entry in cache.
cache | pointer to fingerprint cache | |
dirName | string to locate in cache |
Definition at line 36 of file fprint.c.
References fprintCache_s::ht, and htGetEntry().
Referenced by doLookup().
static fingerPrint doLookup | ( | fingerPrintCache | cache, | |
const char * | dirName, | |||
const char * | baseName, | |||
int | scareMemory | |||
) | [static] |
Return finger print of a file path.
cache | pointer to fingerprint cache | |
dirName | leading directory name of path | |
baseName | file name of path | |
scareMemory |
Definition at line 59 of file fprint.c.
References alloca(), fingerPrint_s::baseName, cacheContainsDirectory(), fprintCacheEntry_s::dev, fprintCacheEntry_s::dirName, fingerPrint_s::entry, fprintCache_s::ht, htAddEntry(), fprintCacheEntry_s::ino, PATH_MAX, realpath(), rpmCleanPath(), stpncpy(), fingerPrint_s::subDir, xmalloc(), and xstrdup().
Referenced by fpLookup(), and fpLookupList().
fingerPrintCache fpCacheCreate | ( | int | sizeHint | ) |
Create finger print cache.
sizeHint | number of elements expected |
Definition at line 13 of file fprint.c.
References hashEqualityString(), hashFunctionString(), htCreate(), and xmalloc().
Referenced by rpmdbFindByFile(), rpmdbFindFpList(), and rpmtsRun().
fingerPrintCache fpCacheFree | ( | fingerPrintCache | cache | ) |
Destroy finger print cache.
cache | pointer to fingerprint cache |
Definition at line 23 of file fprint.c.
References fprintCache_s::ht, and htFree().
Referenced by rpmdbFindByFile(), rpmdbFindFpList(), and rpmtsRun().
int fpEqual | ( | const void * | key1, | |
const void * | key2 | |||
) |
Compare two finger print entries.
This routine is exactly equivalent to the FP_EQUAL macro.
key1 | finger print 1 | |
key2 | finger print 2 |
Definition at line 216 of file fprint.c.
References FP_EQUAL.
Referenced by rpmtsRun().
unsigned int fpHashFunction | ( | const void * | key | ) |
Return hash value for a finger print.
Hash based on dev and inode only!
key | pointer to finger print entry |
Definition at line 195 of file fprint.c.
References fingerPrint_s::baseName, fprintCacheEntry_s::dev, fingerPrint_s::entry, and fprintCacheEntry_s::ino.
Referenced by rpmtsRun().
fingerPrint fpLookup | ( | fingerPrintCache | cache, | |
const char * | dirName, | |||
const char * | baseName, | |||
int | scareMemory | |||
) |
Return finger print of a file path.
cache | pointer to fingerprint cache | |
dirName | leading directory name of file path | |
baseName | base name of file path | |
scareMemory |
Definition at line 189 of file fprint.c.
References doLookup().
Referenced by rpmdbFindByFile().
void fpLookupList | ( | fingerPrintCache | cache, | |
const char ** | dirNames, | |||
const char ** | baseNames, | |||
const int * | dirIndexes, | |||
int | fileCount, | |||
fingerPrint * | fpList | |||
) |
Return finger prints of an array of file paths.
cache | pointer to fingerprint cache | |
dirNames | directory names | |
baseNames | file base names | |
dirIndexes | index into dirNames for each baseNames | |
fileCount | number of file entries |
fpList | pointer to array of finger prints |
Definition at line 236 of file fprint.c.
References fingerPrint_s::baseName, doLookup(), and fingerPrint_s::subDir.
Referenced by rpmdbFindFpList(), and rpmtsRun().