00001 #ifndef H_CPIO
00002 #define H_CPIO
00003
00015 #include <zlib.h>
00016 #include <sys/types.h>
00017
00018 #include <rpmio_internal.h>
00019
00024 #define CPIOERR_CHECK_ERRNO 0x00008000
00025
00028 enum cpioErrorReturns {
00029 CPIOERR_BAD_MAGIC = (2 ),
00030 CPIOERR_BAD_HEADER = (3 ),
00031 CPIOERR_OPEN_FAILED = (4 | CPIOERR_CHECK_ERRNO),
00032 CPIOERR_CHMOD_FAILED = (5 | CPIOERR_CHECK_ERRNO),
00033 CPIOERR_CHOWN_FAILED = (6 | CPIOERR_CHECK_ERRNO),
00034 CPIOERR_WRITE_FAILED = (7 | CPIOERR_CHECK_ERRNO),
00035 CPIOERR_UTIME_FAILED = (8 | CPIOERR_CHECK_ERRNO),
00036 CPIOERR_UNLINK_FAILED = (9 | CPIOERR_CHECK_ERRNO),
00037
00038 CPIOERR_SYMLINK_FAILED = (11 | CPIOERR_CHECK_ERRNO),
00039 CPIOERR_STAT_FAILED = (12 | CPIOERR_CHECK_ERRNO),
00040 CPIOERR_MKDIR_FAILED = (13 | CPIOERR_CHECK_ERRNO),
00041 CPIOERR_MKNOD_FAILED = (14 | CPIOERR_CHECK_ERRNO),
00042 CPIOERR_MKFIFO_FAILED = (15 | CPIOERR_CHECK_ERRNO),
00043 CPIOERR_LINK_FAILED = (16 | CPIOERR_CHECK_ERRNO),
00044 CPIOERR_READLINK_FAILED = (17 | CPIOERR_CHECK_ERRNO),
00045 CPIOERR_READ_FAILED = (18 | CPIOERR_CHECK_ERRNO),
00046 CPIOERR_COPY_FAILED = (19 | CPIOERR_CHECK_ERRNO),
00047 CPIOERR_HDR_SIZE = (20 ),
00048 CPIOERR_UNKNOWN_FILETYPE = (21 ),
00049 CPIOERR_MISSING_HARDLINK = (22 ),
00050 CPIOERR_MD5SUM_MISMATCH = (23 ),
00051 CPIOERR_INTERNAL = (24 )
00052 };
00053
00056 enum cpioMapFlags {
00057 CPIO_MAP_PATH = (1 << 0),
00058 CPIO_MAP_MODE = (1 << 1),
00059 CPIO_MAP_UID = (1 << 2),
00060 CPIO_MAP_GID = (1 << 3),
00061 CPIO_FOLLOW_SYMLINKS = (1 << 4),
00062 CPIO_MULTILIB = (1 << 31)
00063 };
00064
00068 struct cpioFileMapping {
00069 const char * archivePath;
00070 const char * fsPath;
00071 const char * md5sum;
00072 mode_t finalMode;
00073 uid_t finalUid;
00074 gid_t finalGid;
00075 int mapFlags;
00076 };
00077
00083 struct cpioCallbackInfo {
00084 const char * file;
00085 long fileSize;
00086 long fileComplete;
00087 long bytesProcessed;
00088 };
00089
00090 #ifdef __cplusplus
00091 extern "C" {
00092 #endif
00093
00096 typedef void (*cpioCallback) (struct cpioCallbackInfo * filespec, void * data);
00097
00117 int cpioInstallArchive(FD_t cfd, const struct cpioFileMapping * mappings,
00118 int numMappings, cpioCallback cb, void * cbData,
00119 const char ** failedFile)
00120 ;
00121
00133 int cpioBuildArchive(FD_t cfd, const struct cpioFileMapping * mappings,
00134 int numMappings, cpioCallback cb, void * cbData,
00135 unsigned int * archiveSize, const char ** failedFile)
00136 ;
00137
00145 int cpioFileMapCmp(const void * a, const void * b) ;
00146
00152 const char *cpioStrerror(int rc) ;
00153
00154 #ifdef __cplusplus
00155 }
00156 #endif
00157
00158 #endif