summaryrefslogtreecommitdiff
path: root/lib/cpio.h
diff options
context:
space:
mode:
authorFlorian Festi <ffesti@redhat.com>2012-03-22 13:58:02 +0100
committerFlorian Festi <ffesti@redhat.com>2012-03-27 14:12:42 +0200
commit6492aa800f2bb40c4602f4b50e013797a1fb8549 (patch)
treea0cd9a681f7e973d039a4551f8203f22b46dba84 /lib/cpio.h
parentdd05fdd35f680dfff606731a664859ae45762bb1 (diff)
downloadrpm-6492aa800f2bb40c4602f4b50e013797a1fb8549.tar.gz
rpm-6492aa800f2bb40c4602f4b50e013797a1fb8549.tar.bz2
rpm-6492aa800f2bb40c4602f4b50e013797a1fb8549.zip
Untangle lib/fsm.c and lib/cpio.c
Create cpio_t data type that holds the underlaying FD_t instance Move padding and position handling and trailer generation into cpio.c Use only one buffer in the fsm (merging the read and write buffer) Replace the FSM_EAT, FSM_POS, FSM_PAD, FSM_DREAD, FSM_DWRITE states with cpio functions Prepend "rpm" to the cpio function names
Diffstat (limited to 'lib/cpio.h')
-rw-r--r--lib/cpio.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/lib/cpio.h b/lib/cpio.h
index 945318429..206f4b804 100644
--- a/lib/cpio.h
+++ b/lib/cpio.h
@@ -12,8 +12,6 @@
*
*/
-#include "lib/fsm.h"
-
/** \ingroup payload
* @note CPIO_CHECK_ERRNO bit is set only if errno is valid.
*/
@@ -88,17 +86,23 @@ struct cpioCrcPhysicalHeader {
#define PHYS_HDR_SIZE 110 /* Don't depend on sizeof(struct) */
+typedef struct rpmcpio_s * rpmcpio_t;
+
#ifdef __cplusplus
extern "C" {
#endif
/**
- * Write cpio trailer.
- * @retval fsm file path and stat info
- * @return 0 on success
- */
-RPM_GNUC_INTERNAL
-int cpioTrailerWrite(FSM_t fsm);
+ * Create CPIO file object
+ * @param fd file
+ * @param mode XXX
+ * @return CPIO object
+ **/
+rpmcpio_t rpmcpioOpen(FD_t fd, char mode);
+
+int rpmcpioClose(rpmcpio_t cpio);
+
+off_t rpmcpioTell(rpmcpio_t cpio);
/**
* Write cpio header.
@@ -107,7 +111,9 @@ int cpioTrailerWrite(FSM_t fsm);
* @return 0 on success
*/
RPM_GNUC_INTERNAL
-int cpioHeaderWrite(FSM_t fsm, struct stat * st);
+int rpmcpioHeaderWrite(rpmcpio_t cpio, char * path, struct stat * st);
+
+ssize_t rpmcpioWrite(rpmcpio_t cpio, void * buf, size_t size);
/**
* Read cpio header.
@@ -116,7 +122,9 @@ int cpioHeaderWrite(FSM_t fsm, struct stat * st);
* @return 0 on success
*/
RPM_GNUC_INTERNAL
-int cpioHeaderRead(FSM_t fsm, struct stat * st);
+int rpmcpioHeaderRead(rpmcpio_t cpio, char ** path, struct stat * st);
+
+ssize_t rpmcpioRead(rpmcpio_t cpio, void * buf, size_t size);
/** \ingroup payload
* Return formatted error message on payload handling failure.
@@ -124,7 +132,7 @@ int cpioHeaderRead(FSM_t fsm, struct stat * st);
* @return formatted error string
*/
/* XXX should be RPM_GNUC_INTERNAL too but build/pack.c uses */
-const char * cpioStrerror(int rc);
+const char * rpmcpioStrerror(int rc);
#ifdef __cplusplus
}