Main Page Modules Data Structures File List Data Fields Globals Related Pages

# 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, fileSystem @*/
    00079         /*@modifies db, *matchList, rpmGlobalMacroContext, fileSystem @*/;
    00080
    00081 /* Be carefull with the memory... assert(*fullName == '/' || !scareMemory) */
    00082
    00088 /*@only@*/ fingerPrintCache fpCacheCreate(int sizeHint)
    00089         /*@*/;
    00090
    00096 /*@null@*/
    00097 fingerPrintCache fpCacheFree(/*@only@*/ fingerPrintCache cache)
    00098         /*@modifies cache @*/;
    00099
    00108 fingerPrint fpLookup(fingerPrintCache cache, const char * dirName,
    00109                         const char * baseName, int scareMemory)
    00110         /*@modifies cache @*/;
    00111
    00118 unsigned int fpHashFunction(const void * key)
    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 int * dirIndexes,
    00143                   int fileCount, fingerPrint * fpList)
    00144         /*@modifies cache, *fpList @*/;
    00145
    00146 #ifdef __cplusplus
    00147 }
    00148 #endif
    00149
    00150 #endif