# lib/psm.h

Go to the documentation of this file.

    00001 #ifndef H_PSM
    00002 #define H_PSM
    00003
    00009 #include "fsm.h"
    00010 #include "depends.h"
    00011
    00014 struct sharedFileInfo {
    00015     int pkgFileNum;
    00016     int otherFileNum;
    00017     int otherPkg;
    00018     int isRemoved;
    00019 };
    00020
    00023 struct transactionFileInfo_s {
    00024   /* for all packages */
    00025     enum rpmTransactionType type;
    00026     fileAction action;
    00027 /*@owned@*/
    00028     fileAction * actions;
    00029 /*@owned@*/
    00030     struct fingerPrint_s * fps;
    00031     HGE_t hge;
    00032     HAE_t hae;
    00033     HME_t hme;
    00034     HRE_t hre;
    00035     HFD_t hfd;
    00036     Header h;
    00037 /*@owned@*/
    00038     const char * name;
    00039 /*@owned@*/
    00040     const char * version;
    00041 /*@owned@*/
    00042     const char * release;
    00043     int_32 epoch;
    00044     uint_32 flags;
    00045     const uint_32 * fflags;
    00046     const uint_32 * fsizes;
    00047     const uint_32 * fmtimes;
    00048 /*@owned@*/
    00049     const char ** bnl;
    00050 /*@owned@*/
    00051     const char ** dnl;
    00052     int_32 * dil;
    00053 /*@owned@*/
    00054     const char ** obnl;
    00055 /*@owned@*/
    00056     const char ** odnl;
    00057 /*@unused@*/
    00058     int_32 * odil;
    00059 /*@owned@*/ const char ** fmd5s;
    00060 /*@owned@*/
    00061     const char ** flinks;
    00062 /* XXX setuid/setgid bits are turned off if fuser/fgroup doesn't map. */
    00063     uint_16 * fmodes;
    00064     uint_16 * frdevs;
    00065 /*@only@*/ /*@null@*/
    00066     char * fstates;
    00067 /*@owned@*/
    00068     const char ** fuser;
    00069 /*@owned@*/
    00070     const char ** fgroup;
    00071 /*@owned@*/
    00072     const char ** flangs;
    00073     int fc;
    00074     int dc;
    00075     int bnlmax;
    00076     int dnlmax;
    00077     int astriplen;
    00078     int striplen;
    00079     unsigned int archiveSize;
    00080     mode_t dperms;
    00081     mode_t fperms;
    00082 /*@only@*/ /*@null@*/
    00083     const char ** apath;
    00084     int mapflags;
    00085 /*@owned@*/ /*@null@*/
    00086     int * fmapflags;
    00087     uid_t uid;
    00088 /*@owned@*/ /*@null@*/
    00089     uid_t * fuids;
    00090     gid_t gid;
    00091 /*@owned@*/ /*@null@*/
    00092     gid_t * fgids;
    00093     int magic;
    00094 #define TFIMAGIC        0x09697923
    00095 /*@owned@*/
    00096     FSM_t fsm;
    00098   /* these are for TR_ADDED packages */
    00099 /*@dependent@*/
    00100     struct availablePackage * ap;
    00101 /*@owned@*/
    00102     struct sharedFileInfo * replaced;
    00103 /*@owned@*/
    00104     uint_32 * replacedSizes;
    00105
    00106   /* for TR_REMOVED packages */
    00107     unsigned int record;
    00108 };
    00109
    00112 #define PSM_VERBOSE     0x8000
    00113 #define PSM_INTERNAL    0x4000
    00114 #define PSM_SYSCALL     0x2000
    00115 #define PSM_DEAD        0x1000
    00116 #define _fv(_a)         ((_a) | PSM_VERBOSE)
    00117 #define _fi(_a)         ((_a) | PSM_INTERNAL)
    00118 #define _fs(_a)         ((_a) | (PSM_INTERNAL | PSM_SYSCALL))
    00119 #define _fd(_a)         ((_a) | (PSM_INTERNAL | PSM_DEAD))
    00120 typedef enum pkgStage_e {
    00121     PSM_UNKNOWN         =  0,
    00122     PSM_INIT            =  1,
    00123     PSM_PRE             =  2,
    00124     PSM_PROCESS         =  3,
    00125     PSM_POST            =  4,
    00126     PSM_UNDO            =  5,
    00127     PSM_FINI            =  6,
    00128
    00129     PSM_PKGINSTALL      =  7,
    00130     PSM_PKGERASE        =  8,
    00131     PSM_PKGCOMMIT       = 10,
    00132     PSM_PKGSAVE         = 12,
    00133
    00134     PSM_CREATE          = 17,
    00135     PSM_NOTIFY          = 22,
    00136     PSM_DESTROY         = 23,
    00137     PSM_COMMIT          = 25,
    00138
    00139     PSM_CHROOT_IN       = 51,
    00140     PSM_CHROOT_OUT      = 52,
    00141     PSM_SCRIPT          = 53,
    00142     PSM_TRIGGERS        = 54,
    00143     PSM_IMMED_TRIGGERS  = 55,
    00144     PSM_RPMIO_FLAGS     = 56,
    00145
    00146     PSM_RPMDB_LOAD      = 97,
    00147     PSM_RPMDB_ADD       = 98,
    00148     PSM_RPMDB_REMOVE    = 99
    00149
    00150 } pkgStage;
    00151 #undef  _fv
    00152 #undef  _fi
    00153 #undef  _fs
    00154 #undef  _fd
    00155
    00158 struct psm_s {
    00159 /*@kept@*/
    00160     rpmTransactionSet ts;
    00161 /*@kept@*/
    00162     TFI_t fi;
    00163     FD_t cfd;
    00164     FD_t fd;
    00165     Header oh;
    00166 /*@null@*/
    00167     rpmdbMatchIterator mi;
    00168 /*@observer@*/
    00169     const char * stepName;
    00170 /*@only@*/ /*@null@*/
    00171     const char * rpmio_flags;
    00172 /*@only@*/ /*@null@*/
    00173     const char * failedFile;
    00174 /*@only@*/ /*@null@*/
    00175     const char * pkgURL;
    00176 /*@dependent@*/
    00177     const char * pkgfn;
    00178     int scriptTag;
    00179     int progTag;
    00180     int npkgs_installed;
    00181     int scriptArg;
    00182     int sense;
    00183     int countCorrection;
    00184     int chrootDone;
    00185     rpmCallbackType what;
    00186     unsigned long amount;
    00187     unsigned long total;
    00188     rpmRC rc;
    00189     pkgStage goal;
    00190 /*@unused@*/
    00191     pkgStage stage;
    00192 };
    00193
    00194 #ifdef __cplusplus
    00195 extern "C" {
    00196 #endif
    00197
    00203 void loadFi(Header h, TFI_t fi)
    00204         /*@modifies h, fi @*/;
    00205
    00210 void freeFi(TFI_t fi)
    00211         /*@modifies fi @*/;
    00212
    00218 /*@observer@*/ const char *const fiTypeString(/*@partial@*/TFI_t fi)
    00219         /*@*/;
    00220
    00227 int psmStage(PSM_t psm, pkgStage stage)
    00228         /*@globals rpmGlobalMacroContext,
    00229                 fileSystem, internalState @*/
    00230         /*@modifies psm, rpmGlobalMacroContext,
    00231                 fileSystem, internalState @*/;
    00232
    00233 #ifdef __cplusplus
    00234 }
    00235 #endif
    00236
    00237 #endif  /* H_PSM */