rpm  5.2.1
fprint.h
Go to the documentation of this file.
1 #ifndef H_FINGERPRINT
2 #define H_FINGERPRINT
3 
9 #include "rpmhash.h"
10 
13 typedef /*@abstract@*/ struct fprintCache_s * fingerPrintCache;
14 
18 typedef struct fingerPrint_s fingerPrint;
19 
27  const char * dirName;
28  dev_t dev;
29  ino_t ino;
30 };
31 
35 struct fprintCache_s {
37 };
38 
43 struct fingerPrint_s {
45  const struct fprintCacheEntry_s * entry;
47 /*@owned@*/ /*@relnull@*/
48  const char * subDir;
49 /*@dependent@*/
50  const char * baseName;
51 };
52 
55 #define FP_ENTRY_EQUAL(a, b) (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino))
56 
59 #define FP_EQUAL(a, b) ( \
60  FP_ENTRY_EQUAL((a).entry, (b).entry) && \
61  !strcmp((a).baseName, (b).baseName) && ( \
62  ((a).subDir == (b).subDir) || \
63  ((a).subDir && (b).subDir && !strcmp((a).subDir, (b).subDir)) \
64  ) \
65  )
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
80 int rpmdbFindFpList(/*@null@*/ void * _db, fingerPrint * fpList,
81  /*@out@*/ void * _matchList, int numItems,
82  unsigned int exclude)
83  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
84  /*@modifies _db, _matchList, rpmGlobalMacroContext,
85  fileSystem, internalState @*/;
86 
87 /* Be carefull with the memory... assert(*fullName == '/' || !scareMem) */
88 
94 /*@only@*/ fingerPrintCache fpCacheCreate(int sizeHint)
95  /*@globals fileSystem @*/
96  /*@modifies fileSystem @*/;
97 
103 /*@null@*/
104 fingerPrintCache fpCacheFree(/*@only@*/ fingerPrintCache cache)
105  /*@globals fileSystem @*/
106  /*@modifies cache, fileSystem @*/;
107 
116 fingerPrint fpLookup(fingerPrintCache cache, const char * dirName,
117  const char * baseName, int scareMem)
118  /*@globals fileSystem, internalState @*/
119  /*@modifies cache, fileSystem, internalState @*/;
120 
129 rpmuint32_t fpHashFunction(rpmuint32_t h, const void * data, size_t size)
130  /*@*/;
131 
139 int fpEqual(const void * key1, const void * key2)
140  /*@*/;
141 
152 void fpLookupList(fingerPrintCache cache, const char ** dirNames,
153  const char ** baseNames, const rpmuint32_t * dirIndexes,
154  rpmuint32_t fileCount, fingerPrint * fpList)
155  /*@globals fileSystem, internalState @*/
156  /*@modifies cache, *fpList, fileSystem, internalState @*/;
157 
158 #ifdef __cplusplus
159 }
160 #endif
161 
162 #endif