Add rpmteHeaderSize
authorFlorian Festi <ffesti@redhat.com>
Tue, 2 Feb 2010 10:12:07 +0000 (11:12 +0100)
committerFlorian Festi <ffesti@redhat.com>
Fri, 5 Feb 2010 11:38:56 +0000 (12:38 +0100)
lib/rpmte.c
lib/rpmte_internal.h

index b09556c..ed07ec5 100644 (file)
@@ -51,6 +51,7 @@ struct rpmte_s {
 
     rpm_color_t color;         /*!< Color bit(s) from package dependencies. */
     rpm_loff_t pkgFileSize;    /*!< No. of bytes in package file (approx). */
+    rpm_loff_t headerSize;     /*!< No. of bytes in package header */
 
     fnpyKey key;               /*!< (TR_ADDED) Retrieval key. */
     rpmRelocation * relocs;    /*!< (TR_ADDED) Payload file relocations. */
@@ -252,6 +253,7 @@ static void addTE(rpmte p, Header h, fnpyKey key, rpmRelocation * relocs)
     p->fd = NULL;
 
     p->pkgFileSize = 0;
+    p->headerSize = headerSizeof(h, HEADER_MAGIC_NO);
 
     p->this = rpmdsThis(h, RPMTAG_PROVIDENAME, RPMSENSE_EQUAL);
     p->provides = rpmdsNew(h, RPMTAG_PROVIDENAME, 0);
@@ -401,6 +403,10 @@ rpm_loff_t rpmtePkgFileSize(rpmte te)
     return (te != NULL ? te->pkgFileSize : 0);
 }
 
+rpm_loff_t rpmteHeaderSize(rpmte te) {
+    return (te != NULL ? te->headerSize : 0);
+}
+
 rpmte rpmteParent(rpmte te)
 {
     return (te != NULL ? te->parent : NULL);
index 357eead..4e43d5a 100644 (file)
@@ -119,5 +119,13 @@ void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action);
 RPM_GNUC_INTERNAL
 void rpmRelocateFileList(rpmRelocation *relocs, int numRelocations, rpmfs fs, Header h);
 
+/** \ingroup rpmte
+ * Retrieve size in bytes of package header.
+ * @param te           transaction element
+ * @return             size in bytes of package file.
+ */
+RPM_GNUC_INTERNAL
+rpm_loff_t rpmteHeaderSize(rpmte te);
+
 #endif /* _RPMTE_INTERNAL_H */