- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# 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 } rpmfileAttrs;
    00070
    00071 #define RPMFILE_SPOOK   (RPMFILE_GHOST|RPMFILE_TYPED)
    00072 #define RPMFILE_ALL     ~(RPMFILE_NONE)
    00073
    00077 typedef enum fileAction_e {
    00078     FA_UNKNOWN = 0,
    00079     FA_CREATE,
    00080     FA_COPYIN,
    00081     FA_COPYOUT,
    00082     FA_BACKUP,
    00083     FA_SAVE,
    00084     FA_SKIP,
    00085     FA_ALTNAME,
    00086     FA_ERASE,
    00087     FA_SKIPNSTATE,
    00088     FA_SKIPNETSHARED,
    00089     FA_SKIPCOLOR
    00090 } fileAction;
    00091
    00092 #if defined(_RPMFI_INTERNAL)
    00093 #define XFA_SKIPPING(_a)        \
    00094     ((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPCOLOR)
    00095
    00099 struct rpmfi_s {
    00100     int i;
    00101     int j;
    00103 /*@observer@*/
    00104     const char * Type;
    00106     rpmTag tagN;
    00107 /*@refcounted@*/ /*@null@*/
    00108     Header h;
    00110 /*@only@*/ /*?null?*/
    00111     const char ** bnl;
    00112 /*@only@*/ /*?null?*/
    00113     const char ** dnl;
    00115 /*@only@*/ /*@relnull@*/
    00116     const char ** fdigests;
    00117 /*@only@*/ /*@null@*/
    00118     uint32_t * fdigestalgos;
    00119 /*@only@*/ /*@relnull@*/
    00120     const char ** flinks;
    00121 /*@only@*/ /*@null@*/
    00122     const char ** flangs;
    00124 /*@only@*/ /*@relnull@*/
    00125           uint32_t * dil;
    00126 /*@only@*/ /*?null?*/
    00127     const uint32_t * fflags;
    00128 /*@only@*/ /*?null?*/
    00129     const uint32_t * fsizes;
    00130 /*@only@*/ /*?null?*/
    00131     const uint32_t * fmtimes;
    00132 /*@only@*/ /*?null?*/
    00133           uint16_t * fmodes;
    00134 /*@only@*/ /*?null?*/
    00135     const uint16_t * frdevs;
    00136 /*@only@*/ /*?null?*/
    00137     const uint32_t * finodes;
    00139 /*@only@*/ /*@null@*/
    00140     const char ** fuser;
    00141 /*@only@*/ /*@null@*/
    00142     const char ** fgroup;
    00144 /*@only@*/ /*@null@*/
    00145     uint8_t * fstates;
    00147 /*@only@*/ /*@null@*/
    00148     const uint32_t * fcolors;
    00150 /*@only@*/ /*@null@*/
    00151     const char ** fcontexts;
    00153 /*@only@*/ /*@null@*/
    00154     const char ** cdict;
    00155     uint32_t ncdict;
    00156 /*@only@*/ /*@null@*/
    00157     const uint32_t * fcdictx;
    00159 /*@only@*/ /*@null@*/
    00160     const uint32_t * ddict;
    00161     uint32_t nddict;
    00162 /*@only@*/ /*@null@*/
    00163     const uint32_t * fddictx;
    00164 /*@only@*/ /*@null@*/
    00165     const uint32_t * fddictn;
    00167 /*@only@*/ /*?null?*/
    00168     const uint32_t * vflags;
    00170     uint32_t dc;
    00171     uint32_t fc;
    00173 /*=============================*/
    00174 /*@dependent@*/ /*@relnull@*/
    00175     rpmte te;
    00176
    00177 /*-----------------------------*/
    00178     uid_t uid;
    00179     gid_t gid;
    00180     uint32_t flags;
    00181     fileAction action;
    00182 /*@owned@*/ /*@relnull@*/
    00183     fileAction * actions;
    00184 /*@owned@*/
    00185     struct fingerPrint_s * fps;
    00186 /*@owned@*/
    00187     const char ** obnl;
    00188 /*@owned@*/
    00189     const char ** odnl;
    00190 /*@unused@*/
    00191     uint32_t * odil;
    00193 /*@only@*/ /*@relnull@*/
    00194     unsigned char * digests;
    00195     uint32_t digestalgo;
    00196     uint32_t digestlen;
    00198 /*@only@*/ /*@relnull@*/
    00199     const char * pretrans;
    00200 /*@only@*/ /*@relnull@*/
    00201     const char * pretransprog;
    00202 /*@only@*/ /*@relnull@*/
    00203     const char * posttrans;
    00204 /*@only@*/ /*@relnull@*/
    00205     const char * posttransprog;
    00206 /*@only@*/ /*@relnull@*/
    00207     const char * verifyscript;
    00208 /*@only@*/ /*@relnull@*/
    00209     const char * verifyscriptprog;
    00210
    00211 /*@only@*/ /*@null@*/
    00212     char * fn;
    00213     size_t fnlen;
    00215     size_t astriplen;
    00216     size_t striplen;
    00217     unsigned long long archivePos;
    00218     unsigned long long archiveSize;
    00219     mode_t dperms;
    00220     mode_t fperms;
    00221 /*@only@*/ /*@null@*/
    00222     const char ** apath;
    00223     int mapflags;
    00224 /*@owned@*/ /*@null@*/
    00225     int * fmapflags;
    00226 /*@owned@*/
    00227     FSM_t fsm;
    00228     uint32_t color;
    00230     int isSource;
    00232 /*@owned@*/
    00233     uint32_t * replacedSizes;
    00235     unsigned int record;
    00236     int magic;
    00237 #define RPMFIMAGIC      0x09697923
    00238 /*=============================*/
    00239
    00240 /*@refs@*/ int nrefs;
    00241 };
    00242
    00243 #endif  /* _RPMFI_INTERNAL */
    00244
    00245 #ifdef __cplusplus
    00246 extern "C" {
    00247 #endif
    00248
    00251
    00258 /*@unused@*/ /*@null@*/
    00259 rpmfi rpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi,
    00260                 /*@null@*/ const char * msg)
    00261         /*@modifies fi @*/;
    00262
    00270 /*@-exportlocal@*/
    00271 /*@null@*/
    00272 rpmfi XrpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi,
    00273                 /*@null@*/ const char * msg, const char * fn, unsigned ln)
    00274         /*@modifies fi @*/;
    00275 /*@=exportlocal@*/
    00276 #define rpmfiUnlink(_fi, _msg) XrpmfiUnlink(_fi, _msg, __FILE__, __LINE__)
    00277
    00284 /*@unused@*/ /*@null@*/
    00285 rpmfi rpmfiLink (/*@null@*/ rpmfi fi, /*@null@*/ const char * msg)
    00286         /*@modifies fi @*/;
    00287
    00295 /*@null@*/
    00296 rpmfi XrpmfiLink (/*@null@*/ rpmfi fi, /*@null@*/ const char * msg,
    00297                 const char * fn, unsigned ln)
    00298         /*@modifies fi @*/;
    00299 #define rpmfiLink(_fi, _msg)    XrpmfiLink(_fi, _msg, __FILE__, __LINE__)
    00300
    00306 int rpmfiFC(/*@null@*/ rpmfi fi)
    00307         /*@*/;
    00308
    00314 /*@unused@*/
    00315 int rpmfiFX(/*@null@*/ rpmfi fi)
    00316         /*@*/;
    00317
    00324 /*@unused@*/
    00325 int rpmfiSetFX(/*@null@*/ rpmfi fi, int fx)
    00326         /*@modifies fi @*/;
    00327
    00333 int rpmfiDC(/*@null@*/ rpmfi fi)
    00334         /*@*/;
    00335
    00341 int rpmfiDX(/*@null@*/ rpmfi fi)
    00342         /*@*/;
    00343
    00350 int rpmfiSetDX(/*@null@*/ rpmfi fi, int dx)
    00351         /*@modifies fi @*/;
    00352
    00358 int rpmfiIsSource(/*@null@*/ rpmfi fi)
    00359         /*@*/;
    00360
    00366 /*@observer@*/ /*@null@*/
    00367 extern const char * rpmfiBN(/*@null@*/ rpmfi fi)
    00368         /*@*/;
    00369
    00375 /*@observer@*/ /*@null@*/
    00376 extern const char * rpmfiDN(/*@null@*/ rpmfi fi)
    00377         /*@*/;
    00378
    00384 /*@observer@*/
    00385 extern const char * rpmfiFN(/*@null@*/ rpmfi fi)
    00386         /*@modifies fi @*/;
    00387
    00393 uint32_t rpmfiFFlags(/*@null@*/ rpmfi fi)
    00394         /*@*/;
    00395
    00402 uint32_t rpmfiSetFFlags(/*@null@*/ rpmfi fi, uint32_t FFlags)
    00403         /*@modifies fi @*/;
    00404
    00410 uint32_t rpmfiVFlags(/*@null@*/ rpmfi fi)
    00411         /*@*/;
    00412
    00419 uint32_t rpmfiSetVFlags(/*@null@*/ rpmfi fi, uint32_t VFlags)
    00420         /*@modifies fi @*/;
    00421
    00427 uint16_t rpmfiFMode(/*@null@*/ rpmfi fi)
    00428         /*@*/;
    00429
    00435 rpmfileState rpmfiFState(/*@null@*/ rpmfi fi)
    00436         /*@*/;
    00437
    00444 rpmfileState rpmfiSetFState(/*@null@*/ rpmfi fi, rpmfileState fstate)
    00445         /*@modifies fi @*/;
    00446
    00454 /*@observer@*/ /*@null@*/
    00455 extern const unsigned char * rpmfiDigest(/*@null@*/ rpmfi fi,
    00456                 /*@out@*/ /*@null@*/ int * algop,
    00457                 /*@out@*/ /*@null@*/ size_t * lenp)
    00458         /*@modifies *algop, *lenp @*/;
    00459
    00465 /*@observer@*/ /*@null@*/
    00466 extern const char * rpmfiFLink(/*@null@*/ rpmfi fi)
    00467         /*@*/;
    00468
    00474 uint32_t rpmfiFSize(/*@null@*/ rpmfi fi)
    00475         /*@*/;
    00476
    00482 uint16_t rpmfiFRdev(/*@null@*/ rpmfi fi)
    00483         /*@*/;
    00484
    00490 uint32_t rpmfiFInode(/*@null@*/ rpmfi fi)
    00491         /*@*/;
    00492
    00498 uint32_t rpmfiColor(/*@null@*/ rpmfi fi)
    00499         /*@*/;
    00500
    00506 uint32_t rpmfiFColor(/*@null@*/ rpmfi fi)
    00507         /*@*/;
    00508
    00514 /*@-exportlocal@*/
    00515 /*@observer@*/ /*@null@*/
    00516 extern const char * rpmfiFClass(/*@null@*/ rpmfi fi)
    00517         /*@*/;
    00518 /*@=exportlocal@*/
    00519
    00525 /*@-exportlocal@*/
    00526 /*@observer@*/ /*@null@*/
    00527 extern const char * rpmfiFContext(/*@null@*/ rpmfi fi)
    00528         /*@*/;
    00529 /*@=exportlocal@*/
    00530
    00537 uint32_t rpmfiFDepends(/*@null@*/ rpmfi fi,
    00538                 /*@out@*/ /*@null@*/ const uint32_t ** fddictp)
    00539         /*@modifies *fddictp @*/;
    00540
    00546 uint32_t rpmfiFNlink(/*@null@*/ rpmfi fi)
    00547         /*@*/;
    00548
    00554 uint32_t rpmfiFMtime(/*@null@*/ rpmfi fi)
    00555         /*@*/;
    00556
    00562 /*@observer@*/ /*@null@*/
    00563 extern const char * rpmfiFUser(/*@null@*/ rpmfi fi)
    00564         /*@*/;
    00565
    00571 /*@observer@*/ /*@null@*/
    00572 extern const char * rpmfiFGroup(/*@null@*/ rpmfi fi)
    00573         /*@*/;
    00574
    00580 int rpmfiNext(/*@null@*/ rpmfi fi)
    00581         /*@modifies fi @*/;
    00582
    00589 /*@null@*/
    00590 rpmfi rpmfiInit(/*@null@*/ rpmfi fi, int fx)
    00591         /*@modifies fi @*/;
    00592
    00598 /*@unused@*/
    00599 int rpmfiNextD(/*@null@*/ rpmfi fi)
    00600         /*@modifies fi @*/;
    00601
    00608 /*@unused@*/ /*@null@*/
    00609 rpmfi rpmfiInitD(/*@null@*/ rpmfi fi, int dx)
    00610         /*@modifies fi @*/;
    00611
    00617 /*@null@*/
    00618 rpmfi rpmfiFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi)
    00619         /*@globals fileSystem @*/
    00620         /*@modifies fi, fileSystem @*/;
    00621
    00630 /*@null@*/
    00631 rpmfi rpmfiNew(/*@null@*/ const rpmts ts, Header h, rpmTag tagN, int flags)
    00632         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00633         /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00634
    00644 void rpmfiBuildFClasses(Header h,
    00645                 /*@out@*/ const char *** fclassp, /*@out@*/ uint32_t * fcp)
    00646         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00647         /*@modifies h, *fclassp, *fcp, rpmGlobalMacroContext,
    00648                 fileSystem, internalState @*/;
    00649
    00659 void rpmfiBuildFContexts(Header h,
    00660                 /*@out@*/ const char *** fcontextp, /*@out@*/ uint32_t * fcp)
    00661         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00662         /*@modifies h, *fcontextp, *fcp, rpmGlobalMacroContext,
    00663                 fileSystem, internalState @*/;
    00664
    00674 void rpmfiBuildFSContexts(Header h,
    00675                 /*@out@*/ const char *** fcontextp, /*@out@*/ uint32_t * fcp)
    00676         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00677         /*@modifies h, *fcontextp, *fcp, rpmGlobalMacroContext,
    00678                 fileSystem, internalState @*/;
    00679
    00689 void rpmfiBuildREContexts(Header h,
    00690                 /*@out@*/ const char *** fcontextp, /*@out@*/ uint32_t * fcp)
    00691         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00692         /*@modifies h, *fcontextp, *fcp, rpmGlobalMacroContext,
    00693                 fileSystem, internalState @*/;
    00694
    00705 void rpmfiBuildFDeps(Header h, rpmTag tagN,
    00706                 /*@out@*/ const char *** fdepsp, /*@out@*/ uint32_t * fcp)
    00707         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00708         /*@modifies h, *fdepsp, *fcp,
    00709                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00710
    00717 int rpmfiCompare(const rpmfi afi, const rpmfi bfi)
    00718         /*@*/;
    00719
    00727 fileAction rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing)
    00728         /*@globals h_errno, fileSystem, internalState @*/
    00729         /*@modifies nfi, fileSystem, internalState @*/;
    00730
    00736 /*@-redef@*/
    00737 /*@observer@*/
    00738 const char * rpmfiTypeString(rpmfi fi)
    00739         /*@*/;
    00740 /*@=redef@*/
    00741
    00744 #ifdef __cplusplus
    00745 }
    00746 #endif
    00747
    00748 #endif  /* H_RPMDS */