lib/fsm.h - File state machine to handle a payload within an rpm package.
struct fsm_s
struct fsmIterator_s
struct hardLink_s
#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))
typedef enum fileStage_e fileStage
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_CHOWN = (( 37 ) | ( 0x4000 | 0x2000 )), FSM_LCHOWN = (( 38 ) | ( 0x4000 | 0x2000 )), FSM_CHMOD = (( 39 ) | ( 0x4000 | 0x2000 )), FSM_UTIME = (( 40 ) | ( 0x4000 | 0x2000 )), FSM_SYMLINK = (( 41 ) | ( 0x4000 | 0x2000 )), FSM_LINK = (( 42 ) | ( 0x4000 | 0x2000 )), FSM_MKFIFO = (( 43 ) | ( 0x4000 | 0x2000 )), FSM_MKNOD = (( 44 ) | ( 0x4000 | 0x2000 )), FSM_LSTAT = (( 45 ) | ( 0x4000 | 0x2000 )), FSM_STAT = (( 46 ) | ( 0x4000 | 0x2000 )), FSM_READLINK = (( 47 ) | ( 0x4000 | 0x2000 )), FSM_CHROOT = (( 48 ) | ( 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 )) }
const char *const fileStageString (fileStage a)
Return formatted string representation of file stages.
const char *const 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 rpmTransactionSet ts, const TFI_t 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.
rpmTransactionSet fsmGetTs (const FSM_t fsm)
Retrieve transaction set from file state machine iterator.
TFI_t 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 fsmStage (FSM_t fsm, fileStage stage)
File state machine driver.
File state machine to handle a payload within an rpm package.
Definition at line 26 of file fsm.h.
Definition at line 24 of file fsm.h.
Definition at line 25 of file fsm.h.
Definition at line 23 of file fsm.h.
Definition at line 21 of file fsm.h.
Definition at line 19 of file fsm.h.
Definition at line 20 of file fsm.h.
Definition at line 18 of file fsm.h.
Referenced by fileStageString(), fsmSetup(), and fsmStage().
Enumeration values:
Definition at line 28 of file fsm.h.
Return formatted string representation of file disposition.
Parameters:
Returns: formatted string
Definition at line 2131 of file fsm.c.
References FA_ALTNAME, FA_BACKUP, FA_COPYIN, FA_COPYOUT, FA_CREATE, FA_ERASE, FA_SAVE, FA_SKIP, FA_SKIPMULTILIB, FA_SKIPNETSHARED, FA_SKIPNSTATE, FA_UNKNOWN, and fileAction.
Return formatted string representation of file stages.
Parameters:
Returns: formatted string
Definition at line 2151 of file fsm.c.
References fileStage, 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_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_UNLINK, FSM_UTIME, FSM_VERIFY, FSM_WCLOSE, FSM_WOPEN, and FSM_WRITE.
Destroy file state machine instance.
Parameters:
Returns: always NULL
Definition at line 438 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.
Retrieve transaction element file info from file state machine iterator.
Parameters:
Returns: transaction element file info
Definition at line 34 of file fsm.c.
References fsmIterator_s::fi, and fsm_s::iter.
Referenced by dnlInitIterator(), fsmMapAttrs(), fsmMapPath(), fsmMkdirs(), fsmStage(), saveHardLink(), and writeFile().
Retrieve transaction set from file state machine iterator.
Parameters:
Returns: transaction set
Definition at line 27 of file fsm.c.
References fsm_s::iter, and fsmIterator_s::ts.
Referenced by fsmMapAttrs(), fsmStage(), and writeFile().
Map file stat(2) info.
Parameters:
Definition at line 616 of file fsm.c.
References CPIO_MAP_GID, CPIO_MAP_MODE, CPIO_MAP_TYPE, CPIO_MAP_UID, transactionFileInfo_s::dperms, transactionFileInfo_s::fc, transactionFileInfo_s::fgids, transactionFileInfo_s::fmd5s, fsm_s::fmd5sum, transactionFileInfo_s::fmodes, transactionFileInfo_s::fmtimes, transactionFileInfo_s::fperms, transactionFileInfo_s::frdevs, fsmGetFi(), fsmGetTs(), transactionFileInfo_s::fuids, transactionFileInfo_s::gid, int_32, fsm_s::ix, fsm_s::mapFlags, RPMTRANS_FLAG_NOMD5, fsm_s::sb, rpmTransactionSet_s::transFlags, and transactionFileInfo_s::uid.
Map next file path and action.
Parameters:
Definition at line 521 of file fsm.c.
References _free(), transactionFileInfo_s::action, fsm_s::action, transactionFileInfo_s::actions, transactionFileInfo_s::astriplen, fsm_s::astriplen, fsm_s::baseName, transactionFileInfo_s::bnl, CPIO_MAP_PATH, transactionFileInfo_s::dil, fsm_s::dirName, transactionFileInfo_s::dnl, FA_ALTNAME, FA_BACKUP, FA_COPYIN, FA_COPYOUT, FA_CREATE, FA_ERASE, FA_SAVE, FA_SKIP, FA_SKIPMULTILIB, FA_SKIPNETSHARED, FA_SKIPNSTATE, FA_UNKNOWN, transactionFileInfo_s::fc, transactionFileInfo_s::fflags, fsm_s::fflags, transactionFileInfo_s::flags, transactionFileInfo_s::fmapflags, fsmFsPath(), fsmGetFi(), transactionFileInfo_s::fstates, fsm_s::ix, transactionFileInfo_s::mapflags, fsm_s::mapFlags, fsm_s::nsuffix, fsm_s::osuffix, fsm_s::path, RPMFILE_GHOST, RPMFILE_STATE_NETSHARED, RPMFILE_STATE_NOTINSTALLED, fsm_s::sb, fsm_s::subdir, fsm_s::suffix, SUFFIX_RPMNEW, SUFFIX_RPMORIG, SUFFIX_RPMSAVE, and transactionFileInfo_s::type.
Load external data into file state machine.
Parameters:
Returns: 0 on success
Definition at line 454 of file fsm.c.
References transactionFileInfo_s::ap, fsm_s::archiveSize, transactionFileInfo_s::archiveSize, fsm_s::cfd, fsm_s::failedFile, fdGetCpioPos(), fdLink, fdSetCpioPos(), fileStage, FSM_CREATE, FSM_PKGINSTALL, fsmStage(), fsm_s::goal, transactionFileInfo_s::h, rpmTransactionSet_s::id, fsm_s::iter, availablePackage::key, mapInitIterator(), rpmTransactionSet_s::notify, rpmTransactionSet_s::notifyData, fsm_s::rc, RPMCALLBACK_INST_START, and fsm_s::sufbuf.
Referenced by cpio_doio(), and psmStage().
File state machine driver.
Parameters:
Returns: 0 on success
Definition at line 1211 of file fsm.c.
References _, _free(), _fsm_debug, fsm_s::action, alloca(), transactionFileInfo_s::ap, transactionFileInfo_s::archiveSize, fsm_s::astriplen, fsm_s::cfd, fsm_s::commit, CPIO_ALL_HARDLINKS, CPIO_FOLLOW_SYMLINKS, CPIO_TRAILER, CPIOERR_CHMOD_FAILED, CPIOERR_CHOWN_FAILED, CPIOERR_HDR_SIZE, CPIOERR_HDR_TRAILER, CPIOERR_LINK_FAILED, CPIOERR_LSTAT_FAILED, CPIOERR_MISSING_HARDLINK, CPIOERR_MKDIR_FAILED, CPIOERR_MKFIFO_FAILED, CPIOERR_MKNOD_FAILED, CPIOERR_OPEN_FAILED, CPIOERR_READ_FAILED, CPIOERR_READLINK_FAILED, CPIOERR_RENAME_FAILED, CPIOERR_RMDIR_FAILED, CPIOERR_STAT_FAILED, CPIOERR_SYMLINK_FAILED, CPIOERR_UNKNOWN_FILETYPE, CPIOERR_UNLINK_FAILED, CPIOERR_UNMAPPED_FILE, CPIOERR_UTIME_FAILED, CPIOERR_WRITE_FAILED, cpioHeaderRead(), cpioHeaderWrite(), cpioTrailerWrite(), hardLink_s::createdPath, fsm_s::diskchecked, fsm_s::dnlx, errno, fsm_s::exists, expandRegular(), FA_ERASE, FA_UNKNOWN, fsm_s::failedFile, Fclose(), fdGetCpioPos(), fdSetCpioPos(), Ferror(), fsm_s::fflags, fileStage, fileStageString(), hardLink_s::filex, fiTypeString(), transactionFileInfo_s::fmodes, transactionFileInfo_s::fmtimes, Fopen(), Fread(), freeHardLink(), FSM_CHMOD, FSM_CHOWN, FSM_CHROOT, FSM_COMMIT, FSM_CREATE, FSM_DEAD, FSM_DESTROY, FSM_DREAD, FSM_DWRITE, FSM_EAT, FSM_FINI, FSM_HREAD, FSM_HWRITE, FSM_INIT, FSM_INTERNAL, FSM_LCHOWN, FSM_LINK, 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_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_SYSCALL, FSM_TRAILER, FSM_UNDO, FSM_UNKNOWN, FSM_UNLINK, FSM_UTIME, FSM_VERBOSE, FSM_VERIFY, FSM_WCLOSE, FSM_WOPEN, FSM_WRITE, fsmCommitLinks(), fsmFsPath(), fsmGetFi(), fsmGetTs(), fsmMakeLinks(), fsmMapAttrs(), fsmMapPath(), fsmMkdirs(), fsmRmdirs(), Fwrite(), fsm_s::goal, transactionFileInfo_s::h, IS_DEV_LOG, fsm_s::iter, fsm_s::ix, availablePackage::key, lchown, fsm_s::ldn, fsm_s::ldnalloc, fsm_s::ldnlen, fsm_s::li, Link(), hardLink_s::linkIndex, fsm_s::links, hardLink_s::linksLeft, Lstat(), mapFind(), fsm_s::mapFlags, mapNextIterator(), Mkdir(), fsm_s::mkdirsdone, hardLink_s::next, hardLink_s::nlink, rpmTransactionSet_s::notify, rpmTransactionSet_s::notifyData, fsm_s::nsuffix, fsm_s::opath, fsm_s::osb, fsm_s::osuffix, fsm_s::path, fsm_s::postpone, fsm_s::rc, fsm_s::rdb, fsm_s::rdbuf, fsm_s::rdlen, fsm_s::rdnb, fsm_s::rdsize, Readlink(), Rename(), fsm_s::rfd, Rmdir(), RPMCALLBACK_INST_PROGRESS, RPMDEBUG_RMDIR, RPMDEBUG_UNLINK, RPMERR_RMDIR, RPMERR_UNLINK, rpmError, RPMFILE_MISSINGOK, RPMMESS_DEBUG, RPMMESS_WARNING, rpmMessage, S_ISLNK, S_ISSOCK, saveHardLink(), hardLink_s::sb, fsm_s::sb, fsm_s::stage, Stat(), stpcpy(), strict_erasures, fsm_s::subdir, fsm_s::sufbuf, fsm_s::suffix, rpmTransactionSet_s::transFlags, Unlink(), fsm_s::wfd, fsm_s::wrb, fsm_s::wrbuf, writeFile(), writeLinkedFile(), fsm_s::wrlen, fsm_s::wrnb, fsm_s::wrsize, XFA_SKIPPING, xmalloc(), and xstrdup().
Referenced by cpioHeaderRead(), cpioHeaderWrite(), cpioTrailerWrite(), expandRegular(), fsmCommitLinks(), fsmMakeLinks(), fsmMkdirs(), fsmRmdirs(), fsmSetup(), fsmTeardown(), saveHardLink(), writeFile(), and writeLinkedFile().
Clean file state machine.
Parameters:
Returns: 0 on success
Definition at line 504 of file fsm.c.
References fsm_s::cfd, fsm_s::failedFile, fdFree, FSM_DESTROY, fsmStage(), fsm_s::iter, mapFreeIterator(), and fsm_s::rc.
Referenced by cpio_doio(), and psmStage().
Create file state machine instance.
Returns: file state machine data
Definition at line 432 of file fsm.c.
References xcalloc().
Definition at line 13 of file fsm.h.
Generated automatically by Doxygen for rpm from the source code.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |