Commit Graph

12175 Commits

Author SHA1 Message Date
Panu Matilainen f51968d7e1 Print fd debug stats for compressed types centrally on close 2013-03-05 08:58:28 +02:00
Panu Matilainen f6139dbd6f Move fd refcounting from io methods to fdPush() / fdPop()
- One less thing for each and every io type to do...
2013-03-05 08:48:09 +02:00
Panu Matilainen cc3075b964 Clean up / sanitize Ferror() a bit
- There's no need for double error codes here, just break the
  loop on first error we encounter.
- Now that fdio/ufdio error reporting is sane we dont need any
  specially broken tests to avoid errors from fdno being -1
2013-03-05 08:28:36 +02:00
Panu Matilainen 6bbf0f40f4 Pass the underlying file descriptor as argument to fdNew() already 2013-03-05 08:18:41 +02:00
Panu Matilainen e794f1146f Grab io vectors directly from the stack we're passed 2013-03-05 08:10:59 +02:00
Panu Matilainen 40f3f415ea Pass current fd stack to lower level methods, part IV
- Move the error tracking variables to the stack, doesn't make
  much difference now but would allow for true per-iotype specific
  error systems if we had such a thing, and tracking errors
  in the stack they occurred.
- Change fdio error methods to pass stacks around.
2013-03-05 07:52:35 +02:00
Panu Matilainen b1fe8479ca Slightly less broken fd errors
- Return syserrno for fdError() - it might be useless for now but
  that's still less broken than reporting errors on fdno -1, which
  can never be the case on non-compressed fd, and on compressed ones
  its always the case... Currently only compressed streams use
  syserrno but no reason we couldn't use it for plain fd too.
- Return empty string instead of NULL from compressed stream errors
  when there is no error.
2013-03-05 07:39:53 +02:00
Mark Salter 8e1ca16c58 AArch64 support v2
Here is my updated patch adding AArch64 support. The main change was to
use CANONCOLOR=3 rather than 2.

--Mark

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-03-05 06:45:08 +02:00
Panu Matilainen b58ebffa83 Pass current fd stack to the lower level methods, part III
- Change fdio close and fflush methods to pass stacks around. A big
  pile of poop goes down with this particular flush...
2013-03-04 23:48:42 +02:00
Panu Matilainen 2bb55dcd51 Pass current fd stack to the lower level methods, part II
- Change fdio seek and tell methods to pass stacks around with minimal
  other changes for now...
2013-03-04 23:28:07 +02:00
Panu Matilainen b4b5db455b Pass current fd stack to the lower level methods, part I
- The lower level io-type specific methods mostly really just
  want their own stack to get to their private data, rather than
  the fd (which is available through the stack now as well)
- Change fdio read and write methods to pass stacks around with
  minimal changes overall. They all need to be changed but doing
  this in smaller pieces to avoid a humongous commit... Further
  cleanups + sanity to follow once its all been done.
2013-03-04 23:24:38 +02:00
Panu Matilainen 5305c364af Add pointer to parent fd to the fd stack
- Unused atm, will need shortly...
2013-03-04 22:57:38 +02:00
Panu Matilainen 28167e4ef2 Grab a pointer to current stack and operate on it directly in fd push/pop
- Having fd NULL-checked for each these calls makes no sense, and
  we'll shortly have more data in there + more uses for fdGetFps()
- Doesn't change anything, just preliminaries for next steps.
2013-03-04 22:54:48 +02:00
Panu Matilainen df2373609a Eliminate yet more unused rpmio goo
- The _ffileno() method has always been unused and doesn't really
  make sense anyway given how this stuff is structured, might as
  well just axe...
2013-03-04 22:35:00 +02:00
Panu Matilainen 25441048c5 Cosmetics: change FDSTACK_[st] to generic rpm style
- Whether good style or not, in general structs types have _s postfix
  and typedef pointers to them have _t postfix.
2013-03-04 21:48:23 +02:00
Panu Matilainen 25713aafdd Revert "Use separate fooFileno() functions for xzdio and lzdio"
- Oops, the xz/lzma case was even more .. err .. creative  than I
  recalled.  Revert this change for now, this needs a different kind of
  approach to sanely fix.
- This reverts commit af61b0d925.
2013-03-04 21:38:29 +02:00
Panu Matilainen b49571586c Eliminate a whole bunch of unused rpmio code...
- Despite all the io types dutifully supplying such a method, the
  fdio->_fopen() path is not (and has never been) used at all: the
  compressed streams get opened on top of a file descriptor opened
  by ourselves. So, lotsa code deleted, but no functional changes
  as this code has never been wired up anywhere.
- There wouldn't be any particular advantage to using the path-based
  opening over the fd-based one anyway, and while we *could* use that
  as well, it would require jumping through extra hoops to support the
  current "ufdio open always" semantics, so we might just as well
  axe the lot. Bye bye.
2013-03-04 21:22:24 +02:00
Panu Matilainen 349f9444f3 Simplify & clean up Fopen() a bit
- Explicit fdio and unspecified type use plain fdio, everything else
  goes through ufdio for the open. Once we have the physical file
  opened, open the compressed stream on top if necessary. This doesn't
  actually *change* anything in here, just eliminates a whole lot
  of unnecessary cruft.
2013-03-04 20:23:03 +02:00
Panu Matilainen af61b0d925 Use separate fooFileno() functions for xzdio and lzdio
- Now that we can, take advantage of iotFileno() for these too,
  eliminating yet another subtly-different-from-everything-else
  case. Of course the per-filetype fooFileno() vectors start
  seeming fishy and at least redundant now but...
2013-03-04 19:38:23 +02:00
Panu Matilainen 374d877e97 Umm... actually use the correct io type for lzma 2013-03-04 19:25:33 +02:00
Panu Matilainen a8f8d696f6 Generalize Fdopen() to work with any known io type
- Add a function to find io type by its type- or "friendly" name
  and use that for finding the requested type in Fdopen(), which
  apart from legacy gzdio assumptions now doesn't need to know
  anything about our supported types.
2013-03-04 14:54:43 +02:00
Panu Matilainen b2e6360702 Add strerror method to io types, use it
- Eliminate yet another place where we manually test for each and every
  known io type for no good reason at all. As it happens we only
  need two simple handlers for these: one for non-compressed and
  another one for compressed types.
2013-03-04 13:48:23 +02:00
Panu Matilainen 1f3af32cde Add error method to io types, use it
- Eliminate another place where we manually test for each and every
  known io type for no good reason at all. As it happens we only
  need two simple handlers for these: one for non-compressed and
  another one for compressed types.
2013-03-04 13:28:30 +02:00
Panu Matilainen a59ceaf127 Generalize fdbg() to work with any rpmio type
- Plain fd types dont have a special _fopen() method so we can use
  that to determine the kind of message we want to spit out, eliminating
  the hysterical testing for each and every io type separately.
2013-03-04 13:02:56 +02:00
Panu Matilainen 8f94ad126f Add type name and "friendly name" to io type structures 2013-03-04 12:21:48 +02:00
Panu Matilainen b513f382fe Actually use the fdopen method for, well, opening the fd's 2013-03-04 11:49:22 +02:00
Panu Matilainen c2e2a997de Add "fdopen" method/vector to rpmio types
- This is one of the things that *is* io-type specific yet there
  was no vector defined for it and so its manually coded in Fdopen(),
  pfft...
2013-03-04 11:34:30 +02:00
Panu Matilainen 3281828893 Eliminate unused and useless fd io method pointers
- These are not used at all, perhaps because they make no sense
  to begin with... refcounting, underlying physical fd number
  and FD_t allocation aren't going to be io type specific.
2013-03-04 11:26:59 +02:00
Panu Matilainen 240de78f15 Avoid redundant metadata changes to hardlinked files
- Hardlinks have shared metadata by their very definition, it makes
  no sense to keep resetting the metadata for all links we create.
  Only set metadata for first non-skipped hardlink in a set.
2013-02-27 11:23:26 +02:00
Panu Matilainen 8b44106146 Refactor fsmCommit() a bit for next steps
- Return early for the highly special case of /dev/log
- Separate metadata (permissions, time stamps...) setting from
  the renaming part: rename is always required, but setting
  metadata is not (although we currently always do)
- No functional changes
2013-02-27 11:17:12 +02:00
Elena Reshetova af925f6496 Adding FSM file hooks
Two hooks are currently added:
FSM_FILE_OPEN
called after fsmInit() has been called for the file during installation or erase.
FSM_FILE_CLOSE
called after fsmCommit() for the file during installation or after file has been removed on uninstallation

In addition FSM_FILE_CLOSE is called for each directory that isn't included in the package and was created by rpm

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-02-22 11:09:27 +02:00
Panu Matilainen de39b29572 Eliminate the strange cptr_t "alias" for char *
- Perhaps this had some kind of meaning for the ancient implementors,
  but that meaning has gotten long since lost in the sands of time
  and most likely no longer exists at all...
2013-02-20 13:38:24 +02:00
Panu Matilainen 30e457551a Eliminate the unnecessary rpmGetVar() wrapper function
- Convert the sole user to use rpmGetVarArch() instead...
2013-02-20 11:58:24 +02:00
Panu Matilainen ebe7b1c83a Meep, forgot to acquire locks for rpmFreeRpmrc()
- While adding the outer locks before converting all of internals
  is easier here, it makes it also easier to forget places since
  its not actually forced :-/ oh well...
- Should've been in commit 2870caa14c
2013-02-20 11:57:34 +02:00
Panu Matilainen 2870caa14c Introduce rpmrc context object, use for locking at the outer API
- Similar to the context object in rpmlog, hide the global context
  behind a function call to force controlled context acquisition.
  We're going in the opposite direction here (because its simpler in
  this case): there's nothing but the lock in the context now.
- Acquire and release the context on entry to public API
  entry- and exit points, this should be enough to guarantee basic
  safety (as in "does not crash and burn") wrt threads. Assuming
  there are no hidden writers behind the getter APIs...
- For thread *sanity* all the umphteen globals need to go into the
  context which could be per-thread initialized but that's a longer
  story...
2013-02-20 11:14:51 +02:00
Panu Matilainen b36d4ae0cf Refactor rpmIsKnownArch() for locking friendliness 2013-02-20 10:55:15 +02:00
Panu Matilainen 4a093e4efb Refactor rpmMachineScore() for locking friendliness 2013-02-20 10:53:01 +02:00
Panu Matilainen 7e7564352b Refactor single point of exit for rpmGetArchColor() 2013-02-20 10:41:18 +02:00
Panu Matilainen 2065033a08 Use internal interface for OS and ARCH info in rpmrc.c
- No functional change, just preliminaries wrt locking
2013-02-20 10:36:53 +02:00
Panu Matilainen c47e343aa9 Refactor single exit point for rpmReadConfigFiles() 2013-02-20 10:22:04 +02:00
Panu Matilainen 6f76f4fa78 Late evening hacking considered harmful... 2013-02-20 09:07:35 +02:00
Panu Matilainen 5b75e88858 Whoops, misread manual on pthread_rwlock_destroy()
- Turns out "destroying the object and release any resources used by the
  lock" does not include *unlocking* the lock. How silly of me to think
  it would...
2013-02-19 22:26:01 +02:00
Panu Matilainen c192de5171 Really allocate strings dynamically in rpmcpioStrerror() 2013-02-19 22:08:20 +02:00
Panu Matilainen 0e0ec5bd98 Return malloced memory from rpmcpioStrerror()
- This is unlikely to ever run into threads, but returning a const
  pointer to a static buffer is sooooo last century...
2013-02-19 22:02:26 +02:00
Ville Skyttä 8002b3f985 Spelling fixes.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-02-19 21:35:40 +02:00
Panu Matilainen c306442be2 Eliminate hysterical static variable for relocation debug messages
- The static _printed tracking meant that the debug spew would only
  be printed out for one package per process lifetime, regardless of
  how many relocated packages there might be. rpmRelocateFileList()
  will gets called twice for every relocated package within a
  transaction, but then this is debug-only output to begin with.
  When debugging we can live with a little extra spew...
2013-02-19 19:01:43 +02:00
Panu Matilainen 5f857c0c09 Clarify the zero-padding "buffer" use in rpmWriteSignature()
- This is not a buffer where anything gets written to, its only
  used as a source for writing zero-padding into signature headers.
  Rename to "zeros" and make it const which it is.
2013-02-19 18:13:23 +02:00
Panu Matilainen f52b2821c8 Make "now" non-static, there's no need for it to be that way
- This makes "now" be "now" on "package query started" than
  "some arbitrary point in process lifetime when", which could
  in theory be arbitrarily long in the past. Which should be
  a sane thing... and also avoids having to do pthread tricks
  for such a silly and cheap-to-call thing.
2013-02-19 17:59:40 +02:00
Panu Matilainen 9f0e1bbb5a Add basic locking to pubkey objects
- Keys are basically immutable and generally owned by the keyring
  which doesn't currently doesn't expose anything about the keys
  it owns... so there isn't perhaps that much need for locking,
  except for keeping reference counts sane. Under that assumption
  the keys are not locked from within keyring lookup and signature
  verification, as it'd seem the keyring locking is sufficient
  to keep our keys around during them. Just as well there might
  be holes in this theory but gotta start someplace...
2013-02-19 16:51:38 +02:00
Panu Matilainen 23e7ada136 Add rwlocking to keyring for basic thread protection
- While we're mostly interested in very limited thread-safety
  where objects need to be kept private to the owning thread, being
  able to share the keyring (from transaction set) seems desireable,
  so lets try at least...
- Try to keep things as simple as possible: grab locks at the outer
  level functions, dont bother optimizing for write-lock avoidance
  in corner cases etc.
2013-02-19 16:46:47 +02:00