summaryrefslogtreecommitdiff
path: root/lib/fsm.c
AgeCommit message (Collapse)AuthorFilesLines
2013-02-02Adding security msm pluginElena Reshetova1-2/+24
2012-10-01Eliminate all the now unnecessary fsm->ix save-and-restoresPanu Matilainen1-14/+0
- Now that the relevant places are accepting file index as argument, we no longer need to save and restore fsm->ix in all the places dealing with hard links.
2012-10-01Pass file index as argument to fsm fsmMapPath()Panu Matilainen1-10/+9
- Normally this is just the current index, but when writing links its something else and makes sense as an argument (so we dont need to save and restore fsm->ix when doing something different)
2012-10-01Pass file index as argument to fsm fsmCommit()Panu Matilainen1-6/+6
- Normally this is just the current index, but when writing links its something else and makes sense as an argument (so we dont need to save and restore fsm->ix when doing something different)
2012-10-01Pass file index as argument to fsm writeFile()Panu Matilainen1-5/+6
- Normally this is just the current index, but when writing links its something else and makes sense as an argument (so we dont need to save and restore fsm->ix when doing something different)
2012-10-01Eliminate current hardlink set from fsm structPanu Matilainen1-8/+11
- Return the hard link set from saveHardLink() when ready into a local variable in the only place that cares: rpmPackageFilesInstall(). Another pointless and hard-to-follow fsm-global state variable gone...
2012-10-01Pinpoint the one place where fsm->li is modified on real purposePanu Matilainen1-26/+27
- saveHardLinks() is the only place where fsm->li value matters on return: during installation its used for "returning" the current link set when all the links in that set have been seen so they are ready for creating.
2012-10-01Avoid using fsm->li directly when creating pending hard linksPanu Matilainen1-8/+9
- fsmMakeLinks() operates on the current link at hand, doesn't walk the links or anything... pass the link as an argument from the sole caller and operate on that.
2012-10-01Avoid using/modifying fsm->li when committing hardlinksPanu Matilainen1-6/+7
- Using a "global" variable for local... more of the same: fsmCommitLinks() gets called at the end of each round of the install loop if there are links, it does the actual link discovery on its own and fsm->li state will get rewritten by saveHardLink() at the start of the next round.
2012-10-01Avoid using/modifying fsm->li when writing links to payloadPanu Matilainen1-13/+14
- Using a "global" variable for local iteration is just... this gets called once at the end of package build, fsm->li carries no global state here.
2012-10-01Avoid using/modifying fsm->li when freeing hard link setsPanu Matilainen1-4/+6
- Using a "global" variable for local iteration is...
2012-10-01Avoid using/modifying fsm->li on hard link checkingPanu Matilainen1-4/+4
- Using a "global" variable for local iteration is just dumb...
2012-10-01Move hardlink saving out of fsmInit()Panu Matilainen1-5/+6
- Now that we have separate functions for install, erase and build, handle the hardlink saving locally where it matters.
2012-10-01Free hardlink sets centrally in fsmFree()Panu Matilainen1-11/+3
- Having three places doing the same thing doesn't make a whole lotta sense...
2012-10-01Filter out skipped files on hardlink checkingPanu Matilainen1-2/+4
- Legitimately skipped files (links) must not cause install-errors. This has always been broken, but the errors were completely ignored on install prior to rpm 4.10, and now that we're only creating the first instance of a shared file, secondary arch multilib packages with hardlinks were causing install failures because of the "missing" hardlinks here. - The relevant part here is obviously the XFA_SKIPPING() test, for which we need the file states. To keep the lines short, grab the index to a helper variable and replace other fsm->li->filex[i] uses with that too.
2012-08-30Only backup if osuffix is setPanu Matilainen1-1/+2
- This can happen on %ghost files, fsm->ossufix is never set for them. Arguably this is a bug in the file disposition calculations but for now...
2012-08-23Backing up contents when replaced by directory needs special handlingPanu Matilainen1-2/+6
- When a directory is about to replace a %config needing backup, we need to backup early as directories don't use a temporary path, and fsmVerify() will remove the file before we get to it in fsmCommit().
2012-08-23Use fsm->action to decide whether we need a backup or not.Panu Matilainen1-6/+2
- We already have a carefully precalculated action decided for these things, use that instead of bunch of arbitrary (except for osuffix) conditions depending on several nasty hacks and hidden assumptions. Doing so fixes stuff, who would've thought of that? - Adjust test-suite expectations
2012-08-23Backup filename needs suffix, whether its directory or notPanu Matilainen1-1/+1
2012-08-23Remove dead file-backup codePanu Matilainen1-17/+0
- fsmVerify() never ever returns 0 for regular files because of multiple hacks in how this all "works": on install, we skip stat() but claim disk checked and file not existing, so fsmVerify() returns early. Good thing it does too, as otherwise it would remove the file we were supposed to be saving here. The actual %config backup occurs in fsmCommit(): regular files are first installed with a temporary suffix and at "commit" time we decide whether it needs backing up or not (involving several other hacks...)
2012-08-21Fix %config backup on erasure regressionPanu Matilainen1-2/+15
- After commit 1845c1d711b88723e596c88e8a7730a360029089 erasure no longer calls fsmCommit(), missing the backup step entirely. Simply split the backup code to a function of its own and call as needed. The details look somewhat fishy but what in fsm doesn't...
2012-07-02Cosmetics: remove redundant {} block, fixup indentationPanu Matilainen1-14/+11
2012-07-02Dont use mmap() for anything, axe the code insteadPanu Matilainen1-39/+0
- Commit 4cb02aa928d3e41f636d0e01356c7a3cb51018ee asked to see what breaks when mmap() is used, now we know: large package support broke when enabling it. Could be fixed of course by eg adding a size cap to the fsm part as well, but just doesn't seem worth it: I fail to measure any meaningful performance improvement from mmap usage in either case, and added complexity for what is close to zero benefit just doesn't make sense... and various sources in fact note the rpm usage (read through the entire file sequentially) as one of the cases where mmap() is NOT beneficial due to mmap() high setup + teardown cost + page fault speed (or lack of thereof).
2012-05-21Restore basic debug output for fsm operationsPanu Matilainen1-0/+7
- This is close to what we had in the stage-machine days, just to allow easily viewing whats going on inside the fsm (create/skip/etc)
2012-05-04Small patch to reverse hardlink orderingMichael Schroeder1-3/+3
Hi Panu et al, Here's a small patch that changes the ordering used for putting hardlinked files into the cpio archive back to lexicographical. You might wonder what this is about. Well, old rpm-3 (and also old versions of rpm-4, I think) already used lexicographical ordering for files and hardlinks. When deltarpm was created, it made use of this fact when "compressing" the file order of the cpio archive into the so-called "sequence". Deltarpm can deal with "out of order" files, but in that case it needs to reset the compression, which leads to really long sequence strings. Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2012-04-24Eliminate rpmts usage from lower levels of fsm machineryPanu Matilainen1-25/+10
- The only remaining use for rpmts here was grabbing NODIGESTS from rpmtsFlags(). Pass the tiny little piece of information as an argument for the one place needing it and rip all the now unused related goo.
2012-04-24Only install needs selabel handle, dont bother elsewherePanu Matilainen1-1/+1
2012-04-24Dont bother with fsm-level digest statisticsPanu Matilainen1-4/+0
- Most of fsm doesnt need the actual transaction set for anything "real" and dragging it around as a mere statistics collector seems pretty dumb. If we want better statistics, we better come up with a saner way to gather them.
2012-04-24Eliminate rpmts and rpmte kludgery from package buildingPanu Matilainen1-4/+5
- Package building has no associated transaction or ts members, this was all just fake-up kludgery to work around the way how fsm used to work. None of it relevant now, kill kill kill.
2012-04-24Eliminate rpmte usage from lower levels of fsm machineryPanu Matilainen1-16/+17
- Determine the need for reverse iteration based on fsm goal - Everything else was just using rpmte to get to its file states, eliminate the intermediate ping-pong by passign the file states around directly. Makes the thing that little bit less silly.
2012-04-24Move mode-specific flag setting out of fsmNew()Panu Matilainen1-11/+11
2012-04-24Clean up file backup logic a bitPanu Matilainen1-19/+17
- Ghosts are never backed up, and the whole business is irrelevant for package building. Use fsm goal instead of rpmte mode to determine what to do, rpmte in build code is nothing but an ugly hack.
2012-04-24Bury build filestate setting inside fsm remainsPanu Matilainen1-1/+11
- This whole thing probably isn't needed anymore, but for now just lift the FA_SKIP/FA_COPYOUT setting to rpmPackageFilesArchive(), allowing rpmfsSetAction() to become properly internal-only function. - Trim out unnecessary now unnecessary librpm internal includes from librpmbuild code
2012-04-24Split out file state recording out of fsmMapPath()Panu Matilainen1-9/+20
- The file state that gets stored in the rpmdb has nothing to do with path and is only relevant for installs.
2012-04-18Pay attention to NULL returns from rpmcpioOpen()Panu Matilainen1-6/+6
- The archive interface might actually want separate new + open, but for now just flag an internal error on NULL return on archive open.
2012-04-18Sanitize fsm creation/initialization and destructionPanu Matilainen1-25/+13
- Now that there are no more failing parts requiring return codes, change + rename fsmSetup() into a more regular fsmNew() construct, returning newly "instance" of fsm and similarly fsmTeardown() -> fsmFree() to free the thing. - There's no real need to allocate this stuff on heap, but doing so makes life actually simpler for the three callers and makes the whole thing more consistent with common practises in the codebase.
2012-04-18Split out hardlink checking from fsmTeardown()Panu Matilainen1-25/+32
- Checking missing links is only relevant for install, lift the code to separate function and call from the install-case only. - Freeing data while checking seems like a dubious "optimization" but to keep changes minimal, leaving that as it is now.
2012-04-18Eliminate unused leftover rc member from fsm structPanu Matilainen1-3/+2
2012-04-18Move cpio end trailer detection to the cpio codePanu Matilainen1-1/+3
- The fsm shouldn't know any archive format specifics, detect the trailer from rpmcpioHeaderRead() and signal EOF through CPIOERR_HDR_TRAILER instead.
2012-04-18Separate payload archive close and freePanu Matilainen1-12/+11
- When writing, archive finalization can write further data into the payload (eg cpio trailer). We need to be able to fish the final archive size *after* closing it, otherwise archive size will be off by trailer size. - Add new rpmcpioFree() function which simpy frees the archive struct, calling rpmcpioClose() in the process if it wasn't already done. - This also simplifies the error code gymnastics in fsm: we need to free the resources whether error or not, which rpmcpioFree() allows us to do. And for writers, calling rpmcpioClose() only needs to be done if earlier parts were successfull, so we dont need to worry about masking a former error code when calling it.
2012-04-17Eliminate payload archive member from fsm structPanu Matilainen1-32/+36
- Only install and build have an associated archive, and this can be just as well handled as a local variable, passing down as argument to the handful of places needing it. - Error handling looks a bit fishy but that's not exactly new issue...
2012-04-17Push fsm archive size down to the only caller who caresPanu Matilainen1-11/+7
- Archive size is only relevant for build code, no need for tracking this in the big struct. Just return the archiveSize at end of build process.
2012-04-17Lose unnecessary cfd member from fsm, refcount through payload insteadPanu Matilainen1-8/+0
2012-04-17Kill couple of useless "helper" functionsPanu Matilainen1-16/+2
- Both are only ever called once and are so trivial that they're not helping anything at all
2012-04-17Remove now unused psm argument to fsmSetup()Panu Matilainen1-4/+4
- Bah, should've been in commit 4ef540d25bab77b46cbf4467c8f6bc22cdd0e419
2012-04-17Move mapping index + and related loop exits out of fsmInit()Panu Matilainen1-29/+21
- The mapping index is the same for build + erase, but different for install and so is the return code mapping. By doing this inline where the action is we avoid having to fiddle with mapped return codes for the exit case.
2012-04-17Move the install-only payload reading to the install-only codePanu Matilainen1-18/+9
- Besides simplifying the common path everything takes, this removes the need to map error returns back and forth when we can just detect the end of payload directly in the loop and break out.
2012-04-17Split fsm state reset to a separate functionPanu Matilainen1-4/+13
- No functional changes as such, but moving this out of fsmInit() permits other goal-specific items to be moved out of fsmInit()
2012-04-17Zeroing out the fsm is common to all modes, move it to fsmSetup()Panu Matilainen1-4/+1
2012-04-17Push dnl iterator init + free to the sole caller fsmMkdirs()Panu Matilainen1-11/+7
- There's zero need for the rest of the code to know or care about dnl iterator, just pass the file info- and state sets to fsmMkdirs() directly and hide the otherwise unused iterator business there.