<feed xmlns='http://www.w3.org/2005/Atom'>
<title>coreutils/src/du.c, branch v8.7</title>
<subtitle>Mirror of https://https.git.savannah.gnu.org/git/coreutils.git/
</subtitle>
<id>https://git.shady.money/coreutils/atom?h=v8.7</id>
<link rel='self' href='https://git.shady.money/coreutils/atom?h=v8.7'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/'/>
<updated>2010-10-24T00:24:38Z</updated>
<entry>
<title>du: don't print junk when diagnosing out-of-range time stamps</title>
<updated>2010-10-24T00:24:38Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2010-10-24T00:20:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=7d93a082b6e3ece0b120a5150d2020c7fa11b2f5'/>
<id>urn:sha1:7d93a082b6e3ece0b120a5150d2020c7fa11b2f5</id>
<content type='text'>
* src/du.c (show_date): Fix call to fputs with a buffer that
contains some uninitialized data.
* tests/Makefile.am (TESTS): Add du/big-timestamp.
* tests/du/bigtime: New file, which checks for the bug.
</content>
</entry>
<entry>
<title>du: tune, and fix some -L bugs with dangling or cyclic symlinks</title>
<updated>2010-07-24T07:20:07Z</updated>
<author>
<name>Paul R. Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2010-07-24T07:19:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=77428214f13e1d7b81348fd301a388cb4ce8a2a0'/>
<id>urn:sha1:77428214f13e1d7b81348fd301a388cb4ce8a2a0</id>
<content type='text'>
* src/du.c (process_file): Avoid recalculation of hashes
and of file-exclusion for directories.  Do not descend into
the same directory more than once, unless -l is given; this is faster.
Calculate stat buffer lazily, since it
need not be computed at all for excluded files.
Count space if FTS_ERR, since stat buffer is always valid then.
No need for 'print' local variable.
(main): Use FTS_NOSTAT.  Use FTS_TIGHT_CYCLE_CHECK only when not
hashing everything, since process_file finds cycles on its own
when hashing everything.
* tests/du/deref: Add test cases for -L bugs.
</content>
</entry>
<entry>
<title>chcon, chmod, chown, du: don't translate "%s"</title>
<updated>2010-07-09T20:56:05Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2010-07-09T18:11:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=e5ca54448e50c117cf2d7d3491a2bc2f48ae0715'/>
<id>urn:sha1:e5ca54448e50c117cf2d7d3491a2bc2f48ae0715</id>
<content type='text'>
* src/chcon.c (process_file): Replace _("%s") with "%s".
* src/chmod.c (process_file): Likewise.
* src/chown-core.c (change_file_owner): Likewise.
* src/du.c (process_file): Likewise.
</content>
</entry>
<entry>
<title>du: Hash with a mechanism that's simpler and takes less memory.</title>
<updated>2010-07-06T21:58:48Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2010-07-06T21:53:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=fb1a26c3f64669a1b61740252c5db5fd5413c7e5'/>
<id>urn:sha1:fb1a26c3f64669a1b61740252c5db5fd5413c7e5</id>
<content type='text'>
* gl/lib/dev-map.c, gl/lib/dev-map.h, gl/modules/dev-map: Remove.
* gl/lib/ino-map.c, gl/lib/ino-map.h, gl/modules/ino-map: New files.
* gl/modules/dev-map-tests, gl/tests/test-dev-map.c: Remove.
* gl/modules/ino-map-tests, gl/tests/test-ino-map.c: New files.
* gl/lib/di-set.h (struct di_set): Renamed from struct di_set_state,
and now private.  All uses changed.
(_ATTRIBUTE_NONNULL_): Don't assume C99.
(di_set_alloc): Renamed from di_set_init, with no size arg.
Now allocates the object rather than initializing it.
For now, this no longer takes an initial size; we can put this
back later if it is needed.
* gl/lib/di-set.c: Include hash.h, ino-map.h, and limits.h instead of
stdio.h, assert.h, stdint.h, sys/types.h (di-set.h includes that
now), sys/stat.h, and verify.h.
(N_DEV_BITS_4, N_INO_BITS_4, N_DEV_BITS_8, N_INO_BITS_8): Remove.
(struct dev_ino_4, struct dev_ino_8, struct dev_ino_full): Remove.
(enum di_mode): Remove.
(hashint): New typedef.
(HASHINT_MAX, LARGE_INO_MIN): New macros.
(struct di_ent): Now maps a dev_t to a inode set, instead of
containing a union.
(struct dev_map_ent): Remove.
(struct di_set): New type.
(is_encoded_ptr, decode_ptr, di_ent_create): Remove.
(di_ent_hash, di_ent_compare, di_ent_free, di_set_alloc, di_set_free):
(di_set_insert): Adjust to new representation.
(di_ino_hash, map_device, map_inode_number): New functions.
* gl/modules/di-set (Depends-on): Replace dev-map with ino-map.
Remove 'verify'.
* gl/tests/test-di-set.c: Adjust to the above changes to API.
* src/du.c (INITIAL_DI_SET_SIZE): Remove.
(hash_ins, main): Adjust to new di-set API.
</content>
</entry>
<entry>
<title>du: increase the initial dev-inode set size</title>
<updated>2010-07-04T09:15:48Z</updated>
<author>
<name>Jim Meyering</name>
<email>meyering@redhat.com</email>
</author>
<published>2010-06-04T13:30:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=98d48bb0e9b771d95ee2cc2f57e73e1750e465cc'/>
<id>urn:sha1:98d48bb0e9b771d95ee2cc2f57e73e1750e465cc</id>
<content type='text'>
* src/du.c (INITIAL_DI_SET_SIZE): Increase to the prime just under
1024.  This gives a speed-up of about 2% when processing a tree
containing 100,000 files, each with a link count greater than 1,
all pointing to files in some other tree.
</content>
</entry>
<entry>
<title>du: use less than half as much memory when tracking hard links</title>
<updated>2010-07-04T06:40:40Z</updated>
<author>
<name>Jim Meyering</name>
<email>meyering@redhat.com</email>
</author>
<published>2008-12-09T07:49:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=4cb826802413516852a89739454a73c7a6ad0bd8'/>
<id>urn:sha1:4cb826802413516852a89739454a73c7a6ad0bd8</id>
<content type='text'>
When processing a hard-linked file, du must keep track of the file's
device and inode numbers in order to avoid counting its storage
more than once.  When du would process many hard linked files --
as are created by some backup tools -- the amount of memory required
for the supporting data structure could become prohibitively large.
This patch takes advantage of the fact that the amount of information
in the numbers of the typical dev,inode pair is far less than even
32 bits, and hence usually fits in the space of a pointer, be it
32 or 64 bits wide.  A typical du traversal examines files on no
more than a handful of distinct devices, so the device number can
be encoded in just a few bits.  Similarly, few inode numbers use
all of the high bits in an ino_t.  Before, we would represent the
dev,inode pair using a naive struct, and allocate space for each.
Thus, an entry in the hash table consisted of a pointer (to that
struct) and a "next" pointer.  With this change, we encode the
dev,inode information and put those bits in place of the pointer,
and thus do away with the need to allocate additional space for
each dev,inode pair.

* src/du.c: Include "di-set.h".
Don't include "hash.h"; it's no longer used.
(INITIAL_DI_SET_SIZE): Define.
(di_set): New global, to replace "htab".
(entry_hash, entry_compare, hash_init): Remove functions.
(hash_ins): Use di-set functions, rather than ones from the hash module.
(main): Likewise.
* bootstrap.conf (gnulib_modules): Add the new di-set module.
* NEWS (New features): Mention it.
</content>
</entry>
<entry>
<title>du: don't miscount duplicate directories or link-count-1 files</title>
<updated>2010-07-03T08:28:08Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@CS.UCLA.EDU</email>
</author>
<published>2010-07-03T06:41:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=efe53cc72b599979ea292754ecfe8abf7c839d22'/>
<id>urn:sha1:efe53cc72b599979ea292754ecfe8abf7c839d22</id>
<content type='text'>
* NEWS: Mention this.
* src/du.c (hash_all): New static var.
(process_file): Use it.
(main): Set it.
* tests/du/hard-link: Add a couple of test cases to help make
sure this bug stays squashed.
* tests/du/files0-from: Adjust existing tests to reflect
change in semantics with duplicate arguments.
</content>
</entry>
<entry>
<title>doc: df, du, ls: improve --blocksize description in --help</title>
<updated>2010-06-29T05:06:31Z</updated>
<author>
<name>Jim Meyering</name>
<email>meyering@redhat.com</email>
</author>
<published>2010-06-28T11:48:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=5b3adc0d42463cdaf5177908bb434371e01eef96'/>
<id>urn:sha1:5b3adc0d42463cdaf5177908bb434371e01eef96</id>
<content type='text'>
* src/du.c (usage): Print better --blocksize description.
Prompted by Samuel Thibault in &lt;http://bugs.debian.org/353100&gt;.
* src/df.c (usage): Likewise.
* src/ls.c (usage): Likewise.
</content>
</entry>
<entry>
<title>maint: replace each "for (;;)" with "while (true)"</title>
<updated>2010-05-31T09:02:21Z</updated>
<author>
<name>Jim Meyering</name>
<email>meyering@redhat.com</email>
</author>
<published>2010-05-01T12:24:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=da7a704cd36e1d2015d14247e5139fb1999b2211'/>
<id>urn:sha1:da7a704cd36e1d2015d14247e5139fb1999b2211</id>
<content type='text'>
Run this command:
  git ls-files | grep '\.[ch]$' \
    | xargs perl -pi -e 's/for \(;;\)/while (true)/g'
...except for randint.c, which does not include stdbool.h.
In that case, use "while (1)".
* gl/lib/randint.c (randint_genmax): Use "while (1)" for infloops.
* src/cat.c (simple_cat, cat): Use "while (true)" for infloops.
* gl/lib/randread.c (readsource, readisaac): Likewise.
* src/copy.c (copy_reg): Likewise.
* src/csplit.c (record_line_starts, process_regexp): Likewise.
* src/cut.c (set_fields): Likewise.
* src/dd.c (iread, parse_symbols): Likewise.
* src/df.c (find_mount_point, main): Likewise.
* src/du.c (main): Likewise.
* src/expand.c (expand): Likewise.
* src/factor.c (factor_using_division, do_stdin): Likewise.
* src/fmt.c (get_space): Likewise.
* src/ls.c (decode_switches): Likewise.
* src/od.c (main): Likewise.
* src/pr.c (main, read_line): Likewise.
* src/shred.c (dopass, genpattern): Likewise.
* src/sort.c (initbuf, fillbuf, getmonth, keycompare): Likewise.
* src/split.c (bytes_split, lines_split): Likewise.
* src/tac.c (tac_seekable): Likewise.
* src/test.c (and, or): Likewise.
* src/tr.c (squeeze_filter, main): Likewise.
* src/tsort.c (search_item): Likewise.
* src/unexpand.c (unexpand): Likewise.
* src/uniq.c (main): Likewise.
* src/yes.c (main): Likewise.
</content>
</entry>
<entry>
<title>du: recognize -d N as equivalent to --max-depth=N</title>
<updated>2010-05-19T05:28:16Z</updated>
<author>
<name>Jon Ringuette</name>
<email>jonr@scharp.org</email>
</author>
<published>2010-05-18T06:26:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=2b8ecfa6f14db48fbc204b2fc4993de077289c2d'/>
<id>urn:sha1:2b8ecfa6f14db48fbc204b2fc4993de077289c2d</id>
<content type='text'>
* NEWS (New features): Mention it.
* src/du.c (DEBUG_OPT): Remove.  Use long-named ---debug instead.
Commented out.
(MAX_DEPTH_OPTION): Remove.  Use 'd' instead.
(main): Insert literal "d:"; remove DEBUG_OPT.
* doc/coreutils.texi (du invocation): Add -d to indices.
* tests/du/max-depth: Exercise -d, too.
</content>
</entry>
</feed>
