rpm  5.2.1
header_internal.h
Go to the documentation of this file.
1 #ifndef H_HEADER_INTERNAL
2 #define H_HEADER_INTERNAL
3 
8 #include <rpmtag.h>
9 #include <yarn.h>
10 
11 #if !defined(__LCLINT__)
12 #include <netinet/in.h>
13 #endif /* __LCLINT__ */
14 
19 #define hdrchkTags(_ntags) ((_ntags) & 0xff000000)
20 
24 #define hdrchkType(_type) ((_type) < RPM_MIN_TYPE || (_type) > RPM_MAX_TYPE)
25 
30 #define hdrchkData(_nbytes) ((_nbytes) & 0xc0000000)
31 
35 /*@unchecked@*/ /*@observer@*/
36 extern int rpm_typeAlign[16];
37 #define hdrchkAlign(_type, _off) ((_off) & (rpm_typeAlign[_type]-1))
38 
42 #define hdrchkRange(_dl, _off) ((_off) < 0 || (_off) > (_dl))
43 
44 #define INDEX_MALLOC_SIZE 8
45 
46 /*
47  * Teach header.c about legacy tags.
48  */
49 #define HEADER_OLDFILENAMES 1027
50 #define HEADER_BASENAMES 1117
51 
55 typedef /*@abstract@*/ struct entryInfo_s * entryInfo;
56 struct entryInfo_s {
61 };
62 
63 #define REGION_TAG_TYPE RPM_BIN_TYPE
64 #define REGION_TAG_COUNT sizeof(struct entryInfo_s)
65 
66 #define ENTRY_IS_REGION(_e) \
67  (((_e)->info.tag >= HEADER_IMAGE) && ((_e)->info.tag < HEADER_REGIONS))
68 #define ENTRY_IN_REGION(_e) ((_e)->info.offset < 0)
69 
73 typedef /*@abstract@*/ struct indexEntry_s * indexEntry;
74 struct indexEntry_s {
75  struct entryInfo_s info;
76 /*@owned@*/
77  void * data;
78  size_t length;
79  size_t rdlen;
80 };
81 
85 struct headerToken_s {
86  struct rpmioItem_s _item;
87  unsigned char magic[8];
88 /*@only@*/ /*@null@*/
89  void * blob;
90  size_t bloblen;
91 /*@only@*/ /*@null@*/
92  const char * origin;
93 /*@only@*/ /*@null@*/
94  const char * baseurl;
95 /*@only@*/ /*@null@*/
96  const char * digest;
97 /*@null@*/
98  void * rpmdb;
99  struct stat sb;
105 /*@owned@*/
106  indexEntry index;
107  size_t indexUsed;
108  size_t indexAlloced;
110 #define HEADERFLAG_SORTED (1 << 0)
111 #define HEADERFLAG_ALLOCATED (1 << 1)
112 #define HEADERFLAG_LEGACY (1 << 2)
113 #define HEADERFLAG_DEBUG (1 << 3)
114 #define HEADERFLAG_SIGNATURE (1 << 4)
115 #define HEADERFLAG_MAPPED (1 << 5)
116 #define HEADERFLAG_RDONLY (1 << 6)
117 #if defined(__LCLINT__)
118 /*@refs@*/
119  int nrefs;
120 #endif
121 };
122 
123 #ifdef __cplusplus
124 extern "C" {
125 #endif
126 
136 int headerVerifyInfo(rpmuint32_t il, rpmuint32_t dl, const void * pev, void * iv, int negate)
137  /*@modifies *iv @*/;
138 
144 /*@-type@*/ /* FIX: cast? */
145 /*@unused@*/ static inline
147  /*@globals fileSystem, internalState @*/
148  /*@modifies fileSystem, internalState @*/
149 {
150  int nrefs = 0;
151  yarnPossess(h->_item.use);
152  nrefs = (int)yarnPeekLock(h->_item.use);
153  yarnRelease(h->_item.use);
154  return nrefs;
155 }
156 /*@=type@*/
157 
158 #ifdef __cplusplus
159 }
160 #endif
161 
162 #endif /* H_HEADER_INTERNAL */