Bury the fingerprint hash-types into fprint.c, clean up
- fprint.h only needs rpmtypes.h now, remove historical leftovers - Avoids having to define the hash types multiple times as they're now buried out of sight - fpHashFunction() and fpLookupSubdir() can now be made static, do so...
This commit is contained in:
parent
d3de5120b7
commit
ae38f0a977
27
lib/fprint.c
27
lib/fprint.c
|
@ -17,16 +17,28 @@
|
|||
#include <libgen.h>
|
||||
|
||||
/* Create new hash table type rpmFpEntryHash */
|
||||
#include "lib/rpmhash.C"
|
||||
|
||||
#undef HASHTYPE
|
||||
#undef HTKEYTYPE
|
||||
#undef HTDATATYPE
|
||||
#define HASHTYPE rpmFpEntryHash
|
||||
#define HTKEYTYPE const char *
|
||||
#define HTDATATYPE const struct fprintCacheEntry_s *
|
||||
#include "lib/rpmhash.H"
|
||||
#include "lib/rpmhash.C"
|
||||
|
||||
/* Create by-fingerprint hash table */
|
||||
#undef HASHTYPE
|
||||
#undef HTKEYTYPE
|
||||
#undef HTDATATYPE
|
||||
#define HASHTYPE rpmFpHash
|
||||
#define HTKEYTYPE const fingerPrint *
|
||||
#define HTDATATYPE struct rpmffi_s
|
||||
#include "lib/rpmhash.H"
|
||||
#include "lib/rpmhash.C"
|
||||
#undef HASHTYPE
|
||||
#undef HTKEYTYPE
|
||||
#undef HTDATATYPE
|
||||
|
||||
/**
|
||||
* Finger print cache.
|
||||
*/
|
||||
|
@ -196,7 +208,13 @@ exit:
|
|||
return 0;
|
||||
}
|
||||
|
||||
unsigned int fpHashFunction(const fingerPrint * fp)
|
||||
/**
|
||||
* Return hash value for a finger print.
|
||||
* Hash based on dev and inode only!
|
||||
* @param key pointer to finger print entry
|
||||
* @return hash value
|
||||
*/
|
||||
static unsigned int fpHashFunction(const fingerPrint * fp)
|
||||
{
|
||||
unsigned int hash = 0;
|
||||
int j;
|
||||
|
@ -246,7 +264,8 @@ void fpLookupList(fingerPrintCache cache, rpmstrPool pool,
|
|||
}
|
||||
}
|
||||
|
||||
void fpLookupSubdir(rpmFpHash symlinks, fingerPrintCache fpc, rpmte p, int filenr)
|
||||
/* Check file for to be installed symlinks in their path and correct their fp */
|
||||
static void fpLookupSubdir(rpmFpHash symlinks, fingerPrintCache fpc, rpmte p, int filenr)
|
||||
{
|
||||
rpmfi fi = rpmteFI(p);
|
||||
struct fingerPrint_s current_fp;
|
||||
|
|
43
lib/fprint.h
43
lib/fprint.h
|
@ -6,9 +6,7 @@
|
|||
* Identify a file name path by a unique "finger print".
|
||||
*/
|
||||
|
||||
#include <rpm/header.h>
|
||||
#include <rpm/rpmte.h>
|
||||
#include "lib/rpmdb_internal.h"
|
||||
#include <rpm/rpmtypes.h>
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -31,12 +29,6 @@ const char * subDir;
|
|||
const char * baseName; /*!< file base name */
|
||||
};
|
||||
|
||||
/* Create new hash table data type */
|
||||
#define HASHTYPE rpmFpEntryHash
|
||||
#define HTKEYTYPE const char *
|
||||
#define HTDATATYPE const struct fprintCacheEntry_s *
|
||||
#include "lib/rpmhash.H"
|
||||
|
||||
/**
|
||||
* Finger print cache entry.
|
||||
* This is really a directory and symlink cache. We don't differentiate between
|
||||
|
@ -49,22 +41,11 @@ struct fprintCacheEntry_s {
|
|||
ino_t ino; /*!< stat(2) inode number */
|
||||
};
|
||||
|
||||
/* Create new hash table data type */
|
||||
|
||||
struct rpmffi_s {
|
||||
rpmte p;
|
||||
int fileno;
|
||||
};
|
||||
|
||||
#undef HASHTYPE
|
||||
#undef HTKEYTYPE
|
||||
#undef HTDATATYPE
|
||||
|
||||
#define HASHTYPE rpmFpHash
|
||||
#define HTKEYTYPE const fingerPrint *
|
||||
#define HTDATATYPE struct rpmffi_s
|
||||
#include "lib/rpmhash.H"
|
||||
|
||||
/** */
|
||||
#define FP_ENTRY_EQUAL(a, b) (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino))
|
||||
|
||||
|
@ -118,15 +99,6 @@ int fpLookup(fingerPrintCache cache,
|
|||
const char * dirName, const char * baseName, int scareMemory,
|
||||
fingerPrint *fp);
|
||||
|
||||
/**
|
||||
* Return hash value for a finger print.
|
||||
* Hash based on dev and inode only!
|
||||
* @param key pointer to finger print entry
|
||||
* @return hash value
|
||||
*/
|
||||
RPM_GNUC_INTERNAL
|
||||
unsigned int fpHashFunction(const fingerPrint * key);
|
||||
|
||||
/**
|
||||
* Compare two finger print entries.
|
||||
* This routine is exactly equivalent to the FP_EQUAL macro.
|
||||
|
@ -154,19 +126,6 @@ void fpLookupList(fingerPrintCache cache, rpmstrPool pool,
|
|||
const uint32_t * dirIndexes,
|
||||
int fileCount, fingerPrint * fpList);
|
||||
|
||||
/**
|
||||
* Check file for to be installed symlinks in their path,
|
||||
* correct their fingerprint and add it to newht.
|
||||
* @param ht hash table containing all files fingerprints
|
||||
* @param newht hash table to add the corrected fingerprints
|
||||
* @param fpc fingerprint cache
|
||||
* @param fi file iterator of the package
|
||||
* @param filenr the number of the file we are dealing with
|
||||
*/
|
||||
RPM_GNUC_INTERNAL
|
||||
void fpLookupSubdir(rpmFpHash symlinks, fingerPrintCache fpc, rpmte p, int filenr);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "lib/rpmal.h" /* XXX availablePackage */
|
||||
#include "lib/fprint.h"
|
||||
#include "lib/rpmlock.h"
|
||||
#include "lib/rpmdb_internal.h"
|
||||
|
||||
typedef struct diskspaceInfo_s * rpmDiskSpaceInfo;
|
||||
|
||||
|
|
Loading…
Reference in New Issue