rpm  5.2.1
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 
00017 /*@-exportlocal@*/
00018 /*@unchecked@*/
00019 extern int _psm_debug;
00020 /*@=exportlocal@*/
00021 
00024 #define PSM_VERBOSE     0x8000
00025 #define PSM_INTERNAL    0x4000
00026 #define PSM_SYSCALL     0x2000
00027 #define PSM_DEAD        0x1000
00028 #define _fv(_a)         ((_a) | PSM_VERBOSE)
00029 #define _fi(_a)         ((_a) | PSM_INTERNAL)
00030 #define _fs(_a)         ((_a) | (PSM_INTERNAL | PSM_SYSCALL))
00031 #define _fd(_a)         ((_a) | (PSM_INTERNAL | PSM_DEAD))
00032 typedef enum pkgStage_e {
00033     PSM_UNKNOWN         =  0,
00034     PSM_INIT            =  1,
00035     PSM_PRE             =  2,
00036     PSM_PROCESS         =  3,
00037     PSM_POST            =  4,
00038     PSM_UNDO            =  5,
00039     PSM_FINI            =  6,
00040 
00041     PSM_PKGINSTALL      =  7,
00042     PSM_PKGERASE        =  8,
00043     PSM_PKGCOMMIT       = 10,
00044     PSM_PKGSAVE         = 12,
00045 
00046     PSM_CREATE          = 17,
00047     PSM_NOTIFY          = 22,
00048     PSM_DESTROY         = 23,
00049     PSM_COMMIT          = 25,
00050 
00051     PSM_CHROOT_IN       = 51,
00052     PSM_CHROOT_OUT      = 52,
00053     PSM_SCRIPT          = 53,
00054     PSM_TRIGGERS        = 54,
00055     PSM_IMMED_TRIGGERS  = 55,
00056     PSM_RPMIO_FLAGS     = 56,
00057 
00058     PSM_RPMDB_LOAD      = 97,
00059     PSM_RPMDB_ADD       = 98,
00060     PSM_RPMDB_REMOVE    = 99
00061 
00062 } pkgStage;
00063 #undef  _fv
00064 #undef  _fi
00065 #undef  _fs
00066 #undef  _fd
00067 
00071 typedef enum rpmScriptID_e {
00072     RPMSCRIPT_UNKNOWN           =  0,   
00073     RPMSCRIPT_PRETRANS          =  1,   
00074     RPMSCRIPT_TRIGGERPREIN      =  2,   
00075     RPMSCRIPT_PREIN             =  3,   
00076     RPMSCRIPT_POSTIN            =  4,   
00077     RPMSCRIPT_TRIGGERIN         =  5,   
00078     RPMSCRIPT_TRIGGERUN         =  6,   
00079     RPMSCRIPT_PREUN             =  7,   
00080     RPMSCRIPT_POSTUN            =  8,   
00081     RPMSCRIPT_TRIGGERPOSTUN     =  9,   
00082     RPMSCRIPT_POSTTRANS         = 10,   
00083         /* 11-15 unused */
00084     RPMSCRIPT_VERIFY            = 16,   
00085     RPMSCRIPT_SANITYCHECK       = 17,   
00086     RPMSCRIPT_MAX               = 32
00087 } rpmScriptID;
00088 
00092 typedef enum rpmScriptState_e {
00093     RPMSCRIPT_STATE_UNKNOWN     = 0,
00094         /* 0-15 reserved for waitpid return. */
00095     RPMSCRIPT_STATE_EXEC        = (1 << 16), 
00096     RPMSCRIPT_STATE_REAPED      = (1 << 17), 
00097         /* 18-23 unused */
00098     RPMSCRIPT_STATE_SELINUX     = (1 << 24), 
00099     RPMSCRIPT_STATE_EMULATOR    = (1 << 25), 
00100     RPMSCRIPT_STATE_LUA         = (1 << 26)  
00101 } rpmScriptState;
00102 
00106 typedef enum rpmpsmFlags_e {
00107     RPMPSM_FLAGS_DEBUG          = (1 << 0), 
00108     RPMPSM_FLAGS_CHROOTDONE     = (1 << 1), 
00109     RPMPSM_FLAGS_UNORDERED      = (1 << 2), 
00110     RPMPSM_FLAGS_GOTTRIGGERS    = (1 << 3), 
00111 } rpmpsmFlags;
00112 
00115 struct rpmpsm_s {
00116     struct rpmioItem_s _item;   
00117     struct rpmsqElem sq;        
00119 /*@only@*/ /*@null@*/
00120     const char * NVRA;          
00121     rpmpsmFlags flags;          
00122 /*@refcounted@*/
00123     rpmts ts;                   
00124 /*@dependent@*/ /*@null@*/
00125     rpmte te;                   
00126 /*@refcounted@*/ /*@relnull@*/
00127     rpmfi fi;                   
00128 /*@refcounted@*/ /*@relnull@*/
00129     rpmds triggers;             
00130 /*@null@*/
00131     const char ** Tpats;        
00132 /*@null@*/
00133     void * Tmires;              
00134     int nTmires;                
00135 /*@only@*/
00136     HE_t IPhe;                  
00137 /*@relnull@*/
00138     FD_t cfd;                   
00139 /*@relnull@*/
00140     FD_t fd;                    
00141     Header oh;                  
00142 /*@null@*/
00143     rpmmi mi;                   
00144 /*@observer@*/
00145     const char * stepName;      
00146 /*@only@*/ /*@null@*/
00147     const char * rpmio_flags;   
00148 /*@only@*/ /*@null@*/
00149     const char * payload_format;
00150 /*@only@*/ /*@null@*/
00151     const char * failedFile;
00152 /*@only@*/ /*@null@*/
00153     const char * pkgURL;        
00154 /*@dependent@*/
00155     const char * pkgfn;         
00156 /*@only@*/ /*@null@*/
00157     int *sstates;               
00158     rpmTag scriptTag;           
00159     rpmTag progTag;             
00160     int npkgs_installed;        
00161     int scriptArg;              
00162     int sense;                  
00163     int countCorrection;        
00164     rpmCallbackType what;       
00165     unsigned long long amount;  
00166     unsigned long long total;   
00167     rpmRC rc;
00168     pkgStage goal;
00169 /*@unused@*/
00170     pkgStage stage;             
00171     pkgStage nstage;            
00173 #if defined(__LCLINT__)
00174 /*@refs@*/
00175     int nrefs;                  
00176 #endif
00177 };
00178 
00179 #ifdef __cplusplus
00180 extern "C" {
00181 #endif
00182 
00189 /*@unused@*/ /*@null@*/
00190 rpmpsm rpmpsmUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
00191                 /*@null@*/ const char * msg)
00192         /*@modifies psm @*/;
00193 #define rpmpsmUnlink(_psm, _msg)        \
00194     ((rpmpsm)rpmioUnlinkPoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
00195 
00202 /*@unused@*/ /*@newref@*/ /*@null@*/
00203 rpmpsm rpmpsmLink (/*@null@*/ rpmpsm psm, /*@null@*/ const char * msg)
00204         /*@modifies psm @*/;
00205 #define rpmpsmLink(_psm, _msg)  \
00206     ((rpmpsm)rpmioLinkPoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
00207 
00213 /*@null@*/
00214 rpmpsm rpmpsmFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
00215                 /*@null@*/ const char * msg)
00216         /*@globals fileSystem @*/
00217         /*@modifies psm, fileSystem @*/;
00218 #define rpmpsmFree(_psm, _msg)  \
00219     ((rpmpsm)rpmioFreePoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
00220 
00228 /*@null@*/
00229 rpmpsm rpmpsmNew(rpmts ts, /*@null@*/ rpmte te, rpmfi fi)
00230         /*@modifies ts, fi @*/;
00231 
00238 rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
00239         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00240         /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
00241 #define rpmpsmUNSAFE    rpmpsmSTAGE
00242 
00243 #ifdef __cplusplus
00244 }
00245 #endif
00246 
00247 #endif  /* H_PSM */