rpm
4.5
|
00001 #ifndef H_FINGERPRINT 00002 #define H_FINGERPRINT 00003 00009 #include "rpmhash.h" 00010 #include "header.h" 00011 00014 typedef /*@abstract@*/ 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 /*@owned@*/ /*@relnull@*/ 00049 const char * subDir; 00050 /*@dependent@*/ 00051 const char * baseName; 00052 }; 00053 00056 #define FP_ENTRY_EQUAL(a, b) (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino)) 00057 00060 #define FP_EQUAL(a, b) ( \ 00061 FP_ENTRY_EQUAL((a).entry, (b).entry) && \ 00062 !strcmp((a).baseName, (b).baseName) && ( \ 00063 ((a).subDir == (b).subDir) || \ 00064 ((a).subDir && (b).subDir && !strcmp((a).subDir, (b).subDir)) \ 00065 ) \ 00066 ) 00067 00068 #ifdef __cplusplus 00069 extern "C" { 00070 #endif 00071 00081 int rpmdbFindFpList(/*@null@*/ rpmdb db, fingerPrint * fpList, 00082 /*@out@*/ dbiIndexSet * matchList, int numItems, 00083 unsigned int exclude) 00084 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00085 /*@modifies db, *matchList, rpmGlobalMacroContext, 00086 fileSystem, internalState @*/; 00087 00088 /* Be carefull with the memory... assert(*fullName == '/' || !scareMem) */ 00089 00095 /*@only@*/ fingerPrintCache fpCacheCreate(int sizeHint) 00096 /*@*/; 00097 00103 /*@null@*/ 00104 fingerPrintCache fpCacheFree(/*@only@*/ fingerPrintCache cache) 00105 /*@modifies cache @*/; 00106 00115 fingerPrint fpLookup(fingerPrintCache cache, const char * dirName, 00116 const char * baseName, int scareMem) 00117 /*@modifies cache @*/; 00118 00127 uint32_t fpHashFunction(uint32_t h, const void * data, size_t size) 00128 /*@*/; 00129 00137 int fpEqual(const void * key1, const void * key2) 00138 /*@*/; 00139 00150 void fpLookupList(fingerPrintCache cache, const char ** dirNames, 00151 const char ** baseNames, const uint_32 * dirIndexes, 00152 int fileCount, fingerPrint * fpList) 00153 /*@modifies cache, *fpList @*/; 00154 00155 #ifdef __cplusplus 00156 } 00157 #endif 00158 00159 #endif