rpm 5.2.1

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

- File List
- Globals

rpmdb/header_internal.h
Go to the documentation of this file.

    00001 #ifndef H_HEADER_INTERNAL
    00002 #define H_HEADER_INTERNAL
    00003
    00008 #include <rpmtag.h>
    00009 #include <yarn.h>
    00010
    00011 #if !defined(__LCLINT__)
    00012 #include <netinet/in.h>
    00013 #endif  /* __LCLINT__ */
    00014
    00019 #define hdrchkTags(_ntags)      ((_ntags) & 0xff000000)
    00020
    00024 #define hdrchkType(_type) ((_type) < RPM_MIN_TYPE || (_type) > RPM_MAX_TYPE)
    00025
    00030 #define hdrchkData(_nbytes) ((_nbytes) & 0xc0000000)
    00031
    00035 /*@unchecked@*/ /*@observer@*/
    00036 extern int rpm_typeAlign[16];
    00037 #define hdrchkAlign(_type, _off)        ((_off) & (rpm_typeAlign[_type]-1))
    00038
    00042 #define hdrchkRange(_dl, _off)          ((_off) < 0 || (_off) > (_dl))
    00043
    00044 #define INDEX_MALLOC_SIZE       8
    00045
    00046 /*
    00047  * Teach header.c about legacy tags.
    00048  */
    00049 #define HEADER_OLDFILENAMES     1027
    00050 #define HEADER_BASENAMES        1117
    00051
    00055 typedef /*@abstract@*/ struct entryInfo_s * entryInfo;
    00056 struct entryInfo_s {
    00057     rpmTag tag;
    00058     rpmTagType type;
    00059     rpmint32_t offset;
    00060     rpmTagCount count;
    00061 };
    00062
    00063 #define REGION_TAG_TYPE         RPM_BIN_TYPE
    00064 #define REGION_TAG_COUNT        sizeof(struct entryInfo_s)
    00065
    00066 #define ENTRY_IS_REGION(_e) \
    00067         (((_e)->info.tag >= HEADER_IMAGE) && ((_e)->info.tag < HEADER_REGIONS))
    00068 #define ENTRY_IN_REGION(_e)     ((_e)->info.offset < 0)
    00069
    00073 typedef /*@abstract@*/ struct indexEntry_s * indexEntry;
    00074 struct indexEntry_s {
    00075     struct entryInfo_s info;
    00076 /*@owned@*/
    00077     void * data;
    00078     size_t length;
    00079     size_t rdlen;
    00080 };
    00081
    00085 struct headerToken_s {
    00086     struct rpmioItem_s _item;
    00087     unsigned char magic[8];
    00088 /*@only@*/ /*@null@*/
    00089     void * blob;
    00090     size_t bloblen;
    00091 /*@only@*/ /*@null@*/
    00092     const char * origin;
    00093 /*@only@*/ /*@null@*/
    00094     const char * baseurl;
    00095 /*@only@*/ /*@null@*/
    00096     const char * digest;
    00097 /*@null@*/
    00098     void * rpmdb;
    00099     struct stat sb;
    00100     rpmuint32_t instance;
    00101     rpmuint32_t startoff;
    00102     rpmuint32_t endoff;
    00103     struct rpmop_s h_loadops;
    00104     struct rpmop_s h_getops;
    00105 /*@owned@*/
    00106     indexEntry index;
    00107     size_t indexUsed;
    00108     size_t indexAlloced;
    00109     rpmuint32_t flags;
    00110 #define HEADERFLAG_SORTED       (1 << 0)
    00111 #define HEADERFLAG_ALLOCATED    (1 << 1)
    00112 #define HEADERFLAG_LEGACY       (1 << 2)
    00113 #define HEADERFLAG_DEBUG        (1 << 3)
    00114 #define HEADERFLAG_SIGNATURE    (1 << 4)
    00115 #define HEADERFLAG_MAPPED       (1 << 5)
    00116 #define HEADERFLAG_RDONLY       (1 << 6)
    00117 #if defined(__LCLINT__)
    00118 /*@refs@*/
    00119     int nrefs;
    00120 #endif
    00121 };
    00122
    00123 #ifdef __cplusplus
    00124 extern "C" {
    00125 #endif
    00126
    00136 int headerVerifyInfo(rpmuint32_t il, rpmuint32_t dl, const void * pev, void * iv, int negate)
    00137         /*@modifies *iv @*/;
    00138
    00144 /*@-type@*/ /* FIX: cast? */
    00145 /*@unused@*/ static inline
    00146 int headerUsageCount(Header h)
    00147         /*@globals fileSystem, internalState @*/
    00148         /*@modifies fileSystem, internalState @*/
    00149 {
    00150     int nrefs = 0;
    00151     yarnPossess(h->_item.use);
    00152     nrefs = (int)yarnPeekLock(h->_item.use);
    00153     yarnRelease(h->_item.use);
    00154     return nrefs;
    00155 }
    00156 /*@=type@*/
    00157
    00158 #ifdef __cplusplus
    00159 }
    00160 #endif
    00161
    00162 #endif  /* H_HEADER_INTERNAL */