summaryrefslogtreecommitdiff
path: root/src/filesdb.c
AgeCommit message (Collapse)AuthorFilesLines
2011-09-09Do not include trailing slash for directory string literalsGuillem Jover1-0/+1
This makes it more natural to manage the directory names, and avoids some doubled slashes.
2011-05-15dpkg: Change write_filelist_except() to take a mask intead of a boolGuillem Jover1-4/+4
This generalizes the function to exclude any desired file namenode flag and not just fnnf_elide_other_lists. It also gets rid of the bool variable which is generally a bad interface to change function behaviour when it should really be a named flag or a mask.
2011-05-15dpkg: Make fd variable passed to cu_closefd staticGuillem Jover1-1/+1
The push_cleanup() call takes a pointer to the fd variable which resides in the stack. In case of error and stack unwinding due to longjmp, the value of fd might get overwritten by subsequent stack usage. Thus this kind of variables need to be static so that their value cannot change on stack rollback.
2011-05-15libdpkg: Rename cu_closefile to cu_closestreamGuillem Jover1-1/+1
This should make it clear we are referring to a stdio stream, and not the future planned ‘struct file’.
2011-03-14Move pkgadmindir() and pkgadminfile() to the filesdb moduleGuillem Jover1-0/+40
These functions are not really part of the modstatdb module, and by moving them out they get detangled and will make it possible to extend them w/o pulling additional code into binaries not using the functions.
2011-03-02Use varbuf_end_str() instead of ad-hoc varbuf_add_char() callsGuillem Jover1-1/+1
This allows the strings to be terminated, thus printable or accessed through the standard C string functions, and at the same time appendable.
2011-03-02dpkg: Use pkgadminfile() instead of varbuf_pkgadminfile()Guillem Jover1-4/+5
This simplifies the API, and unifies the different call sites, the extremely small performance penalty is irrelevant in these cases.
2011-02-11dpkg: Use varbuf_pkgadminfile() instead of manually building the pathGuillem Jover1-5/+1
2011-01-16libdpkg: Rename varbufaddstr() to varbuf_add_str()Guillem Jover1-5/+5
Make the varbuf API a bit more consistent.
2011-01-16libdpkg: Rename varbufaddc() to varbuf_add_char()Guillem Jover1-2/+2
Make the varbuf API a bit more consistent.
2011-01-16libdpkg: Rename varbufreset() to varbuf_reset()Guillem Jover1-2/+2
Make the varbuf API a bit more consistent.
2011-01-08Use fd_read() instead of fd_buf_copy()Guillem Jover1-2/+3
The latter is doing unneeded work. Switch to use a simpler but equally functional variant.
2010-11-19Cleanup white spacesGuillem Jover1-7/+7
Remove trailing spaces. Remove blank lines not separating different code blocks. Remove blank lines at the end of the file.
2010-11-19Cleanup and improve source code commentsGuillem Jover1-35/+34
Global review, which includes the following changes to try to increase consistency, update and improve the source code comments: - Spelling fixes. - Use American English forms. - Uppercase NULL, NUL and ASCII. - Use “Note: ” instead of the slightly cryptic “NB: ” form. - Write comments as proper sentences, including capitalizations and ending dots. - Move comments before the code, function or variable they refer to. - Move general function comments outside the body. - Convert function and variable description comments to doxygen. - Use one space before dot, exclamation and question marks. - Use ‘’ or “” instead of `' style quoting. - Remove author names from comments, already visible from “git blame”. - Mark strings for translators with “TRANSLATORS: ”. - Remove useless or outdated comments. - Fix comment indentation. - Standardize comment format: /* Short text comment. */ /* Long text, * comment. */ /* * Section text. */
2010-11-19libdpkg: Namespace package database functions with pkg_db_ prefixGuillem Jover1-1/+1
2010-08-26Add gettext messages for plural formsGuillem Jover1-1/+3
Some of the singular forms are not currently used, but we keep them for consistency, and to avoid confusing translators. Closes: #594218
2010-06-25dpkg: Use iterators instead of exposing packageslump directlyGuillem Jover1-0/+56
2010-05-19Use bool instead of int wherever appropriateGuillem Jover1-9/+13
2010-03-12Do an fsync on database directoriesGuillem Jover1-0/+3
After creating, renaming or unlinking database files sync its containing directory, to guarantee the new file entry is correctly listed in the directory. Closes: #567089 Base-on-patch-by: Jean-Baptiste Lallement <jeanbaptiste.lallement@gmail.com>
2010-03-12libdpkg: Create new pkgadmindir() to hide admindir and INFODIRGuillem Jover1-2/+1
The callers should not be concerned about where the package info directory is located, the new functions encapsulates the knowdlegde in the dbmodify module.
2010-03-05dpkg: Use posix_fadvise on non-Linux to speed up .list files loadingStefan Fritsch1-0/+22
When FIEMAP is not available try to use posix_fadvise() to request the preloading of the .list files. A search with dpkg-query went from 28 to 17 seconds, giving around 40% improvement. Closes: #557560 Signed-off-by: Guillem Jover <guillem@debian.org>
2010-03-05dpkg: Use FIEMAP to sort .list files before scanningMorten Hustveit1-4/+88
When running dpkg from a cold cache on a system where <admindir>/info/ lies on a hard disk, a lot of time is spent waiting for seeks between (typically) thousands of files. This patch changes the behavior of ensure_allinstfiles_available(), so that it accesses the packages in the order of their .list files' physical locations on the hard disk, greatly reducing drive head movements. The performance improvement is around 70% on my system: reinstalling a simple package takes 8 seconds instead of 27 seconds. The caches were dropped before each run, and 10 runs were done with consistent results. The performance is identical to the previous patch using FIBMAP, althought this one has the advantage of not needing root privileges. Signed-off-by: Guillem Jover <guillem@debian.org>
2010-02-19dpkg: Make pkg_files_add_file() staticGuillem Jover1-1/+1
2009-12-22Move color member from struct pkginfo to struct perpackagestateGuillem Jover1-0/+1
The only user of this field is in the dependency cycle detection, only found under src/. So move it there where it belongs.
2009-11-08Unify text in license headersGuillem Jover1-5/+5
Add a missing “of the License” after “version 2”. Move “but” and “GNU” at the end of line to the next line. This matches more closely the paragraph found in the license text for the GPL version 2.
2009-11-08Replace FSF address by pointing to the gnu.org URLGuillem Jover1-3/+2
Use the <http://www.gnu.org/licenses/> URL, instead of in most cases the outdated FSF address, which is way more stable, as the latter has changed several times in the past.
2009-10-26Sort order of header includesGuillem Jover1-8/+8
Place first <config.h> and <compat.h>, then all <sys/*.h> sorted by complexity, followed by the rest of the system headers, then <dpkg/*.h> and finally the local "*.h" ones. Move <dpkg/i18n.h> inclusion into libdpkg inclusion block, as the <gettext.h> compatibility header already takes care of including <locale.h> before <libintl.h> on environments were its probamatic. Removed duplicated inclusions.
2009-10-16dpkg: Remove unused variable current in pkg_files_add_file()Guillem Jover1-1/+1
Introduced on commit 4985c686c30b2d0682aab0885d32c36007a7998d by me while manually merging the patch that didn't apply cleanly on master. Reported-by: Sean Finney <seanius@debian.org>
2009-10-14dpkg: Refactor file addition into package files to a new functionDavid Benjamin1-27/+50
Added private function pkg_files_add_file for inserting a file to a package's entries. The function takes a file_tail to avoid an O(n^2) loop when adding to the end of the list. (This is what the original code does, so I have mirrored its behavior.) Signed-off-by: David Benjamin <davidben@mit.edu> Signed-off-by: Guillem Jover <guillem@debian.org>
2009-10-14dpkg: Split off emptying a package's file infoDavid Benjamin1-13/+34
Put it into a separate function for reuse by other routines and to simplify ensure_packagefiles_available. Signed-off-by: David Benjamin <davidben@mit.edu> Signed-off-by: Guillem Jover <guillem@debian.org>
2009-09-06libdpkg: Move buffer I/O declarations to buffer.hGuillem Jover1-0/+1
2009-07-15libdpkg: Split dpkg-priv.h into smaller piecesGuillem Jover1-1/+1
Make the dependencies on other modules explicit, and avoid clutter by not including unneeded stuff.
2009-07-15Disable default automake preprocessor include pathsGuillem Jover1-4/+4
Tell automake not to add “-I.” to the preprocessor flags, to avoid file collisions with system headers. Re-add the path where config.h is located. Namespace and use bracketed file inclusions for libdpkg headers, and use quoted inclusions for program headers.
2009-07-15libdpkg: Rename dpkg-i18n.h to i18n.hGuillem Jover1-1/+1
2009-06-26libdpkg: Suffix path related function names with ‘path_’Guillem Jover1-1/+1
2009-06-19Use NUL character instead of 0Guillem Jover1-1/+1
2009-06-17Move diversion db parsing into a new fileGuillem Jover1-72/+0
2009-06-17Move statoverride db parsing into a new fileGuillem Jover1-127/+0
2009-03-27Global review of error checking associated to strtol functionsRaphael Hertzog1-3/+3
Several calls to strtol() or strtoul() are not followed by a proper check that ensures that they have parsed an integer value (and not an empty string).
2009-03-10Fix typo in dpkg output (‘unexecpted’ → ‘unexpected’)Guillem Jover1-1/+1
Closes: #519082 Reported-by: Ivan Masár <helix84@centrum.sk>
2009-02-26dpkg: Add progress reporting while reading the file list databaseGuillem Jover1-3/+13
Reading the files database can take a while on machines with slow disks and an empty cache. To make the wait more tolerable try to display a progress indicator if the output is a terminal. Based-on-patch-by: Romain Francoise <rfrancoise@debian.org>
2008-12-09Mark strings for translationGuillem Jover1-15/+19
2008-12-05Use the warning function instead of hand-coded print callsGuillem Jover1-3/+2
2008-09-14libdpkg: Move stdlib.h inclusion to its direct includersGuillem Jover1-0/+1
2008-09-14libcompat: Add new compat.h headerGuillem Jover1-0/+1
2008-09-14libdpkg: Move gettext related definitions to a new dpkg-i18n.hGuillem Jover1-0/+2
2008-06-30Switch to use UTF-8 copyright symbol and add missing onesGuillem Jover1-2/+2
Some 'Copyright <year>' entries didn't have a copyright symbol. Add it and switch the rest from '(C)' to '©', but we don't do this on program output which for now should remain pure ascii.
2008-06-28libdpkg: Move skip_slash_dotslash from parsehelp.c to path.cGuillem Jover1-0/+1
And from dpkg-db.h dpkg-priv.h.
2008-03-30Implement triggers supportIan Jackson1-0/+5
Closes: #17243, #68981, #215374, #217622, #248693, #308285
2008-03-25Move duplicate ensure_package_clientdata functions to src/filesdb.cGuillem Jover1-0/+11