projects
/
osl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add target for man page, install oslfsck and its man page on make install.
[osl.git]
/
fsck.c
diff --git
a/fsck.c
b/fsck.c
index 246a0b6f3c5f38a881227958d7769eb12d18cc39..f700e9f9624c6437b33c04d0418767c364da79e3 100644
(file)
--- a/
fsck.c
+++ b/
fsck.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 2007-200
8
Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2007-200
9
Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
@@
-20,7
+20,7
@@
/** version text used by various commands if -V switch was given */
#define VERSION_TEXT(prefix) "osl_" prefix " " VERSION " " "\n" \
/** version text used by various commands if -V switch was given */
#define VERSION_TEXT(prefix) "osl_" prefix " " VERSION " " "\n" \
- "Copyright (C) 2008 Andre Noll\n" \
+ "Copyright (C) 2008
-2009
Andre Noll\n" \
"This is free software with ABSOLUTELY NO WARRANTY." \
" See COPYING for details.\n" \
"Written by Andre Noll.\n" \
"This is free software with ABSOLUTELY NO WARRANTY." \
" See COPYING for details.\n" \
"Written by Andre Noll.\n" \
@@
-399,15
+399,13
@@
static int check_index_ranges(struct osl_table *t)
//DEBUG_LOG("%d rows. %d columns\n", t->num_rows, t->desc->num_columns);
t->num_invalid_rows = 0;
for (i = 0; i < t->num_rows; i++) {
//DEBUG_LOG("%d rows. %d columns\n", t->num_rows, t->desc->num_columns);
t->num_invalid_rows = 0;
for (i = 0; i < t->num_rows; i++) {
+ const struct osl_column_description *cd;
+
if (row_is_invalid(t, i)) {
t->num_invalid_rows++;
continue;
}
if (row_is_invalid(t, i)) {
t->num_invalid_rows++;
continue;
}
- for (j = 0; j < t->desc->num_columns; j++) { /* FXIME */
- const struct osl_column_description *cd =
- get_column_description(t->desc, j);
- if (cd->storage_type != OSL_MAPPED_STORAGE)
- continue;
+ FOR_EACH_MAPPED_COLUMN(j, t, cd) {
ret = check_range(t, i, j);
if (ret < 0) {
if (ret != -E_FSCK_RANGE_VIOLATION)
ret = check_range(t, i, j);
if (ret < 0) {
if (ret != -E_FSCK_RANGE_VIOLATION)
@@
-512,6
+510,8
@@
static int check_for_invalid_objects(struct osl_table *t, uint32_t **lost_bytes)
/* first count used bytes */
FOR_EACH_MAPPED_COLUMN(i, t, cd) {
loss[i] = t->columns[i].data_map.size;
/* first count used bytes */
FOR_EACH_MAPPED_COLUMN(i, t, cd) {
loss[i] = t->columns[i].data_map.size;
+ DEBUG_LOG("column %i data map: %u bytes\n", i,
+ t->columns[i].data_map.size);
for (j = 0; j < t->num_rows; j++) {
struct osl_object obj;
ret = get_mapped_object(t, i, j, &obj);
for (j = 0; j < t->num_rows; j++) {
struct osl_object obj;
ret = get_mapped_object(t, i, j, &obj);
@@
-553,10
+553,10
@@
static int prune_mapped_column(struct osl_table *t, uint32_t col_num, int fd)
ret = get_mapped_object(t, col_num, i, &obj);
if (ret < 0)
return ret;
ret = get_mapped_object(t, col_num, i, &obj);
if (ret < 0)
return ret;
- ret = _write_all(fd, (char *)(obj.data)
- 1, obj.size + 1
);
+ ret = _write_all(fd, (char *)(obj.data)
, obj.size
);
if (ret < 0)
return ret;
if (ret < 0)
return ret;
- written += obj.size
+ 1
;
+ written += obj.size;
ret = get_row_index(t, i, &index_entry);
if (ret < 0)
return ret;
ret = get_row_index(t, i, &index_entry);
if (ret < 0)
return ret;
@@
-577,7
+577,8
@@
static int prune_objects(struct osl_table *t, uint32_t *lost_bytes)
NOTICE_LOG("removing unreferenced objects from data files\n");
/* first make a copy of the index */
NOTICE_LOG("removing unreferenced objects from data files\n");
/* first make a copy of the index */
- ret = osl_open(old_idx_filename, O_WRONLY | O_CREAT | O_EXCL, 0644);
+ DEBUG_LOG("opening %s\n", old_idx_filename);
+ ret = osl_open(old_idx_filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (ret < 0)
goto out_free;
fd = ret;
if (ret < 0)
goto out_free;
fd = ret;
@@
-884,8
+885,11
@@
static int fsck_init(struct osl_table_description *desc, struct osl_table **t)
ret = map_table(*t, (MAP_TBL_FL_IGNORE_DIRTY));
else
ret = map_table(*t, 0);
ret = map_table(*t, (MAP_TBL_FL_IGNORE_DIRTY));
else
ret = map_table(*t, 0);
- if (ret >= 0)
+ if (ret >= 0)
{
(*t)->num_rows = table_num_rows(*t);
(*t)->num_rows = table_num_rows(*t);
+ DEBUG_LOG("index header size: %d\n", (*t)->index_header_size);
+ DEBUG_LOG("row index size: %d\n", (*t)->row_index_size);
+ }
out:
return ret;
}
out:
return ret;
}
@@
-1169,7
+1173,8
@@
static int check_table(char *db_dir, char *table_name)
ret = dump_table(conf.dump_dir_arg, &desc);
out:
if (ret < 0)
ret = dump_table(conf.dump_dir_arg, &desc);
out:
if (ret < 0)
- ERROR_LOG("failed to check table %s\n", table_name);
+ ERROR_LOG("failed to check table %s: %s\n", table_name,
+ fsck_strerror(-ret));
else
NOTICE_LOG("successfully checked table %s\n", table_name);
return ret;
else
NOTICE_LOG("successfully checked table %s\n", table_name);
return ret;