summaryrefslogtreecommitdiff
path: root/gl/lib/di-set.h
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-06-27 23:29:07 +0200
committerJim Meyering <meyering@redhat.com>2010-07-04 08:40:40 +0200
commitf42496b72b4f829744c279d9e51fe698a52fbbfc (patch)
treea3c1bead46787ac3602dd206b41895737e9c21b4 /gl/lib/di-set.h
parent6357909ee6cecaafc4636bd053d9a10ad8ac2dab (diff)
downloadcoreutils-f42496b72b4f829744c279d9e51fe698a52fbbfc.tar.xz
di-set: manipulate sets of dev/inode pairs efficiently
* gl/lib/di-set.c: Implementation. * gl/lib/di-set.h: Declarations. * gl/modules/di-set: Define module. * gl/modules/di-set-tests: Define test module. * gl/tests/test-di-set.c: Likewise.
Diffstat (limited to 'gl/lib/di-set.h')
-rw-r--r--gl/lib/di-set.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/gl/lib/di-set.h b/gl/lib/di-set.h
new file mode 100644
index 000000000..f90d0ddc7
--- /dev/null
+++ b/gl/lib/di-set.h
@@ -0,0 +1,28 @@
+#include "dev-map.h"
+
+struct di_set_state
+{
+ /* A map to help compact device numbers. */
+ struct dev_map dev_map;
+
+ /* A set of compact dev,inode pairs. */
+ struct hash_table *di_set;
+};
+
+#undef _ATTRIBUTE_NONNULL_
+#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
+# define _ATTRIBUTE_NONNULL_(m,...) __attribute__ ((__nonnull__ (m)))
+#else
+# define _ATTRIBUTE_NONNULL_(m,...)
+#endif
+
+int di_set_init (struct di_set_state *, size_t) _ATTRIBUTE_NONNULL_ (1);
+void di_set_free (struct di_set_state *) _ATTRIBUTE_NONNULL_ (1);
+int di_set_insert (struct di_set_state *, dev_t, ino_t)
+ _ATTRIBUTE_NONNULL_ (1);
+
+struct di_ent;
+int di_ent_create (struct di_set_state *di_set_state,
+ dev_t dev, ino_t ino,
+ struct di_ent **di_ent)
+ _ATTRIBUTE_NONNULL_ (1,4);