• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

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 
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@*/ rpmdb db, fingerPrint  * fpList,
00081                 /*@out@*/ dbiIndexSet * 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         /*@*/;
00096 
00102 /*@null@*/
00103 fingerPrintCache fpCacheFree(/*@only@*/ fingerPrintCache cache)
00104         /*@modifies cache @*/;
00105 
00114 fingerPrint fpLookup(fingerPrintCache cache, const char * dirName, 
00115                         const char * baseName, int scareMem)
00116         /*@modifies cache @*/;
00117 
00126 uint32_t fpHashFunction(uint32_t h, const void * data, size_t size)
00127         /*@*/;
00128 
00136 int fpEqual(const void * key1, const void * key2)
00137         /*@*/;
00138 
00149 void fpLookupList(fingerPrintCache cache, const char ** dirNames, 
00150                   const char ** baseNames, const uint32_t * dirIndexes, 
00151                   uint32_t fileCount, fingerPrint * fpList)
00152         /*@modifies cache, *fpList @*/;
00153 
00154 #ifdef __cplusplus
00155 }
00156 #endif
00157 
00158 #endif

Generated on Mon Nov 29 2010 05:18:46 for rpm by  doxygen 1.7.2