rpm  5.2.1
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 
17 /*@-exportlocal@*/
18 /*@unchecked@*/
19 extern int _psm_debug;
20 /*@=exportlocal@*/
21 
24 #define PSM_VERBOSE 0x8000
25 #define PSM_INTERNAL 0x4000
26 #define PSM_SYSCALL 0x2000
27 #define PSM_DEAD 0x1000
28 #define _fv(_a) ((_a) | PSM_VERBOSE)
29 #define _fi(_a) ((_a) | PSM_INTERNAL)
30 #define _fs(_a) ((_a) | (PSM_INTERNAL | PSM_SYSCALL))
31 #define _fd(_a) ((_a) | (PSM_INTERNAL | PSM_DEAD))
32 typedef enum pkgStage_e {
34  PSM_INIT = 1,
35  PSM_PRE = 2,
37  PSM_POST = 4,
38  PSM_UNDO = 5,
39  PSM_FINI = 6,
40 
45 
46  PSM_CREATE = 17,
47  PSM_NOTIFY = 22,
49  PSM_COMMIT = 25,
50 
53  PSM_SCRIPT = 53,
57 
61 
62 } pkgStage;
63 #undef _fv
64 #undef _fi
65 #undef _fs
66 #undef _fd
67 
71 typedef enum rpmScriptID_e {
83  /* 11-15 unused */
87 } rpmScriptID;
88 
92 typedef enum rpmScriptState_e {
94  /* 0-15 reserved for waitpid return. */
95  RPMSCRIPT_STATE_EXEC = (1 << 16),
96  RPMSCRIPT_STATE_REAPED = (1 << 17),
97  /* 18-23 unused */
100  RPMSCRIPT_STATE_LUA = (1 << 26)
102 
106 typedef enum rpmpsmFlags_e {
107  RPMPSM_FLAGS_DEBUG = (1 << 0),
111 } rpmpsmFlags;
112 
115 struct rpmpsm_s {
117  struct rpmsqElem sq;
119 /*@only@*/ /*@null@*/
120  const char * NVRA;
122 /*@refcounted@*/
124 /*@dependent@*/ /*@null@*/
126 /*@refcounted@*/ /*@relnull@*/
128 /*@refcounted@*/ /*@relnull@*/
130 /*@null@*/
131  const char ** Tpats;
132 /*@null@*/
133  void * Tmires;
134  int nTmires;
135 /*@only@*/
137 /*@relnull@*/
139 /*@relnull@*/
142 /*@null@*/
144 /*@observer@*/
145  const char * stepName;
146 /*@only@*/ /*@null@*/
147  const char * rpmio_flags;
148 /*@only@*/ /*@null@*/
149  const char * payload_format;
150 /*@only@*/ /*@null@*/
151  const char * failedFile;
152 /*@only@*/ /*@null@*/
153  const char * pkgURL;
154 /*@dependent@*/
155  const char * pkgfn;
156 /*@only@*/ /*@null@*/
157  int *sstates;
161  int scriptArg;
162  int sense;
165  unsigned long long amount;
166  unsigned long long total;
169 /*@unused@*/
173 #if defined(__LCLINT__)
174 /*@refs@*/
175  int nrefs;
176 #endif
177 };
178 
179 #ifdef __cplusplus
180 extern "C" {
181 #endif
182 
189 /*@unused@*/ /*@null@*/
190 rpmpsm rpmpsmUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
191  /*@null@*/ const char * msg)
192  /*@modifies psm @*/;
193 #define rpmpsmUnlink(_psm, _msg) \
194  ((rpmpsm)rpmioUnlinkPoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
195 
202 /*@unused@*/ /*@newref@*/ /*@null@*/
203 rpmpsm rpmpsmLink (/*@null@*/ rpmpsm psm, /*@null@*/ const char * msg)
204  /*@modifies psm @*/;
205 #define rpmpsmLink(_psm, _msg) \
206  ((rpmpsm)rpmioLinkPoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
207 
213 /*@null@*/
214 rpmpsm rpmpsmFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
215  /*@null@*/ const char * msg)
216  /*@globals fileSystem @*/
217  /*@modifies psm, fileSystem @*/;
218 #define rpmpsmFree(_psm, _msg) \
219  ((rpmpsm)rpmioFreePoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
220 
228 /*@null@*/
229 rpmpsm rpmpsmNew(rpmts ts, /*@null@*/ rpmte te, rpmfi fi)
230  /*@modifies ts, fi @*/;
231 
238 rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
239  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
240  /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
241 #define rpmpsmUNSAFE rpmpsmSTAGE
242 
243 #ifdef __cplusplus
244 }
245 #endif
246 
247 #endif /* H_PSM */