#include "cpio.h"
Include dependency graph for fsm.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | hardLink_s |
Keeps track of the set of all hard links to a file in an archive. More... | |
struct | fsmIterator_s |
Iterator across package file info, forward on install, backward on erase. More... | |
struct | fsm_s |
File name and stat information. More... | |
Defines | |
#define | FSM_VERBOSE 0x8000 |
#define | FSM_INTERNAL 0x4000 |
#define | FSM_SYSCALL 0x2000 |
#define | FSM_DEAD 0x1000 |
#define | _fv(_a) ((_a) | FSM_VERBOSE) |
#define | _fi(_a) ((_a) | FSM_INTERNAL) |
#define | _fs(_a) ((_a) | (FSM_INTERNAL | FSM_SYSCALL)) |
#define | _fd(_a) ((_a) | (FSM_INTERNAL | FSM_DEAD)) |
Typedefs | |
typedef enum fileStage_e | fileStage |
Enumerations | |
enum | fileStage_e { FSM_UNKNOWN = 0, FSM_INIT = (( 1 ) | ( 0x4000 | 0x1000 )), FSM_PRE = (( 2 ) | ( 0x4000 | 0x1000 )), FSM_PROCESS = (( 3 ) | 0x8000 ), FSM_POST = (( 4 ) | ( 0x4000 | 0x1000 )), FSM_UNDO = 5, FSM_FINI = 6, FSM_PKGINSTALL = (( 7 ) | ( 0x4000 | 0x1000 )), FSM_PKGERASE = (( 8 ) | ( 0x4000 | 0x1000 )), FSM_PKGBUILD = (( 9 ) | ( 0x4000 | 0x1000 )), FSM_PKGCOMMIT = (( 10 ) | ( 0x4000 | 0x1000 )), FSM_PKGUNDO = (( 11 ) | ( 0x4000 | 0x1000 )), FSM_CREATE = (( 17 ) | ( 0x4000 | 0x1000 )), FSM_MAP = (( 18 ) | ( 0x4000 | 0x1000 )), FSM_MKDIRS = (( 19 ) | 0x4000 ), FSM_RMDIRS = (( 20 ) | 0x4000 ), FSM_MKLINKS = (( 21 ) | 0x4000 ), FSM_NOTIFY = (( 22 ) | ( 0x4000 | 0x1000 )), FSM_DESTROY = (( 23 ) | ( 0x4000 | 0x1000 )), FSM_VERIFY = (( 24 ) | ( 0x4000 | 0x1000 )), FSM_COMMIT = (( 25 ) | ( 0x4000 | 0x1000 )), FSM_UNLINK = (( 33 ) | ( 0x4000 | 0x2000 )), FSM_RENAME = (( 34 ) | ( 0x4000 | 0x2000 )), FSM_MKDIR = (( 35 ) | ( 0x4000 | 0x2000 )), FSM_RMDIR = (( 36 ) | ( 0x4000 | 0x2000 )), FSM_LSETFCON = (( 39 ) | ( 0x4000 | 0x2000 )), FSM_CHOWN = (( 40 ) | ( 0x4000 | 0x2000 )), FSM_LCHOWN = (( 41 ) | ( 0x4000 | 0x2000 )), FSM_CHMOD = (( 42 ) | ( 0x4000 | 0x2000 )), FSM_UTIME = (( 43 ) | ( 0x4000 | 0x2000 )), FSM_SYMLINK = (( 44 ) | ( 0x4000 | 0x2000 )), FSM_LINK = (( 45 ) | ( 0x4000 | 0x2000 )), FSM_MKFIFO = (( 46 ) | ( 0x4000 | 0x2000 )), FSM_MKNOD = (( 47 ) | ( 0x4000 | 0x2000 )), FSM_LSTAT = (( 48 ) | ( 0x4000 | 0x2000 )), FSM_STAT = (( 49 ) | ( 0x4000 | 0x2000 )), FSM_READLINK = (( 50 ) | ( 0x4000 | 0x2000 )), FSM_CHROOT = (( 51 ) | ( 0x4000 | 0x2000 )), FSM_NEXT = (( 65 ) | ( 0x4000 | 0x1000 )), FSM_EAT = (( 66 ) | ( 0x4000 | 0x1000 )), FSM_POS = (( 67 ) | ( 0x4000 | 0x1000 )), FSM_PAD = (( 68 ) | ( 0x4000 | 0x1000 )), FSM_TRAILER = (( 69 ) | ( 0x4000 | 0x1000 )), FSM_HREAD = (( 70 ) | ( 0x4000 | 0x1000 )), FSM_HWRITE = (( 71 ) | ( 0x4000 | 0x1000 )), FSM_DREAD = (( 72 ) | ( 0x4000 | 0x2000 )), FSM_DWRITE = (( 73 ) | ( 0x4000 | 0x2000 )), FSM_ROPEN = (( 129 ) | ( 0x4000 | 0x2000 )), FSM_READ = (( 130 ) | ( 0x4000 | 0x2000 )), FSM_RCLOSE = (( 131 ) | ( 0x4000 | 0x2000 )), FSM_WOPEN = (( 132 ) | ( 0x4000 | 0x2000 )), FSM_WRITE = (( 133 ) | ( 0x4000 | 0x2000 )), FSM_WCLOSE = (( 134 ) | ( 0x4000 | 0x2000 )) } |
Functions | |
const char * | fileStageString (fileStage a) |
Return formatted string representation of file stages. | |
const char * | fileActionString (fileAction a) |
Return formatted string representation of file disposition. | |
FSM_t | newFSM (void) |
Create file state machine instance. | |
FSM_t | freeFSM (FSM_t fsm) |
Destroy file state machine instance. | |
int | fsmSetup (FSM_t fsm, fileStage goal, const char *afmt, const rpmts ts, const rpmfi fi, FD_t cfd, unsigned int *archiveSize, const char **failedFile) |
Load external data into file state machine. | |
int | fsmTeardown (FSM_t fsm) |
Clean file state machine. | |
rpmts | fsmGetTs (const FSM_t fsm) |
Retrieve transaction set from file state machine iterator. | |
rpmfi | fsmGetFi (const FSM_t fsm) |
Retrieve transaction element file info from file state machine iterator. | |
int | fsmMapPath (FSM_t fsm) |
Map next file path and action. | |
int | fsmMapAttrs (FSM_t fsm) |
Map file stat(2) info. | |
int | fsmNext (FSM_t fsm, fileStage nstage) |
File state machine driver. | |
int | fsmStage (FSM_t fsm, fileStage stage) |
File state machine driver. | |
Variables | |
int | _fsm_debug |
Definition in file fsm.h.
|
|
|
|
|
|
|
|
|
Definition at line 21 of file fsm.h. Referenced by fsmStage(). |
|
Definition at line 19 of file fsm.h. Referenced by fsmStage(). |
|
Definition at line 20 of file fsm.h. Referenced by fsmStage(). |
|
Definition at line 18 of file fsm.h. Referenced by fsmStage(). |
|
|
|
|
Return formatted string representation of file disposition.
Definition at line 2555 of file fsm.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. |
|
Return formatted string representation of file stages.
Definition at line 2575 of file fsm.c. References FSM_CHMOD, FSM_CHOWN, FSM_CHROOT, FSM_COMMIT, FSM_CREATE, FSM_DESTROY, FSM_DREAD, FSM_DWRITE, FSM_EAT, FSM_FINI, FSM_HREAD, FSM_HWRITE, FSM_INIT, FSM_LCHOWN, FSM_LINK, FSM_LSETFCON, FSM_LSTAT, FSM_MAP, FSM_MKDIR, FSM_MKDIRS, FSM_MKFIFO, FSM_MKLINKS, FSM_MKNOD, FSM_NEXT, FSM_NOTIFY, FSM_PAD, FSM_PKGBUILD, FSM_PKGCOMMIT, FSM_PKGERASE, FSM_PKGINSTALL, FSM_PKGUNDO, FSM_POS, FSM_POST, FSM_PRE, FSM_PROCESS, FSM_RCLOSE, FSM_READ, FSM_READLINK, FSM_RENAME, FSM_RMDIR, FSM_RMDIRS, FSM_ROPEN, FSM_STAT, FSM_SYMLINK, FSM_TRAILER, FSM_UNDO, FSM_UNKNOWN, FSM_UTIME, FSM_VERIFY, FSM_WCLOSE, FSM_WOPEN, and FSM_WRITE. Referenced by fsmStage(). |
|
Destroy file state machine instance.
Definition at line 540 of file fsm.c. References _free(), fsm_s::dnlx, freeHardLink(), fsm_s::iter, fsm_s::ldn, fsm_s::li, fsm_s::links, mapFreeIterator(), hardLink_s::next, and fsm_s::path. Referenced by rpmfiFree(). |
|
Retrieve transaction element file info from file state machine iterator.
Definition at line 59 of file fsm.c. References fsmIterator_s::fi, and fsm_s::iter. Referenced by dnlInitIterator(), fsmMapAttrs(), fsmMapFContext(), fsmMapPath(), fsmMkdirs(), saveHardLink(), and writeFile(). |
|
Retrieve transaction set from file state machine iterator.
Definition at line 52 of file fsm.c. References fsm_s::iter, and fsmIterator_s::ts. Referenced by fsmMapAttrs(), fsmMapFContext(), and fsmMkdirs(). |
|
Map file stat(2) info.
Definition at line 788 of file fsm.c. References _, CPIO_MAP_GID, CPIO_MAP_MODE, CPIO_MAP_TYPE, CPIO_MAP_UID, fsm_s::digest, fsm_s::digestlen, fsm_s::fdigest, fsm_s::fdigestalgo, FSM_PKGINSTALL, fsmGetFi(), fsmGetTs(), gnameToGid(), fsm_s::goal, fsm_s::ix, fsm_s::mapFlags, RPMMESS_WARNING, rpmMessage, RPMTRANS_FLAG_NOFDIGESTS, rpmtsFlags(), fsm_s::sb, and unameToUid(). |
|
Map next file path and action.
Definition at line 686 of file fsm.c. References _free(), fsm_s::action, fsm_s::astriplen, fsm_s::baseName, CPIO_MAP_PATH, fsm_s::dirName, FA_ALTNAME, FA_BACKUP, FA_COPYIN, FA_COPYOUT, FA_CREATE, FA_ERASE, FA_SAVE, FA_SKIP, FA_SKIPCOLOR, FA_SKIPNETSHARED, FA_SKIPNSTATE, FA_UNKNOWN, fsm_s::fflags, fsmFsPath(), fsmGetFi(), fsm_s::ix, fsm_s::mapFlags, fsm_s::nsuffix, fsm_s::osuffix, fsm_s::path, RPMFILE_GHOST, RPMFILE_STATE_NETSHARED, RPMFILE_STATE_NOTINSTALLED, RPMFILE_STATE_WRONGCOLOR, rpmteType(), fsm_s::sb, fsm_s::subdir, fsm_s::suffix, SUFFIX_RPMNEW, SUFFIX_RPMORIG, SUFFIX_RPMSAVE, TR_ADDED, and TR_REMOVED. |
|
File state machine driver.
Definition at line 413 of file fsm.c. References _fsm_threads, fsmStage(), fsmThread(), fsm_s::nstage, rpmsqJoin(), and rpmsqThread(). Referenced by cpioHeaderRead(), cpioHeaderWrite(), cpioTrailerWrite(), extractRegular(), fsmCommitLinks(), fsmMakeLinks(), fsmMkdirs(), fsmRmdirs(), fsmStage(), saveHardLink(), tarHeaderRead(), tarHeaderReadName(), tarHeaderWrite(), tarHeaderWriteBlock(), tarHeaderWriteName(), tarTrailerWrite(), writeFile(), and writeLinkedFile(). |
|
Load external data into file state machine.
Definition at line 558 of file fsm.c. References _fsm_debug, fsm_s::archiveSize, fsm_s::blksize, fsm_s::cfd, cpioHeaderRead(), cpioHeaderWrite(), cpioTrailerWrite(), fsm_s::failedFile, fdGetCpioPos(), fdLink, fdSetCpioPos(), FSM_CREATE, FSM_PKGBUILD, FSM_PKGINSTALL, fsmUNSAFE, fsm_s::goal, fsm_s::headerRead, fsm_s::headerWrite, fsm_s::iter, mapInitIterator(), fsm_s::rc, RPMCALLBACK_INST_START, rpmtsGetTid(), rpmtsNotify(), fsm_s::sufbuf, TAR_BLOCK_SIZE, tarHeaderRead(), tarHeaderWrite(), tarTrailerWrite(), and fsm_s::trailerWrite. Referenced by cpio_doio(), and rpmpsmStage(). |
|
File state machine driver.
Definition at line 1495 of file fsm.c. References _fafilter, _fsm_debug, fsm_s::action, fsm_s::astriplen, CPIO_ALL_HARDLINKS, CPIOERR_HDR_TRAILER, errno, fileStageString(), hardLink_s::filex, freeHardLink(), FSM_DEAD, FSM_FINI, FSM_INIT, FSM_INTERNAL, FSM_NOTIFY, FSM_PKGBUILD, FSM_PKGCOMMIT, FSM_PKGERASE, FSM_PKGINSTALL, FSM_PROCESS, FSM_SYSCALL, FSM_UNDO, FSM_UNKNOWN, FSM_VERBOSE, fsmNext(), fsmUNSAFE, left, fsm_s::li, fsm_s::links, fsm_s::mapFlags, hardLink_s::next, hardLink_s::nlink, fsm_s::osb, fsm_s::path, fsm_s::postpone, fsm_s::rc, RPMMESS_DEBUG, rpmMessage, hardLink_s::sb, fsm_s::sb, fsm_s::stage, urlPath(), and writeLinkedFile(). Referenced by fsmNext(), and fsmThread(). |
|
Clean file state machine.
Definition at line 637 of file fsm.c. References _fsm_debug, fsm_s::cfd, fsm_s::failedFile, fdFree, FSM_DESTROY, fsmUNSAFE, fsm_s::iter, mapFreeIterator(), and fsm_s::rc. Referenced by cpio_doio(), and rpmpsmStage(). |
|
Create file state machine instance.
Definition at line 534 of file fsm.c. References xcalloc(). Referenced by rpmfiNew(). |
|
|