return ret;
}
-static int check_table(char *base_dir, char *table_name)
+static int check_table(char *db_dir, char *table_name)
{
struct osl_table_description desc = {
.column_descriptions = NULL,
- .dir = base_dir,
+ .dir = db_dir,
.name = table_name
};
int ret;
return ret;
}
-static int check_all_tables(char *base_dir)
+static int check_all_tables(char *db_dir)
{
DIR *dir;
struct dirent *entry;
- int cwd_fd, ret2, ret = para_opendir(base_dir, &dir, &cwd_fd);
+ int cwd_fd, ret2, ret = para_opendir(db_dir, &dir, &cwd_fd);
if (ret < 0)
return ret;
m = s.st_mode;
if (!S_ISDIR(m))
continue;
- ret = check_table(base_dir, entry->d_name);
+ ret = check_table(db_dir, entry->d_name);
if (ret < 0)
break;
}
int main(int argc, char **argv)
{
int i, ret;
- char *base_dir = NULL;
+ char *db_dir = NULL;
struct fsck_cmdline_parser_params params = {
.override = 0,
.initialize = 1,
}
loglevel = conf.loglevel_arg;
HANDLE_VERSION_FLAG("fsck", conf);
- if (conf.base_dir_given)
- base_dir = para_strdup(conf.base_dir_arg);
+ if (conf.database_dir_given)
+ db_dir = para_strdup(conf.database_dir_arg);
else {
char *home = para_homedir();
- base_dir = make_message("%s/.paraslash/afs_database", home);
+ db_dir = make_message("%s/.paraslash/afs_database", home);
free(home);
}
- INFO_LOG("base_dir: %s\n", base_dir);
+ INFO_LOG("database dir: %s\n", db_dir);
if (!conf.inputs_num) {
- ret = check_all_tables(base_dir);
+ ret = check_all_tables(db_dir);
goto out;
}
for (i = 0; i < conf.inputs_num; i++) {
- ret = check_table(base_dir, conf.inputs[i]);
+ ret = check_table(db_dir, conf.inputs[i]);
if (ret < 0)
break;
}
conf.loglevel_arg - 1);
} else
NOTICE_LOG("success\n");
- if (base_dir)
- free(base_dir);
+ if (db_dir)
+ free(db_dir);
return ret < 0? EXIT_FAILURE : EXIT_SUCCESS;
}
--- /dev/null
+option "loglevel" l
+#~~~~~~~~~~~~~~~~~~
+
+"set loglevel (0-6)"
+
+ int typestr="level"
+ default="3"
+ optional
+
+option "database-dir" d
+#~~~~~~~~~~~~~~~~~~~~~~
+"Full path to the database directory"
+string typestr="path"
+required
+details="
+ Unless non-option arguments are given, all subdirectories
+ of \"path\" are considered osl tables which oslfsck will try
+ to fix.
+"
+
+option "dump_dir" D
+#~~~~~~~~~~~~~~~~~~
+"If path is non-empty, para_fsck will write a
+dump of all given tables to the specified
+path."
+
+ string typestr="path"
+ optional
+ default=""
+
+option "no_fsck" n
+#~~~~~~~~~~~~~~~~~
+"Disable fsck mode."
+
+ flag off
+
+option "force" f
+#~~~~~~~~~~~~~~~
+"Force fsck even if the table is dirty.
+Ignored if -n is given."
+
+ flag off
+
+option "dry_run" -
+#~~~~~~~~~~~~~~~~~
+"Only report problems, don't try to fix them."
+
+ flag off
+