Fix another typo.
[adu.git] / create.c
index 1b4ba880a1c3d220adc664b83bdae3ab1a46eef0..408ab635b5f74ffaabf4539691e009670ef103cf 100644 (file)
--- a/create.c
+++ b/create.c
@@ -31,7 +31,9 @@ static int consider_bloom(struct stat64 *s)
        return 1;
 }
 
+/** Data size to hash for the global bloom filter. */
 #define GLOBAL_BLOOM_BUF_SIZE (sizeof(ino_t) + sizeof(dev_t) + sizeof(off_t))
+/** For the user bloom filter also the uid is being hashed. */
 #define USER_BLOOM_BUF_SIZE (GLOBAL_BLOOM_BUF_SIZE + sizeof(uid_t))
 
 static void make_bloom_buf(struct stat64 *s, uint8_t buf[USER_BLOOM_BUF_SIZE])
@@ -54,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,
@@ -63,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,
@@ -169,7 +169,7 @@ static int scan_dir(char *dirname, uint64_t *parent_dir_num)
                                continue;
                        dir_size += s.st_size;
                        dir_files++;
-                       ret = create_user_table(s.st_uid, &ui);
+                       ret = create_user_table(conf.database_dir_arg, s.st_uid, &ui);
                        if (ret < 0)
                                goto out;
                        ret = update_user_row(ui->table, this_dir_num,
@@ -190,7 +190,7 @@ static int scan_dir(char *dirname, uint64_t *parent_dir_num)
                else
                        dir_size += s.st_size;
                dir_files++;
-               ret = create_user_table(s.st_uid, &ui);
+               ret = create_user_table(conf.database_dir_arg, s.st_uid, &ui);
                if (ret < 0)
                        goto out;
                ret = insert_user_bloom(&s, bloom_buf);
@@ -223,7 +223,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");
        }
 }
 
@@ -256,8 +256,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;
@@ -269,7 +269,7 @@ int com_create(void)
        ret = scan_dir(conf.base_dir_arg, &zero);
        if (ret < 0)
                goto out;
-       ret = write_uid_file();
+       ret = write_uid_file(conf.database_dir_arg);
        log_bloom_stats();
 out:
        bloom_free(global_bloom_filter);