6 * Identify a file name path by a unique "finger print".
9 #include <rpm/rpmtypes.h>
13 typedef struct fprintCache_s * fingerPrintCache;
16 * @todo Convert to pointer and make abstract.
18 typedef struct fingerPrint_s fingerPrint;
30 * Create finger print cache.
31 * @param sizeHint number of elements expected
32 * @param pool string pool (or NULL for private)
33 * @return pointer to initialized fingerprint cache
36 fingerPrintCache fpCacheCreate(int sizeHint, rpmstrPool pool);
39 * Destroy finger print cache.
40 * @param cache pointer to fingerprint cache
44 fingerPrintCache fpCacheFree(fingerPrintCache cache);
47 fingerPrint * fpCacheGetByFp(fingerPrintCache cache,
48 struct fingerPrint_s * fp, int ix,
49 struct rpmffi_s ** recs, int * numRecs);
52 void fpCachePopulate(fingerPrintCache cache, rpmts ts, int fileCount);
54 /* compare an existing fingerprint with a looked-up fingerprint for db/bn */
56 int fpLookupEquals(fingerPrintCache cache, fingerPrint * fp,
57 const char * dirName, const char * baseName);
60 const char *fpEntryDir(fingerPrintCache cache, fingerPrint *fp);
63 dev_t fpEntryDev(fingerPrintCache cache, fingerPrint *fp);
66 * Return finger print of a file path.
67 * @param cache pointer to fingerprint cache
68 * @param dirName leading directory name of file path
69 * @param baseName base name of file path
70 * @retval fp pointer of fingerprint struct to fill out
71 * @return 0 on success
74 int fpLookup(fingerPrintCache cache,
75 const char * dirName, const char * baseName,
79 * Compare two finger print entries.
80 * This routine is exactly equivalent to the FP_EQUAL macro.
81 * @param key1 finger print 1
82 * @param key2 finger print 2
83 * @return result of comparing key1 and key2
86 int fpEqual(const fingerPrint * key1, const fingerPrint * key2);
89 * Return finger prints of an array of file paths.
90 * @param cache pointer to fingerprint cache
91 * @param pool pointer to file name pool
92 * @param dirNames directory names
93 * @param baseNames file base names
94 * @param dirIndexes index into dirNames for each baseNames
95 * @param fileCount number of file entries
96 * @return pointer to array of finger prints
99 fingerPrint * fpLookupList(fingerPrintCache cache, rpmstrPool pool,
100 rpmsid * dirNames, rpmsid * baseNames,
101 const uint32_t * dirIndexes, int fileCount);