00001 #ifndef H_FINGERPRINT
00002 #define H_FINGERPRINT
00003
00009 #include "rpmhash.h"
00010 #include "header.h"
00011
00014 typedef struct fprintCache_s * fingerPrintCache;
00015
00019 typedef struct fingerPrint_s fingerPrint;
00020
00027 struct fprintCacheEntry_s {
00028 const char * dirName;
00029 dev_t dev;
00030 ino_t ino;
00031 };
00032
00036 struct fprintCache_s {
00037 hashTable ht;
00038 };
00039
00044 struct fingerPrint_s {
00046 const struct fprintCacheEntry_s * entry;
00048 const char * subDir;
00049 const char * baseName;
00050 };
00051
00053 #define FP_ENTRY_EQUAL(a, b) (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino))
00054
00056 #define FP_EQUAL(a, b) ( \
00057 FP_ENTRY_EQUAL((a).entry, (b).entry) && \
00058 !strcmp((a).baseName, (b).baseName) && ( \
00059 ((a).subDir == (b).subDir) || \
00060 ((a).subDir && (b).subDir && !strcmp((a).subDir, (b).subDir)) \
00061 ) \
00062 )
00063
00064 #ifdef __cplusplus
00065 extern "C" {
00066 #endif
00067
00076 int rpmdbFindFpList( rpmdb db, fingerPrint * fpList,
00077 dbiIndexSet * matchList, int numItems)
00078
00079
00080 ;
00081
00082 int rpmdbFindFpListExclude( rpmdb db, fingerPrint * fpList,
00083 dbiIndexSet * matchList, int numItems, unsigned int exclude)
00084
00085
00086 ;
00087
00088
00089
00095 fingerPrintCache fpCacheCreate(int sizeHint)
00096 ;
00097
00103
00104 fingerPrintCache fpCacheFree( fingerPrintCache cache)
00105 ;
00106
00115 fingerPrint fpLookup(fingerPrintCache cache, const char * dirName,
00116 const char * baseName, int scareMemory)
00117 ;
00118
00125 unsigned int fpHashFunction(const void * key)
00126 ;
00127
00135 int fpEqual(const void * key1, const void * key2)
00136 ;
00137
00148 void fpLookupList(fingerPrintCache cache, const char ** dirNames,
00149 const char ** baseNames, const int * dirIndexes,
00150 int fileCount, fingerPrint * fpList)
00151 ;
00152
00153 #ifdef __cplusplus
00154 }
00155 #endif
00156
00157 #endif