14 typedef enum rollbackDir_e {
15 ROLLBACK_SAVE = 1, /*!< Save files. */
16 ROLLBACK_RESTORE = 2, /*!< Restore files. */
29 struct sharedFileInfo {
38 struct transactionFileInfo_s {
39 /* for all packages */
40 enum rpmTransactionType type;
41 fileAction action; /*!< File disposition default. */
42 /*@owned@*/ fileAction * actions; /*!< File disposition(s) */
43 /*@owned@*/ struct fingerPrint_s * fps; /*!< File fingerprint(s) */
44 HGE_t hge; /*!< Vector to headerGetEntry() */
45 HFD_t hfd; /*!< Vector to headerFreeData() */
46 Header h; /*!< Package header */
47 /*@owned@*/ const char * name;
48 /*@owned@*/ const char * version;
49 /*@owned@*/ const char * release;
51 uint_32 flags; /*!< File flag default. */
52 const uint_32 * fflags; /*!< File flag(s) (from header) */
53 const uint_32 * fsizes; /*!< File size(s) (from header) */
54 const uint_32 * fmtimes; /*!< File modification time(s) (from header) */
55 /*@owned@*/ const char ** bnl; /*!< Base name(s) (from header) */
56 /*@owned@*/ const char ** dnl; /*!< Directory name(s) (from header) */
57 int_32 * dil; /*!< Directory indice(s) (from header) */
58 /*@owned@*/ const char ** obnl; /*!< Original base name(s) (from header) */
59 /*@owned@*/ const char ** odnl; /*!< Original directory name(s) (from header) */
60 int_32 * odil; /*!< Original directory indice(s) (from header) */
61 /*@owned@*/ const char ** fmd5s;/*!< File MD5 sum(s) (from header) */
62 /*@owned@*/ const char ** flinks; /*!< File link(s) (from header) */
63 /* XXX setuid/setgid bits are turned off if fuser/fgroup doesn't map. */
64 uint_16 * fmodes; /*!< File mode(s) (from header) */
65 /*@owned@*/ char * fstates; /*!< File state(s) (from header) */
66 /*@owned@*/ const char ** fuser; /*!< File owner(s) */
67 /*@owned@*/ const char ** fgroup; /*!< File group(s) */
68 /*@owned@*/ const char ** flangs; /*!< File lang(s) */
69 int fc; /*!< No. of files. */
70 int dc; /*!< No. of directories. */
71 int bnlmax; /*!< Length (in bytes) of longest base name. */
72 int dnlmax; /*!< Length (in bytes) of longest dir name. */
76 unsigned int archiveSize;
77 mode_t dperms; /*!< Directory perms (0755) if not mapped. */
78 mode_t fperms; /*!< File perms (0644) if not mapped. */
79 /*@owned@*/ const char ** apath;
81 /*@owned@*/ int * fmapflags;
83 /*@owned@*/ /*@null@*/ uid_t * fuids; /*!< File uid(s) */
85 /*@owned@*/ /*@null@*/ gid_t * fgids; /*!< File gid(s) */
87 #define TFIMAGIC 0x09697923
88 /*@owned@*/ FSM_t fsm; /*!< File state machine data. */
90 /* these are for TR_ADDED packages */
91 /*@dependent@*/ struct availablePackage * ap;
92 /*@owned@*/ struct sharedFileInfo * replaced;
93 /*@owned@*/ uint_32 * replacedSizes;
94 /* for TR_REMOVED packages */
101 rpmTransactionSet ts;
103 int scriptTag; /*!< Scriptlet tag. */
104 int progTag; /*!< Scriptlet interpreter tag. */
105 int scriptArg; /*!< No. of installed instances. */
106 int sense; /*!< One of RPMSENSE_TRIGGER{IN,UN,POSTUN}. */
107 int countCorrection; /*!< 0 if installing, -1 if removing. */
117 * Load data from header into transaction file element info.
119 * @param fi transaction element file info
121 void loadFi(Header h, TFI_t fi)
122 /*@modifies h, fi @*/;
125 * Destroy transaction element file info.
126 * @param fi transaction element file info
128 void freeFi(TFI_t fi)
132 * Return formatted string representation of package disposition.
133 * @param a package dispostion
134 * @return formatted string
136 /*@observer@*/ const char *const fiTypeString(TFI_t fi);
139 * Return formatted string representation of file disposition.
140 * @param a file dispostion
141 * @return formatted string
143 /*@observer@*/ const char *const fileActionString(fileAction a);
146 * Install binary package (from transaction set).
147 * @param psm package state machine data
148 * @return 0 on success, 1 on bad magic, 2 on error
150 int installBinaryPackage(PSM_t psm)
154 * Erase binary package (from transaction set).
155 * @param psm package state machine data
156 * @return 0 on success
158 int removeBinaryPackage(PSM_t psm)
162 * @param psm package state machine data
163 * @return 0 on success
165 int repackage(PSM_t psm)
170 int psmStage(PSM_t psm, fileStage stage)
177 #endif /* H_ROLLBACK */