- Main Page
- Related Pages
- Modules
- Data Structures
- Files

# lib/cpio.h

Go to the documentation of this file.

    00001 #ifndef H_CPIO
    00002 #define H_CPIO
    00003
    00018 #define CPIOERR_CHECK_ERRNO     0x00008000
    00019
    00022 enum cpioErrorReturns {
    00023         CPIOERR_BAD_MAGIC       = (2                    ),
    00024         CPIOERR_BAD_HEADER      = (3                    ),
    00025         CPIOERR_OPEN_FAILED     = (4    | CPIOERR_CHECK_ERRNO),
    00026         CPIOERR_CHMOD_FAILED    = (5    | CPIOERR_CHECK_ERRNO),
    00027         CPIOERR_CHOWN_FAILED    = (6    | CPIOERR_CHECK_ERRNO),
    00028         CPIOERR_WRITE_FAILED    = (7    | CPIOERR_CHECK_ERRNO),
    00029         CPIOERR_UTIME_FAILED    = (8    | CPIOERR_CHECK_ERRNO),
    00030         CPIOERR_UNLINK_FAILED   = (9    | CPIOERR_CHECK_ERRNO),
    00031
    00032         CPIOERR_RENAME_FAILED   = (10   | CPIOERR_CHECK_ERRNO),
    00033         CPIOERR_SYMLINK_FAILED  = (11   | CPIOERR_CHECK_ERRNO),
    00034         CPIOERR_STAT_FAILED     = (12   | CPIOERR_CHECK_ERRNO),
    00035         CPIOERR_LSTAT_FAILED    = (13   | CPIOERR_CHECK_ERRNO),
    00036         CPIOERR_MKDIR_FAILED    = (14   | CPIOERR_CHECK_ERRNO),
    00037         CPIOERR_RMDIR_FAILED    = (15   | CPIOERR_CHECK_ERRNO),
    00038         CPIOERR_MKNOD_FAILED    = (16   | CPIOERR_CHECK_ERRNO),
    00039         CPIOERR_MKFIFO_FAILED   = (17   | CPIOERR_CHECK_ERRNO),
    00040         CPIOERR_LINK_FAILED     = (18   | CPIOERR_CHECK_ERRNO),
    00041         CPIOERR_READLINK_FAILED = (19   | CPIOERR_CHECK_ERRNO),
    00042         CPIOERR_READ_FAILED     = (20   | CPIOERR_CHECK_ERRNO),
    00043         CPIOERR_COPY_FAILED     = (21   | CPIOERR_CHECK_ERRNO),
    00044         CPIOERR_LSETFCON_FAILED = (22   | CPIOERR_CHECK_ERRNO),
    00045         CPIOERR_HDR_SIZE        = (23                   ),
    00046         CPIOERR_HDR_TRAILER     = (24                   ),
    00047         CPIOERR_UNKNOWN_FILETYPE= (25                   ),
    00048         CPIOERR_MISSING_HARDLINK= (26                   ),
    00049         CPIOERR_DIGEST_MISMATCH = (27                   ),
    00050         CPIOERR_INTERNAL        = (28                   ),
    00051         CPIOERR_UNMAPPED_FILE   = (29                   ),
    00052         CPIOERR_ENOENT          = (30                   ),
    00053         CPIOERR_ENOTEMPTY       = (31                   )
    00054 };
    00055
    00058 typedef enum cpioMapFlags_e {
    00059     CPIO_MAP_PATH       = (1 <<  0),
    00060     CPIO_MAP_MODE       = (1 <<  1),
    00061     CPIO_MAP_UID        = (1 <<  2),
    00062     CPIO_MAP_GID        = (1 <<  3),
    00063     CPIO_FOLLOW_SYMLINKS= (1 <<  4),
    00064     CPIO_MAP_ABSOLUTE   = (1 <<  5),
    00065     CPIO_MAP_ADDDOT     = (1 <<  6),
    00066     CPIO_ALL_HARDLINKS  = (1 <<  7),
    00067     CPIO_MAP_TYPE       = (1 <<  8),
    00068     CPIO_SBIT_CHECK     = (1 <<  9),
    00069     CPIO_PAYLOAD_LIST   = (1 << 10),
    00070     CPIO_PAYLOAD_EXTRACT= (1 << 11),
    00071     CPIO_PAYLOAD_CREATE = (1 << 12)
    00072 } cpioMapFlags;
    00073
    00074 #define CPIO_NEWC_MAGIC "070701"
    00075 #define CPIO_CRC_MAGIC  "070702"
    00076 #define CPIO_TRAILER    "TRAILER!!!"
    00077
    00081 struct cpioCrcPhysicalHeader {
    00082     char magic[6];
    00083     char inode[8];
    00084     char mode[8];
    00085     char uid[8];
    00086     char gid[8];
    00087     char nlink[8];
    00088     char mtime[8];
    00089     char filesize[8];
    00090     char devMajor[8];
    00091     char devMinor[8];
    00092     char rdevMajor[8];
    00093     char rdevMinor[8];
    00094     char namesize[8];
    00095     char checksum[8];                   /* ignored !! */
    00096 };
    00097
    00098 #define PHYS_HDR_SIZE   110             /* Don't depend on sizeof(struct) */
    00099
    00100 /*@unchecked@*/
    00101 extern int _cpio_debug;
    00102
    00103 #ifdef __cplusplus
    00104 extern "C" {
    00105 #endif
    00106
    00112 int cpioTrailerWrite(FSM_t fsm)
    00113         /*@globals h_errno, fileSystem, internalState @*/
    00114         /*@modifies fsm, fileSystem, internalState @*/;
    00115
    00122 int cpioHeaderWrite(FSM_t fsm, struct stat * st)
    00123         /*@globals h_errno, fileSystem, internalState @*/
    00124         /*@modifies fsm, fileSystem, internalState @*/;
    00125
    00132 int cpioHeaderRead(FSM_t fsm, struct stat * st)
    00133         /*@globals h_errno, fileSystem, internalState @*/
    00134         /*@modifies fsm, *st, fileSystem, internalState @*/;
    00135
    00141 /*@observer@*/ const char * cpioStrerror(int rc)
    00142         /*@*/;
    00143
    00144 #ifdef __cplusplus
    00145 }
    00146 #endif
    00147
    00148 #endif  /* H_CPIO */