From 14d1139bc508d99ad5e2753940dee46d6e0346fb Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Thu, 29 Mar 2012 15:49:51 +0200 Subject: [PATCH] Kill FSM: Remove remains --- lib/fsm.c | 84 --------------------------------------------------------------- lib/fsm.h | 5 +--- 2 files changed, 1 insertion(+), 88 deletions(-) diff --git a/lib/fsm.c b/lib/fsm.c index 3334296..0afbca8 100644 --- a/lib/fsm.c +++ b/lib/fsm.c @@ -92,8 +92,6 @@ struct fsm_s { unsigned fflags; /*!< File flags. */ rpmFileAction action; /*!< File disposition. */ fileStage goal; /*!< Package state machine goal. */ - fileStage stage; /*!< External file stage. */ - fileStage nstage; /*!< Next file stage. */ struct stat sb; /*!< Current file stat(2) info. */ struct stat osb; /*!< Original file stat(2) info. */ @@ -143,7 +141,6 @@ static rpmte fsmGetTe(const FSM_t fsm) */ static const char * fileStageString(fileStage a); static const char * fileActionString(rpmFileAction a); -static int fsmStage(FSM_t fsm, fileStage stage); /** \ingroup payload * Build path to file from file info, ornamented with subdir and suffix. @@ -427,12 +424,6 @@ const char * dnlNextIterator(DNLI_t dnli) return dn; } -static int fsmNext(FSM_t fsm, fileStage nstage) -{ - fsm->nstage = nstage; - return fsmStage(fsm, fsm->nstage); -} - /** * Map next file path and action. * @param fsm file state machine @@ -1757,62 +1748,6 @@ static int fsmCommit(FSM_t fsm) return rc; } -/********************************************************************/ - -/** - * File state machine driver. - * @param fsm file state machine - * @param stage next stage - * @return 0 on success - */ -static int fsmStage(FSM_t fsm, fileStage stage) -{ - const char * const cur = fileStageString(stage); - struct stat * st = &fsm->sb; - int saveerrno = errno; - int rc = fsm->rc; - -#define _fafilter(_a) \ - (!((_a) == FA_CREATE || (_a) == FA_ERASE || (_a) == FA_COPYIN || (_a) == FA_COPYOUT) \ - ? fileActionString(_a) : "") - - if (stage & FSM_DEAD) { - /* do nothing */ - } else if (stage & FSM_INTERNAL) { - if (_fsm_debug && !(stage & FSM_SYSCALL)) - rpmlog(RPMLOG_DEBUG, " %8s %06o%3d (%4d,%4d)%10d %s %s\n", - cur, - (unsigned)st->st_mode, (int)st->st_nlink, - (int)st->st_uid, (int)st->st_gid, (int)st->st_size, - (fsm->path ? fsm->path : ""), - _fafilter(fsm->action)); - } else { - fsm->stage = stage; - if (_fsm_debug || !(stage & FSM_VERBOSE)) - rpmlog(RPMLOG_DEBUG, "%-8s %06o%3d (%4d,%4d)%10d %s %s\n", - cur, - (unsigned)st->st_mode, (int)st->st_nlink, - (int)st->st_uid, (int)st->st_gid, (int)st->st_size, - (fsm->path ? fsm->path : ""), - _fafilter(fsm->action)); - } -#undef _fafilter - - switch (stage) { - case FSM_UNKNOWN: - break; - case FSM_POST: - break; - default: - break; - } - - if (!(stage & FSM_INTERNAL)) { - fsm->rc = (rc == CPIOERR_HDR_TRAILER ? 0 : rc); - } - return rc; -} - /** * Return formatted string representation of file disposition. * @param a file dispostion @@ -1900,25 +1835,6 @@ static const char * fileStageString(fileStage a) } } -int rpmfsmRun(fileStage goal, rpmts ts, rpmte te, rpmfi fi, FD_t cfd, - rpmpsm psm, rpm_loff_t * archiveSize, char ** failedFile) -{ - struct fsm_s fsm_; - FSM_t fsm = &fsm_; - int rc = 0; - int ec = 0; - - memset(fsm, 0, sizeof(*fsm)); - rc = fsmSetup(fsm, goal, ts, te, fi, cfd, psm, archiveSize, failedFile); - if (!rc) - rc = fsmUNSAFE(fsm, fsm->goal); - ec = fsmTeardown(fsm); - - /* Return the relevant code: if setup or the fsm failed, teardown doesn't matter */ - return (rc ? rc : ec); -} - - int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfi fi, FD_t cfd, rpmpsm psm, char ** failedFile) { diff --git a/lib/fsm.h b/lib/fsm.h index 7b5d993..287474b 100644 --- a/lib/fsm.h +++ b/lib/fsm.h @@ -106,8 +106,7 @@ extern "C" { #endif /** - * Execute a file state machine goal - * @param goal + * Execute a file actions for package * @param ts transaction set * @param fi transaction element file info * @param cfd @@ -116,8 +115,6 @@ extern "C" { * @retval failedFile pointer to first file name that failed (malloced) * @return 0 on success */ -int rpmfsmRun(fileStage goal, rpmts ts, rpmte te, rpmfi fi, FD_t cfd, - rpmpsm psm, rpm_loff_t * archiveSize, char ** failedFile); int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfi fi, FD_t cfd, rpmpsm psm, char ** failedFile); -- 2.7.4