rpm  5.4.10
psm.h
Go to the documentation of this file.
1 #ifndef H_PSM
2 #define H_PSM
3 
13 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmpsm_s * rpmpsm;
14 
15 #include <rpmsq.h>
16 #include <rpmfi.h> /* XXX rpmfi typedef */
17 
18 /*@-exportlocal@*/
19 /*@unchecked@*/
20 extern int _psm_debug;
21 /*@=exportlocal@*/
22 
25 #define PSM_VERBOSE 0x8000
26 #define PSM_INTERNAL 0x4000
27 #define PSM_SYSCALL 0x2000
28 #define PSM_DEAD 0x1000
29 #define _fv(_a) ((_a) | PSM_VERBOSE)
30 #define _fi(_a) ((_a) | PSM_INTERNAL)
31 #define _fs(_a) ((_a) | (PSM_INTERNAL | PSM_SYSCALL))
32 #define _fd(_a) ((_a) | (PSM_INTERNAL | PSM_DEAD))
33 typedef enum pkgStage_e {
35  PSM_INIT = 1,
36  PSM_PRE = 2,
38  PSM_POST = 4,
39  PSM_UNDO = 5,
40  PSM_FINI = 6,
41 
46 
47  PSM_CREATE = 17,
48  PSM_NOTIFY = 22,
50  PSM_COMMIT = 25,
51 
54  PSM_SCRIPT = 53,
60 
64 
65 } pkgStage;
66 #undef _fv
67 #undef _fi
68 #undef _fs
69 #undef _fd
70 
71 #if defined(_RPMPSM_INTERNAL)
72 
75 typedef enum rpmpsmFlags_e {
76  RPMPSM_FLAGS_DEBUG = (1 << 0),
77  RPMPSM_FLAGS_CHROOTDONE = (1 << 1),
78  RPMPSM_FLAGS_UNORDERED = (1 << 2),
79  RPMPSM_FLAGS_GOTTRIGGERS = (1 << 3),
80 } rpmpsmFlags;
81 
84 struct rpmpsm_s {
85  struct rpmioItem_s _item;
86  struct rpmsqElem sq;
88 /*@only@*/ /*@null@*/
89  const char * NVRA;
90  rpmpsmFlags flags;
91 /*@refcounted@*/
92  rpmts ts;
93 /*@dependent@*/ /*@null@*/
94  rpmte te;
95 /*@refcounted@*/ /*@relnull@*/
96  rpmfi fi;
97 /*@refcounted@*/ /*@relnull@*/
98  rpmds triggers;
99 /*@null@*/
100  const char ** Tpats;
101 /*@null@*/
102  void * Tmires;
103  int nTmires;
104 /*@only@*/
105  HE_t IPhe;
106 /*@relnull@*/
107  FD_t cfd;
108 /*@relnull@*/
109  FD_t fd;
110  Header oh;
111 /*@null@*/
112  rpmmi mi;
113 /*@observer@*/
114  const char * stepName;
115 /*@only@*/ /*@null@*/
116  const char * rpmio_flags;
117 /*@only@*/ /*@null@*/
118  const char * payload_format;
119 /*@only@*/ /*@null@*/
120  const char * failedFile;
121 /*@only@*/ /*@null@*/
122  const char * pkgURL;
123 /*@dependent@*/
124  const char * pkgfn;
125 /*@only@*/ /*@null@*/
126  rpmuint32_t sstates[RPMSCRIPT_MAX];
127  rpmuint32_t smetrics[RPMSCRIPT_MAX];
128  rpmTag scriptTag;
129  rpmTag progTag;
130  int npkgs_installed;
131  int scriptArg;
132  int sense;
133  int countCorrection;
134  rpmCallbackType what;
135  unsigned long long amount;
136  unsigned long long total;
137  rpmRC rc;
138  pkgStage goal;
139 /*@unused@*/
140  pkgStage stage;
141  pkgStage nstage;
143 #if defined(__LCLINT__)
144 /*@refs@*/
145  int nrefs;
146 #endif
147 };
148 #endif /* _RPMPSM_INTERNAL */
149 
150 #ifdef __cplusplus
151 extern "C" {
152 #endif
153 
160 /*@unused@*/ /*@null@*/
161 rpmpsm rpmpsmUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
162  /*@null@*/ const char * msg)
163  /*@modifies psm @*/;
164 #define rpmpsmUnlink(_psm, _msg) \
165  ((rpmpsm)rpmioUnlinkPoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
166 
173 /*@unused@*/ /*@newref@*/ /*@null@*/
174 rpmpsm rpmpsmLink (/*@null@*/ rpmpsm psm, /*@null@*/ const char * msg)
175  /*@modifies psm @*/;
176 #define rpmpsmLink(_psm, _msg) \
177  ((rpmpsm)rpmioLinkPoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
178 
184 /*@null@*/
185 rpmpsm rpmpsmFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
186  /*@null@*/ const char * msg)
187  /*@globals fileSystem @*/
188  /*@modifies psm, fileSystem @*/;
189 #define rpmpsmFree(_psm, _msg) \
190  ((rpmpsm)rpmioFreePoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
191 
199 /*@null@*/
200 rpmpsm rpmpsmNew(rpmts ts, /*@null@*/ rpmte te, rpmfi fi)
201  /*@modifies ts, fi @*/;
202 
209 rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
210  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
211  /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
212 #define rpmpsmUNSAFE rpmpsmSTAGE
213 
221 rpmRC rpmpsmScriptStage(rpmpsm psm, rpmTag scriptTag, rpmTag progTag)
222  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
223  /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
224 
225 void rpmpsmSetAsync(rpmpsm psm, int async)
226  /*@modifies psm @*/;
227 
228 #ifdef __cplusplus
229 }
230 #endif
231 
232 #endif /* H_PSM */
Structure(s) used for file info tag sets.
The Header data structure.
#define rpmpsmUnlink(_psm, _msg)
Definition: psm.h:164
rpmpsm rpmpsmNew(rpmts ts, rpmte te, rpmfi fi)
Create and load a package state machine.
Definition: psm.c:2220
struct rpmpsm_s * rpmpsm
Package state machine data.
Definition: psm.h:13
Definition: rpmdb.c:436
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
Package state machine driver.
Definition: psm.c:2592
struct rpmds_s * rpmds
Dependency tag sets from a header, so that a header can be discarded early.
Definition: rpmtypes.h:28
struct rpmte_s * rpmte
An element of a transaction set, i.e.
Definition: rpmtypes.h:38
Definition: psm.h:40
pkgStage_e
Definition: psm.h:33
unsigned int rpmuint32_t
Definition: rpmiotypes.h:25
Definition: psm.h:50
struct rpmfi_s * rpmfi
File info tag sets from a header, so that a header can be discarded early.
Definition: rpmfi.h:78
Definition: psm.h:54
enum pkgStage_e pkgStage
Definition: psm.h:35
#define rpmpsmFree(_psm, _msg)
Definition: psm.h:189
The FD_t File Handle data structure.
Definition: psm.h:48
rpmRC rpmpsmScriptStage(rpmpsm psm, rpmTag scriptTag, rpmTag progTag)
Run rpmpsmStage(PSM_SCRIPT) for scriptTag and progTag.
Definition: psm.c:2146
enum rpmRC_e rpmRC
RPM return codes.
Definition: rpmtag.h:503
Definition: psm.h:39
Definition: psm.h:47
Definition: psm.h:38
void rpmpsmSetAsync(rpmpsm psm, int async)
Definition: psm.c:2133
struct rpmts_s * rpmts
The RPM Transaction Set.
Definition: rpmtypes.h:14
int _psm_debug
Definition: psm.c:76
enum rpmTag_e rpmTag
Definition: rpmtag.h:471
Definition: psm.h:36
#define rpmpsmLink(_psm, _msg)
Definition: psm.h:176