rpmdb/fprint.h

Go to the documentation of this file.
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@*/ /*@null@*/ const char * subDir;
00049 /*@dependent@*/ 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(/*@null@*/ rpmdb db, fingerPrint  * fpList,
00077                 /*@out@*/ dbiIndexSet * matchList, int numItems)
00078         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00079         /*@modifies db, *matchList, rpmGlobalMacroContext,
00080                 fileSystem, internalState @*/;
00081 
00082 /* Be carefull with the memory... assert(*fullName == '/' || !scareMemory) */
00083 
00089 /*@only@*/ fingerPrintCache fpCacheCreate(int sizeHint)
00090         /*@*/;
00091 
00097 /*@null@*/
00098 fingerPrintCache fpCacheFree(/*@only@*/ fingerPrintCache cache)
00099         /*@modifies cache @*/;
00100 
00109 fingerPrint fpLookup(fingerPrintCache cache, const char * dirName, 
00110                         const char * baseName, int scareMemory)
00111         /*@modifies cache @*/;
00112 
00119 unsigned int fpHashFunction(const void * key)
00120         /*@*/;
00121 
00129 int fpEqual(const void * key1, const void * key2)
00130         /*@*/;
00131 
00142 void fpLookupList(fingerPrintCache cache, const char ** dirNames, 
00143                   const char ** baseNames, const int * dirIndexes, 
00144                   int fileCount, fingerPrint * fpList)
00145         /*@modifies cache, *fpList @*/;
00146 
00147 #ifdef __cplusplus
00148 }
00149 #endif
00150 
00151 #endif

Generated on Fri Oct 12 08:44:54 2007 for rpm by  doxygen 1.5.2