rpm  4.5
fprint.h
Go to the documentation of this file.
1 #ifndef H_FINGERPRINT
2 #define H_FINGERPRINT
3 
9 #include "rpmhash.h"
10 #include "header.h"
11 
14 typedef /*@abstract@*/ struct fprintCache_s * fingerPrintCache;
15 
19 typedef struct fingerPrint_s fingerPrint;
20 
28  const char * dirName;
29  dev_t dev;
30  ino_t ino;
31 };
32 
36 struct fprintCache_s {
38 };
39 
44 struct fingerPrint_s {
46  const struct fprintCacheEntry_s * entry;
48 /*@owned@*/ /*@relnull@*/
49  const char * subDir;
50 /*@dependent@*/
51  const char * baseName;
52 };
53 
56 #define FP_ENTRY_EQUAL(a, b) (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino))
57 
60 #define FP_EQUAL(a, b) ( \
61  FP_ENTRY_EQUAL((a).entry, (b).entry) && \
62  !strcmp((a).baseName, (b).baseName) && ( \
63  ((a).subDir == (b).subDir) || \
64  ((a).subDir && (b).subDir && !strcmp((a).subDir, (b).subDir)) \
65  ) \
66  )
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
81 int rpmdbFindFpList(/*@null@*/ rpmdb db, fingerPrint * fpList,
82  /*@out@*/ dbiIndexSet * matchList, int numItems,
83  unsigned int exclude)
84  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
85  /*@modifies db, *matchList, rpmGlobalMacroContext,
86  fileSystem, internalState @*/;
87 
88 /* Be carefull with the memory... assert(*fullName == '/' || !scareMem) */
89 
95 /*@only@*/ fingerPrintCache fpCacheCreate(int sizeHint)
96  /*@*/;
97 
103 /*@null@*/
104 fingerPrintCache fpCacheFree(/*@only@*/ fingerPrintCache cache)
105  /*@modifies cache @*/;
106 
115 fingerPrint fpLookup(fingerPrintCache cache, const char * dirName,
116  const char * baseName, int scareMem)
117  /*@modifies cache @*/;
118 
127 uint32_t fpHashFunction(uint32_t h, const void * data, size_t size)
128  /*@*/;
129 
137 int fpEqual(const void * key1, const void * key2)
138  /*@*/;
139 
150 void fpLookupList(fingerPrintCache cache, const char ** dirNames,
151  const char ** baseNames, const uint_32 * dirIndexes,
152  int fileCount, fingerPrint * fpList)
153  /*@modifies cache, *fpList @*/;
154 
155 #ifdef __cplusplus
156 }
157 #endif
158 
159 #endif