rpm 5.3.7

rpmdb/fprint.h

Go to the documentation of this file.
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 
00039 #if defined(_FPRINT_INTERNAL)
00040 struct rpmffi_s {
00041     rpmte p;
00042     int fileno;
00043 };
00044 #endif  /* _FPRINT_INTERNAL */
00045 
00050 struct fingerPrint_s {
00052     const struct fprintCacheEntry_s * entry;
00054 /*@owned@*/ /*@relnull@*/
00055     const char * subDir;
00056 /*@dependent@*/
00057     const char * baseName;      
00058 };
00059 
00062 #define FP_ENTRY_EQUAL(a, b) (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino))
00063 
00066 #define FP_EQUAL(a, b) ( \
00067         FP_ENTRY_EQUAL((a).entry, (b).entry) && \
00068         !strcmp((a).baseName, (b).baseName) && ( \
00069             ((a).subDir == (b).subDir) || \
00070             ((a).subDir && (b).subDir && !strcmp((a).subDir, (b).subDir)) \
00071         ) \
00072     )
00073 
00074 #ifdef __cplusplus
00075 extern "C" {
00076 #endif
00077 
00083 /*@only@*/ fingerPrintCache fpCacheCreate(int sizeHint)
00084         /*@globals fileSystem @*/
00085         /*@modifies fileSystem @*/;
00086 
00092 /*@null@*/
00093 fingerPrintCache fpCacheFree(/*@only@*/ fingerPrintCache cache)
00094         /*@globals fileSystem @*/
00095         /*@modifies cache, fileSystem @*/;
00096 
00105 fingerPrint fpLookup(fingerPrintCache cache, const char * dirName, 
00106                         const char * baseName, int scareMem)
00107         /*@globals fileSystem, internalState @*/
00108         /*@modifies cache, fileSystem, internalState @*/;
00109 
00118 uint32_t fpHashFunction(uint32_t h, const void * data, size_t size)
00119         /*@*/;
00120 
00128 int fpEqual(const void * key1, const void * key2)
00129         /*@*/;
00130 
00141 void fpLookupList(fingerPrintCache cache, const char ** dirNames, 
00142                   const char ** baseNames, const rpmuint32_t * dirIndexes, 
00143                   rpmuint32_t fileCount, fingerPrint * fpList)
00144         /*@globals fileSystem, internalState @*/
00145         /*@modifies cache, *fpList, fileSystem, internalState @*/;
00146 
00156 void fpLookupSubdir(hashTable symlinks, hashTable fphash, fingerPrintCache fpc,
00157                 void * _p, int filenr)
00158         /*@*/;
00159 
00160 #ifdef __cplusplus
00161 }
00162 #endif
00163 
00164 #endif