|
|
2ff057 |
#ifndef H_FINGERPRINT
|
|
|
2ff057 |
#define H_FINGERPRINT
|
|
|
2ff057 |
|
|
|
2ff057 |
/** \ingroup rpmtrans
|
|
|
2ff057 |
* \file lib/fprint.h
|
|
|
2ff057 |
* Identify a file name path by a unique "finger print".
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
|
|
|
2ff057 |
#include <rpm/rpmtypes.h>
|
|
|
2ff057 |
|
|
|
2ff057 |
/**
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
typedef struct fprintCache_s * fingerPrintCache;
|
|
|
2ff057 |
|
|
|
2ff057 |
/**
|
|
|
2ff057 |
* @todo Convert to pointer and make abstract.
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
typedef struct fingerPrint_s fingerPrint;
|
|
|
2ff057 |
|
|
|
2ff057 |
struct rpmffi_s {
|
|
|
2ff057 |
rpmte p;
|
|
|
2ff057 |
int fileno;
|
|
|
2ff057 |
};
|
|
|
2ff057 |
|
|
|
2ff057 |
#ifdef __cplusplus
|
|
|
2ff057 |
extern "C" {
|
|
|
2ff057 |
#endif
|
|
|
2ff057 |
|
|
|
2ff057 |
/**
|
|
|
2ff057 |
* Create finger print cache.
|
|
|
2ff057 |
* @param sizeHint number of elements expected
|
|
|
2ff057 |
* @param pool string pool (or NULL for private)
|
|
|
2ff057 |
* @return pointer to initialized fingerprint cache
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
RPM_GNUC_INTERNAL
|
|
|
2ff057 |
fingerPrintCache fpCacheCreate(int sizeHint, rpmstrPool pool);
|
|
|
2ff057 |
|
|
|
2ff057 |
/**
|
|
|
2ff057 |
* Destroy finger print cache.
|
|
|
2ff057 |
* @param cache pointer to fingerprint cache
|
|
|
2ff057 |
* @return NULL always
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
RPM_GNUC_INTERNAL
|
|
|
2ff057 |
fingerPrintCache fpCacheFree(fingerPrintCache cache);
|
|
|
2ff057 |
|
|
|
2ff057 |
RPM_GNUC_INTERNAL
|
|
|
2ff057 |
fingerPrint * fpCacheGetByFp(fingerPrintCache cache,
|
|
|
2ff057 |
struct fingerPrint_s * fp, int ix,
|
|
|
2ff057 |
struct rpmffi_s ** recs, int * numRecs);
|
|
|
2ff057 |
|
|
|
2ff057 |
RPM_GNUC_INTERNAL
|
|
|
2ff057 |
void fpCachePopulate(fingerPrintCache cache, rpmts ts, int fileCount);
|
|
|
2ff057 |
|
|
|
2ff057 |
/* compare an existing fingerprint with a looked-up fingerprint for db/bn */
|
|
|
2ff057 |
RPM_GNUC_INTERNAL
|
|
|
2ff057 |
int fpLookupEquals(fingerPrintCache cache, fingerPrint * fp,
|
|
|
2ff057 |
const char * dirName, const char * baseName);
|
|
|
2ff057 |
|
|
|
2ff057 |
RPM_GNUC_INTERNAL
|
|
|
2ff057 |
const char *fpEntryDir(fingerPrintCache cache, fingerPrint *fp);
|
|
|
2ff057 |
|
|
|
2ff057 |
RPM_GNUC_INTERNAL
|
|
|
2ff057 |
dev_t fpEntryDev(fingerPrintCache cache, fingerPrint *fp);
|
|
|
2ff057 |
|
|
|
2ff057 |
/**
|
|
|
2ff057 |
* Return finger print of a file path.
|
|
|
2ff057 |
* @param cache pointer to fingerprint cache
|
|
|
2ff057 |
* @param dirName leading directory name of file path
|
|
|
2ff057 |
* @param baseName base name of file path
|
|
|
2ff057 |
* @retval fp pointer of fingerprint struct to fill out
|
|
|
2ff057 |
* @return 0 on success
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
RPM_GNUC_INTERNAL
|
|
|
2ff057 |
int fpLookup(fingerPrintCache cache,
|
|
|
2ff057 |
const char * dirName, const char * baseName,
|
|
|
2ff057 |
fingerPrint **fp);
|
|
|
2ff057 |
|
|
|
2ff057 |
/**
|
|
|
2ff057 |
* Compare two finger print entries.
|
|
|
2ff057 |
* This routine is exactly equivalent to the FP_EQUAL macro.
|
|
|
2ff057 |
* @param key1 finger print 1
|
|
|
2ff057 |
* @param key2 finger print 2
|
|
|
2ff057 |
* @return result of comparing key1 and key2
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
RPM_GNUC_INTERNAL
|
|
|
2ff057 |
int fpEqual(const fingerPrint * key1, const fingerPrint * key2);
|
|
|
2ff057 |
|
|
|
2ff057 |
/**
|
|
|
2ff057 |
* Return finger prints of an array of file paths.
|
|
|
2ff057 |
* @param cache pointer to fingerprint cache
|
|
|
2ff057 |
* @param pool pointer to file name pool
|
|
|
2ff057 |
* @param dirNames directory names
|
|
|
2ff057 |
* @param baseNames file base names
|
|
|
2ff057 |
* @param dirIndexes index into dirNames for each baseNames
|
|
|
2ff057 |
* @param fileCount number of file entries
|
|
|
2ff057 |
* @return pointer to array of finger prints
|
|
|
2ff057 |
*/
|
|
|
2ff057 |
RPM_GNUC_INTERNAL
|
|
|
2ff057 |
fingerPrint * fpLookupList(fingerPrintCache cache, rpmstrPool pool,
|
|
|
2ff057 |
rpmsid * dirNames, rpmsid * baseNames,
|
|
|
2ff057 |
const uint32_t * dirIndexes, int fileCount);
|
|
|
2ff057 |
|
|
|
2ff057 |
#ifdef __cplusplus
|
|
|
2ff057 |
}
|
|
|
2ff057 |
#endif
|
|
|
2ff057 |
|
|
|
2ff057 |
#endif
|