rpmdb/fprint.h File Reference

Identify a file name path by a unique "finger print". More...

#include "rpmhash.h"
#include "header.h"

Include dependency graph for fprint.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fprintCacheEntry_s
 Finger print cache entry. More...
struct  fprintCache_s
 Finger print cache. More...
struct  fingerPrint_s
 Associates a trailing sub-directory and final base name with an existing directory finger print. More...

Defines

#define FP_ENTRY_EQUAL(a, b)   (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino))
#define FP_EQUAL(a, b)

Typedefs

typedef fprintCache_sfingerPrintCache
typedef fingerPrint_s fingerPrint

Functions

int rpmdbFindFpList (rpmdb db, fingerPrint *fpList, dbiIndexSet *matchList, int numItems, unsigned int exclude)
 Find fingerprint matches in database.
fingerPrintCache fpCacheCreate (int sizeHint)
 Create finger print cache.
fingerPrintCache fpCacheFree (fingerPrintCache cache)
 Destroy finger print cache.
fingerPrint fpLookup (fingerPrintCache cache, const char *dirName, const char *baseName, int scareMem)
 Return finger print of a file path.
uint32_t fpHashFunction (uint32_t h, const void *data, size_t size)
 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 uint_32 *dirIndexes, int fileCount, fingerPrint *fpList)
 Return finger prints of an array of file paths.


Detailed Description

Identify a file name path by a unique "finger print".

Definition in file fprint.h.


Define Documentation

#define FP_ENTRY_EQUAL ( a,
 )     (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino))

Definition at line 56 of file fprint.h.

#define FP_EQUAL ( a,
 ) 

Value:

( \
        FP_ENTRY_EQUAL((a).entry, (b).entry) && \
        !strcmp((a).baseName, (b).baseName) && ( \
            ((a).subDir == (b).subDir) || \
            ((a).subDir && (b).subDir && !strcmp((a).subDir, (b).subDir)) \
        ) \
    )

Definition at line 60 of file fprint.h.

Referenced by findFps(), fpEqual(), rpmdbFindByFile(), and rpmdbFindFpList().


Typedef Documentation

typedef struct fingerPrint_s fingerPrint

Todo:
Convert to pointer and make abstract.

Definition at line 19 of file fprint.h.

typedef struct fprintCache_s* fingerPrintCache

Definition at line 14 of file fprint.h.


Function Documentation

fingerPrintCache fpCacheCreate ( int  sizeHint  ) 

Create finger print cache.

Parameters:
sizeHint number of elements expected
Returns:
pointer to initialized fingerprint cache

Definition at line 13 of file fprint.c.

References htCreate(), and xmalloc().

Referenced by rpmdbFindByFile(), rpmdbFindFpList(), and rpmtsRun().

fingerPrintCache fpCacheFree ( fingerPrintCache  cache  ) 

Destroy finger print cache.

Parameters:
cache pointer to fingerprint cache
Returns:
NULL always

Definition at line 22 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.

Parameters:
key1 finger print 1
key2 finger print 2
Returns:
result of comparing key1 and key2

Definition at line 212 of file fprint.c.

References FP_EQUAL.

Referenced by rpmtsRun().

uint32_t fpHashFunction ( uint32_t  h,
const void *  data,
size_t  size 
)

Return hash value for a finger print.

Hash based on dev and inode only!

Parameters:
h hash initial value
*data finger print entry
size size of fingerprint entry
Returns:
hash value

Definition at line 194 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  scareMem 
)

Return finger print of a file path.

Parameters:
cache pointer to fingerprint cache
dirName leading directory name of file path
baseName base name of file path
scareMem 
Returns:
pointer to the finger print associated with a file path.

Definition at line 188 of file fprint.c.

References doLookup().

Referenced by rpmdbFindByFile().

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

Return finger prints of an array of file paths.

Warning:
: scareMem is assumed!
Parameters:
cache pointer to fingerprint cache
dirNames directory names
baseNames file base names
dirIndexes index into dirNames for each baseNames
fileCount number of file entries
Return values:
*fpList array of finger prints

Definition at line 232 of file fprint.c.

References fingerPrint_s::baseName, doLookup(), and fingerPrint_s::subDir.

Referenced by rpmdbFindFpList(), and rpmtsRun().


Generated on Fri Sep 7 01:28:05 2007 for rpm by  doxygen 1.5.1