rpm  5.4.10
rpmfi.h
Go to the documentation of this file.
1 #ifndef H_RPMFI
2 #define H_RPMFI
3 
9 /*@-exportlocal@*/
10 /*@unchecked@*/
11 extern int _rpmfi_debug;
12 /*@=exportlocal@*/
13 
21 typedef enum rpmFileTypes_e {
22  PIPE = 1,
23  CDEV = 2,
24  XDIR = 4,
25  BDEV = 6,
26  REG = 8,
27  LINK = 10,
28  SOCK = 12
29 } rpmFileTypes;
30 
34 typedef enum rpmfileState_e {
40 } rpmfileState;
41 #define RPMFILE_STATE_MISSING -1 /* XXX used for unavailable data */
42 
46 typedef enum rpmfileAttrs_e {
47 /*@-enummemuse@*/
49 /*@=enummemuse@*/
50  RPMFILE_CONFIG = (1 << 0),
51  RPMFILE_DOC = (1 << 1),
52  RPMFILE_ICON = (1 << 2),
53  RPMFILE_MISSINGOK = (1 << 3),
54  RPMFILE_NOREPLACE = (1 << 4),
55  RPMFILE_SPECFILE = (1 << 5),
56  RPMFILE_GHOST = (1 << 6),
57  RPMFILE_LICENSE = (1 << 7),
58  RPMFILE_README = (1 << 8),
59  RPMFILE_EXCLUDE = (1 << 9),
60  RPMFILE_UNPATCHED = (1 << 10),
61  RPMFILE_PUBKEY = (1 << 11),
62  RPMFILE_POLICY = (1 << 12),
63  RPMFILE_EXISTS = (1 << 13),
64  RPMFILE_SPARSE = (1 << 14),
65  RPMFILE_TYPED = (1 << 15),
66  RPMFILE_SOURCE = (1 << 16),
67  RPMFILE_PATCH = (1 << 17),
68  RPMFILE_OPTIONAL = (1 << 18),
69  RPMFILE_REMOVE = (1 << 19)
70 } rpmfileAttrs;
71 
72 #define RPMFILE_SPOOK (RPMFILE_GHOST|RPMFILE_TYPED)
73 #define RPMFILE_ALL ~(RPMFILE_NONE)
74 
78 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmfi_s * rpmfi;
79 
80 #if defined(_RPMFI_INTERNAL)
81 
82 #include "mire.h"
83 
87 struct rpmfi_s {
88  struct rpmioItem_s _item;
89  int i;
90  int j;
92 /*@observer@*/
93  const char * Type;
95  rpmTag tagN;
96 /*@refcounted@*/ /*@null@*/
97  Header h;
99 /*@only@*/ /*@relnull@*/
100  const char ** bnl;
101 /*@only@*/ /*@relnull@*/
102  const char ** dnl;
104 /*@only@*/ /*@relnull@*/
105  const char ** fdigests;
106 /*@only@*/ /*@null@*/
107  rpmuint32_t * fdigestalgos;
108 /*@only@*/ /*@relnull@*/
109  const char ** flinks;
110 /*@only@*/ /*@null@*/
111  const char ** flangs;
113 /*@only@*/ /*@relnull@*/
114  rpmuint32_t * dil;
115 /*@only@*/ /*@relnull@*/
116  const rpmuint32_t * fflags;
117 /*@only@*/ /*@relnull@*/
118  const rpmuint32_t * fsizes;
119 /*@only@*/ /*@relnull@*/
120  const rpmuint32_t * fmtimes;
121 /*@only@*/ /*@relnull@*/
122  rpmuint16_t * fmodes;
123 /*@only@*/ /*@relnull@*/
124  const rpmuint16_t * frdevs;
125 /*@only@*/ /*@relnull@*/
126  const rpmuint32_t * finodes;
128 /*@only@*/ /*@null@*/
129  const char ** fuser;
130 /*@only@*/ /*@null@*/
131  const char ** fgroup;
133 /*@only@*/ /*@null@*/
134  rpmuint8_t * fstates;
136 /*@only@*/ /*@null@*/
137  const rpmuint32_t * fcolors;
139 /*@only@*/ /*@null@*/
140  const char ** fcaps;
142 /*@only@*/ /*@null@*/
143  const char ** fcontexts;
145 /*@only@*/ /*@null@*/
146  const char ** cdict;
147  rpmuint32_t ncdict;
148 /*@only@*/ /*@null@*/
149  const rpmuint32_t * fcdictx;
151 /*@only@*/ /*@null@*/
152  const rpmuint32_t * ddict;
153  rpmuint32_t nddict;
154 /*@only@*/ /*@null@*/
155  const rpmuint32_t * fddictx;
156 /*@only@*/ /*@null@*/
157  const rpmuint32_t * fddictn;
159 /*@only@*/ /*@relnull@*/
160  const rpmuint32_t * vflags;
162  rpmuint32_t dc;
163  rpmuint32_t fc;
165 /*=============================*/
166 /*@dependent@*/ /*@relnull@*/
167  void * te;
168 
169 /*@only@*/
170  void * _fnbf;
171 /*@only@*/ /*@null@*/
172  miRE exclude;
173  int nexclude;
174 /*@only@*/ /*@null@*/
175  miRE include;
176  int ninclude;
178 /*-----------------------------*/
179  uid_t uid;
180  gid_t gid;
181  rpmuint32_t flags;
182  int action;
183 /*@owned@*/ /*@relnull@*/
184  int * actions;
185 /*@owned@*/
186  struct fingerPrint_s * fps;
187 /*@owned@*/
188  const char ** obnl;
189 /*@owned@*/
190  const char ** odnl;
191 /*@unused@*/
192  rpmuint32_t * odil;
194 /*@only@*/ /*@relnull@*/
195  unsigned char * digests;
196  rpmuint32_t digestalgo;
197  rpmuint32_t digestlen;
199 /*@only@*/ /*@relnull@*/
200  const char * pretrans;
201 /*@only@*/ /*@relnull@*/
202  const char * pretransprog;
203 /*@only@*/ /*@relnull@*/
204  const char * posttrans;
205 /*@only@*/ /*@relnull@*/
206  const char * posttransprog;
207 /*@only@*/ /*@relnull@*/
208  const char * verifyscript;
209 /*@only@*/ /*@relnull@*/
210  const char * verifyscriptprog;
211 
212 /*@only@*/ /*@null@*/
213  char * fn;
214  size_t fnlen;
216  size_t astriplen;
217  size_t striplen;
218  unsigned long long archivePos;
219  unsigned long long archiveSize;
220  mode_t dperms;
221  mode_t fperms;
222 /*@only@*/ /*@null@*/
223  const char ** apath;
224  int mapflags;
225 /*@owned@*/ /*@null@*/
226  int * fmapflags;
227 /*@owned@*/
228  void * fsm;
229  rpmuint32_t color;
231  int isSource;
233 /*@owned@*/
234  rpmuint32_t * replacedSizes;
236  unsigned int record;
237  int magic;
238 #define RPMFIMAGIC 0x09697923
239 /*=============================*/
240 #if defined(__LCLINT__)
241 /*@refs@*/
242  int nrefs;
243 #endif
244 };
245 
246 #endif /* _RPMFI_INTERNAL */
247 
248 #ifdef __cplusplus
249 extern "C" {
250 #endif
251 
252 #if !defined(_RPMFI_NOMETHODS)
253 
255 
262 /*@unused@*/ /*@null@*/
263 rpmfi rpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi,
264  /*@null@*/ const char * msg)
265  /*@modifies fi @*/;
266 #define rpmfiUnlink(_fi, _msg) \
267  ((rpmfi) rpmioUnlinkPoolItem((rpmioItem)(_fi), _msg, __FILE__, __LINE__))
268 
275 /*@unused@*/ /*@null@*/
276 rpmfi rpmfiLink (/*@null@*/ rpmfi fi, /*@null@*/ const char * msg)
277  /*@modifies fi @*/;
278 #define rpmfiLink(_fi, _msg) \
279  ((rpmfi) rpmioLinkPoolItem((rpmioItem)(_fi), _msg, __FILE__, __LINE__))
280 
286 int rpmfiFC(/*@null@*/ rpmfi fi)
287  /*@*/;
288 
294 /*@unused@*/
295 int rpmfiFX(/*@null@*/ rpmfi fi)
296  /*@*/;
297 
304 /*@unused@*/
305 int rpmfiSetFX(/*@null@*/ rpmfi fi, int fx)
306  /*@modifies fi @*/;
307 
313 int rpmfiDC(/*@null@*/ rpmfi fi)
314  /*@*/;
315 
321 int rpmfiDX(/*@null@*/ rpmfi fi)
322  /*@*/;
323 
330 int rpmfiSetDX(/*@null@*/ rpmfi fi, int dx)
331  /*@modifies fi @*/;
332 
338 int rpmfiIsSource(/*@null@*/ rpmfi fi)
339  /*@*/;
340 
346 /*@observer@*/ /*@null@*/
347 extern const char * rpmfiBN(/*@null@*/ rpmfi fi)
348  /*@*/;
349 
355 /*@observer@*/ /*@null@*/
356 extern const char * rpmfiDN(/*@null@*/ rpmfi fi)
357  /*@*/;
358 
364 /*@observer@*/
365 extern const char * rpmfiFN(/*@null@*/ rpmfi fi)
366  /*@modifies fi @*/;
367 
373 extern size_t rpmfiFNMaxLen(/*@null@*/ rpmfi fi)
374  /*@*/;
375 
381 rpmuint32_t rpmfiFFlags(/*@null@*/ rpmfi fi)
382  /*@*/;
383 
390 rpmuint32_t rpmfiSetFFlags(/*@null@*/ rpmfi fi, rpmuint32_t FFlags)
391  /*@modifies fi @*/;
392 
398 rpmuint32_t rpmfiVFlags(/*@null@*/ rpmfi fi)
399  /*@*/;
400 
407 rpmuint32_t rpmfiSetVFlags(/*@null@*/ rpmfi fi, rpmuint32_t VFlags)
408  /*@modifies fi @*/;
409 
415 rpmuint16_t rpmfiFMode(/*@null@*/ rpmfi fi)
416  /*@*/;
417 
423 rpmfileState rpmfiFState(/*@null@*/ rpmfi fi)
424  /*@*/;
425 
432 rpmfileState rpmfiSetFState(/*@null@*/ rpmfi fi, rpmfileState fstate)
433  /*@modifies fi @*/;
434 
442 /*@observer@*/ /*@null@*/
443 extern const unsigned char * rpmfiDigest(/*@null@*/ rpmfi fi,
444  /*@out@*/ /*@null@*/ int * algop,
445  /*@out@*/ /*@null@*/ size_t * lenp)
446  /*@modifies *algop, *lenp @*/;
447 
453 /*@observer@*/ /*@null@*/
454 extern const char * rpmfiFLink(/*@null@*/ rpmfi fi)
455  /*@*/;
456 
462 rpmuint32_t rpmfiFSize(/*@null@*/ rpmfi fi)
463  /*@*/;
464 
470 rpmuint16_t rpmfiFRdev(/*@null@*/ rpmfi fi)
471  /*@*/;
472 
478 rpmuint32_t rpmfiFInode(/*@null@*/ rpmfi fi)
479  /*@*/;
480 
486 rpmuint32_t rpmfiColor(/*@null@*/ rpmfi fi)
487  /*@*/;
488 
494 rpmuint32_t rpmfiFColor(/*@null@*/ rpmfi fi)
495  /*@*/;
496 
502 /*@-exportlocal@*/
503 /*@observer@*/ /*@null@*/
504 extern const char * rpmfiFClass(/*@null@*/ rpmfi fi)
505  /*@*/;
506 /*@=exportlocal@*/
507 
513 /*@-exportlocal@*/
514 /*@observer@*/ /*@null@*/
515 extern const char * rpmfiFContext(/*@null@*/ rpmfi fi)
516  /*@*/;
517 /*@=exportlocal@*/
518 
525 rpmuint32_t rpmfiFDepends(/*@null@*/ rpmfi fi,
526  /*@out@*/ /*@null@*/ const rpmuint32_t ** fddictp)
527  /*@modifies *fddictp @*/;
528 
534 rpmuint32_t rpmfiFNlink(/*@null@*/ rpmfi fi)
535  /*@*/;
536 
542 rpmuint32_t rpmfiFMtime(/*@null@*/ rpmfi fi)
543  /*@*/;
544 
550 /*@observer@*/ /*@null@*/
551 extern const char * rpmfiFUser(/*@null@*/ rpmfi fi)
552  /*@*/;
553 
559 /*@observer@*/ /*@null@*/
560 extern const char * rpmfiFGroup(/*@null@*/ rpmfi fi)
561  /*@*/;
562 
568 void * rpmfiBloomFN(/*@null@*/ const rpmfi fi)
569  /*@*/;
570 
576 /*@null@*/
577 void * rpmfiExclude(/*@null@*/ const rpmfi fi)
578  /*@*/;
579 
585 int rpmfiNExclude(/*@null@*/ const rpmfi fi)
586  /*@*/;
587 
593 /*@null@*/
594 void * rpmfiInclude(/*@null@*/ const rpmfi fi)
595  /*@*/;
596 
602 int rpmfiNInclude(/*@null@*/ const rpmfi fi)
603  /*@*/;
604 
605 #if defined(_RPMFI_INTERNAL)
606 #include "fprint.h"
613 /*@null@*/
614 struct fingerPrint_s * rpmfiFpsIndex(rpmfi fi, int ix)
615  /*@*/;
616 
617 void rpmfiFpLookup(rpmfi fi, fingerPrintCache fpc)
618  /*@modifies fi, fpc @*/;
619 #endif
620 
626 /*@null@*/
627 void * rpmfiFNBF(rpmfi fi)
628  /*@*/;
629 
635 int rpmfiNext(/*@null@*/ rpmfi fi)
636  /*@modifies fi @*/;
637 
644 /*@null@*/
645 rpmfi rpmfiInit(/*@null@*/ rpmfi fi, int fx)
646  /*@modifies fi @*/;
647 
653 /*@unused@*/
654 int rpmfiNextD(/*@null@*/ rpmfi fi)
655  /*@modifies fi @*/;
656 
663 /*@unused@*/ /*@null@*/
664 rpmfi rpmfiInitD(/*@null@*/ rpmfi fi, int dx)
665  /*@modifies fi @*/;
666 
673 int rpmfiSetHeader(rpmfi fi, /*@null@*/ Header h)
674  /*@modifies fi, h @*/;
675 
681 /*@null@*/
682 rpmfi rpmfiFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi)
683  /*@globals fileSystem @*/
684  /*@modifies fi, fileSystem @*/;
685 #define rpmfiFree(_fi) \
686  ((rpmfi) rpmioFreePoolItem((rpmioItem)(_fi), __FUNCTION__, __FILE__, __LINE__))
687 
696 /*@null@*/
697 rpmfi rpmfiNew(/*@null@*/ const void * _ts, Header h, rpmTag tagN, int flags)
698  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
699  /*@modifies _ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
700 
707 int rpmfiFStat(rpmfi fi, /*@out@*/ struct stat * st)
708  /*@modifies *st @*/;
709 
717 int rpmfiStat(rpmfi fi, const char * path, /*@out@*/ struct stat * st)
718  /*@modifies fi, *st @*/;
719 
726 /*@null@*/
727 void * rpmfiOpendir(rpmfi fi, const char * name)
728  /*@globals fileSystem, internalState @*/
729  /*@modifies fi, fileSystem, internalState @*/;
730 
741  /*@out@*/ const char *** fclassp, /*@out@*/ rpmuint32_t * fcp)
742  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
743  /*@modifies h, *fclassp, *fcp, rpmGlobalMacroContext,
744  fileSystem, internalState @*/;
745 
746 #ifdef DYING
747 
756 void rpmfiBuildFContexts(Header h,
757  /*@out@*/ const char *** fcontextp, /*@out@*/ rpmuint32_t * fcp)
758  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
759  /*@modifies h, *fcontextp, *fcp, rpmGlobalMacroContext,
760  fileSystem, internalState @*/;
761 
771 void rpmfiBuildFSContexts(Header h,
772  /*@out@*/ const char *** fcontextp, /*@out@*/ rpmuint32_t * fcp)
773  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
774  /*@modifies h, *fcontextp, *fcp, rpmGlobalMacroContext,
775  fileSystem, internalState @*/;
776 
786 void rpmfiBuildREContexts(Header h,
787  /*@out@*/ const char *** fcontextp, /*@out@*/ rpmuint32_t * fcp)
788  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
789  /*@modifies h, *fcontextp, *fcp, rpmGlobalMacroContext,
790  fileSystem, internalState @*/;
791 #endif
792 
803 void rpmfiBuildFDeps(Header h, rpmTag tagN,
804  /*@out@*/ const char *** fdepsp, /*@out@*/ rpmuint32_t * fcp)
805  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
806  /*@modifies h, *fdepsp, *fcp,
807  rpmGlobalMacroContext, fileSystem, internalState @*/;
808 
815 int rpmfiCompare(const rpmfi afi, const rpmfi bfi)
816  /*@*/;
817 
825 int rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing)
826  /*@globals h_errno, fileSystem, internalState @*/
827  /*@modifies nfi, fileSystem, internalState @*/;
828 
834 /*@-redef@*/
835 /*@observer@*/
836 const char * rpmfiTypeString(rpmfi fi)
837  /*@*/;
838 /*@=redef@*/
839 
845 /*@null@*/
847  /*@modifies relocs@*/;
848 
855 /*@only@*/ /*@null@*/
856 rpmRelocation rpmfiDupeRelocations(rpmRelocation relocs, int * nrelocsp)
857  /*@modifies *nrelocsp @*/;
858 
867 int rpmfiAddRelocation(rpmRelocation * relp, int * nrelp,
868  const char * oldPath, const char * newPath)
869  /*@modifies *relp, *nrelp @*/;
870 
872 #endif /* _RPMFI_NOMETHODS */
873 
874 #ifdef __cplusplus
875 }
876 #endif
877 
878 #endif /* H_RPMDS */