Commit Graph

81 Commits

Author SHA1 Message Date
Florian Festi bd60c4285f Kill FSM: Make FSM_PKGINSTALL a function 2012-03-30 15:00:41 +02:00
Florian Festi 75073ae2a4 Move fsm_s to fsm.c and remove fsmNext() from fsm.h 2012-03-27 14:12:42 +02:00
Florian Festi 6492aa800f Untangle lib/fsm.c and lib/cpio.c
Create cpio_t data type that holds the underlaying FD_t instance
Move padding and position handling and trailer generation into cpio.c
Use only one buffer in the fsm (merging the read and write buffer)
Replace the FSM_EAT, FSM_POS, FSM_PAD, FSM_DREAD, FSM_DWRITE states with cpio functions
Prepend "rpm" to the cpio function names
2012-03-27 14:12:42 +02:00
Panu Matilainen ac4a011be5 Kill off yet more repackage remnants from fsm
- CPIO_ALL_HARDLINKS flag and related code has been unused and dead
  since rpm >= 4.6.x
2012-01-17 12:50:51 +02:00
Panu Matilainen 0b163b65a9 Eliminate FSM_WOPEN, FSM_WRITE and FSM_WCLOSE stages
- These are nothing but unnecessarily specialized Fopen(), Fwrite() and
  Fclose() for what is a purely local need in expandRegular(). Move
  the local stuff where it belongs.
2012-01-17 11:03:27 +02:00
Panu Matilainen 680c3cfbf7 Eliminate FSM_ROPEN, FSM_READ and FSM_RCLOSE stages
- These are nothing but unnecessarily specialized Fopen(), Fread() and
  Fclose() for what is a purely local need in writeFile(). Move
  the local stuff where it belongs.
2012-01-17 10:52:46 +02:00
Panu Matilainen ff74325088 Eliminate file digest related members from fsm struct
- Both digest algo and the current file digest from header are
  only needed inside expandRegular(), push the stuff down there.
2012-01-17 09:03:55 +02:00
Panu Matilainen 9834b743d6 Eliminate the now obviously unnecessary opath member from fsm struct 2012-01-16 14:40:45 +02:00
Panu Matilainen 62c7654279 Sanitize file capability setting in fsm
- Move parsing, setting and freeing of capabilities into simple
  helper function, there's no point whatsoever having the current
  capability stored in fsm when it only complicates freeing and all.
  WTH was I thinking when implementing this? (well, everything in
  fsm was done that way so...  but that's a lame excuse)
2012-01-13 11:36:28 +02:00
Panu Matilainen d4b8acc5d3 Sanitize selinux labeling in fsm
- Move all the label foobar into a simple helper function which
  finds, sets and frees the context if selinux is enabled, use
  for both regular operation and orphan directory labeling.
  Simplifies things a good deal...
- While the selabel handle can change during a transaction, it
  wont change while the fsm is running so its sufficient to grab
  it on entry instead of repeatedly calling rpmtsSELabelHandle() after
  figuring out where in the world our ts might be.
2012-01-13 11:08:47 +02:00
Panu Matilainen cc1b352952 Eliminate unused subdir member from fsm struct 2012-01-13 10:27:11 +02:00
Panu Matilainen a8fd66d87f Eliminate silly sufbuf from fsm struct
- Allocate fsm->suffix directly when suffix is needed instead.
  Doesn't change anything, only makes life that little bit simpler.
2012-01-13 10:23:50 +02:00
Panu Matilainen 37f7802aa6 Remove unused "orphan" directory creation tracking variable from fsm 2012-01-13 09:41:56 +02:00
Panu Matilainen 8049e42f30 Move directory tracking variables out of fsm struct to local scope
- These are not used or needed outside fsmMkdirs() so its just
  plain dumb to have them in the big struct. No functional changes,
  just taming the fsm monster a little bit.
2012-01-13 09:40:11 +02:00
Panu Matilainen aee64fbc46 Turn FSM into a blackbox, much like PSM is
- Similar in spirit to PSM blackbox treatment in
  commit df9cdb1321, except that
  technically fsm guts are still wide-open in fsm.h due to cpio
  "needing" them (yuck).
- Allows getting rid of dumb a**-backwards things like rpmfiFSM()
  which is just not needed, fsm is a relatively short-lived entity
  inside psm and build, nobody else needs to bother with it except
  for the returned results.
- Figure out the cpio map flags in fsmSetup() where it logically belongs,
  we have all the necessary info available there.
- Get rid of newFSM() and freeFSM(), we can just as well place the
  fsm on stack, merge the necessary cleanup bits from freeFSM()
  into fsmTeardown()
- Supposedly no functional changes, knock wood.
2012-01-11 15:41:22 +02:00
Panu Matilainen 72bd2de21e Clean up progress callbacks in fsm/psm machinery
- Move notifications from fsm to psm side for sanity and symmetry,
  psm already has members to hold the callback state.
- Replace PSM_NOTIFY "state" with a helper function that both
  fsm and psm itself use (except for error callbacks which are
  a bit different)
- Init psm->total early, this doesn't change and can now be
  used to refer to "all done" value whatever it happens to be,
  instead of magic "100" values etc.
- Packages with no files are now handled through the same path
  as everything else from progress reporting pov, we just skip calls
  to fsm if there are no files.
- Issue stop callbacks for install as well. While INST_CLOSE_FILE
  can be (and is currently) used to detect this condition, its
  conceptually an entirely different thing.
- Fix erasure callback parameters, they were reversed (starting from
  total and ending with 0, ehh...)
2012-01-05 16:05:10 +02:00
Panu Matilainen ef75cadf03 Pass and remember the controlling psm (if any) in fsm 2012-01-05 16:05:10 +02:00
Panu Matilainen 89c2fd9f51 Rip the stillborn, broken apply/commit transaction goo
- This was beginnings of something ten years ago, and that something
  was long since abandoned. These never did anything useful
  that --justdb/--noscripts wouldn't do.
2010-12-20 11:38:21 +02:00
Panu Matilainen 2fb15a5443 Stop abusing enum typedefs for bitfield types
- Enums are fine for defining the bitfield flags, but the bitfield
  itself is not an enumeration. Add a separate typedef on "rpmFlags"
  type (presenting a bitfield of flags) for all of these. Compilers
  hardly care, but the typedefs give a nice visual clue for
  us humans using these flags far away from ho^H^H definitions.
2010-09-21 11:10:14 +03:00
Panu Matilainen a795c69c20 Eliminate unused no-op FSM_CHROOT stage
- the fsm thingie doesn't need to deal with chroot issues: except for
  build where it doesn't matter, its only called from psm where the
  chroot is already taken care of
2010-05-31 13:29:43 +03:00
Panu Matilainen 6109d6388e Remove libcap stuff out of system.h
- just a few places need, avoid polluting everything with it
- make fsm->fcaps void * to avoid having to deal with fcap_t not defined
2010-01-05 13:29:52 +02:00
Panu Matilainen 0d4a9d13cb Remove bogus const from fsm [o]path members and use of _constfree()
- in reality the paths point to allocated memory at all times
2009-12-16 09:43:55 +02:00
Panu Matilainen bdfb54bd23 Remove cpio stuff from FD_t
- only the FSM cares about cpio position, move it there - there's only
  ever one fd active inside FSM, no need to track it per-fd
2009-10-14 17:03:14 +03:00
Jindrich Novy 7acdfded4a Add md5->filedigest aliases (rhbz#487597)
- add %verify(nofiledigest) as %verify(nomd5) file attribute alias
- reference digests as digests not checksums
- make old md5 related symbols obsolete and use newer reference
- update man page accordingly
2009-02-27 14:34:39 +01:00
Panu Matilainen 610347de6e Pass rpmte to fsmSetup()
- fsm needs the transaction element for progress notification and
  element type anyway
2008-11-27 09:25:12 +02:00
Panu Matilainen 54b683d2f3 Remove bogus consts from fsmSetup() args
- rpmfi is messed with (at least file actions)
- const on typedef'ed type doesn't mean a thing anyhow
2008-11-27 09:25:12 +02:00
Panu Matilainen 36d4908efe Use matching type for fsm->digest to avoid unnecessary cast 2008-11-19 15:46:02 +02:00
Panu Matilainen 2d5b4e3bac Lose useless fsm/rpmfi astriplen field
- only "used" for debugging output, duh...
2008-11-15 13:22:19 +02:00
Panu Matilainen ed9836dfba Remove unused fsm subbuf field 2008-11-12 21:58:56 +02:00
Panu Matilainen fbc06059cb Cpio flags are only relevant for fsm, get them out of rpmfi 2008-11-11 20:48:35 +02:00
Panu Matilainen 8e3b5bfc89 Push archivePos from rpmfi to fsm
- archive position is only meaningful in fsm context anyway
2008-11-11 18:16:22 +02:00
Panu Matilainen 97ab15cc9e Add fsm and rpmfi machinery for file capabilities
- new rpmfiFCaps() API to retrieve the info from rpmfi set
- fsm internals quite similar to selinux handling
- plenty of #ifdef's, another possibility would be adding cap_foo dummies to
  system.h like for selinux
2008-10-29 11:49:38 +02:00
Panu Matilainen 7681f80e25 Mark various fsm* bits internal
- build code uses fsmSetup() and fsmTearDown(), those need to remain
  visible for now
2008-10-09 15:35:36 +03:00
Panu Matilainen 2093f7cceb Plug leaks in selinux context handling in fsm 2008-07-03 17:14:45 +03:00
Panu Matilainen 161395648f Use 64bit type internally for package archive size & offset
- cpio "new" ascii format limits individual files to UINT32_MAX, no such
  limit on the entire archive though
- RPMSIGTAG_PAYLOADSIZE is 32bit type atm, assert that the archive size
  fits to UINT32_MAX despite internal presentation being larger
- FD_t limits the real archive to rpm_off_t still
2008-06-09 12:29:07 +03:00
Panu Matilainen 09d8cbafff Unexport file state machine internals
- fsmGetTs(), fsmGetFi(), fileStageString(), fileActionString(),
  fsmMapPath(), fsmMapAttrs() and fsmStage() aren't needed outside fsm,
  make 'em static to avoid leaking to symbol space
2008-06-03 14:26:34 +03:00
Panu Matilainen ae5667cf06 Lose unused fdigests array from rpmfi struct
- only used in rpmfiNew() where it's converted to binary from the header
  hex presentation and free'd immediately, a local variable will do just as
  well
- some useless references in fsm and psm, kill'em too
2008-06-02 09:50:48 +03:00
Panu Matilainen 4aa7ab6422 Teach fsm internals to honor rpmfi digest type 2008-06-02 09:50:48 +03:00
Panu Matilainen f771b641d3 Rename rpmfi and fsm checksum md5-sum fields to refer to digest
- no functional changes
- groundwork for supporting other than md5 checksums
2008-06-02 09:50:48 +03:00
Panu Matilainen e886043a10 Add rpm_off_t type for file size types, use where spotted
- preliminaries for bumping up the max size, use rpm-specific type
  as off_t size varies, header data needs fixed size
2008-02-04 11:27:00 +02:00
Panu Matilainen 8bdd462b50 Make fsm failedFile non-const like it really is
- callers need to free it so const is wrong
- cast away the hardlink-hackery in fsm instead
2007-12-18 10:10:03 +02:00
Panu Matilainen 6966c5d8ac Stick cpioMapFlags to fsm.h, they're only used by fsm.c
- allows FSM* typedefs to move to where they belong
2007-12-17 13:39:14 +02:00
Panu Matilainen 8268570f48 Hide fsmIterator_s struct details, not needed outside fsm.c 2007-12-17 13:20:05 +02:00
Panu Matilainen c3353c2af4 Stuff hardLink_s inside fsm.c, add pointer typedef to fsm.h
- nothing outside fsm.c needs except for the declaration in fsm_s
2007-12-17 13:15:53 +02:00
Panu Matilainen 9ce13e09ef Switch to <rpm/foo.h> style for public headers
- adjust include paths accordingly
2007-12-08 14:02:32 +02:00
Panu Matilainen 361a8e697b Move file action enums to rpmfi where they logically belong 2007-12-02 22:50:55 +02:00
Ralf Corsépius 60939d6985 Expand private include file names to be relative to $(top_srcdir) 2007-11-23 11:39:29 +01:00
Panu Matilainen c0149602a6 Rename public fileAction* type to rpmFileAction for namespacing 2007-09-20 16:19:25 +03:00
Ralf Corsépius ebef4f211c Remove splint tags. 2007-09-11 19:07:39 +02:00
Panu Matilainen 049674696d Remove const type-qualifiers from function return types everywhere.
They're meaningless in C and cause tonne of build warnings.
2007-07-10 12:15:43 +03:00