summaryrefslogtreecommitdiff
path: root/lib/header.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-12-22 13:25:48 +0200
committerPanu Matilainen <pmatilai@redhat.com>2009-12-22 13:25:48 +0200
commitcef9afbf2ab652e3a8d9f1aa96d517036408d81b (patch)
tree3300579b1b0dfe5186b73f87b0d672f36da99eee /lib/header.c
parenta14d06482a667441b47bdf4a6e76e751b99389ee (diff)
downloadlibrpm-tizen-cef9afbf2ab652e3a8d9f1aa96d517036408d81b.tar.gz
librpm-tizen-cef9afbf2ab652e3a8d9f1aa96d517036408d81b.tar.bz2
librpm-tizen-cef9afbf2ab652e3a8d9f1aa96d517036408d81b.zip
Make header struct really opaque outside header.c
- the low-level stuff in signature.c and package.c need entryInfo_s and indexEntry_s but not the header itself - also move the other defines which have no use outside header.c there
Diffstat (limited to 'lib/header.c')
-rw-r--r--lib/header.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/header.c b/lib/header.c
index 893d6f910..5f9baebdc 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -68,11 +68,37 @@ static const int typeSizes[16] = {
0
};
+typedef enum headerFlags_e {
+ HEADERFLAG_SORTED = (1 << 0), /*!< Are header entries sorted? */
+ HEADERFLAG_ALLOCATED = (1 << 1), /*!< Is 1st header region allocated? */
+ HEADERFLAG_LEGACY = (1 << 2), /*!< Header came from legacy source? */
+ HEADERFLAG_DEBUG = (1 << 3), /*!< Debug this header? */
+} headerFlags;
+
+/** \ingroup header
+ * The Header data structure.
+ */
+struct headerToken_s {
+ void * blob; /*!< Header region blob. */
+ indexEntry index; /*!< Array of tags. */
+ int indexUsed; /*!< Current size of tag array. */
+ int indexAlloced; /*!< Allocated size of tag array. */
+ unsigned int instance; /*!< Rpmdb instance (offset) */
+ headerFlags flags;
+ int nrefs; /*!< Reference count. */
+};
+
/** \ingroup header
* Maximum no. of bytes permitted in a header.
*/
static const size_t headerMaxbytes = (32*1024*1024);
+#define INDEX_MALLOC_SIZE 8
+
+#define ENTRY_IS_REGION(_e) \
+ (((_e)->info.tag >= HEADER_IMAGE) && ((_e)->info.tag < HEADER_REGIONS))
+#define ENTRY_IN_REGION(_e) ((_e)->info.offset < 0)
+
/** \ingroup header
* HEADER_EXT_TAG format function prototype.
* This is allowed to fail, which indicates the tag doesn't exist.