rpm 5.3.12
lib/rpmfi.h
Go to the documentation of this file.
00001 #ifndef H_RPMFI
00002 #define H_RPMFI
00003 
00009 /*@-exportlocal@*/
00010 /*@unchecked@*/
00011 extern int _rpmfi_debug;
00012 /*@=exportlocal@*/
00013 
00021 typedef enum rpmFileTypes_e {
00022     PIPE        =  1,   
00023     CDEV        =  2,   
00024     XDIR        =  4,   
00025     BDEV        =  6,   
00026     REG         =  8,   
00027     LINK        = 10,   
00028     SOCK        = 12    
00029 } rpmFileTypes;
00030 
00034 typedef enum rpmfileState_e {
00035     RPMFILE_STATE_NORMAL        = 0,
00036     RPMFILE_STATE_REPLACED      = 1,
00037     RPMFILE_STATE_NOTINSTALLED  = 2,
00038     RPMFILE_STATE_NETSHARED     = 3,
00039     RPMFILE_STATE_WRONGCOLOR    = 4
00040 } rpmfileState;
00041 #define RPMFILE_STATE_MISSING   -1      /* XXX used for unavailable data */
00042 
00046 typedef enum rpmfileAttrs_e {
00047 /*@-enummemuse@*/
00048     RPMFILE_NONE        = 0,
00049 /*@=enummemuse@*/
00050     RPMFILE_CONFIG      = (1 <<  0),    
00051     RPMFILE_DOC         = (1 <<  1),    
00052     RPMFILE_ICON        = (1 <<  2),    
00053     RPMFILE_MISSINGOK   = (1 <<  3),    
00054     RPMFILE_NOREPLACE   = (1 <<  4),    
00055     RPMFILE_SPECFILE    = (1 <<  5),    
00056     RPMFILE_GHOST       = (1 <<  6),    
00057     RPMFILE_LICENSE     = (1 <<  7),    
00058     RPMFILE_README      = (1 <<  8),    
00059     RPMFILE_EXCLUDE     = (1 <<  9),    
00060     RPMFILE_UNPATCHED   = (1 << 10),    
00061     RPMFILE_PUBKEY      = (1 << 11),    
00062     RPMFILE_POLICY      = (1 << 12),    
00063     RPMFILE_EXISTS      = (1 << 13),    
00064     RPMFILE_SPARSE      = (1 << 14),    
00065     RPMFILE_TYPED       = (1 << 15),    
00066     RPMFILE_SOURCE      = (1 << 16),    
00067     RPMFILE_PATCH       = (1 << 17),    
00068     RPMFILE_OPTIONAL    = (1 << 18),    
00069     RPMFILE_REMOVE      = (1 << 19)     
00070 } rpmfileAttrs;
00071 
00072 #define RPMFILE_SPOOK   (RPMFILE_GHOST|RPMFILE_TYPED)
00073 #define RPMFILE_ALL     ~(RPMFILE_NONE)
00074 
00078 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmfi_s * rpmfi;
00079 
00080 #if defined(_RPMFI_INTERNAL)
00081 
00082 #include "mire.h"
00083 
00087 struct rpmfi_s {
00088     struct rpmioItem_s _item;   
00089     int i;                      
00090     int j;                      
00092 /*@observer@*/
00093     const char * Type;          
00095     rpmTag tagN;                
00096 /*@refcounted@*/ /*@null@*/
00097     Header h;                   
00099 /*@only@*/ /*@relnull@*/
00100     const char ** bnl;          
00101 /*@only@*/ /*@relnull@*/
00102     const char ** dnl;          
00104 /*@only@*/ /*@relnull@*/
00105     const char ** fdigests;     
00106 /*@only@*/ /*@null@*/
00107     rpmuint32_t * fdigestalgos; 
00108 /*@only@*/ /*@relnull@*/
00109     const char ** flinks;       
00110 /*@only@*/ /*@null@*/
00111     const char ** flangs;       
00113 /*@only@*/ /*@relnull@*/
00114           rpmuint32_t * dil;    
00115 /*@only@*/ /*@relnull@*/
00116     const rpmuint32_t * fflags; 
00117 /*@only@*/ /*@relnull@*/
00118     const rpmuint32_t * fsizes; 
00119 /*@only@*/ /*@relnull@*/
00120     const rpmuint32_t * fmtimes;
00121 /*@only@*/ /*@relnull@*/
00122           rpmuint16_t * fmodes; 
00123 /*@only@*/ /*@relnull@*/
00124     const rpmuint16_t * frdevs; 
00125 /*@only@*/ /*@relnull@*/
00126     const rpmuint32_t * finodes;
00128 /*@only@*/ /*@null@*/
00129     const char ** fuser;        
00130 /*@only@*/ /*@null@*/
00131     const char ** fgroup;       
00133 /*@only@*/ /*@null@*/
00134     rpmuint8_t * fstates;       
00136 /*@only@*/ /*@null@*/
00137     const rpmuint32_t * fcolors;
00139 /*@only@*/ /*@null@*/
00140     const char ** fcaps;        
00142 /*@only@*/ /*@null@*/
00143     const char ** fcontexts;    
00145 /*@only@*/ /*@null@*/
00146     const char ** cdict;        
00147     rpmuint32_t ncdict;         
00148 /*@only@*/ /*@null@*/
00149     const rpmuint32_t * fcdictx;
00151 /*@only@*/ /*@null@*/
00152     const rpmuint32_t * ddict;  
00153     rpmuint32_t nddict;         
00154 /*@only@*/ /*@null@*/
00155     const rpmuint32_t * fddictx;
00156 /*@only@*/ /*@null@*/
00157     const rpmuint32_t * fddictn;
00159 /*@only@*/ /*@relnull@*/
00160     const rpmuint32_t * vflags; 
00162     rpmuint32_t dc;             
00163     rpmuint32_t fc;             
00165 /*=============================*/
00166 /*@dependent@*/ /*@relnull@*/
00167     void * te;
00168 
00169 /*@only@*/
00170     void * _fnbf;               
00171 /*@only@*/ /*@null@*/
00172     miRE exclude;               
00173     int nexclude;               
00174 /*@only@*/ /*@null@*/
00175     miRE include;               
00176     int ninclude;               
00178 /*-----------------------------*/
00179     uid_t uid;                  
00180     gid_t gid;                  
00181     rpmuint32_t flags;          
00182     int action;                 
00183 /*@owned@*/ /*@relnull@*/
00184     int * actions;              
00185 /*@owned@*/
00186     struct fingerPrint_s * fps; 
00187 /*@owned@*/
00188     const char ** obnl;         
00189 /*@owned@*/
00190     const char ** odnl;         
00191 /*@unused@*/
00192     rpmuint32_t * odil;         
00194 /*@only@*/ /*@relnull@*/
00195     unsigned char * digests;    
00196     rpmuint32_t digestalgo;     
00197     rpmuint32_t digestlen;      
00199 /*@only@*/ /*@relnull@*/
00200     const char * pretrans;
00201 /*@only@*/ /*@relnull@*/
00202     const char * pretransprog;
00203 /*@only@*/ /*@relnull@*/
00204     const char * posttrans;
00205 /*@only@*/ /*@relnull@*/
00206     const char * posttransprog;
00207 /*@only@*/ /*@relnull@*/
00208     const char * verifyscript;
00209 /*@only@*/ /*@relnull@*/
00210     const char * verifyscriptprog;
00211 
00212 /*@only@*/ /*@null@*/
00213     char * fn;                  
00214     size_t fnlen;               
00216     size_t astriplen;
00217     size_t striplen;
00218     unsigned long long archivePos;
00219     unsigned long long archiveSize;
00220     mode_t dperms;              
00221     mode_t fperms;              
00222 /*@only@*/ /*@null@*/
00223     const char ** apath;
00224     int mapflags;
00225 /*@owned@*/ /*@null@*/
00226     int * fmapflags;
00227 /*@owned@*/
00228     void * fsm;                 
00229     rpmuint32_t color;          
00231     int isSource;               
00233 /*@owned@*/
00234     rpmuint32_t * replacedSizes;
00236     unsigned int record;        
00237     int magic;
00238 #define RPMFIMAGIC      0x09697923
00239 /*=============================*/
00240 #if defined(__LCLINT__)
00241 /*@refs@*/
00242     int nrefs;                  
00243 #endif
00244 };
00245 
00246 #endif  /* _RPMFI_INTERNAL */
00247 
00248 #ifdef __cplusplus
00249 extern "C" {
00250 #endif
00251 
00252 #if !defined(_RPMFI_NOMETHODS)
00253 
00255 
00262 /*@unused@*/ /*@null@*/
00263 rpmfi rpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi,
00264                 /*@null@*/ const char * msg)
00265         /*@modifies fi @*/;
00266 #define rpmfiUnlink(_fi, _msg)  \
00267     ((rpmfi) rpmioUnlinkPoolItem((rpmioItem)(_fi), _msg, __FILE__, __LINE__))
00268 
00275 /*@unused@*/ /*@null@*/
00276 rpmfi rpmfiLink (/*@null@*/ rpmfi fi, /*@null@*/ const char * msg)
00277         /*@modifies fi @*/;
00278 #define rpmfiLink(_fi, _msg)    \
00279     ((rpmfi) rpmioLinkPoolItem((rpmioItem)(_fi), _msg, __FILE__, __LINE__))
00280 
00286 int rpmfiFC(/*@null@*/ rpmfi fi)
00287         /*@*/;
00288 
00294 /*@unused@*/
00295 int rpmfiFX(/*@null@*/ rpmfi fi)
00296         /*@*/;
00297 
00304 /*@unused@*/
00305 int rpmfiSetFX(/*@null@*/ rpmfi fi, int fx)
00306         /*@modifies fi @*/;
00307 
00313 int rpmfiDC(/*@null@*/ rpmfi fi)
00314         /*@*/;
00315 
00321 int rpmfiDX(/*@null@*/ rpmfi fi)
00322         /*@*/;
00323 
00330 int rpmfiSetDX(/*@null@*/ rpmfi fi, int dx)
00331         /*@modifies fi @*/;
00332 
00338 int rpmfiIsSource(/*@null@*/ rpmfi fi)
00339         /*@*/;
00340 
00346 /*@observer@*/ /*@null@*/
00347 extern const char * rpmfiBN(/*@null@*/ rpmfi fi)
00348         /*@*/;
00349 
00355 /*@observer@*/ /*@null@*/
00356 extern const char * rpmfiDN(/*@null@*/ rpmfi fi)
00357         /*@*/;
00358 
00364 /*@observer@*/
00365 extern const char * rpmfiFN(/*@null@*/ rpmfi fi)
00366         /*@modifies fi @*/;
00367 
00373 extern size_t rpmfiFNMaxLen(/*@null@*/ rpmfi fi)
00374         /*@*/;
00375 
00381 rpmuint32_t rpmfiFFlags(/*@null@*/ rpmfi fi)
00382         /*@*/;
00383 
00390 rpmuint32_t rpmfiSetFFlags(/*@null@*/ rpmfi fi, rpmuint32_t FFlags)
00391         /*@modifies fi @*/;
00392 
00398 rpmuint32_t rpmfiVFlags(/*@null@*/ rpmfi fi)
00399         /*@*/;
00400 
00407 rpmuint32_t rpmfiSetVFlags(/*@null@*/ rpmfi fi, rpmuint32_t VFlags)
00408         /*@modifies fi @*/;
00409 
00415 rpmuint16_t rpmfiFMode(/*@null@*/ rpmfi fi)
00416         /*@*/;
00417 
00423 rpmfileState rpmfiFState(/*@null@*/ rpmfi fi)
00424         /*@*/;
00425 
00432 rpmfileState rpmfiSetFState(/*@null@*/ rpmfi fi, rpmfileState fstate)
00433         /*@modifies fi @*/;
00434 
00442 /*@observer@*/ /*@null@*/
00443 extern const unsigned char * rpmfiDigest(/*@null@*/ rpmfi fi,
00444                 /*@out@*/ /*@null@*/ int * algop,
00445                 /*@out@*/ /*@null@*/ size_t * lenp)
00446         /*@modifies *algop, *lenp @*/;
00447 
00453 /*@observer@*/ /*@null@*/
00454 extern const char * rpmfiFLink(/*@null@*/ rpmfi fi)
00455         /*@*/;
00456 
00462 rpmuint32_t rpmfiFSize(/*@null@*/ rpmfi fi)
00463         /*@*/;
00464 
00470 rpmuint16_t rpmfiFRdev(/*@null@*/ rpmfi fi)
00471         /*@*/;
00472 
00478 rpmuint32_t rpmfiFInode(/*@null@*/ rpmfi fi)
00479         /*@*/;
00480 
00486 rpmuint32_t rpmfiColor(/*@null@*/ rpmfi fi)
00487         /*@*/;
00488 
00494 rpmuint32_t rpmfiFColor(/*@null@*/ rpmfi fi)
00495         /*@*/;
00496 
00502 /*@-exportlocal@*/
00503 /*@observer@*/ /*@null@*/
00504 extern const char * rpmfiFClass(/*@null@*/ rpmfi fi)
00505         /*@*/;
00506 /*@=exportlocal@*/
00507 
00513 /*@-exportlocal@*/
00514 /*@observer@*/ /*@null@*/
00515 extern const char * rpmfiFContext(/*@null@*/ rpmfi fi)
00516         /*@*/;
00517 /*@=exportlocal@*/
00518 
00525 rpmuint32_t rpmfiFDepends(/*@null@*/ rpmfi fi,
00526                 /*@out@*/ /*@null@*/ const rpmuint32_t ** fddictp)
00527         /*@modifies *fddictp @*/;
00528 
00534 rpmuint32_t rpmfiFNlink(/*@null@*/ rpmfi fi)
00535         /*@*/;
00536 
00542 rpmuint32_t rpmfiFMtime(/*@null@*/ rpmfi fi)
00543         /*@*/;
00544 
00550 /*@observer@*/ /*@null@*/
00551 extern const char * rpmfiFUser(/*@null@*/ rpmfi fi)
00552         /*@*/;
00553 
00559 /*@observer@*/ /*@null@*/
00560 extern const char * rpmfiFGroup(/*@null@*/ rpmfi fi)
00561         /*@*/;
00562 
00568 void * rpmfiBloomFN(/*@null@*/ const rpmfi fi)
00569         /*@*/;
00570 
00576 /*@null@*/
00577 void * rpmfiExclude(/*@null@*/ const rpmfi fi)
00578         /*@*/;
00579 
00585 int rpmfiNExclude(/*@null@*/ const rpmfi fi)
00586         /*@*/;
00587 
00593 /*@null@*/
00594 void * rpmfiInclude(/*@null@*/ const rpmfi fi)
00595         /*@*/;
00596 
00602 int rpmfiNInclude(/*@null@*/ const rpmfi fi)
00603         /*@*/;
00604 
00605 #if defined(_RPMFI_INTERNAL)
00606 #include "fprint.h"
00613 /*@null@*/
00614 struct fingerPrint_s * rpmfiFpsIndex(rpmfi fi, int ix)
00615         /*@*/;
00616 
00617 void rpmfiFpLookup(rpmfi fi, fingerPrintCache fpc)
00618         /*@modifies fi, fpc @*/;
00619 #endif
00620 
00626 /*@null@*/
00627 void * rpmfiFNBF(rpmfi fi)
00628         /*@*/;
00629 
00635 int rpmfiNext(/*@null@*/ rpmfi fi)
00636         /*@modifies fi @*/;
00637 
00644 /*@null@*/
00645 rpmfi rpmfiInit(/*@null@*/ rpmfi fi, int fx)
00646         /*@modifies fi @*/;
00647 
00653 /*@unused@*/
00654 int rpmfiNextD(/*@null@*/ rpmfi fi)
00655         /*@modifies fi @*/;
00656 
00663 /*@unused@*/ /*@null@*/
00664 rpmfi rpmfiInitD(/*@null@*/ rpmfi fi, int dx)
00665         /*@modifies fi @*/;
00666 
00673 int rpmfiSetHeader(rpmfi fi, /*@null@*/ Header h)
00674         /*@modifies fi, h @*/;
00675 
00681 /*@null@*/
00682 rpmfi rpmfiFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi)
00683         /*@globals fileSystem @*/
00684         /*@modifies fi, fileSystem @*/;
00685 #define rpmfiFree(_fi)  \
00686     ((rpmfi) rpmioFreePoolItem((rpmioItem)(_fi), __FUNCTION__, __FILE__, __LINE__))
00687 
00696 /*@null@*/
00697 rpmfi rpmfiNew(/*@null@*/ const void * _ts, Header h, rpmTag tagN, int flags)
00698         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00699         /*@modifies _ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
00700 
00707 int rpmfiFStat(rpmfi fi, /*@out@*/ struct stat * st)
00708         /*@modifies *st @*/;
00709 
00717 int rpmfiStat(rpmfi fi, const char * path, /*@out@*/ struct stat * st)
00718         /*@modifies fi, *st @*/;
00719 
00726 /*@null@*/
00727 void * rpmfiOpendir(rpmfi fi, const char * name)
00728         /*@globals fileSystem, internalState @*/
00729         /*@modifies fi, fileSystem, internalState @*/;
00730 
00740 void rpmfiBuildFClasses(Header h,
00741                 /*@out@*/ const char *** fclassp, /*@out@*/ rpmuint32_t * fcp)
00742         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00743         /*@modifies h, *fclassp, *fcp, rpmGlobalMacroContext,
00744                 fileSystem, internalState @*/;
00745 
00746 #ifdef  DYING
00747 
00756 void rpmfiBuildFContexts(Header h,
00757                 /*@out@*/ const char *** fcontextp, /*@out@*/ rpmuint32_t * fcp)
00758         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00759         /*@modifies h, *fcontextp, *fcp, rpmGlobalMacroContext,
00760                 fileSystem, internalState @*/;
00761 
00771 void rpmfiBuildFSContexts(Header h,
00772                 /*@out@*/ const char *** fcontextp, /*@out@*/ rpmuint32_t * fcp)
00773         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00774         /*@modifies h, *fcontextp, *fcp, rpmGlobalMacroContext,
00775                 fileSystem, internalState @*/;
00776 
00786 void rpmfiBuildREContexts(Header h,
00787                 /*@out@*/ const char *** fcontextp, /*@out@*/ rpmuint32_t * fcp)
00788         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00789         /*@modifies h, *fcontextp, *fcp, rpmGlobalMacroContext,
00790                 fileSystem, internalState @*/;
00791 #endif
00792 
00803 void rpmfiBuildFDeps(Header h, rpmTag tagN,
00804                 /*@out@*/ const char *** fdepsp, /*@out@*/ rpmuint32_t * fcp)
00805         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00806         /*@modifies h, *fdepsp, *fcp,
00807                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00808 
00815 int rpmfiCompare(const rpmfi afi, const rpmfi bfi)
00816         /*@*/;
00817 
00825 int rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing)
00826         /*@globals h_errno, fileSystem, internalState @*/
00827         /*@modifies nfi, fileSystem, internalState @*/;
00828 
00834 /*@-redef@*/
00835 /*@observer@*/
00836 const char * rpmfiTypeString(rpmfi fi)
00837         /*@*/;
00838 /*@=redef@*/
00839 
00845 /*@null@*/
00846 rpmRelocation rpmfiFreeRelocations(/*@only@*/ rpmRelocation relocs)
00847         /*@modifies relocs@*/;
00848 
00855 /*@only@*/ /*@null@*/
00856 rpmRelocation rpmfiDupeRelocations(rpmRelocation relocs, int * nrelocsp)
00857         /*@modifies *nrelocsp @*/;
00858 
00867 int rpmfiAddRelocation(rpmRelocation * relp, int * nrelp,
00868                 const char * oldPath, const char * newPath)
00869         /*@modifies *relp, *nrelp @*/;
00870 
00872 #endif  /* _RPMFI_NOMETHODS */
00873 
00874 #ifdef __cplusplus
00875 }
00876 #endif
00877 
00878 #endif  /* H_RPMDS */