00001 #ifndef H_FINGERPRINT
00002 #define H_FINGERPRINT
00003
00009 #include "rpmhash.h"
00010 #include "header.h"
00011
00018 struct fprintCacheEntry_s {
00019 const char * dirName;
00020 dev_t dev;
00021 ino_t ino;
00022 int isFake;
00023 };
00024
00028 typedef struct fprintCache_s {
00029 hashTable ht;
00030 } * fingerPrintCache;
00031
00036 typedef struct fingerPrint_s {
00038 const struct fprintCacheEntry_s * entry;
00040 const char * subDir;
00041 const char * baseName;
00042 } fingerPrint;
00043
00044
00046 #define fpFree(a) free((void *)(a).baseName)
00047
00049 #define FP_ENTRY_EQUAL(a, b) (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino))
00050
00052 #define FP_EQUAL(a, b) ( \
00053 FP_ENTRY_EQUAL((a).entry, (b).entry) && \
00054 !strcmp((a).baseName, (b).baseName) && ( \
00055 ((a).subDir == (b).subDir) || \
00056 ((a).subDir && (b).subDir && !strcmp((a).subDir, (b).subDir)) \
00057 ) \
00058 )
00059
00060 #ifdef __cplusplus
00061 extern "C" {
00062 #endif
00063
00064
00065
00071 fingerPrintCache fpCacheCreate(int sizeHint)
00072 ;
00073
00078 void fpCacheFree( fingerPrintCache cache)
00079 ;
00080
00089 fingerPrint fpLookup(fingerPrintCache cache, const char * dirName,
00090 const char * baseName, int scareMemory)
00091 ;
00092
00099 unsigned int fpHashFunction(const void * key)
00100 ;
00101
00109 int fpEqual(const void * key1, const void * key2)
00110 ;
00111
00122 void fpLookupList(fingerPrintCache cache, const char ** dirNames,
00123 const char ** baseNames, const int * dirIndexes,
00124 int fileCount, fingerPrint * fpList)
00125 ;
00126
00134
00135 void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
00136 ;
00137
00138 #ifdef __cplusplus
00139 }
00140 #endif
00141
00142 #endif