fsm.h File Reference
PAYLOAD.

File state machine to handle a payload within an rpm package. More...

`#include <iosm.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.

## Typedefs

typedef struct iosm_s * | FSM_t
| File state machine data. More...
typedef struct iosmIterator_s * | FSMI_t
| Iterator across package file info, forward on install, backward on erase. More...

## Functions

IOSM_t | newFSM (void)
| Create file state machine instance. More...
IOSM_t | freeFSM (IOSM_t fsm)
| Destroy file state machine instance. More...
int | fsmSetup (void *_fsm, iosmFileStage goal, const char *afmt, const void *_ts, const void *_fi, FD_t cfd, unsigned int *archiveSize, const char **failedFile)
| Load external data into file state machine. More...
int | fsmTeardown (void *_fsm)
| Clean file state machine. More...
int | fsmMapPath (IOSM_t fsm)
| Map next file path and action. More...
int | fsmMapAttrs (IOSM_t fsm)
| Map file stat(2) info. More...
int | fsmNext (IOSM_t fsm, iosmFileStage nstage)
| File state machine driver. More...
int | fsmStage (IOSM_t fsm, iosmFileStage stage)
| File state machine driver. More...

## Variables

int | _fsm_debug

## Detailed Description

File state machine to handle a payload within an rpm package.

Definition in file fsm.h.

## Function Documentation

IOSM_t freeFSM | ( | IOSM_t | fsm | ) |

Destroy file state machine instance.

Parameters

  fsm | file state machine

Returns
  always NULL

Definition at line 547 of file fsm.c.

References _free(), freeHardLink(), and mapFreeIterator().

Referenced by rpmfiFini().

int fsmMapAttrs | ( | IOSM_t | fsm | ) |

Map file stat(2) info.

Parameters

  fsm | file state machine

Definition at line 890 of file fsm.c.

References _, fsmGetFi(), gnameToGid(), IOSM_MAP_GID, IOSM_MAP_MODE, IOSM_MAP_TYPE, IOSM_MAP_UID, IOSM_PKGINSTALL, rpmlog(), RPMLOG_WARNING, and unameToUid().

Referenced by fsmStage().

int fsmMapPath | ( | IOSM_t | fsm | ) |

Map next file path and action.

Parameters

  fsm | file state machine

Definition at line 799 of file fsm.c.

References _free(), FA_ALTNAME, FA_BACKUP, FA_COPYIN, FA_COPYOUT, FA_CREATE, FA_ERASE, FA_SAVE, FA_SKIP, FA_SKIPCOLOR, FA_SKIPNETSHARED, FA_SKIPNSTATE, FA_UNKNOWN, fsmFsPath(), fsmGetFi(), IOSM_MAP_PATH, RPMFILE_GHOST, RPMFILE_STATE_NETSHARED, RPMFILE_STATE_NOTINSTALLED, RPMFILE_STATE_WRONGCOLOR, rpmteType(), SUFFIX_RPMNEW, SUFFIX_RPMORIG, SUFFIX_RPMSAVE, and TR_REMOVED.

Referenced by fsmStage().

int fsmNext | ( | IOSM_t | fsm,
|  | iosmFileStage | nstage
| ) |  |

File state machine driver.

Parameters

  fsm | file state machine
  nstage | next stage

Returns
  0 on success

Definition at line 428 of file fsm.c.

References fsmStage(), rpmsqJoin(), and rpmsqThread().

Referenced by extractRegular(), fsmCommitLinks(), fsmMakeLinks(), fsmMkdirs(), fsmRmdirs(), fsmSetup(), fsmStage(), saveHardLink(), writeFile(), and writeLinkedFile().

int fsmSetup | ( | void * | _fsm,
|  | iosmFileStage | goal,
|  | const char * | afmt,
|  | const void * | _ts,
|  | const void * | _fi,
|  | FD_t | cfd,
|  | unsigned int * | archiveSize,
|  | const char ** | failedFile
| ) |  |

Load external data into file state machine.

Parameters

  _fsm | file state machine
  goal |
  afmt | archive format (NULL uses cpio)
  _ts | transaction set
  _fi | transaction element file info
  cfd | payload descriptor

Return values

  archiveSize | pointer to archive size
  failedFile | pointer to first file name that failed.

Returns
  0 on success

Definition at line 617 of file fsm.c.

References _fsm_debug, _fsm_threads, _iosmNext, _tsmask, arHeaderRead(), arHeaderWrite(), arSetup(), arTrailerWrite(), cpioHeaderRead(), cpioHeaderWrite(), cpioTrailerWrite(), FA_COPYOUT, fdGetCpioPos(), fdLink(), fdSetCpioPos(), fsmNext(), fsmUNSAFE, IOSM_CREATE, IOSM_PKGBUILD, IOSM_PKGCOMMIT, IOSM_PKGERASE, IOSM_PKGINSTALL, mapInitIterator(), reverse, 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.

Referenced by cpio_doio(), and rpmpsmStage().

int fsmStage | ( | IOSM_t | fsm,
|  | iosmFileStage | stage
| ) |  |

File state machine driver.

Parameters

  fsm | file state machine
  stage | next stage

Returns
  0 on success

Definition at line 1590 of file fsm.c.

References _, _fafilter, _free(), alloca(), errno, extractRegular(), FA_ERASE, FA_UNKNOWN, fdGetCpioPos(), freeHardLink(), fsmCommitLinks(), fsmFsPath(), fsmGetFi(), fsmGetTs(), fsmMakeLinks(), fsmMapAttrs(), fsmMapFContext(), fsmMapPath(), fsmMkdirs(), fsmNext(), fsmRmdirs(), fsmUNSAFE, 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_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, iosmFileActionSkipped(), iosmFileStageString(), iosmStage(), IS_DEV_LOG, mapFind(), mapNextIterator(), RPMCALLBACK_INST_PROGRESS, RPMFILE_GHOST, RPMFILE_MISSINGOK, rpmfiTypeString(), rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMLOG_WARNING, rpmtsNotify(), S_ISLNK, S_ISSOCK, saveHardLink(), stpcpy(), Unlink(), urlPath(), writeFile(), writeLinkedFile(), xmalloc(), and xstrdup().

Referenced by fsmNext().

int fsmTeardown | ( | void * | _fsm | ) |

Clean file state machine.

Parameters

  _fsm | file state machine

Returns
  0 on success

Definition at line 741 of file fsm.c.

References _free(), fdFree(), fsmGetTs(), fsmUNSAFE, IOSM_DESTROY, mapFreeIterator(), rpmswAdd(), RPMTS_OP_DIGEST, rpmtsFree(), and rpmtsOp().

Referenced by cpio_doio(), and rpmpsmStage().

IOSM_t newFSM | ( | void |  | ) |

Create file state machine instance.

Returns
  file state machine

Definition at line 541 of file fsm.c.

References xcalloc().

Referenced by rpmfiNew().

## Variable Documentation

int _fsm_debug

Definition at line 52 of file fsm.c.