fprint.h
Go to the documentation of this file.
#ifndef H_FINGERPRINT
#define H_FINGERPRINT
#include "rpmhash.h"
typedef /*@abstract@*/ struct fprintCache_s * fingerPrintCache;
typedef struct fingerPrint_s fingerPrint;
struct fprintCacheEntry_s {
const char * dirName;
dev_t dev;
ino_t ino;
};
struct fprintCache_s {
hashTable ht;
};
struct fingerPrint_s {
const struct fprintCacheEntry_s * entry;
/*@owned@*/ /*@relnull@*/
const char * subDir;
/*@dependent@*/
const char * baseName;
};
#define FP_ENTRY_EQUAL(a, b) (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino))
#define FP_EQUAL(a, b) ( \
FP_ENTRY_EQUAL((a).entry, (b).entry) && \
!strcmp((a).baseName, (b).baseName) && ( \
((a).subDir == (b).subDir) || \
((a).subDir && (b).subDir && !strcmp((a).subDir, (b).subDir)) \
) \
)
#ifdef __cplusplus
extern "C" {
#endif
int rpmdbFindFpList(/*@null@*/ void * _db, fingerPrint * fpList,
/*@out@*/ void * _matchList, int numItems,
unsigned int exclude)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies _db, _matchList, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/* Be carefull with the memory... assert(*fullName == '/' || !scareMem) */
/*@only@*/ fingerPrintCache fpCacheCreate(int sizeHint)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/;
/*@null@*/
fingerPrintCache fpCacheFree(/*@only@*/ fingerPrintCache cache)
/*@globals fileSystem @*/
/*@modifies cache, fileSystem @*/;
fingerPrint fpLookup(fingerPrintCache cache, const char * dirName,
const char * baseName, int scareMem)
/*@globals fileSystem, internalState @*/
/*@modifies cache, fileSystem, internalState @*/;
rpmuint32_t fpHashFunction(rpmuint32_t h, const void * data, size_t size)
/*@*/;
int fpEqual(const void * key1, const void * key2)
/*@*/;
void fpLookupList(fingerPrintCache cache, const char ** dirNames,
const char ** baseNames, const rpmuint32_t * dirIndexes,
rpmuint32_t fileCount, fingerPrint * fpList)
/*@globals fileSystem, internalState @*/
/*@modifies cache, *fpList, fileSystem, internalState @*/;
#ifdef __cplusplus
}
#endif
#endif