Merge branch 'refs/heads/t/doc-improvements'
[adu.git] / create.c
index 51583a65fe4910ab4d5d812d48e26d25745f9cd4..a3373db4ff5d975eb46161512ad8654518abe717 100644 (file)
--- a/create.c
+++ b/create.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2008 Andre Noll <maan@tuebingen.mpg.de>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -56,8 +56,7 @@ static int insert_global_bloom(struct stat64 *s,
 {
        if (!consider_bloom(s))
                return 0;
-       return bloom_test_and_insert(buf, GLOBAL_BLOOM_BUF_SIZE,
-               global_bloom_filter);
+       return bloom_insert(buf, GLOBAL_BLOOM_BUF_SIZE, global_bloom_filter);
 }
 
 static int insert_user_bloom(struct stat64 *s,
@@ -65,8 +64,7 @@ static int insert_user_bloom(struct stat64 *s,
 {
        if (!consider_bloom(s))
                return 0;
-       return bloom_test_and_insert(buf, USER_BLOOM_BUF_SIZE,
-               user_bloom_filter);
+       return bloom_insert(buf, USER_BLOOM_BUF_SIZE, user_bloom_filter);
 }
 
 static int add_directory(char *dirname, uint64_t *dir_num, uint64_t *parent_dir_num,
@@ -142,10 +140,9 @@ static int scan_dir(char *dirname, uint64_t *parent_dir_num)
        check_signals();
        DEBUG_LOG("----------------- %llu: %s\n", (long long unsigned)current_dir_num, dirname);
        ret = adu_opendir(dirname, &dir, &cwd_fd);
-       if (ret < 0) {
-               if (ret != -ERRNO_TO_ERROR(EACCES))
-                       return ret;
-               WARNING_LOG("permission denied for %s\n", dirname);
+       if (ret < 0) { /* Non-fatal, continue with next dir */
+               WARNING_LOG("skipping dir %s: %s\n", dirname,
+                       adu_strerror(-ret));
                return 1;
        }
        while ((entry = readdir(dir))) {
@@ -225,7 +222,7 @@ static void log_bloom_stat(struct bloom *b)
        NOTICE_LOG("\t%u%% of bits are set\n", percent);
        if (percent > 50) {
                WARNING_LOG("results may be unreliable!\n");
-               WARNING_LOG("consider incrasing bllom filter size\n");
+               WARNING_LOG("consider increasing bloom filter size\n");
        }
 }
 
@@ -258,8 +255,8 @@ int com_create(void)
        if (!S_ISDIR(statbuf.st_mode))
                return -ERRNO_TO_ERROR(ENOTDIR);
        if (order >= 10 && num > 0) {
-               bloom_init(order, num, &global_bloom_filter);
-               bloom_init(order, num, &user_bloom_filter);
+               global_bloom_filter = bloom_new(order, num);
+               user_bloom_filter = bloom_new(order, num);
        } else
                WARNING_LOG("hard link detection deactivated\n");
        device_id = statbuf.st_dev;