X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=fsck.c;h=3b605c2d0a65d6260094ba99494009ee8bbfbef8;hp=60bd27026cd3c962327d6074ec51b202fb7daea0;hb=de9a70360fcd3b5285d280ad1f229f679d453603;hpb=97727c2e95cce064e03f495e97119cae447397d7;ds=sidebyside diff --git a/fsck.c b/fsck.c index 60bd2702..3b605c2d 100644 --- a/fsck.c +++ b/fsck.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2008 Andre Noll + * Copyright (C) 1997-2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -19,7 +19,9 @@ static struct fsck_args_info conf; INIT_FSCK_ERRLISTS; -INIT_STDERR_LOGGING(conf.loglevel_arg); + +static int loglevel; +INIT_STDERR_LOGGING(loglevel); /* taken from git */ signed char hexval_table[256] = { @@ -474,7 +476,7 @@ static int dummy_compare(const struct osl_object *obj1, const struct osl_object static unsigned files_pruned; -int prune_disk_storage_file(const char *path, const void *private_data) +int prune_disk_storage_file(const char *path, void *private_data) { HASH_TYPE hash[HASH_SIZE]; unsigned flags = *(unsigned *)private_data; @@ -534,7 +536,8 @@ static int prune_disk_storage_files(struct osl_table *t) PARA_INFO_LOG("looking for unreferenced disk storage files\n"); FOR_EACH_DISK_STORAGE_COLUMN(i, t, cd) { char *dirname = column_filename(t, i); - ret = for_each_file_in_dir(dirname, prune_disk_storage_file, &t->desc->flags); + ret = for_each_file_in_dir(dirname, prune_disk_storage_file, + (unsigned *)&t->desc->flags); free(dirname); } if (files_pruned) @@ -935,6 +938,14 @@ static int check_all_tables(char *base_dir) return ret; } +/** + * The praslash database check program. + * + * \param argc Usual arg count. + * \param argv Usual arg vector. + * + * \return \p EXIT_SUCCESS or \p EXIT_FAILURE. + */ int main(int argc, char **argv) { int i, ret; @@ -946,6 +957,7 @@ int main(int argc, char **argv) goto out; } HANDLE_VERSION_FLAG("fsck", conf); + loglevel = get_loglevel_by_name(conf.loglevel_arg); if (conf.base_dir_given) base_dir = para_strdup(conf.base_dir_arg); else { @@ -969,9 +981,6 @@ out: base_dir? base_dir : "", para_strerror(-ret) ); - if (conf.loglevel_arg > 1) - PARA_EMERG_LOG("re-run with \"--loglevel %d\" to increase verbosity\n", - conf.loglevel_arg - 1); } else PARA_NOTICE_LOG("success\n"); if (base_dir)