1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
#ifndef H_RPMGI
#define H_RPMGI
/** \ingroup rpmio
* \file lib/rpmgi.h
*/
#include <rpmlib.h>
#include <rpmte.h>
#include <rpmts.h>
#include <fts.h>
#include <argv.h>
/**
*/
/*@-exportlocal@*/
/*@unchecked@*/
extern int _rpmgi_debug;
/*@=exportlocal@*/
/**
*/
typedef enum rpmgiFlags_e {
RPMGI_NONE = 0,
RPMGI_TSADD = (1 << 0),
RPMGI_TSORDER = (1 << 1),
RPMGI_NOGLOB = (1 << 2),
RPMGI_NOMANIFEST = (1 << 3),
RPMGI_NOHEADER = (1 << 4)
} rpmgiFlags;
/*@unchecked@*/
extern rpmgiFlags giFlags;
#if defined(_RPMGI_INTERNAL)
/** \ingroup rpmio
*/
struct rpmgi_s {
/*@refcounted@*/
rpmts ts; /*!< Iterator transaction set. */
int tag; /*!< Iterator type. */
/*@kept@*/ /*@relnull@*/
const void * keyp; /*!< Iterator key. */
size_t keylen; /*!< Iterator key length. */
rpmgiFlags flags; /*!< Iterator control bits. */
int active; /*!< Iterator is active? */
int i; /*!< Element index. */
/*@null@*/
const char * hdrPath; /*!< Path to current iterator header. */
/*@refcounted@*/ /*@null@*/
Header h; /*!< Current iterator header. */
/*@null@*/
rpmtsi tsi;
/*@null@*/
rpmdbMatchIterator mi;
/*@refcounted@*/
FD_t fd;
ARGV_t argv;
int argc;
int ftsOpts;
/*@null@*/
FTS * ftsp;
/*@relnull@*/
FTSENT * fts;
/*@refs@*/
int nrefs; /*!< Reference count. */
};
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* Unreference a generalized iterator instance.
* @param gi generalized iterator
* @param msg
* @return NULL always
*/
/*@unused@*/ /*@null@*/
rpmgi rpmgiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmgi gi,
/*@null@*/ const char * msg)
/*@modifies gi @*/;
/** @todo Remove debugging entry from the ABI. */
/*@-exportlocal@*/
/*@null@*/
rpmgi XrpmgiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmgi gi,
/*@null@*/ const char * msg, const char * fn, unsigned ln)
/*@modifies gi @*/;
/*@=exportlocal@*/
#define rpmgiUnlink(_gi, _msg) XrpmgiUnlink(_gi, _msg, __FILE__, __LINE__)
/**
* Reference a generalized iterator instance.
* @param gi generalized iterator
* @param msg
* @return new generalized iterator reference
*/
/*@unused@*/ /*@newref@*/ /*@null@*/
rpmgi rpmgiLink (/*@null@*/ rpmgi gi, /*@null@*/ const char * msg)
/*@modifies gi @*/;
/** @todo Remove debugging entry from the ABI. */
/*@newref@*/ /*@null@*/
rpmgi XrpmgiLink (/*@null@*/ rpmgi gi, /*@null@*/ const char * msg,
const char * fn, unsigned ln)
/*@modifies gi @*/;
#define rpmgiLink(_gi, _msg) XrpmgiLink(_gi, _msg, __FILE__, __LINE__)
/** Destroy a generalized iterator.
* @param gi generalized iterator
* @return NULL always
*/
/*@null@*/
rpmgi rpmgiFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmgi gi)
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/
/*@modifies gi, rpmGlobalMacroContext, h_errno, internalState @*/;
/**
* Return a generalized iterator.
* @param ts transaction set
* @param tag rpm tag
* @param keyp key data (NULL for sequential access)
* @param keylen key data length (0 will use strlen(keyp))
* @return new iterator
*/
/*@null@*/
rpmgi rpmgiNew(rpmts ts, int tag, /*@kept@*/ /*@null@*/ const void * keyp,
size_t keylen)
/*@globals internalState @*/
/*@modifies ts, internalState @*/;
/**
* Perform next iteration step.
* @param gi generalized iterator
* @returns RPMRC_OK on success, RPMRC_NOTFOUND on EOI
*/
rpmRC rpmgiNext(/*@null@*/ rpmgi gi)
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/
/*@modifies gi, rpmGlobalMacroContext, h_errno, internalState @*/;
/**
* Return current header path.
* @param gi generalized iterator
* @returns header path
*/
/*@observer@*/ /*@null@*/
const char * rpmgiHdrPath(rpmgi gi)
/*@*/;
/**
* Return current iteration header.
* @param gi generalized iterator
* @returns header
*/
/*@null@*/
Header rpmgiHeader(/*@null@*/ rpmgi gi)
/*@*/;
/**
* Return current iteration transaction set.
* @param gi generalized iterator
* @returns transaction set
*/
/*@null@*/
rpmts rpmgiTs(/*@null@*/ rpmgi gi)
/*@*/;
/**
* Load iterator args.
* @param gi generalized iterator
* @param argv arg list
* @param ftsOpts fts(3) flags
* @param flags iterator flags
* @returns RPMRC_OK on success
*/
rpmRC rpmgiSetArgs(rpmgi gi, /*@null@*/ ARGV_t argv,
int ftsOpts, rpmgiFlags flags)
/*@globals internalState @*/
/*@modifies gi, internalState @*/;
#ifdef __cplusplus
}
#endif
#endif /* H_RPMGI */
|