Mass-rename all rpmfiFooIndex() functions to rpmfilesFoo()

- These all operate on rpmfiles, not rpmfi, now so make the point
  clearer. All internal stuff so we're free to mess around.
- No functional changes, only a straightforward perl-assisted rename...
This commit is contained in:
Panu Matilainen 2013-11-07 15:57:13 +02:00
parent 02286c0d67
commit d9c0b07adb
6 changed files with 154 additions and 154 deletions

View File

@ -374,7 +374,7 @@ static void fpLookupSubdir(rpmFpHash symlinks, fingerPrintCache fpc, rpmte p, in
for (i=0; i<numRecs; i++) {
rpmfiles foundfi = rpmteFiles(recs[i].p);
char const *linktarget = rpmfiFLinkIndex(foundfi, recs[i].fileno);
char const *linktarget = rpmfilesFLink(foundfi, recs[i].fileno);
char *link;
if (linktarget && *linktarget != '\0') {
@ -491,7 +491,7 @@ void fpCachePopulate(fingerPrintCache fpc, rpmts ts, int fileCount)
char const *linktarget;
if (XFA_SKIPPING(rpmfsGetAction(fs, i)))
continue;
linktarget = rpmfiFLinkIndex(fi, i);
linktarget = rpmfilesFLink(fi, i);
if (!(linktarget && *linktarget != '\0'))
continue;
ffi.p = p;

View File

@ -186,19 +186,19 @@ static DNLI_t dnlInitIterator(rpmfiles fi, rpmfs fs, int reverse)
/* Identify parent directories not skipped. */
for (i = 0; i < fc; i++)
if (!XFA_SKIPPING(rpmfsGetAction(fs, i)))
dnli->active[rpmfiDIIndex(fi, i)] = 1;
dnli->active[rpmfilesDI(fi, i)] = 1;
/* Exclude parent directories that are explicitly included. */
for (i = 0; i < fc; i++) {
int dil;
size_t dnlen, bnlen;
if (!S_ISDIR(rpmfiFModeIndex(fi, i)))
if (!S_ISDIR(rpmfilesFMode(fi, i)))
continue;
dil = rpmfiDIIndex(fi, i);
dnlen = strlen(rpmfiDNIndex(fi, dil));
bnlen = strlen(rpmfiBNIndex(fi, i));
dil = rpmfilesDI(fi, i);
dnlen = strlen(rpmfilesDN(fi, dil));
bnlen = strlen(rpmfilesBN(fi, i));
for (j = 0; j < dc; j++) {
const char * dnl;
@ -206,13 +206,13 @@ static DNLI_t dnlInitIterator(rpmfiles fi, rpmfs fs, int reverse)
if (!dnli->active[j] || j == dil)
continue;
dnl = rpmfiDNIndex(fi, j);
dnl = rpmfilesDN(fi, j);
jlen = strlen(dnl);
if (jlen != (dnlen+bnlen+1))
continue;
if (!rstreqn(dnl, rpmfiDNIndex(fi, dil), dnlen))
if (!rstreqn(dnl, rpmfilesDN(fi, dil), dnlen))
continue;
if (!rstreqn(dnl+dnlen, rpmfiBNIndex(fi, i), bnlen))
if (!rstreqn(dnl+dnlen, rpmfilesBN(fi, i), bnlen))
continue;
if (dnl[dnlen+bnlen] != '/' || dnl[dnlen+bnlen+1] != '\0')
continue;
@ -232,7 +232,7 @@ static DNLI_t dnlInitIterator(rpmfiles fi, rpmfs fs, int reverse)
rpmlog(RPMLOG_DEBUG,
"========== Directories not explicitly included in package:\n");
}
rpmlog(RPMLOG_DEBUG, "%10d %s\n", i, rpmfiDNIndex(fi, i));
rpmlog(RPMLOG_DEBUG, "%10d %s\n", i, rpmfilesDN(fi, i));
}
if (j)
rpmlog(RPMLOG_DEBUG, "==========\n");
@ -262,7 +262,7 @@ const char * dnlNextIterator(DNLI_t dnli)
} while (i >= 0 && i < dc && !dnli->active[i]);
if (i >= 0 && i < dc)
dn = rpmfiDNIndex(fi, i);
dn = rpmfilesDN(fi, i);
else
i = -1;
dnli->isave = i;
@ -288,11 +288,11 @@ static int fsmMapPath(FSM_t fsm, int i)
/* XXX these should use rpmfiFFlags() etc */
/* Build doesn't have file states */
fsm->action = (fsm->fs) ? rpmfsGetAction(fsm->fs, i) : 0;
fsm->fflags = rpmfiFFlagsIndex(fi, i);
fsm->fflags = rpmfilesFFlags(fi, i);
/* src rpms have simple base name in payload. */
fsm->dirName = rpmfiDNIndex(fi, rpmfiDIIndex(fi, i));
fsm->baseName = rpmfiBNIndex(fi, i);
fsm->dirName = rpmfilesDN(fi, rpmfilesDI(fi, i));
fsm->baseName = rpmfilesBN(fi, i);
/* Never create backup for %ghost files. */
if (fsm->goal != FSM_PKGBUILD && !(fsm->fflags & RPMFILE_GHOST)) {
@ -452,9 +452,9 @@ static int fsmMapAttrs(FSM_t fsm)
/* this check is pretty moot, rpmfi accessors check array bounds etc */
if (fi && i >= 0 && i < rpmfilesFC(fi)) {
mode_t finalMode = rpmfiFModeIndex(fi, i);
const char *user = rpmfiFUserIndex(fi, i);
const char *group = rpmfiFGroupIndex(fi, i);
mode_t finalMode = rpmfilesFMode(fi, i);
const char *user = rpmfilesFUser(fi, i);
const char *group = rpmfilesFGroup(fi, i);
uid_t uid = 0;
gid_t gid = 0;
@ -479,11 +479,11 @@ static int fsmMapAttrs(FSM_t fsm)
st->st_mode = finalMode;
st->st_dev = 0;
st->st_ino = rpmfiFInodeIndex(fi, i);
st->st_rdev = rpmfiFRdevIndex(fi, i);
st->st_mtime = rpmfiFMtimeIndex(fi, i);
st->st_size = rpmfiFSizeIndex(fi, i);
st->st_nlink = rpmfiFNlinkIndex(fi, i);
st->st_ino = rpmfilesFInode(fi, i);
st->st_rdev = rpmfilesFRdev(fi, i);
st->st_mtime = rpmfilesFMtime(fi, i);
st->st_size = rpmfilesFSize(fi, i);
st->st_nlink = rpmfilesFNlink(fi, i);
if ((S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode))
&& st->st_nlink == 0) {
@ -911,7 +911,7 @@ static int fsmInit(FSM_t fsm)
/* mode must be known so that dirs don't get suffix. */
rpmfiles fi = rpmfiFiles(fsm->fi);
fsm->sb.st_mode = rpmfiFModeIndex(fi, fsm->ix);
fsm->sb.st_mode = rpmfilesFMode(fi, fsm->ix);
/* Generate file path. */
rc = fsmMapPath(fsm, fsm->ix);
@ -1166,10 +1166,10 @@ static int fsmSetmeta(FSM_t fsm, int ix, const struct stat * st)
}
/* Set file capabilities (if enabled) */
if (!rc && S_ISREG(st->st_mode) && !getuid()) {
rc = fsmSetFCaps(fsm->path, rpmfiFCapsIndex(fi, ix));
rc = fsmSetFCaps(fsm->path, rpmfilesFCaps(fi, ix));
}
if (!rc) {
rc = fsmUtime(fsm->path, st->st_mode, rpmfiFMtimeIndex(fi, ix));
rc = fsmUtime(fsm->path, st->st_mode, rpmfilesFMtime(fi, ix));
}
if (!rc) {
rc = rpmpluginsCallFsmFilePrepare(fsm->plugins, fsm->path, dest,
@ -1458,7 +1458,7 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfi fi, FD_t cfd,
if (!rc) {
rpmfiles files = rpmfiFiles(fi);
for (int i=0; i<fc; i++) {
if (!found[i] && !(rpmfiFFlagsIndex(files, i) & RPMFILE_GHOST))
if (!found[i] && !(rpmfilesFFlags(files, i) & RPMFILE_GHOST))
rc = CPIOERR_MISSING_HARDLINK; // XXX other error code
}
}

View File

@ -194,18 +194,18 @@ static void rpmalAddFiles(rpmal al, rpmalNum pkgNum, rpmfiles fi)
for (int i = 0; i < fc; i++) {
/* Ignore colored provides not in our rainbow. */
ficolor = rpmfiFColorIndex(fi, i);
ficolor = rpmfilesFColor(fi, i);
if (al->tscolor && ficolor && !(al->tscolor & ficolor))
continue;
/* Ignore files that wont be installed */
if (skipdoc && (rpmfiFFlagsIndex(fi, i) & RPMFILE_DOC))
if (skipdoc && (rpmfilesFFlags(fi, i) & RPMFILE_DOC))
continue;
if (skipconf && (rpmfiFFlagsIndex(fi, i) & RPMFILE_CONFIG))
if (skipconf && (rpmfilesFFlags(fi, i) & RPMFILE_CONFIG))
continue;
fileName.dirName = rpmfiDNIdIndex(fi, rpmfiDIIndex(fi, i));
fileName.baseName = rpmfiBNIdIndex(fi, i);
fileName.dirName = rpmfilesDNId(fi, rpmfilesDI(fi, i));
fileName.baseName = rpmfilesBNId(fi, i);
fileEntry.entryIx = i;

View File

@ -200,7 +200,7 @@ int rpmfiSetDX(rpmfi fi, int dx)
return j;
}
int rpmfiDIIndex(rpmfiles fi, int dx)
int rpmfilesDI(rpmfiles fi, int dx)
{
int j = -1;
if (fi != NULL && dx >= 0 && dx < fi->fc) {
@ -210,7 +210,7 @@ int rpmfiDIIndex(rpmfiles fi, int dx)
return j;
}
rpmsid rpmfiBNIdIndex(rpmfiles fi, int ix)
rpmsid rpmfilesBNId(rpmfiles fi, int ix)
{
rpmsid id = 0;
if (fi != NULL && ix >= 0 && ix < fi->fc) {
@ -220,7 +220,7 @@ rpmsid rpmfiBNIdIndex(rpmfiles fi, int ix)
return id;
}
rpmsid rpmfiDNIdIndex(rpmfiles fi, int jx)
rpmsid rpmfilesDNId(rpmfiles fi, int jx)
{
rpmsid id = 0;
if (fi != NULL && jx >= 0 && jx < fi->fc) {
@ -230,7 +230,7 @@ rpmsid rpmfiDNIdIndex(rpmfiles fi, int jx)
return id;
}
const char * rpmfiBNIndex(rpmfiles fi, int ix)
const char * rpmfilesBN(rpmfiles fi, int ix)
{
const char * BN = NULL;
@ -241,7 +241,7 @@ const char * rpmfiBNIndex(rpmfiles fi, int ix)
return BN;
}
const char * rpmfiDNIndex(rpmfiles fi, int jx)
const char * rpmfilesDN(rpmfiles fi, int jx)
{
const char * DN = NULL;
@ -252,7 +252,7 @@ const char * rpmfiDNIndex(rpmfiles fi, int jx)
return DN;
}
char * rpmfiFNIndex(rpmfiles fi, int ix)
char * rpmfilesFN(rpmfiles fi, int ix)
{
char *fn = NULL;
if (fi != NULL && ix >= 0 && ix < fi->fc) {
@ -314,7 +314,7 @@ int rpmfiFindFN(rpmfi fi, const char * fn)
return -1;
}
rpmfileAttrs rpmfiFFlagsIndex(rpmfiles fi, int ix)
rpmfileAttrs rpmfilesFFlags(rpmfiles fi, int ix)
{
rpmfileAttrs FFlags = 0;
@ -325,7 +325,7 @@ rpmfileAttrs rpmfiFFlagsIndex(rpmfiles fi, int ix)
return FFlags;
}
rpmVerifyAttrs rpmfiVFlagsIndex(rpmfiles fi, int ix)
rpmVerifyAttrs rpmfilesVFlags(rpmfiles fi, int ix)
{
rpmVerifyAttrs VFlags = 0;
@ -336,7 +336,7 @@ rpmVerifyAttrs rpmfiVFlagsIndex(rpmfiles fi, int ix)
return VFlags;
}
rpm_mode_t rpmfiFModeIndex(rpmfiles fi, int ix)
rpm_mode_t rpmfilesFMode(rpmfiles fi, int ix)
{
rpm_mode_t fmode = 0;
@ -347,7 +347,7 @@ rpm_mode_t rpmfiFModeIndex(rpmfiles fi, int ix)
return fmode;
}
rpmfileState rpmfiFStateIndex(rpmfiles fi, int ix)
rpmfileState rpmfilesFState(rpmfiles fi, int ix)
{
rpmfileState fstate = RPMFILE_STATE_MISSING;
@ -372,7 +372,7 @@ int rpmfiDigestAlgo(rpmfi fi)
return fi ? rpmfilesDigestAlgo(fi->files) : 0;
}
const unsigned char * rpmfiFDigestIndex(rpmfiles fi, int ix, int *algo, size_t *len)
const unsigned char * rpmfilesFDigest(rpmfiles fi, int ix, int *algo, size_t *len)
{
const unsigned char *digest = NULL;
@ -399,7 +399,7 @@ char * rpmfiFDigestHex(rpmfi fi, int *algo)
return fdigest;
}
const char * rpmfiFLinkIndex(rpmfiles fi, int ix)
const char * rpmfilesFLink(rpmfiles fi, int ix)
{
const char * flink = NULL;
@ -410,7 +410,7 @@ const char * rpmfiFLinkIndex(rpmfiles fi, int ix)
return flink;
}
rpm_loff_t rpmfiFSizeIndex(rpmfiles fi, int ix)
rpm_loff_t rpmfilesFSize(rpmfiles fi, int ix)
{
rpm_loff_t fsize = 0;
@ -423,7 +423,7 @@ rpm_loff_t rpmfiFSizeIndex(rpmfiles fi, int ix)
return fsize;
}
rpm_rdev_t rpmfiFRdevIndex(rpmfiles fi, int ix)
rpm_rdev_t rpmfilesFRdev(rpmfiles fi, int ix)
{
rpm_rdev_t frdev = 0;
@ -434,7 +434,7 @@ rpm_rdev_t rpmfiFRdevIndex(rpmfiles fi, int ix)
return frdev;
}
rpm_ino_t rpmfiFInodeIndex(rpmfiles fi, int ix)
rpm_ino_t rpmfilesFInode(rpmfiles fi, int ix)
{
rpm_ino_t finode = 0;
@ -458,7 +458,7 @@ rpm_color_t rpmfiColor(rpmfi fi)
return color;
}
rpm_color_t rpmfiFColorIndex(rpmfiles fi, int ix)
rpm_color_t rpmfilesFColor(rpmfiles fi, int ix)
{
rpm_color_t fcolor = 0;
@ -470,7 +470,7 @@ rpm_color_t rpmfiFColorIndex(rpmfiles fi, int ix)
return fcolor;
}
const char * rpmfiFClassIndex(rpmfiles fi, int ix)
const char * rpmfilesFClass(rpmfiles fi, int ix)
{
const char * fclass = NULL;
int cdictx;
@ -483,7 +483,7 @@ const char * rpmfiFClassIndex(rpmfiles fi, int ix)
return fclass;
}
uint32_t rpmfiFDependsIndex(rpmfiles fi, int ix, const uint32_t ** fddictp)
uint32_t rpmfilesFDepends(rpmfiles fi, int ix, const uint32_t ** fddictp)
{
int fddictx = -1;
int fddictn = 0;
@ -502,7 +502,7 @@ uint32_t rpmfiFDependsIndex(rpmfiles fi, int ix, const uint32_t ** fddictp)
return fddictn;
}
uint32_t rpmfiFLinksIndex(rpmfiles fi, int ix, const int ** files)
uint32_t rpmfilesFLinks(rpmfiles fi, int ix, const int ** files)
{
uint32_t nlink = 0;
@ -526,15 +526,15 @@ uint32_t rpmfiFLinksIndex(rpmfiles fi, int ix, const int ** files)
uint32_t rpmfiFLinks(rpmfi fi, const int ** files)
{
return rpmfiFLinksIndex(fi->files, fi ? fi->i : -1, files);
return rpmfilesFLinks(fi->files, fi ? fi->i : -1, files);
}
uint32_t rpmfiFNlinkIndex(rpmfiles fi, int ix)
uint32_t rpmfilesFNlink(rpmfiles fi, int ix)
{
return rpmfiFLinksIndex(fi, ix, NULL);
return rpmfilesFLinks(fi, ix, NULL);
}
rpm_time_t rpmfiFMtimeIndex(rpmfiles fi, int ix)
rpm_time_t rpmfilesFMtime(rpmfiles fi, int ix)
{
rpm_time_t fmtime = 0;
@ -545,7 +545,7 @@ rpm_time_t rpmfiFMtimeIndex(rpmfiles fi, int ix)
return fmtime;
}
const char * rpmfiFUserIndex(rpmfiles fi, int ix)
const char * rpmfilesFUser(rpmfiles fi, int ix)
{
const char * fuser = NULL;
@ -556,7 +556,7 @@ const char * rpmfiFUserIndex(rpmfiles fi, int ix)
return fuser;
}
const char * rpmfiFGroupIndex(rpmfiles fi, int ix)
const char * rpmfilesFGroup(rpmfiles fi, int ix)
{
const char * fgroup = NULL;
@ -567,7 +567,7 @@ const char * rpmfiFGroupIndex(rpmfiles fi, int ix)
return fgroup;
}
const char * rpmfiFCapsIndex(rpmfiles fi, int ix)
const char * rpmfilesFCaps(rpmfiles fi, int ix)
{
const char *fcaps = NULL;
if (fi != NULL && ix >= 0 && ix < fi->fc) {
@ -576,7 +576,7 @@ const char * rpmfiFCapsIndex(rpmfiles fi, int ix)
return fcaps;
}
const char * rpmfiFLangsIndex(rpmfiles fi, int ix)
const char * rpmfilesFLangs(rpmfiles fi, int ix)
{
const char *flangs = NULL;
if (fi != NULL && fi->flangs != NULL && ix >= 0 && ix < fi->fc) {
@ -676,32 +676,32 @@ rpmFileTypes rpmfiWhatis(rpm_mode_t mode)
return REG;
}
int rpmfiCompareIndex(rpmfiles afi, int aix, rpmfiles bfi, int bix)
int rpmfilesCompare(rpmfiles afi, int aix, rpmfiles bfi, int bix)
{
mode_t amode = rpmfiFModeIndex(afi, aix);
mode_t bmode = rpmfiFModeIndex(bfi, bix);
mode_t amode = rpmfilesFMode(afi, aix);
mode_t bmode = rpmfilesFMode(bfi, bix);
rpmFileTypes awhat = rpmfiWhatis(amode);
if ((rpmfiFFlagsIndex(afi, aix) & RPMFILE_GHOST) ||
(rpmfiFFlagsIndex(bfi, bix) & RPMFILE_GHOST)) return 0;
if ((rpmfilesFFlags(afi, aix) & RPMFILE_GHOST) ||
(rpmfilesFFlags(bfi, bix) & RPMFILE_GHOST)) return 0;
/* Mode difference is a conflict, except for symlinks */
if (!(awhat == LINK && rpmfiWhatis(bmode) == LINK) && amode != bmode)
return 1;
if (awhat == LINK || awhat == REG) {
if (rpmfiFSizeIndex(afi, aix) != rpmfiFSizeIndex(bfi, bix))
if (rpmfilesFSize(afi, aix) != rpmfilesFSize(bfi, bix))
return 1;
}
if (!rstreq(rpmfiFUserIndex(afi, aix), rpmfiFUserIndex(bfi, bix)))
if (!rstreq(rpmfilesFUser(afi, aix), rpmfilesFUser(bfi, bix)))
return 1;
if (!rstreq(rpmfiFGroupIndex(afi, aix), rpmfiFGroupIndex(bfi, bix)))
if (!rstreq(rpmfilesFGroup(afi, aix), rpmfilesFGroup(bfi, bix)))
return 1;
if (awhat == LINK) {
const char * alink = rpmfiFLinkIndex(afi, aix);
const char * blink = rpmfiFLinkIndex(bfi, bix);
const char * alink = rpmfilesFLink(afi, aix);
const char * blink = rpmfilesFLink(bfi, bix);
if (alink == blink) return 0;
if (alink == NULL) return 1;
if (blink == NULL) return -1;
@ -710,8 +710,8 @@ int rpmfiCompareIndex(rpmfiles afi, int aix, rpmfiles bfi, int bix)
size_t adiglen, bdiglen;
int aalgo, balgo;
const unsigned char * adigest, * bdigest;
adigest = rpmfiFDigestIndex(afi, aix, &aalgo, &adiglen);
bdigest = rpmfiFDigestIndex(bfi, bix, &balgo, &bdiglen);
adigest = rpmfilesFDigest(afi, aix, &aalgo, &adiglen);
bdigest = rpmfilesFDigest(bfi, bix, &balgo, &bdiglen);
if (adigest == bdigest) return 0;
if (adigest == NULL) return 1;
if (bdigest == NULL) return -1;
@ -719,19 +719,19 @@ int rpmfiCompareIndex(rpmfiles afi, int aix, rpmfiles bfi, int bix)
if (aalgo != balgo || adiglen != bdiglen) return -1;
return memcmp(adigest, bdigest, adiglen);
} else if (awhat == CDEV || awhat == BDEV) {
if (rpmfiFRdevIndex(afi, aix) != rpmfiFRdevIndex(bfi, bix))
if (rpmfilesFRdev(afi, aix) != rpmfilesFRdev(bfi, bix))
return 1;
}
return 0;
}
rpmFileAction rpmfiDecideFateIndex(rpmfiles ofi, int oix,
rpmFileAction rpmfilesDecideFate(rpmfiles ofi, int oix,
rpmfiles nfi, int nix,
int skipMissing)
{
char * fn = rpmfiFNIndex(nfi, nix);
rpmfileAttrs newFlags = rpmfiFFlagsIndex(nfi, nix);
char * fn = rpmfilesFN(nfi, nix);
rpmfileAttrs newFlags = rpmfilesFFlags(nfi, nix);
char buffer[1024];
rpmFileTypes dbWhat, newWhat, diskWhat;
struct stat sb;
@ -760,8 +760,8 @@ rpmFileAction rpmfiDecideFateIndex(rpmfiles ofi, int oix,
}
diskWhat = rpmfiWhatis((rpm_mode_t)sb.st_mode);
dbWhat = rpmfiWhatis(rpmfiFModeIndex(ofi, oix));
newWhat = rpmfiWhatis(rpmfiFModeIndex(nfi, nix));
dbWhat = rpmfiWhatis(rpmfilesFMode(ofi, oix));
newWhat = rpmfiWhatis(rpmfilesFMode(nfi, nix));
/*
* This order matters - we'd prefer to CREATE the file if at all
@ -776,7 +776,7 @@ rpmFileAction rpmfiDecideFateIndex(rpmfiles ofi, int oix,
const unsigned char * odigest, * ndigest;
/* See if the file on disk is identical to the one in old pkg */
odigest = rpmfiFDigestIndex(ofi, oix, &oalgo, &odiglen);
odigest = rpmfilesFDigest(ofi, oix, &oalgo, &odiglen);
if (diskWhat == REG) {
if (rpmDoDigest(oalgo, fn, 0, (unsigned char *)buffer, NULL))
goto exit; /* assume file has been removed */
@ -785,7 +785,7 @@ rpmFileAction rpmfiDecideFateIndex(rpmfiles ofi, int oix,
}
/* See if the file on disk is identical to the one in new pkg */
ndigest = rpmfiFDigestIndex(nfi, nix, &nalgo, &ndiglen);
ndigest = rpmfilesFDigest(nfi, nix, &nalgo, &ndiglen);
if (diskWhat == REG && newWhat == REG) {
/* hash algo changed in new, recalculate digest */
if (oalgo != nalgo)
@ -809,7 +809,7 @@ rpmFileAction rpmfiDecideFateIndex(rpmfiles ofi, int oix,
const char * oFLink, * nFLink;
/* See if the link on disk is identical to the one in old pkg */
oFLink = rpmfiFLinkIndex(ofi, oix);
oFLink = rpmfilesFLink(ofi, oix);
if (diskWhat == LINK) {
ssize_t link_len = readlink(fn, buffer, sizeof(buffer) - 1);
if (link_len == -1)
@ -820,7 +820,7 @@ rpmFileAction rpmfiDecideFateIndex(rpmfiles ofi, int oix,
}
/* See if the link on disk is identical to the one in new pkg */
nFLink = rpmfiFLinkIndex(nfi, nix);
nFLink = rpmfilesFLink(nfi, nix);
if (diskWhat == LINK && newWhat == LINK) {
if (nFLink && rstreq(nFLink, buffer))
goto exit; /* unmodified config file, replace. */
@ -841,10 +841,10 @@ exit:
return action;
}
int rpmfiConfigConflictIndex(rpmfiles fi, int ix)
int rpmfilesConfigConflict(rpmfiles fi, int ix)
{
char * fn = NULL;
rpmfileAttrs flags = rpmfiFFlagsIndex(fi, ix);
rpmfileAttrs flags = rpmfilesFFlags(fi, ix);
char buffer[1024];
rpmFileTypes newWhat, diskWhat;
struct stat sb;
@ -856,12 +856,12 @@ int rpmfiConfigConflictIndex(rpmfiles fi, int ix)
/* Only links and regular files can be %config, this is kinda moot */
/* XXX: Why are we returning 1 here? */
newWhat = rpmfiWhatis(rpmfiFModeIndex(fi, ix));
newWhat = rpmfiWhatis(rpmfilesFMode(fi, ix));
if (newWhat != LINK && newWhat != REG)
return 1;
/* If it's not on disk, there's nothing to be saved */
fn = rpmfiFNIndex(fi, ix);
fn = rpmfilesFN(fi, ix);
if (lstat(fn, &sb))
goto exit;
@ -886,7 +886,7 @@ int rpmfiConfigConflictIndex(rpmfiles fi, int ix)
}
/* Files of different sizes obviously are not identical */
if (rpmfiFSizeIndex(fi, ix) != sb.st_size) {
if (rpmfilesFSize(fi, ix) != sb.st_size) {
rc = 1;
goto exit;
}
@ -895,7 +895,7 @@ int rpmfiConfigConflictIndex(rpmfiles fi, int ix)
if (newWhat == REG) {
int algo;
size_t diglen;
const unsigned char *ndigest = rpmfiFDigestIndex(fi,ix, &algo, &diglen);
const unsigned char *ndigest = rpmfilesFDigest(fi,ix, &algo, &diglen);
if (rpmDoDigest(algo, fn, 0, (unsigned char *)buffer, NULL))
goto exit; /* assume file has been removed */
if (ndigest && memcmp(ndigest, buffer, diglen) == 0)
@ -906,7 +906,7 @@ int rpmfiConfigConflictIndex(rpmfiles fi, int ix)
if (link_len == -1)
goto exit; /* assume file has been removed */
buffer[link_len] = '\0';
nFLink = rpmfiFLinkIndex(fi, ix);
nFLink = rpmfilesFLink(fi, ix);
if (nFLink && rstreq(nFLink, buffer))
goto exit; /* unmodified config file */
}
@ -1413,8 +1413,8 @@ static void rpmfiBuildNLink(rpmfiles fi, Header h)
files = fileidHashCreate(fi->fc, fidHashFunc, fidCmp, NULL, NULL);
for (int i=0; i < fi->fc; i++) {
if (!S_ISREG(rpmfiFModeIndex(fi, i)) ||
(rpmfiFFlagsIndex(fi, i) & RPMFILE_GHOST) ||
if (!S_ISREG(rpmfilesFMode(fi, i)) ||
(rpmfilesFFlags(fi, i) & RPMFILE_GHOST) ||
fi->finodes[i] <= 0) {
continue;
}
@ -1430,8 +1430,8 @@ static void rpmfiBuildNLink(rpmfiles fi, Header h)
for (int i=0; i < fi->fc; i++) {
int fcnt;
int * data;
if (!S_ISREG(rpmfiFModeIndex(fi, i)) ||
(rpmfiFFlagsIndex(fi, i) & RPMFILE_GHOST)) {
if (!S_ISREG(rpmfilesFMode(fi, i)) ||
(rpmfilesFFlags(fi, i) & RPMFILE_GHOST)) {
continue;
}
f_id.id_dev = fdevs[i];
@ -1628,7 +1628,7 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTagVal tagN, rpmfiFlags flags)
return rpmfiNewPool(NULL, h, tagN, flags);
}
void rpmfiSetFReplacedSizeIndex(rpmfiles fi, int ix, rpm_loff_t newsize)
void rpmfilesSetFReplacedSize(rpmfiles fi, int ix, rpm_loff_t newsize)
{
if (fi != NULL && ix >= 0 && ix < fi->fc) {
/* Switch over to 64 bit variant */
@ -1651,7 +1651,7 @@ void rpmfiSetFReplacedSizeIndex(rpmfiles fi, int ix, rpm_loff_t newsize)
}
}
rpm_loff_t rpmfiFReplacedSizeIndex(rpmfiles fi, int ix)
rpm_loff_t rpmfilesFReplacedSize(rpmfiles fi, int ix)
{
rpm_loff_t rsize = 0;
if (fi != NULL && ix >= 0 && ix < fi->fc) {
@ -1690,7 +1690,7 @@ void rpmfiSetApath(rpmfi fi, char **apath)
*/
#define RPMFI_ITERFUNC(TYPE, NAME, IXV) \
TYPE rpmfi ## NAME(rpmfi fi) { return rpmfi ## NAME ## Index(fi->files, fi ? fi->IXV : -1); }
TYPE rpmfi ## NAME(rpmfi fi) { return rpmfiles ## NAME(fi->files, fi ? fi->IXV : -1); }
RPMFI_ITERFUNC(rpmsid, BNId, i)
RPMFI_ITERFUNC(rpmsid, DNId, j)
@ -1718,7 +1718,7 @@ const char * rpmfiFN(rpmfi fi)
const char *fn = ""; /* preserve behavior on errors */
if (fi != NULL) {
free(fi->fn);
fi->fn = rpmfiFNIndex(fi->files, fi->i);
fi->fn = rpmfilesFN(fi->files, fi->i);
if (fi->fn != NULL)
fn = fi->fn;
}
@ -1727,29 +1727,29 @@ const char * rpmfiFN(rpmfi fi)
const unsigned char * rpmfiFDigest(rpmfi fi, int *algo, size_t *len)
{
return rpmfiFDigestIndex(fi->files, fi ? fi->i : -1, algo, len);
return rpmfilesFDigest(fi->files, fi ? fi->i : -1, algo, len);
}
uint32_t rpmfiFDepends(rpmfi fi, const uint32_t ** fddictp)
{
return rpmfiFDependsIndex(fi->files, fi ? fi->i : -1, fddictp);
return rpmfilesFDepends(fi->files, fi ? fi->i : -1, fddictp);
}
int rpmfiCompare(const rpmfi afi, const rpmfi bfi)
{
return rpmfiCompareIndex(afi->files, afi ? afi->i : -1, bfi->files, bfi ? bfi->i : -1);
return rpmfilesCompare(afi->files, afi ? afi->i : -1, bfi->files, bfi ? bfi->i : -1);
}
rpmFileAction rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing)
{
return rpmfiDecideFateIndex(ofi->files, ofi ? ofi->i : -1,
return rpmfilesDecideFate(ofi->files, ofi ? ofi->i : -1,
nfi->files, nfi ? nfi->i : -1,
skipMissing);
}
int rpmfiConfigConflict(const rpmfi fi)
{
return rpmfiConfigConflictIndex(fi->files, fi ? fi->i : -1);
return rpmfilesConfigConflict(fi->files, fi ? fi->i : -1);
}
rpmstrPool rpmfilesPool(rpmfiles fi)
@ -1989,7 +1989,7 @@ int rpmfiArchiveReadToFile(rpmfi fi, FD_t fd, char nodigest)
if (!nodigest) {
digestalgo = rpmfiDigestAlgo(fi);
fidigest = rpmfiFDigestIndex(fi->files, rpmfiFX(fi), NULL, NULL);
fidigest = rpmfilesFDigest(fi->files, rpmfiFX(fi), NULL, NULL);
fdInitDigest(fd, digestalgo, 0);
}

View File

@ -38,99 +38,99 @@ RPM_GNUC_INTERNAL
rpmsid rpmfiDNId(rpmfi fi);
RPM_GNUC_INTERNAL
int rpmfiDIIndex(rpmfiles fi, int dx);
int rpmfilesDI(rpmfiles fi, int dx);
RPM_GNUC_INTERNAL
rpmsid rpmfiBNIdIndex(rpmfiles fi, int ix);
rpmsid rpmfilesBNId(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
rpmsid rpmfiDNIdIndex(rpmfiles fi, int jx);
rpmsid rpmfilesDNId(rpmfiles fi, int jx);
RPM_GNUC_INTERNAL
const char * rpmfiBNIndex(rpmfiles fi, int ix);
const char * rpmfilesBN(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
const char * rpmfiDNIndex(rpmfiles fi, int jx);
const char * rpmfilesDN(rpmfiles fi, int jx);
RPM_GNUC_INTERNAL
char * rpmfiFNIndex(rpmfiles fi, int ix);
char * rpmfilesFN(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
rpmVerifyAttrs rpmfiVFlagsIndex(rpmfiles fi, int ix);
rpmVerifyAttrs rpmfilesVFlags(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
rpmfileState rpmfiFStateIndex(rpmfiles fi, int ix);
rpmfileState rpmfilesFState(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
const char * rpmfiFLinkIndex(rpmfiles fi, int ix);
const char * rpmfilesFLink(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
rpm_loff_t rpmfiFSizeIndex(rpmfiles fi, int ix);
rpm_loff_t rpmfilesFSize(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
rpm_color_t rpmfiFColorIndex(rpmfiles fi, int ix);
rpm_color_t rpmfilesFColor(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
const char * rpmfiFClassIndex(rpmfiles fi, int ix);
const char * rpmfilesFClass(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
uint32_t rpmfiFDependsIndex(rpmfiles fi, int ix, const uint32_t ** fddictp);
uint32_t rpmfilesFDepends(rpmfiles fi, int ix, const uint32_t ** fddictp);
RPM_GNUC_INTERNAL
uint32_t rpmfiFNlinkIndex(rpmfiles fi, int ix);
uint32_t rpmfilesFNlink(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
uint32_t rpmfiFLinksIndex(rpmfiles fi, int ix, const int ** files);
uint32_t rpmfilesFLinks(rpmfiles fi, int ix, const int ** files);
RPM_GNUC_INTERNAL
const char * rpmfiFLangsIndex(rpmfiles fi, int ix);
const char * rpmfilesFLangs(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
rpmfileAttrs rpmfiFFlagsIndex(rpmfiles fi, int ix);
rpmfileAttrs rpmfilesFFlags(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
rpm_mode_t rpmfiFModeIndex(rpmfiles fi, int ix);
rpm_mode_t rpmfilesFMode(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
const unsigned char * rpmfiFDigestIndex(rpmfiles fi, int ix, int *algo, size_t *len);
const unsigned char * rpmfilesFDigest(rpmfiles fi, int ix, int *algo, size_t *len);
RPM_GNUC_INTERNAL
rpm_rdev_t rpmfiFRdevIndex(rpmfiles fi, int ix);
rpm_rdev_t rpmfilesFRdev(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
rpm_ino_t rpmfiFInodeIndex(rpmfiles fi, int ix);
rpm_ino_t rpmfilesFInode(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
rpm_time_t rpmfiFMtimeIndex(rpmfiles fi, int ix);
rpm_time_t rpmfilesFMtime(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
const char * rpmfiFUserIndex(rpmfiles fi, int ix);
const char * rpmfilesFUser(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
const char * rpmfiFGroupIndex(rpmfiles fi, int ix);
const char * rpmfilesFGroup(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
const char * rpmfiFCapsIndex(rpmfiles fi, int ix);
const char * rpmfilesFCaps(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
struct fingerPrint_s *rpmfiFps(rpmfiles fi);
RPM_GNUC_INTERNAL
rpmFileAction rpmfiDecideFateIndex(rpmfiles ofi, int oix,
rpmFileAction rpmfilesDecideFate(rpmfiles ofi, int oix,
rpmfiles nfi, int nix,
int skipMissing);
RPM_GNUC_INTERNAL
int rpmfiCompareIndex(rpmfiles afi, int aix, rpmfiles bfi, int bix);
int rpmfilesCompare(rpmfiles afi, int aix, rpmfiles bfi, int bix);
RPM_GNUC_INTERNAL
int rpmfiConfigConflictIndex(rpmfiles fi, int ix);
int rpmfilesConfigConflict(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
void rpmfiSetFReplacedSizeIndex(rpmfiles fi, int ix, rpm_loff_t newsize);
void rpmfilesSetFReplacedSize(rpmfiles fi, int ix, rpm_loff_t newsize);
RPM_GNUC_INTERNAL
rpm_loff_t rpmfiFReplacedSizeIndex(rpmfiles fi, int ix);
rpm_loff_t rpmfilesFReplacedSize(rpmfiles fi, int ix);
RPM_GNUC_INTERNAL
void rpmfiFpLookup(rpmfiles fi, fingerPrintCache fpc);

View File

@ -298,8 +298,8 @@ static uint64_t countFiles(rpmts ts)
static int handleRemovalConflict(rpmfiles fi, int fx, rpmfiles ofi, int ofx)
{
int rConflicts = 0; /* Removed files don't conflict, normally */
rpmFileTypes ft = rpmfiWhatis(rpmfiFModeIndex(fi, fx));
rpmFileTypes oft = rpmfiWhatis(rpmfiFModeIndex(ofi, ofx));
rpmFileTypes ft = rpmfiWhatis(rpmfilesFMode(fi, fx));
rpmFileTypes oft = rpmfiWhatis(rpmfilesFMode(ofi, ofx));
struct stat sb;
char *fn = NULL;
@ -310,7 +310,7 @@ static int handleRemovalConflict(rpmfiles fi, int fx, rpmfiles ofi, int ofx)
} else if (oft == LINK) {
/* We can't correctly handle directory symlink changing to directory */
if (ft == XDIR) {
fn = rpmfiFNIndex(fi, fx);
fn = rpmfilesFN(fi, fx);
if (stat(fn, &sb) == 0 && S_ISDIR(sb.st_mode))
rConflicts = 1;
}
@ -322,7 +322,7 @@ static int handleRemovalConflict(rpmfiles fi, int fx, rpmfiles ofi, int ofx)
*/
if (rConflicts) {
if (fn == NULL)
fn = rpmfiFNIndex(fi, fx);
fn = rpmfilesFN(fi, fx);
if (lstat(fn, &sb) || rpmfiWhatis(sb.st_mode) == ft)
rConflicts = 0;
}
@ -347,8 +347,8 @@ static int handleColorConflict(rpmts ts,
rpm_color_t tscolor = rpmtsColor(ts);
if (tscolor != 0) {
rpm_color_t fcolor = rpmfiFColorIndex(fi, fx) & tscolor;
rpm_color_t ofcolor = rpmfiFColorIndex(ofi, ofx) & tscolor;
rpm_color_t fcolor = rpmfilesFColor(fi, fx) & tscolor;
rpm_color_t ofcolor = rpmfilesFColor(ofi, ofx) & tscolor;
if (fcolor != 0 && ofcolor != 0 && fcolor != ofcolor) {
rpm_color_t prefcolor = rpmtsPrefColor(ts);
@ -385,12 +385,12 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx
int beingRemoved)
{
rpmfs fs = rpmteGetFileStates(p);
int isCfgFile = ((rpmfiFFlagsIndex(otherFi, ofx) | rpmfiFFlagsIndex(fi, fx)) & RPMFILE_CONFIG);
int isCfgFile = ((rpmfilesFFlags(otherFi, ofx) | rpmfilesFFlags(fi, fx)) & RPMFILE_CONFIG);
if (XFA_SKIPPING(rpmfsGetAction(fs, fx)))
return;
if (rpmfiCompareIndex(otherFi, ofx, fi, fx)) {
if (rpmfilesCompare(otherFi, ofx, fi, fx)) {
int rConflicts = 1;
char rState = RPMFILE_STATE_REPLACED;
@ -425,7 +425,7 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx
if (rConflicts) {
char *altNEVR = headerGetAsString(otherHeader, RPMTAG_NEVRA);
char *fn = rpmfiFNIndex(fi, fx);
char *fn = rpmfilesFN(fi, fx);
rpmteAddProblem(p, RPMPROB_FILE_CONFLICT, altNEVR, fn,
headerGetInstance(otherHeader));
free(fn);
@ -444,10 +444,10 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx
if (isCfgFile) {
int skipMissing = ((rpmtsFlags(ts) & RPMTRANS_FLAG_ALLFILES) ? 0 : 1);
rpmFileAction action;
action = rpmfiDecideFateIndex(otherFi, ofx, fi, fx, skipMissing);
action = rpmfilesDecideFate(otherFi, ofx, fi, fx, skipMissing);
rpmfsSetAction(fs, fx, action);
}
rpmfiSetFReplacedSizeIndex(fi, fx, rpmfiFSizeIndex(otherFi, ofx));
rpmfilesSetFReplacedSize(fi, fx, rpmfilesFSize(otherFi, ofx));
}
/**
@ -476,7 +476,7 @@ static void handleOverlappedFiles(rpmts ts, fingerPrintCache fpc, rpmte p, rpmfi
if (XFA_SKIPPING(rpmfsGetAction(fs, i)))
continue;
FFlags = rpmfiFFlagsIndex(fi, i);
FFlags = rpmfilesFFlags(fi, i);
fixupSize = 0;
@ -546,7 +546,7 @@ static void handleOverlappedFiles(rpmts ts, fingerPrintCache fpc, rpmte p, rpmfi
rpmFileAction action;
if (rpmfsGetAction(fs, i) != FA_UNKNOWN)
break;
if (rpmfiConfigConflictIndex(fi, i)) {
if (rpmfilesConfigConflict(fi, i)) {
/* Here is a non-overlapped pre-existing config file. */
action = (FFlags & RPMFILE_NOREPLACE) ?
FA_ALTNAME : FA_BACKUP;
@ -559,7 +559,7 @@ static void handleOverlappedFiles(rpmts ts, fingerPrintCache fpc, rpmte p, rpmfi
assert(otherFi != NULL);
/* Mark added overlapped non-identical files as a conflict. */
if (rpmfiCompareIndex(otherFi, otherFileNum, fi, i)) {
if (rpmfilesCompare(otherFi, otherFileNum, fi, i)) {
int rConflicts;
/* If enabled, resolve colored conflicts to preferred type */
@ -567,7 +567,7 @@ assert(otherFi != NULL);
otherFs, otherFi, otherFileNum);
if (rConflicts && reportConflicts) {
char *fn = rpmfiFNIndex(fi, i);
char *fn = rpmfilesFN(fi, i);
rpmteAddProblem(p, RPMPROB_NEW_FILE_CONFLICT,
rpmteNEVRA(otherTe), fn, 0);
free(fn);
@ -578,7 +578,7 @@ assert(otherFi != NULL);
if (oaction != FA_UNKNOWN && !XFA_SKIPPING(oaction)) {
rpmfileAttrs oflags;
/* ...but ghosts aren't really created so... */
oflags = rpmfiFFlagsIndex(otherFi, otherFileNum);
oflags = rpmfilesFFlags(otherFi, otherFileNum);
if (!(oflags & RPMFILE_GHOST)) {
rpmfsSetAction(fs, i, FA_SKIP);
}
@ -590,9 +590,9 @@ assert(otherFi != NULL);
break;
/* Try to get the disk accounting correct even if a conflict. */
fixupSize = rpmfiFSizeIndex(otherFi, otherFileNum);
fixupSize = rpmfilesFSize(otherFi, otherFileNum);
if (rpmfiConfigConflictIndex(fi, i)) {
if (rpmfilesConfigConflict(fi, i)) {
/* Here is an overlapped pre-existing config file. */
rpmFileAction action;
action = (FFlags & RPMFILE_NOREPLACE) ? FA_ALTNAME : FA_SKIP;
@ -618,11 +618,11 @@ assert(otherFi != NULL);
}
if (XFA_SKIPPING(rpmfsGetAction(fs, i)))
break;
if (rpmfiFStateIndex(fi, i) != RPMFILE_STATE_NORMAL)
if (rpmfilesFState(fi, i) != RPMFILE_STATE_NORMAL)
break;
/* Pre-existing modified config files need to be saved. */
if (rpmfiConfigConflictIndex(fi, i)) {
if (rpmfilesConfigConflict(fi, i)) {
rpmfsSetAction(fs, i, FA_BACKUP);
break;
}
@ -634,7 +634,7 @@ assert(otherFi != NULL);
/* Update disk space info for a file. */
rpmtsUpdateDSI(ts, fpEntryDev(fpc, fiFps), fpEntryDir(fpc, fiFps),
rpmfiFSizeIndex(fi, i), rpmfiFReplacedSizeIndex(fi, i),
rpmfilesFSize(fi, i), rpmfilesFReplacedSize(fi, i),
fixupSize, rpmfsGetAction(fs, i));
}
@ -851,7 +851,7 @@ static void skipInstallFiles(const rpmts ts, rpmte p)
if (!dff[j]) continue; /* dir was not emptied here. */
/* Find parent directory and basename. */
dn = rpmfiDNIndex(files, j); dnlen = strlen(dn) - 1;
dn = rpmfilesDN(files, j); dnlen = strlen(dn) - 1;
bn = dn + dnlen; bnlen = 0;
while (bn > dn && bn[-1] != '/') {
bnlen++;