From fb1a26c3f64669a1b61740252c5db5fd5413c7e5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 6 Jul 2010 14:53:14 -0700 Subject: du: Hash with a mechanism that's simpler and takes less memory. * 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. --- gl/modules/dev-map | 23 ----------------------- gl/modules/dev-map-tests | 10 ---------- gl/modules/di-set | 3 +-- gl/modules/ino-map | 24 ++++++++++++++++++++++++ gl/modules/ino-map-tests | 10 ++++++++++ 5 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 gl/modules/dev-map delete mode 100644 gl/modules/dev-map-tests create mode 100644 gl/modules/ino-map create mode 100644 gl/modules/ino-map-tests (limited to 'gl/modules') diff --git a/gl/modules/dev-map b/gl/modules/dev-map deleted file mode 100644 index 91f437b27..000000000 --- a/gl/modules/dev-map +++ /dev/null @@ -1,23 +0,0 @@ -Description: -maintain a mapping of dev_t numbers to small integers - -Files: -lib/dev-map.c -lib/dev-map.h - -Depends-on: -hash - -configure.ac: - -Makefile.am: -lib_SOURCES += dev-map.c dev-map.h - -Include: -"dev-map.h" - -License -GPL - -Maintainer: -Jim Meyering diff --git a/gl/modules/dev-map-tests b/gl/modules/dev-map-tests deleted file mode 100644 index 4bec2e6b2..000000000 --- a/gl/modules/dev-map-tests +++ /dev/null @@ -1,10 +0,0 @@ -Files: -tests/test-dev-map.c - -Depends-on: - -configure.ac: - -Makefile.am: -TESTS += test-dev-map -check_PROGRAMS += test-dev-map diff --git a/gl/modules/di-set b/gl/modules/di-set index fe5277858..562db14a4 100644 --- a/gl/modules/di-set +++ b/gl/modules/di-set @@ -6,9 +6,8 @@ lib/di-set.c lib/di-set.h Depends-on: -dev-map +ino-map hash -verify configure.ac: diff --git a/gl/modules/ino-map b/gl/modules/ino-map new file mode 100644 index 000000000..06ee51d5b --- /dev/null +++ b/gl/modules/ino-map @@ -0,0 +1,24 @@ +Description: +maintain a mapping of ino_t numbers to small integers + +Files: +lib/ino-map.c +lib/ino-map.h + +Depends-on: +hash +verify + +configure.ac: + +Makefile.am: +lib_SOURCES += ino-map.c ino-map.h + +Include: +"ino-map.h" + +License +GPL + +Maintainer: +Jim Meyering diff --git a/gl/modules/ino-map-tests b/gl/modules/ino-map-tests new file mode 100644 index 000000000..fa10b4ffc --- /dev/null +++ b/gl/modules/ino-map-tests @@ -0,0 +1,10 @@ +Files: +tests/test-ino-map.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-ino-map +check_PROGRAMS += test-ino-map -- cgit v1.2.3-70-g09d2