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,
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 
182 /*@null@*/
183 rpmpsm rpmpsmFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
184  /*@null@*/ const char * msg)
185  /*@globals fileSystem @*/
186  /*@modifies psm, fileSystem @*/;
187 #define rpmpsmFree(_psm, _msg) \
188  ((rpmpsm)rpmioFreePoolItem((rpmioItem)(_psm), _msg, __FILE__, __LINE__))
189 
197 /*@null@*/
198 rpmpsm rpmpsmNew(rpmts ts, /*@null@*/ rpmte te, rpmfi fi)
199  /*@modifies ts, fi @*/;
200 
207 rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
208  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
209  /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
210 #define rpmpsmUNSAFE rpmpsmSTAGE
211 
219 rpmRC rpmpsmScriptStage(rpmpsm psm, rpmTag scriptTag, rpmTag progTag)
220  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
221  /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
222 
223 void rpmpsmSetAsync(rpmpsm psm, int async)
224  /*@modifies psm @*/;
225 
226 #ifdef __cplusplus
227 }
228 #endif
229 
230 #endif /* H_PSM */