rpm  5.4.15
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,
58 
62 
63 } pkgStage;
64 #undef _fv
65 #undef _fi
66 #undef _fs
67 #undef _fd
68 
69 #if defined(_RPMPSM_INTERNAL)
70 
73 typedef enum rpmpsmFlags_e {
74  RPMPSM_FLAGS_DEBUG = (1 << 0),
75  RPMPSM_FLAGS_CHROOTDONE = (1 << 1),
76  RPMPSM_FLAGS_UNORDERED = (1 << 2),
77  RPMPSM_FLAGS_GOTTRIGGERS = (1 << 3),
78 } rpmpsmFlags;
79 
82 struct rpmpsm_s {
83  struct rpmioItem_s _item;
84  struct rpmsqElem sq;
86 /*@only@*/ /*@null@*/
87  const char * NVRA;
88  rpmpsmFlags flags;
89 /*@refcounted@*/
90  rpmts ts;
91 /*@dependent@*/ /*@null@*/
92  rpmte te;
93 /*@refcounted@*/ /*@relnull@*/
94  rpmfi fi;
95 /*@refcounted@*/ /*@relnull@*/
96  rpmds triggers;
97 /*@null@*/
98  const char ** Tpats;
99 /*@null@*/
100  void * Tmires;
101  int nTmires;
102 /*@only@*/
103  HE_t IPhe;
104 /*@relnull@*/
105  FD_t cfd;
106 /*@relnull@*/
107  FD_t fd;
108  Header oh;
109 /*@null@*/
110  rpmmi mi;
111 /*@observer@*/
112  const char * stepName;
113 /*@only@*/ /*@null@*/
114  const char * rpmio_flags;
115 /*@only@*/ /*@null@*/
116  const char * payload_format;
117 /*@only@*/ /*@null@*/
118  const char * failedFile;
119 /*@only@*/ /*@null@*/
120  const char * pkgURL;
121 /*@dependent@*/
122  const char * pkgfn;
123 /*@only@*/ /*@null@*/
124  rpmuint32_t sstates[RPMSCRIPT_MAX];
125  rpmuint32_t smetrics[RPMSCRIPT_MAX];
126  rpmTag scriptTag;
127  rpmTag progTag;
128  int npkgs_installed;
129  int scriptArg;
130  int sense;
131  int countCorrection;
132  rpmCallbackType what;
133  unsigned long long amount;
134  unsigned long long total;
135  rpmRC rc;
136  pkgStage goal;
137 /*@unused@*/
138  pkgStage stage;
139  pkgStage nstage;
141 #if defined(__LCLINT__)
142 /*@refs@*/
143  int nrefs;
144 #endif
145 };
146 #endif /* _RPMPSM_INTERNAL */
147 
148 #ifdef __cplusplus
149 extern "C" {
150 #endif
151 
158 /*@unused@*/ /*@null@*/
159 rpmpsm rpmpsmUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
160  /*@null@*/ const char * msg)
161  /*@modifies psm @*/;
162 #define rpmpsmUnlink(_psm, _msg) \
163  ((rpmpsm)rpmioUnlinkPoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
164 
171 /*@unused@*/ /*@newref@*/ /*@null@*/
172 rpmpsm rpmpsmLink (/*@null@*/ rpmpsm psm, /*@null@*/ const char * msg)
173  /*@modifies psm @*/;
174 #define rpmpsmLink(_psm, _msg) \
175  ((rpmpsm)rpmioLinkPoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
176 
183 /*@null@*/
184 rpmpsm rpmpsmFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
185  /*@null@*/ const char * msg)
186  /*@globals fileSystem @*/
187  /*@modifies psm, fileSystem @*/;
188 #define rpmpsmFree(_psm, _msg) \
189  ((rpmpsm)rpmioFreePoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
190 
198 /*@null@*/
199 rpmpsm rpmpsmNew(rpmts ts, /*@null@*/ rpmte te, rpmfi fi)
200  /*@modifies ts, fi @*/;
201 
208 rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
209  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
210  /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
211 #define rpmpsmUNSAFE rpmpsmSTAGE
212 
220 rpmRC rpmpsmScriptStage(rpmpsm psm, rpmTag scriptTag, rpmTag progTag)
221  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
222  /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
223 
224 void rpmpsmSetAsync(rpmpsm psm, int async)
225  /*@modifies psm @*/;
226 
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 #endif /* H_PSM */
const char bson_timestamp_t * ts
Definition: bson.h:1004
Structure(s) used for file info tag sets.
The Header data structure.
#define rpmpsmUnlink(_psm, _msg)
Definition: psm.h:162
rpmpsm rpmpsmNew(rpmts ts, rpmte te, rpmfi fi)
Create and load a package state machine.
Definition: psm.c:1850
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:2222
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:28
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:83
Definition: psm.h:54
enum pkgStage_e pkgStage
Definition: psm.h:35
#define rpmpsmFree(_psm, _msg)
Definition: psm.h:188
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:1788
const char const bson int mongo_write_concern int flags
Definition: mongo.h:485
enum rpmRC_e rpmRC
RPM return codes.
Definition: rpmtag.h:502
Definition: psm.h:39
Definition: psm.h:47
Definition: psm.h:38
void rpmpsmSetAsync(rpmpsm psm, int async)
Definition: psm.c:1774
struct rpmts_s * rpmts
The RPM Transaction Set.
Definition: rpmtypes.h:14
int _psm_debug
Definition: psm.c:78
rpmfi fi
Definition: filetriggers.h:15
enum rpmTag_e rpmTag
Definition: rpmtag.h:470
Definition: psm.h:36
#define rpmpsmLink(_psm, _msg)
Definition: psm.h:174