]> git.tuebingen.mpg.de Git - adu.git/blobdiff - adu.c
scan_dir(): Print error reason if lstat() failed.
[adu.git] / adu.c
diff --git a/adu.c b/adu.c
index 4c1c62c0d56bb3955dabd1cfb52499d6d6fca4a3..27c026701d493d502f8856c82c76a37336d37340 100644 (file)
--- a/adu.c
+++ b/adu.c
@@ -18,13 +18,6 @@ static int signum;
 /** Command line and config file options. */
 struct gengetopt_args_info conf;
 
-/** Global dir count. */
-uint64_t num_dirs = 0;
-/** Global files count. */
-uint64_t num_files = 0;
-/** Global bytes count. */
-uint64_t num_bytes = 0;
-
 /** The number of different uids found so far. */
 uint32_t num_uids = 0;
 
@@ -40,6 +33,16 @@ static uint32_t uid_hash_table_size;
  */
 static struct user_info *uid_hash_table;
 
+static inline int ui_used(struct user_info *ui)
+{
+       return ui->flags & UI_FL_SLOT_USED;
+}
+
+static inline int ui_admissible(struct user_info *ui)
+{
+       return ui->flags & UI_FL_ADMISSIBLE;
+}
+
 /**
  * The table containing the directory names and statistics.
  */
@@ -50,8 +53,6 @@ struct osl_table *dir_table = NULL;
  */
 struct uid_range *admissible_uids;
 
-/** Evaluates to 1 if x < y, to -1 if x > y and to 0 if x == y. */
-#define NUM_COMPARE(x, y) ((int)((x) < (y)) - (int)((x) > (y)))
 
 /**
  * Compare the size of two directories
@@ -472,6 +473,12 @@ char *get_uid_list_name(void)
        return make_message("%s/uid_list", conf.database_dir_arg);
 }
 
+void sort_hash_table(int (*comp)(const void *, const void *))
+{
+       qsort(uid_hash_table, uid_hash_table_size, sizeof(struct user_info),
+               comp);
+}
+
 int open_dir_table(int create)
 {
        dir_table_desc.dir = adu_strdup(conf.database_dir_arg);