File state machine to handle archive I/O and system call's. More...
#include <rpmiotypes.h>
#include <rpmsw.h>
Go to the source code of this file.
Defines | |
#define | IOSM_VERBOSE 0x8000 |
#define | IOSM_INTERNAL 0x4000 |
#define | IOSM_SYSCALL 0x2000 |
#define | IOSM_DEAD 0x1000 |
#define | _fv(_a) ((_a) | IOSM_VERBOSE) |
#define | _fi(_a) ((_a) | IOSM_INTERNAL) |
#define | _fs(_a) ((_a) | (IOSM_INTERNAL | IOSM_SYSCALL)) |
#define | _fd(_a) ((_a) | (IOSM_INTERNAL | IOSM_DEAD)) |
Typedefs | |
typedef struct iosm_s * | IOSM_t |
File state machine data. | |
typedef enum iosmFileAction_e | iosmFileAction |
File disposition(s) during package install/erase processing. | |
typedef enum iosmMapFlags_e | iosmMapFlags |
typedef enum iosmFileStage_e | iosmFileStage |
Enumerations | |
enum | iosmFileAction_e { FA_UNKNOWN = 0, FA_CREATE, FA_COPYIN, FA_COPYOUT, FA_BACKUP, FA_SAVE, FA_SKIP, FA_ALTNAME, FA_ERASE, FA_SKIPNSTATE, FA_SKIPNETSHARED, FA_SKIPCOLOR } |
File disposition(s) during package install/erase processing. More... | |
enum | iosmMapFlags_e { IOSM_MAP_PATH = (1 << 0), IOSM_MAP_MODE = (1 << 1), IOSM_MAP_UID = (1 << 2), IOSM_MAP_GID = (1 << 3), IOSM_FOLLOW_SYMLINKS = (1 << 4), IOSM_MAP_ABSOLUTE = (1 << 5), IOSM_MAP_ADDDOT = (1 << 6), IOSM_ALL_HARDLINKS = (1 << 7), IOSM_MAP_TYPE = (1 << 8), IOSM_SBIT_CHECK = (1 << 9), IOSM_PAYLOAD_LIST = (1 << 10), IOSM_PAYLOAD_EXTRACT = (1 << 11), IOSM_PAYLOAD_CREATE = (1 << 12) } |
enum | iosmFileStage_e { IOSM_UNKNOWN = 0, IOSM_INIT = _fd(1), IOSM_PRE = _fd(2), IOSM_PROCESS = _fv(3), IOSM_POST = _fd(4), IOSM_UNDO = 5, IOSM_FINI = 6, IOSM_PKGINSTALL = _fd(7), IOSM_PKGERASE = _fd(8), IOSM_PKGBUILD = _fd(9), IOSM_PKGCOMMIT = _fd(10), IOSM_PKGUNDO = _fd(11), IOSM_CREATE = _fd(17), IOSM_MAP = _fd(18), IOSM_MKDIRS = _fi(19), IOSM_RMDIRS = _fi(20), IOSM_MKLINKS = _fi(21), IOSM_NOTIFY = _fd(22), IOSM_DESTROY = _fd(23), IOSM_VERIFY = _fd(24), IOSM_COMMIT = _fd(25), IOSM_UNLINK = _fs(33), IOSM_RENAME = _fs(34), IOSM_MKDIR = _fs(35), IOSM_RMDIR = _fs(36), IOSM_LSETFCON = _fs(39), IOSM_CHOWN = _fs(40), IOSM_LCHOWN = _fs(41), IOSM_CHMOD = _fs(42), IOSM_UTIME = _fs(43), IOSM_SYMLINK = _fs(44), IOSM_LINK = _fs(45), IOSM_MKFIFO = _fs(46), IOSM_MKNOD = _fs(47), IOSM_LSTAT = _fs(48), IOSM_STAT = _fs(49), IOSM_READLINK = _fs(50), IOSM_CHROOT = _fs(51), IOSM_NEXT = _fd(65), IOSM_EAT = _fd(66), IOSM_POS = _fd(67), IOSM_PAD = _fd(68), IOSM_TRAILER = _fd(69), IOSM_HREAD = _fd(70), IOSM_HWRITE = _fd(71), IOSM_DREAD = _fs(72), IOSM_DWRITE = _fs(73), IOSM_ROPEN = _fs(129), IOSM_READ = _fs(130), IOSM_RCLOSE = _fs(131), IOSM_WOPEN = _fs(132), IOSM_WRITE = _fs(133), IOSM_WCLOSE = _fs(134) } |
Functions | |
const char * | iosmFileStageString (iosmFileStage a) |
Return formatted string representation of file stages. | |
const char * | iosmFileActionString (iosmFileAction a) |
Return formatted string representation of file disposition. | |
char * | iosmStrerror (int rc) |
Return formatted error message on payload handling failure. | |
int | iosmSetup (IOSM_t iosm, iosmFileStage goal, const char *afmt, const void *_ts, const void *_fi, FD_t cfd, unsigned int *archiveSize, const char **failedFile) |
Load external data into I/O state machine. | |
int | iosmTeardown (IOSM_t iosm) |
Clean I/O state machine. | |
int | iosmFileActionSkipped (iosmFileAction action) |
Is the file going to be skipped? | |
int | iosmNext (IOSM_t iosm, iosmFileStage nstage) |
File state machine driver. | |
int | iosmStage (IOSM_t iosm, iosmFileStage stage) |
File state machine driver. | |
Variables | |
int | _iosm_debug |
File state machine to handle archive I/O and system call's.
Definition in file iosm.h.
#define IOSM_DEAD 0x1000 |
Definition at line 106 of file iosm.h.
Referenced by fsmStage(), and iosmStage().
#define IOSM_INTERNAL 0x4000 |
Definition at line 104 of file iosm.h.
Referenced by fsmStage(), and iosmStage().
#define IOSM_SYSCALL 0x2000 |
Definition at line 105 of file iosm.h.
Referenced by fsmStage(), and iosmStage().
#define IOSM_VERBOSE 0x8000 |
Definition at line 103 of file iosm.h.
Referenced by fsmStage(), and iosmStage().
typedef enum iosmFileAction_e iosmFileAction |
File disposition(s) during package install/erase processing.
typedef enum iosmFileStage_e iosmFileStage |
enum iosmFileAction_e |
File disposition(s) during package install/erase processing.
enum iosmFileStage_e |
int iosmFileActionSkipped | ( | iosmFileAction | action ) |
Is the file going to be skipped?
iosm | I/O state machine |
Definition at line 2678 of file iosm.c.
References IOSM_SKIPPING.
Referenced by dnlInitIterator(), fsmCommitLinks(), fsmMakeLinks(), fsmStage(), handleInstInstalledFiles(), handleOverlappedFiles(), iosmCommitLinks(), iosmMakeLinks(), iosmStage(), rpmtsRun(), saveHardLink(), and skipFiles().
const char* iosmFileActionString | ( | iosmFileAction | a ) |
Return formatted string representation of file disposition.
a | file dispostion |
Definition at line 2683 of file iosm.c.
References FA_ALTNAME, FA_BACKUP, FA_COPYIN, FA_COPYOUT, FA_CREATE, FA_ERASE, FA_SAVE, FA_SKIP, FA_SKIPCOLOR, FA_SKIPNETSHARED, FA_SKIPNSTATE, and FA_UNKNOWN.
const char* iosmFileStageString | ( | iosmFileStage | a ) |
Return formatted string representation of file stages.
a | file stage |
Definition at line 2703 of file iosm.c.
References IOSM_CHMOD, IOSM_CHOWN, IOSM_CHROOT, IOSM_COMMIT, IOSM_CREATE, IOSM_DESTROY, IOSM_DREAD, IOSM_DWRITE, IOSM_EAT, IOSM_FINI, IOSM_HREAD, IOSM_HWRITE, IOSM_INIT, IOSM_LCHOWN, IOSM_LINK, IOSM_LSETFCON, IOSM_LSTAT, IOSM_MAP, IOSM_MKDIR, IOSM_MKDIRS, IOSM_MKFIFO, IOSM_MKLINKS, IOSM_MKNOD, IOSM_NEXT, IOSM_NOTIFY, IOSM_PAD, IOSM_PKGBUILD, IOSM_PKGCOMMIT, IOSM_PKGERASE, IOSM_PKGINSTALL, IOSM_PKGUNDO, IOSM_POS, IOSM_POST, IOSM_PRE, IOSM_PROCESS, IOSM_RCLOSE, IOSM_READ, IOSM_READLINK, IOSM_RENAME, IOSM_RMDIR, IOSM_RMDIRS, IOSM_ROPEN, IOSM_STAT, IOSM_SYMLINK, IOSM_TRAILER, IOSM_UNDO, IOSM_UNKNOWN, IOSM_UNLINK, IOSM_UTIME, IOSM_VERIFY, IOSM_WCLOSE, IOSM_WOPEN, and IOSM_WRITE.
Referenced by fsmStage(), and iosmStage().
int iosmNext | ( | IOSM_t | iosm, |
iosmFileStage | nstage | ||
) |
File state machine driver.
iosm | I/O state machine |
nstage | next stage |
Definition at line 452 of file iosm.c.
References iosmStage(), rpmsqJoin(), and rpmsqThread().
Referenced by iosmCommitLinks(), iosmMakeLinks(), iosmMkdirs(), iosmRmdirs(), iosmSetup(), and iosmStage().
int iosmSetup | ( | IOSM_t | iosm, |
iosmFileStage | goal, | ||
const char * | afmt, | ||
const void * | _ts, | ||
const void * | _fi, | ||
FD_t | cfd, | ||
unsigned int * | archiveSize, | ||
const char ** | failedFile | ||
) |
Load external data into I/O state machine.
iosm | I/O state machine |
goal | |
afmt | archive format (NULL uses cpio) |
_ts | transaction set |
_fi | transaction element file info |
cfd | payload descriptor |
archiveSize | pointer to archive size |
failedFile | pointer to first file name that failed. |
Definition at line 660 of file iosm.c.
References _iosm_debug, _iosm_threads, _iosmNext, _tsmask, arHeaderRead(), arHeaderWrite(), arSetup(), arTrailerWrite(), cpioHeaderRead(), cpioHeaderWrite(), cpioTrailerWrite(), FA_COPYOUT, fdGetCpioPos(), fdLink(), fdSetCpioPos(), IOSM_CREATE, IOSM_PKGBUILD, IOSM_PKGCOMMIT, IOSM_PKGERASE, IOSM_PKGINSTALL, iosmNext(), iosmUNSAFE, mapInitIterator(), RPMCALLBACK_INST_START, rpmteType(), RPMTRANS_FLAG_NOCONTEXTS, RPMTRANS_FLAG_NOFDIGESTS, rpmtsFlags(), rpmtsGetTid(), rpmtsLink(), rpmtsNotify(), TAR_BLOCK_SIZE, tarHeaderRead(), tarHeaderWrite(), tarTrailerWrite(), TR_ADDED, and TR_REMOVED.
int iosmStage | ( | IOSM_t | iosm, |
iosmFileStage | stage | ||
) |
File state machine driver.
iosm | I/O state machine |
stage | next stage |
Definition at line 1648 of file iosm.c.
References _, _fafilter, _free(), alloca(), Chmod(), Chown(), CPIO_TRAILER, errno, extractRegular(), FA_ERASE, FA_UNKNOWN, Fclose(), fdGetCpioPos(), fdSetCpioPos(), FDSTAT_DIGEST, fdstat_op(), Ferror(), Fopen(), Fread(), freeHardLink(), Fwrite(), IOSM_ALL_HARDLINKS, IOSM_CHMOD, IOSM_CHOWN, IOSM_CHROOT, IOSM_COMMIT, IOSM_CREATE, IOSM_DEAD, IOSM_DESTROY, IOSM_DREAD, IOSM_DWRITE, IOSM_EAT, IOSM_FINI, IOSM_FOLLOW_SYMLINKS, IOSM_HREAD, IOSM_HWRITE, IOSM_INIT, IOSM_INTERNAL, IOSM_LCHOWN, IOSM_LINK, IOSM_LSETFCON, IOSM_LSTAT, IOSM_MAP, IOSM_MKDIR, IOSM_MKDIRS, IOSM_MKFIFO, IOSM_MKLINKS, IOSM_MKNOD, IOSM_NEXT, IOSM_NOTIFY, IOSM_PAD, IOSM_PAYLOAD_EXTRACT, IOSM_PAYLOAD_LIST, IOSM_PKGBUILD, IOSM_PKGCOMMIT, IOSM_PKGERASE, IOSM_PKGINSTALL, IOSM_POS, IOSM_POST, IOSM_PRE, IOSM_PROCESS, IOSM_RCLOSE, IOSM_READ, IOSM_READLINK, IOSM_RENAME, IOSM_RMDIR, IOSM_RMDIRS, IOSM_ROPEN, IOSM_SBIT_CHECK, IOSM_STAT, IOSM_SYMLINK, IOSM_SYSCALL, IOSM_TRAILER, IOSM_UNDO, IOSM_UNKNOWN, IOSM_UNLINK, IOSM_UTIME, IOSM_VERBOSE, IOSM_VERIFY, IOSM_WCLOSE, IOSM_WOPEN, IOSM_WRITE, iosmCommitLinks(), iosmFileActionSkipped(), iosmFileStageString(), iosmFsPath(), iosmGetFi(), iosmMakeLinks(), iosmMapAttrs(), iosmMapFContext(), iosmMapPath(), iosmMkdirs(), iosmNext(), iosmRmdirs(), iosmUNSAFE, IS_DEV_LOG, Lchown(), Link(), lsetfilecon, Lstat(), mapFind(), mapNextIterator(), Mkdir(), Mkfifo(), Mknod(), Readlink(), Rename(), Rmdir(), RPMCALLBACK_INST_PROGRESS, RPMFILE_GHOST, RPMFILE_MISSINGOK, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMLOG_WARNING, rpmswAdd(), rpmtsNotify(), S_ISLNK, S_ISSOCK, saveHardLink(), Stat(), stpcpy(), Symlink(), Unlink(), urlPath(), Utime(), writeFile(), writeLinkedFile(), xmalloc(), and xstrdup().
Referenced by fsmStage(), and iosmNext().
int iosmTeardown | ( | IOSM_t | iosm ) |
Clean I/O state machine.
iosm | I/O state machine |
Definition at line 793 of file iosm.c.
References _free(), fdFree(), IOSM_DESTROY, iosmUNSAFE, mapFreeIterator(), rpmswAdd(), RPMTS_OP_DIGEST, rpmtsFree(), and rpmtsOp().
int _iosm_debug |