rpm 5.3.7

lib/psm.h

Go to the documentation of this file.
00001 #ifndef H_PSM
00002 #define H_PSM
00003 
00013 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmpsm_s * rpmpsm;
00014 
00015 #include <rpmsq.h>
00016 #include <rpmfi.h>      /* XXX rpmfi typedef */
00017 
00018 /*@-exportlocal@*/
00019 /*@unchecked@*/
00020 extern int _psm_debug;
00021 /*@=exportlocal@*/
00022 
00025 #define PSM_VERBOSE     0x8000
00026 #define PSM_INTERNAL    0x4000
00027 #define PSM_SYSCALL     0x2000
00028 #define PSM_DEAD        0x1000
00029 #define _fv(_a)         ((_a) | PSM_VERBOSE)
00030 #define _fi(_a)         ((_a) | PSM_INTERNAL)
00031 #define _fs(_a)         ((_a) | (PSM_INTERNAL | PSM_SYSCALL))
00032 #define _fd(_a)         ((_a) | (PSM_INTERNAL | PSM_DEAD))
00033 typedef enum pkgStage_e {
00034     PSM_UNKNOWN         =  0,
00035     PSM_INIT            =  1,
00036     PSM_PRE             =  2,
00037     PSM_PROCESS         =  3,
00038     PSM_POST            =  4,
00039     PSM_UNDO            =  5,
00040     PSM_FINI            =  6,
00041 
00042     PSM_PKGINSTALL      =  7,
00043     PSM_PKGERASE        =  8,
00044     PSM_PKGCOMMIT       = 10,
00045     PSM_PKGSAVE         = 12,
00046 
00047     PSM_CREATE          = 17,
00048     PSM_NOTIFY          = 22,
00049     PSM_DESTROY         = 23,
00050     PSM_COMMIT          = 25,
00051 
00052     PSM_CHROOT_IN       = 51,
00053     PSM_CHROOT_OUT      = 52,
00054     PSM_SCRIPT          = 53,
00055     PSM_TRIGGERS        = 54,
00056     PSM_IMMED_TRIGGERS  = 55,
00057     PSM_RPMIO_FLAGS     = 56,
00058 
00059     PSM_RPMDB_LOAD      = 97,
00060     PSM_RPMDB_ADD       = 98,
00061     PSM_RPMDB_REMOVE    = 99
00062 
00063 } pkgStage;
00064 #undef  _fv
00065 #undef  _fi
00066 #undef  _fs
00067 #undef  _fd
00068 
00069 #if defined(_RPMPSM_INTERNAL)
00070 
00073 typedef enum rpmpsmFlags_e {
00074     RPMPSM_FLAGS_DEBUG          = (1 << 0), 
00075     RPMPSM_FLAGS_CHROOTDONE     = (1 << 1), 
00076     RPMPSM_FLAGS_UNORDERED      = (1 << 2), 
00077     RPMPSM_FLAGS_GOTTRIGGERS    = (1 << 3), 
00078 } rpmpsmFlags;
00079 
00082 struct rpmpsm_s {
00083     struct rpmioItem_s _item;   
00084     struct rpmsqElem sq;        
00086 /*@only@*/ /*@null@*/
00087     const char * NVRA;          
00088     rpmpsmFlags flags;          
00089 /*@refcounted@*/
00090     rpmts ts;                   
00091 /*@dependent@*/ /*@null@*/
00092     rpmte te;                   
00093 /*@refcounted@*/ /*@relnull@*/
00094     rpmfi fi;                   
00095 /*@refcounted@*/ /*@relnull@*/
00096     rpmds triggers;             
00097 /*@null@*/
00098     const char ** Tpats;        
00099 /*@null@*/
00100     void * Tmires;              
00101     int nTmires;                
00102 /*@only@*/
00103     HE_t IPhe;                  
00104 /*@relnull@*/
00105     FD_t cfd;                   
00106 /*@relnull@*/
00107     FD_t fd;                    
00108     Header oh;                  
00109 /*@null@*/
00110     rpmmi mi;                   
00111 /*@observer@*/
00112     const char * stepName;      
00113 /*@only@*/ /*@null@*/
00114     const char * rpmio_flags;   
00115 /*@only@*/ /*@null@*/
00116     const char * payload_format;
00117 /*@only@*/ /*@null@*/
00118     const char * failedFile;
00119 /*@only@*/ /*@null@*/
00120     const char * pkgURL;        
00121 /*@dependent@*/
00122     const char * pkgfn;         
00123 /*@only@*/ /*@null@*/
00124     rpmuint32_t sstates[RPMSCRIPT_MAX]; 
00125     rpmuint32_t smetrics[RPMSCRIPT_MAX];
00126     rpmTag scriptTag;           
00127     rpmTag progTag;             
00128     int npkgs_installed;        
00129     int scriptArg;              
00130     int sense;                  
00131     int countCorrection;        
00132     rpmCallbackType what;       
00133     unsigned long long amount;  
00134     unsigned long long total;   
00135     rpmRC rc;
00136     pkgStage goal;
00137 /*@unused@*/
00138     pkgStage stage;             
00139     pkgStage nstage;            
00141 #if defined(__LCLINT__)
00142 /*@refs@*/
00143     int nrefs;                  
00144 #endif
00145 };
00146 #endif  /* _RPMPSM_INTERNAL */
00147 
00148 #ifdef __cplusplus
00149 extern "C" {
00150 #endif
00151 
00158 /*@unused@*/ /*@null@*/
00159 rpmpsm rpmpsmUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
00160                 /*@null@*/ const char * msg)
00161         /*@modifies psm @*/;
00162 #define rpmpsmUnlink(_psm, _msg)        \
00163     ((rpmpsm)rpmioUnlinkPoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
00164 
00171 /*@unused@*/ /*@newref@*/ /*@null@*/
00172 rpmpsm rpmpsmLink (/*@null@*/ rpmpsm psm, /*@null@*/ const char * msg)
00173         /*@modifies psm @*/;
00174 #define rpmpsmLink(_psm, _msg)  \
00175     ((rpmpsm)rpmioLinkPoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
00176 
00182 /*@null@*/
00183 rpmpsm rpmpsmFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
00184                 /*@null@*/ const char * msg)
00185         /*@globals fileSystem @*/
00186         /*@modifies psm, fileSystem @*/;
00187 #define rpmpsmFree(_psm, _msg)  \
00188     ((rpmpsm)rpmioFreePoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
00189 
00197 /*@null@*/
00198 rpmpsm rpmpsmNew(rpmts ts, /*@null@*/ rpmte te, rpmfi fi)
00199         /*@modifies ts, fi @*/;
00200 
00207 rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
00208         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00209         /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
00210 #define rpmpsmUNSAFE    rpmpsmSTAGE
00211 
00219 rpmRC rpmpsmScriptStage(rpmpsm psm, rpmTag scriptTag, rpmTag progTag)
00220         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00221         /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
00222 
00223 void rpmpsmSetAsync(rpmpsm psm, int async)
00224         /*@modifies psm @*/;
00225 
00226 #ifdef __cplusplus
00227 }
00228 #endif
00229 
00230 #endif  /* H_PSM */