rpm  5.4.10
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 
20 #if defined(_FPRINT_INTERNAL)
21 
27 struct fprintCacheEntry_s {
28  const char * dirName;
29  dev_t dev;
30  ino_t ino;
31 };
32 
36 struct fprintCache_s {
37  hashTable ht;
38 };
39 
40 struct rpmffi_s {
41  rpmte p;
42  int fileno;
43 };
44 #endif /* _FPRINT_INTERNAL */
45 
50 struct fingerPrint_s {
52  const struct fprintCacheEntry_s * entry;
54 /*@owned@*/ /*@relnull@*/
55  const char * subDir;
56 /*@dependent@*/
57  const char * baseName;
58 };
59 
62 #define FP_ENTRY_EQUAL(a, b) (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino))
63 
66 #define FP_EQUAL(a, b) ( \
67  FP_ENTRY_EQUAL((a).entry, (b).entry) && \
68  !strcmp((a).baseName, (b).baseName) && ( \
69  ((a).subDir == (b).subDir) || \
70  ((a).subDir && (b).subDir && !strcmp((a).subDir, (b).subDir)) \
71  ) \
72  )
73 
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 
83 /*@only@*/ fingerPrintCache fpCacheCreate(int sizeHint)
84  /*@globals fileSystem @*/
85  /*@modifies fileSystem @*/;
86 
92 /*@null@*/
94  /*@globals fileSystem @*/
95  /*@modifies cache, fileSystem @*/;
96 
105 fingerPrint fpLookup(fingerPrintCache cache, const char * dirName,
106  const char * baseName, int scareMem)
107  /*@globals fileSystem, internalState @*/
108  /*@modifies cache, fileSystem, internalState @*/;
109 
118 uint32_t fpHashFunction(uint32_t h, const void * data, size_t size)
119  /*@*/;
120 
128 int fpEqual(const void * key1, const void * key2)
129  /*@*/;
130 
141 void fpLookupList(fingerPrintCache cache, const char ** dirNames,
142  const char ** baseNames, const rpmuint32_t * dirIndexes,
143  rpmuint32_t fileCount, fingerPrint * fpList)
144  /*@globals fileSystem, internalState @*/
145  /*@modifies cache, *fpList, fileSystem, internalState @*/;
146 
156 void fpLookupSubdir(hashTable symlinks, hashTable fphash, fingerPrintCache fpc,
157  void * _p, int filenr)
158  /*@*/;
159 
160 #ifdef __cplusplus
161 }
162 #endif
163 
164 #endif