Main Page   Modules   Compound List   File List   Compound Members   File Members   Related Pages  

lib/fprint.h

Go to the documentation of this file.
00001 #ifndef H_FINGERPRINT
00002 #define H_FINGERPRINT
00003 
00009 #include "hash.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 /*@abstract@*/ struct fprintCache_s {
00029     hashTable ht;                       
00030 } * fingerPrintCache;
00031 
00036 typedef struct fingerprint_s {
00038     const struct fprintCacheEntry_s * entry;
00040 /*@owned@*/ /*@null@*/ const char * subDir;
00041 /*@dependent@*/ const char * baseName;  
00042 } fingerPrint;
00043 
00044 /* only if !scarceMemory */
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 /* Be carefull with the memory... assert(*fullName == '/' || !scareMemory) */
00065 
00071 /*@only@*/ fingerPrintCache fpCacheCreate(int sizeHint) /*@*/;
00072 
00077 void            fpCacheFree(/*@only@*/ fingerPrintCache cache);
00078 
00087 fingerPrint     fpLookup(fingerPrintCache cache, const char * dirName, 
00088                         const char * baseName, int scareMemory) /*@*/;
00089 
00096 unsigned int fpHashFunction(const void * key)   /*@*/;
00097 
00105 int fpEqual(const void * key1, const void * key2)       /*@*/;
00106 
00117 void fpLookupList(fingerPrintCache cache, const char ** dirNames, 
00118                   const char ** baseNames, const int * dirIndexes, 
00119                   int fileCount, fingerPrint * fpList)
00120                         /*@modifies cache, *fpList @*/;
00121 
00129 void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
00130         /*@modifies h, cache, *fpList @*/;
00131 
00132 #ifdef __cplusplus
00133 }
00134 #endif
00135 
00136 #endif

Generated at Mon May 21 08:53:39 2001 for rpm by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001