ino_t ino; /*!< stat(2) inode number */
};
+/**
+ * Associates a trailing sub-directory and final base name with an existing
+ * directory finger print.
+ */
+struct fingerPrint_s {
+ /*! directory finger print entry (the directory path is stat(2)-able */
+ const struct fprintCacheEntry_s * entry;
+ /*! trailing sub-directory path (directories that are not stat(2)-able */
+ const char * subDir;
+ const char * baseName; /*!< file base name */
+};
+
#define FP_ENTRY_EQUAL(a, b) (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino))
#define FP_EQUAL(a, b) ( \
struct rpmffi_s * recs;
int numRecs;
int i;
- fingerPrint *fp = rpmfiFpsIndex(fi, filenr);
+ fingerPrint *fp = rpmfiFps(fi) + filenr;
int symlinkcount = 0;
struct rpmffi_s ffi = { p, filenr};
}
-int fpCacheGetByFp(fingerPrintCache cache, struct fingerPrint_s * fp,
- struct rpmffi_s ** recs, int * numRecs)
+fingerPrint * fpCacheGetByFp(fingerPrintCache cache,
+ struct fingerPrint_s * fp, int ix,
+ struct rpmffi_s ** recs, int * numRecs)
{
- return rpmFpHashGetEntry(cache->fp, fp, recs, numRecs, NULL);
+ if (rpmFpHashGetEntry(cache->fp, fp + ix, recs, numRecs, NULL))
+ return fp + ix;
+ else
+ return NULL;
}
void fpCachePopulate(fingerPrintCache fpc, rpmts ts, int fileCount)
pi = rpmtsiInit(ts);
while ((p = rpmtsiNext(pi, 0)) != NULL) {
+ fingerPrint *fpList;
(void) rpmdbCheckSignals();
if ((fi = rpmteFI(p)) == NULL)
rpmfiFpLookup(fi, fpc);
fs = rpmteGetFileStates(p);
fc = rpmfsFC(fs);
+ fpList = rpmfiFps(fi);
/* collect symbolic links */
for (i = 0; i < fc; i++) {
struct rpmffi_s ffi;
continue;
ffi.p = p;
ffi.fileno = i;
- rpmFpHashAddEntry(symlinks, rpmfiFpsIndex(fi, i), ffi);
+ rpmFpHashAddEntry(symlinks, fpList + i, ffi);
}
(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), fc);
*/
typedef struct fingerPrint_s fingerPrint;
-/**
- * Associates a trailing sub-directory and final base name with an existing
- * directory finger print.
- */
-struct fingerPrint_s {
-/*! directory finger print entry (the directory path is stat(2)-able */
- const struct fprintCacheEntry_s * entry;
-/*! trailing sub-directory path (directories that are not stat(2)-able */
-const char * subDir;
-const char * baseName; /*!< file base name */
-};
-
struct rpmffi_s {
rpmte p;
int fileno;
fingerPrintCache fpCacheFree(fingerPrintCache cache);
RPM_GNUC_INTERNAL
-int fpCacheGetByFp(fingerPrintCache cache, struct fingerPrint_s * fp,
- struct rpmffi_s ** recs, int * numRecs);
+fingerPrint * fpCacheGetByFp(fingerPrintCache cache,
+ struct fingerPrint_s * fp, int ix,
+ struct rpmffi_s ** recs, int * numRecs);
RPM_GNUC_INTERNAL
void fpCachePopulate(fingerPrintCache cache, rpmts ts, int fileCount);
return flangs;
}
-struct fingerPrint_s *rpmfiFpsIndex(rpmfi fi, int ix)
+struct fingerPrint_s *rpmfiFps(rpmfi fi)
{
- struct fingerPrint_s * fps = NULL;
- if (fi != NULL && fi->fps != NULL && ix >= 0 && ix < fi->fc) {
- fps = fi->fps + ix;
- }
- return fps;
+ return (fi != NULL) ? fi->fps : NULL;
}
int rpmfiNext(rpmfi fi)
const char * rpmfiFCapsIndex(rpmfi fi, int ix);
RPM_GNUC_INTERNAL
-struct fingerPrint_s *rpmfiFpsIndex(rpmfi fi, int ix);
+struct fingerPrint_s *rpmfiFps(rpmfi fi);
RPM_GNUC_INTERNAL
rpmFileAction rpmfiDecideFateIndex(rpmfi ofi, int oix, rpmfi nfi, int nix,
rpmfs otherFs;
rpm_count_t fc = rpmfiFC(fi);
int reportConflicts = !(rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACENEWFILES);
+ fingerPrint * fpList = rpmfiFps(fi);
for (i = 0; i < fc; i++) {
struct fingerPrint_s * fiFps;
if (XFA_SKIPPING(rpmfsGetAction(fs, i)))
continue;
- fiFps = rpmfiFpsIndex(fi, i);
FFlags = rpmfiFFlagsIndex(fi, i);
fixupSize = 0;
* will be installed and removed so the records for an overlapped
* files will be sorted in exactly the same order.
*/
- fpCacheGetByFp(fpc, fiFps, &recs, &numRecs);
+ fiFps = fpCacheGetByFp(fpc, fpList, i, &recs, &numRecs);
/*
* If this package is being added, look only at other packages
rpmfs fs;
int j;
unsigned int fileNum;
- const char * oldDir;
rpmdbMatchIterator mi;
Header h, newheader;
headerGet(h, RPMTAG_FILESTATES, &ostates, hgflags);
}
- oldDir = NULL;
/* loop over all interesting files in that package */
do {
- int gotRecs;
+ int fpIx;
struct rpmffi_s * recs;
int numRecs;
const char * dirName;
baseName = rpmtdGetString(&bnames);
fpLookup(fpc, dirName, baseName, 1, &fpp);
+ fpIx = 0;
} else {
- fpp = rpmfiFpsIndex(otherFi, fileNum);
+ fpp = rpmfiFps(otherFi);
+ fpIx = fileNum;
}
/* search for files in the transaction with same finger print */
- gotRecs = fpCacheGetByFp(fpc, fpp, &recs, &numRecs);
+ fpCacheGetByFp(fpc, fpp, fpIx, &recs, &numRecs);
- for (j=0; (j<numRecs)&&gotRecs; j++) {
+ for (j = 0; j < numRecs; j++) {
p = recs[j].p;
fi = rpmteFI(p);
fs = rpmteGetFileStates(p);