rpm 5.2.1
|
00001 #ifndef H_FINGERPRINT 00002 #define H_FINGERPRINT 00003 00009 #include "rpmhash.h" 00010 00013 typedef /*@abstract@*/ struct fprintCache_s * fingerPrintCache; 00014 00018 typedef struct fingerPrint_s fingerPrint; 00019 00026 struct fprintCacheEntry_s { 00027 const char * dirName; 00028 dev_t dev; 00029 ino_t ino; 00030 }; 00031 00035 struct fprintCache_s { 00036 hashTable ht; 00037 }; 00038 00043 struct fingerPrint_s { 00045 const struct fprintCacheEntry_s * entry; 00047 /*@owned@*/ /*@relnull@*/ 00048 const char * subDir; 00049 /*@dependent@*/ 00050 const char * baseName; 00051 }; 00052 00055 #define FP_ENTRY_EQUAL(a, b) (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino)) 00056 00059 #define FP_EQUAL(a, b) ( \ 00060 FP_ENTRY_EQUAL((a).entry, (b).entry) && \ 00061 !strcmp((a).baseName, (b).baseName) && ( \ 00062 ((a).subDir == (b).subDir) || \ 00063 ((a).subDir && (b).subDir && !strcmp((a).subDir, (b).subDir)) \ 00064 ) \ 00065 ) 00066 00067 #ifdef __cplusplus 00068 extern "C" { 00069 #endif 00070 00080 int rpmdbFindFpList(/*@null@*/ void * _db, fingerPrint * fpList, 00081 /*@out@*/ void * _matchList, int numItems, 00082 unsigned int exclude) 00083 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00084 /*@modifies _db, _matchList, rpmGlobalMacroContext, 00085 fileSystem, internalState @*/; 00086 00087 /* Be carefull with the memory... assert(*fullName == '/' || !scareMem) */ 00088 00094 /*@only@*/ fingerPrintCache fpCacheCreate(int sizeHint) 00095 /*@globals fileSystem @*/ 00096 /*@modifies fileSystem @*/; 00097 00103 /*@null@*/ 00104 fingerPrintCache fpCacheFree(/*@only@*/ fingerPrintCache cache) 00105 /*@globals fileSystem @*/ 00106 /*@modifies cache, fileSystem @*/; 00107 00116 fingerPrint fpLookup(fingerPrintCache cache, const char * dirName, 00117 const char * baseName, int scareMem) 00118 /*@globals fileSystem, internalState @*/ 00119 /*@modifies cache, fileSystem, internalState @*/; 00120 00129 rpmuint32_t fpHashFunction(rpmuint32_t h, const void * data, size_t size) 00130 /*@*/; 00131 00139 int fpEqual(const void * key1, const void * key2) 00140 /*@*/; 00141 00152 void fpLookupList(fingerPrintCache cache, const char ** dirNames, 00153 const char ** baseNames, const rpmuint32_t * dirIndexes, 00154 rpmuint32_t fileCount, fingerPrint * fpList) 00155 /*@globals fileSystem, internalState @*/ 00156 /*@modifies cache, *fpList, fileSystem, internalState @*/; 00157 00158 #ifdef __cplusplus 00159 } 00160 #endif 00161 00162 #endif