9 rpmFileAction * actions; /*!< File disposition(s). */
11 sharedFileInfo replaced; /*!< (TR_ADDED) to be replaced files in the rpmdb */
13 int allocatedReplaced;
16 rpmfs rpmfsNew(rpm_count_t fc, int initState)
18 rpmfs fs = xcalloc(1, sizeof(*fs));
20 fs->actions = xmalloc(fs->fc * sizeof(*fs->actions));
21 memset(fs->actions, FA_UNKNOWN, fs->fc * sizeof(*fs->actions));
23 fs->states = xmalloc(sizeof(*fs->states) * fs->fc);
24 memset(fs->states, RPMFILE_STATE_NORMAL, fs->fc);
29 rpmfs rpmfsFree(rpmfs fs)
35 memset(fs, 0, sizeof(*fs)); /* trash and burn */
41 rpm_count_t rpmfsFC(rpmfs fs)
43 return (fs != NULL) ? fs->fc : 0;
46 void rpmfsAddReplaced(rpmfs fs, int pkgFileNum, char rstate,
47 int otherPkg, int otherFileNum)
50 fs->replaced = xcalloc(3, sizeof(*fs->replaced));
51 fs->allocatedReplaced = 3;
53 if (fs->numReplaced>=fs->allocatedReplaced) {
54 fs->allocatedReplaced += (fs->allocatedReplaced>>1) + 2;
55 fs->replaced = xrealloc(fs->replaced, fs->allocatedReplaced*sizeof(*fs->replaced));
57 fs->replaced[fs->numReplaced].pkgFileNum = pkgFileNum;
58 fs->replaced[fs->numReplaced].rstate = rstate;
59 fs->replaced[fs->numReplaced].otherPkg = otherPkg;
60 fs->replaced[fs->numReplaced].otherFileNum = otherFileNum;
65 sharedFileInfo rpmfsGetReplaced(rpmfs fs)
67 if (fs && fs->numReplaced)
73 sharedFileInfo rpmfsNextReplaced(rpmfs fs , sharedFileInfo replaced)
77 if (replaced - fs->replaced < fs->numReplaced)
83 void rpmfsSetState(rpmfs fs, unsigned int ix, rpmfileState state)
86 fs->states[ix] = state;
89 rpmfileState rpmfsGetState(rpmfs fs, unsigned int ix)
92 if (fs->states) return fs->states[ix];
93 return RPMFILE_STATE_MISSING;
96 rpm_fstate_t * rpmfsGetStates(rpmfs fs)
101 rpmFileAction rpmfsGetAction(rpmfs fs, unsigned int ix)
103 rpmFileAction action;
104 if (fs->actions != NULL && ix < fs->fc) {
105 action = fs->actions[ix];
112 void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action)
114 if (fs->actions != NULL && ix < fs->fc) {
115 fs->actions[ix] = action;