rpmal.c rpmal.h rpmchecksig.c rpmds.c rpmfi.c rpmfi_internal.h rpmgi.c \
rpminstall.c rpmts_internal.h \
rpmlead.c rpmlead.h rpmps.c rpmrc.c \
- rpmte.c rpmte_internal.h rpmts.c \
+ rpmte.c rpmte_internal.h rpmts.c rpmfs.h rpmfs.c \
rpmvercmp.c signature.c signature.h transaction.c \
verify.c rpmlock.c rpmlock.h misc.h \
rpmscript.h rpmscript.c legacy.c merge.c \
--- /dev/null
+#include "system.h"
+#include "lib/rpmfs.h"
+#include "debug.h"
+
+struct rpmfs_s {
+ unsigned int fc;
+
+ rpm_fstate_t * states;
+ rpmFileAction * actions; /*!< File disposition(s). */
+
+ sharedFileInfo replaced; /*!< (TR_ADDED) to be replaced files in the rpmdb */
+ int numReplaced;
+ int allocatedReplaced;
+};
+
+rpmfs rpmfsNew(unsigned int fc, rpmElementType type) {
+ rpmfs fs = xmalloc(sizeof(*fs));
+ fs->fc = fc;
+ fs->replaced = NULL;
+ fs->states = NULL;
+ if (type == TR_ADDED) {
+ fs->states = xmalloc(sizeof(*fs->states) * fs->fc);
+ memset(fs->states, RPMFILE_STATE_NORMAL, fs->fc);
+ }
+ fs->actions = xmalloc(fc * sizeof(*fs->actions));
+ memset(fs->actions, FA_UNKNOWN, fc * sizeof(*fs->actions));
+ fs->numReplaced = fs->allocatedReplaced = 0;
+ return fs;
+}
+
+rpmfs rpmfsFree(rpmfs fs) {
+ fs->replaced = _free(fs->replaced);
+ fs->states = _free(fs->states);
+ fs->actions = _free(fs->actions);
+
+ fs = _free(fs);
+ return fs;
+}
+
+rpm_count_t rpmfsFC(rpmfs fs) {
+ return fs->fc;
+}
+
+void rpmfsAddReplaced(rpmfs fs, int pkgFileNum, int otherPkg, int otherFileNum)
+{
+ if (!fs->replaced) {
+ fs->replaced = xcalloc(3, sizeof(*fs->replaced));
+ fs->allocatedReplaced = 3;
+ }
+ if (fs->numReplaced>=fs->allocatedReplaced) {
+ fs->allocatedReplaced += (fs->allocatedReplaced>>1) + 2;
+ fs->replaced = xrealloc(fs->replaced, fs->allocatedReplaced*sizeof(*fs->replaced));
+ }
+ fs->replaced[fs->numReplaced].pkgFileNum = pkgFileNum;
+ fs->replaced[fs->numReplaced].otherPkg = otherPkg;
+ fs->replaced[fs->numReplaced].otherFileNum = otherFileNum;
+
+ fs->numReplaced++;
+}
+
+sharedFileInfo rpmfsGetReplaced(rpmfs fs)
+{
+ if (fs && fs->numReplaced)
+ return fs->replaced;
+ else
+ return NULL;
+}
+
+sharedFileInfo rpmfsNextReplaced(rpmfs fs , sharedFileInfo replaced)
+{
+ if (fs && replaced) {
+ replaced++;
+ if (replaced - fs->replaced < fs->numReplaced)
+ return replaced;
+ }
+ return NULL;
+}
+
+void rpmfsSetState(rpmfs fs, unsigned int ix, rpmfileState state)
+{
+ assert(ix < fs->fc);
+ fs->states[ix] = state;
+}
+
+rpmfileState rpmfsGetState(rpmfs fs, unsigned int ix)
+{
+ assert(ix < fs->fc);
+ if (fs->states) return fs->states[ix];
+ return RPMFILE_STATE_MISSING;
+}
+
+rpm_fstate_t * rpmfsGetStates(rpmfs fs)
+{
+ return fs->states;
+}
+
+rpmFileAction rpmfsGetAction(rpmfs fs, unsigned int ix)
+{
+ rpmFileAction action;
+ if (fs->actions != NULL && ix < fs->fc) {
+ action = fs->actions[ix];
+ } else {
+ action = FA_UNKNOWN;
+ }
+ return action;
+}
+
+void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action)
+{
+ if (fs->actions != NULL && ix < fs->fc) {
+ fs->actions[ix] = action;
+ }
+}
--- /dev/null
+#ifndef _RPMFS_H
+#define _RPMFS_H
+
+#include <rpm/rpmfi.h>
+#include <rpm/rpmte.h>
+
+/** \ingroup rpmfs
+ * Transaction element file states.
+ */
+typedef struct rpmfs_s * rpmfs;
+typedef struct sharedFileInfo_s * sharedFileInfo;
+typedef char rpm_fstate_t;
+
+/* XXX psm needs access to these */
+struct sharedFileInfo_s {
+ int pkgFileNum;
+ int otherPkg;
+ int otherFileNum;
+};
+
+RPM_GNUC_INTERNAL
+rpmfs rpmfsNew(unsigned int fc, rpmElementType type);
+
+RPM_GNUC_INTERNAL
+rpmfs rpmfsFree(rpmfs fs);
+
+RPM_GNUC_INTERNAL
+rpm_count_t rpmfsFC(rpmfs fs);
+
+RPM_GNUC_INTERNAL
+void rpmfsAddReplaced(rpmfs fs, int pkgFileNum, int otherPkg, int otherFileNum);
+
+RPM_GNUC_INTERNAL
+sharedFileInfo rpmfsGetReplaced(rpmfs fs);
+
+RPM_GNUC_INTERNAL
+sharedFileInfo rpmfsNextReplaced(rpmfs fs , sharedFileInfo replaced);
+
+RPM_GNUC_INTERNAL
+void rpmfsSetState(rpmfs fs, unsigned int ix, rpmfileState state);
+
+RPM_GNUC_INTERNAL
+rpmfileState rpmfsGetState(rpmfs fs, unsigned int ix);
+
+/* May return NULL */
+RPM_GNUC_INTERNAL
+rpm_fstate_t * rpmfsGetStates(rpmfs fs);
+
+RPM_GNUC_INTERNAL
+rpmFileAction rpmfsGetAction(rpmfs fs, unsigned int ix);
+
+/* XXX this should be internal too but build code needs for now */
+void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action);
+
+#endif /* _RPMFS_H */
return te->fs;
}
-rpmfs rpmfsNew(unsigned int fc, rpmElementType type) {
- rpmfs fs = xmalloc(sizeof(*fs));
- fs->fc = fc;
- fs->replaced = NULL;
- fs->states = NULL;
- if (type == TR_ADDED) {
- fs->states = xmalloc(sizeof(*fs->states) * fs->fc);
- memset(fs->states, RPMFILE_STATE_NORMAL, fs->fc);
- }
- fs->actions = xmalloc(fc * sizeof(*fs->actions));
- memset(fs->actions, FA_UNKNOWN, fc * sizeof(*fs->actions));
- fs->numReplaced = fs->allocatedReplaced = 0;
- return fs;
-}
-
-rpmfs rpmfsFree(rpmfs fs) {
- fs->replaced = _free(fs->replaced);
- fs->states = _free(fs->states);
- fs->actions = _free(fs->actions);
-
- fs = _free(fs);
- return fs;
-}
-
-rpm_count_t rpmfsFC(rpmfs fs) {
- return fs->fc;
-}
-
-void rpmfsAddReplaced(rpmfs fs, int pkgFileNum, int otherPkg, int otherFileNum)
-{
- if (!fs->replaced) {
- fs->replaced = xcalloc(3, sizeof(*fs->replaced));
- fs->allocatedReplaced = 3;
- }
- if (fs->numReplaced>=fs->allocatedReplaced) {
- fs->allocatedReplaced += (fs->allocatedReplaced>>1) + 2;
- fs->replaced = xrealloc(fs->replaced, fs->allocatedReplaced*sizeof(*fs->replaced));
- }
- fs->replaced[fs->numReplaced].pkgFileNum = pkgFileNum;
- fs->replaced[fs->numReplaced].otherPkg = otherPkg;
- fs->replaced[fs->numReplaced].otherFileNum = otherFileNum;
-
- fs->numReplaced++;
-}
-
-sharedFileInfo rpmfsGetReplaced(rpmfs fs)
-{
- if (fs && fs->numReplaced)
- return fs->replaced;
- else
- return NULL;
-}
-
-sharedFileInfo rpmfsNextReplaced(rpmfs fs , sharedFileInfo replaced)
-{
- if (fs && replaced) {
- replaced++;
- if (replaced - fs->replaced < fs->numReplaced)
- return replaced;
- }
- return NULL;
-}
-
-void rpmfsSetState(rpmfs fs, unsigned int ix, rpmfileState state)
-{
- assert(ix < fs->fc);
- fs->states[ix] = state;
-}
-
-rpmfileState rpmfsGetState(rpmfs fs, unsigned int ix)
-{
- assert(ix < fs->fc);
- if (fs->states) return fs->states[ix];
- return RPMFILE_STATE_MISSING;
-}
-
-rpm_fstate_t * rpmfsGetStates(rpmfs fs)
-{
- return fs->states;
-}
-
-rpmFileAction rpmfsGetAction(rpmfs fs, unsigned int ix)
-{
- rpmFileAction action;
- if (fs->actions != NULL && ix < fs->fc) {
- action = fs->actions[ix];
- } else {
- action = FA_UNKNOWN;
- }
- return action;
-}
-
-void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action)
-{
- if (fs->actions != NULL && ix < fs->fc) {
- fs->actions[ix] = action;
- }
-}
#include <rpm/rpmte.h>
#include <rpm/rpmds.h>
-
-/** \ingroup rpmte
- * Dependncy ordering information.
- */
-
-/**
- */
-typedef struct sharedFileInfo_s * sharedFileInfo;
+#include "lib/rpmfs.h"
/** \ingroup rpmte
* Transaction element ordering chain linkage.
*/
typedef struct tsortInfo_s * tsortInfo;
-/** \ingroup rpmte
- * Transaction element file states.
- */
-typedef struct rpmfs_s * rpmfs;
-
-/**
- */
-struct sharedFileInfo_s {
- int pkgFileNum;
- int otherPkg;
- int otherFileNum;
-};
-
-typedef char rpm_fstate_t;
-
-struct rpmfs_s {
- unsigned int fc;
-
- rpm_fstate_t * states;
- rpmFileAction * actions; /*!< File disposition(s). */
-
- sharedFileInfo replaced; /*!< (TR_ADDED) to be replaced files in the rpmdb */
- int numReplaced;
- int allocatedReplaced;
-};
-
RPM_GNUC_INTERNAL
rpmfi rpmteSetFI(rpmte te, rpmfi fi);
RPM_GNUC_INTERNAL
void rpmteSetTSI(rpmte te, tsortInfo tsi);
-//RPM_GNUC_INTERNAL
+/* XXX should be internal too but build code needs for now... */
rpmfs rpmteGetFileStates(rpmte te);
-RPM_GNUC_INTERNAL
-rpmfs rpmfsNew(unsigned int fc, rpmElementType type);
-
-RPM_GNUC_INTERNAL
-rpmfs rpmfsFree(rpmfs fs);
-
-RPM_GNUC_INTERNAL
-rpm_count_t rpmfsFC(rpmfs fs);
-
-RPM_GNUC_INTERNAL
-void rpmfsAddReplaced(rpmfs fs, int pkgFileNum, int otherPkg, int otherFileNum);
-
-RPM_GNUC_INTERNAL
-sharedFileInfo rpmfsGetReplaced(rpmfs fs);
-
-RPM_GNUC_INTERNAL
-sharedFileInfo rpmfsNextReplaced(rpmfs fs , sharedFileInfo replaced);
-
-RPM_GNUC_INTERNAL
-void rpmfsSetState(rpmfs fs, unsigned int ix, rpmfileState state);
-
-RPM_GNUC_INTERNAL
-rpmfileState rpmfsGetState(rpmfs fs, unsigned int ix);
-
-/*
- * May return NULL
- */
-RPM_GNUC_INTERNAL
-rpm_fstate_t * rpmfsGetStates(rpmfs fs);
-
-RPM_GNUC_INTERNAL
-rpmFileAction rpmfsGetAction(rpmfs fs, unsigned int ix);
-
-//RPM_GNUC_INTERNAL
-void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action);
-
/* XXX here for now... */
/**
* Relocate files in header.