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 int isFake;
00032 };
00033
00037 struct fprintCache_s {
00038 hashTable ht;
00039 };
00040
00045 struct fingerPrint_s {
00047 const struct fprintCacheEntry_s * entry;
00049 const char * subDir;
00050 const char * baseName;
00051 };
00052
00053
00055 #define fpFree(a) free((void *)(a).baseName)
00056
00058 #define FP_ENTRY_EQUAL(a, b) (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino))
00059
00061 #define FP_EQUAL(a, b) ( \
00062 FP_ENTRY_EQUAL((a).entry, (b).entry) && \
00063 !strcmp((a).baseName, (b).baseName) && ( \
00064 ((a).subDir == (b).subDir) || \
00065 ((a).subDir && (b).subDir && !strcmp((a).subDir, (b).subDir)) \
00066 ) \
00067 )
00068
00069 #ifdef __cplusplus
00070 extern "C" {
00071 #endif
00072
00081 int rpmdbFindFpList( rpmdb db, fingerPrint * fpList,
00082 dbiIndexSet * matchList, int numItems)
00083
00084 ;
00085
00086
00087
00093 fingerPrintCache fpCacheCreate(int sizeHint)
00094 ;
00095
00100 void fpCacheFree( fingerPrintCache cache)
00101 ;
00102
00111 fingerPrint fpLookup(fingerPrintCache cache, const char * dirName,
00112 const char * baseName, int scareMemory)
00113 ;
00114
00121 unsigned int fpHashFunction(const void * key)
00122 ;
00123
00131 int fpEqual(const void * key1, const void * key2)
00132 ;
00133
00144 void fpLookupList(fingerPrintCache cache, const char ** dirNames,
00145 const char ** baseNames, const int * dirIndexes,
00146 int fileCount, fingerPrint * fpList)
00147 ;
00148
00156
00157 void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
00158 ;
00159
00160 #ifdef __cplusplus
00161 }
00162 #endif
00163
00164 #endif