Imported reiserfsprogs-3.6.2

This commit is contained in:
Jeff Mahoney committed 2012-10-11 11:27:42 -04:00
1 parent e7102bdb66
commit b69459eb80
86 files changed
+23136 -13423

No files matched your search

+95 -54
View File
@@ -1,99 +1,119 @@
/*
* Copyright 1996-1999 Hans Reiser
* Copyright 1996-2002 Hans Reiser
*/
#include "fsck.h"
#include <stdarg.h>
int fsck_user_confirmed (reiserfs_filsys_t fs, char * q, char * a, int default_answer)
int fsck_user_confirmed (reiserfs_filsys_t * fs, char * q, char * a, int default_answer)
{
if (!fsck_interactive (fs))
return default_answer;
return user_confirmed (q, a);
return user_confirmed (fsck_progress_file (fs), q, a);
}
void stage_report (int pass, reiserfs_filsys_t fs)
void stage_report (int pass, reiserfs_filsys_t * fs)
{
FILE * fp;
struct fsck_data * stat;
stat = stats (fs);
fp = stderr;
switch (pass) {
case 0:
fsck_progress ("\tRead blocks (but not data blocks) %lu\n", stat->analyzed);
stat->analyzed = 0;
case 0:
{
struct pass0_stat * stat;
/* what has been done on pass 0 */
stat = pass_0_stat (fs);
fsck_progress ("\tRead blocks (but not data blocks) %lu\n", stat->dealt_with);
fsck_progress ("\t\tLeaves among those %lu\n", stat->leaves);
if (stat->leaves_corrected)
fsck_progress ("\t\t\t- corrected leaves %lu\n", stat->leaves_corrected);
if (stat->all_contents_removed)
fsck_progress ("\t\t\t- eaves all contents of which could not be saved and deleted %lu\n", stat->all_contents_removed);
if (stat->pointed_leaves)
fsck_progress ("\t\t\t- leaves pointed by indirect items %lu\n", stat->pointed_leaves);
if (stat->pointed)
fsck_progress ("\t\tBlocks pointed by indirect items %lu\n", stat->pointed);
if (stat->pointed_once)
fsck_progress ("\t\t\t- once %lu\n", stat->pointed_once);
if (stat->pointed_more_than_once)
fsck_progress ("\t\t\t- more than once %lu\n", stat->pointed_more_than_once);
fsck_progress ("\t\t\t- leaves all contents of which could not be saved and deleted %lu\n",
stat->all_contents_removed);
if (stat->too_old_leaves)
fsck_progress ("\t\t\t- too old leaves %lu (skipped)\n", stat->too_old_leaves);
if (stat->wrong_pointers)
fsck_progress ("\t\t\t- pointers to wrong area of filesystem (zeroed) %lu\n", stat->wrong_pointers);
/* pass1 will calculate how many pointers were zeeros there */
stat->wrong_pointers = 0;
fsck_progress ("\t\tpointers in indirect items to wrong area %lu (zeroed)\n",
stat->wrong_pointers);
fsck_progress ("\t\tObjectids found %lu\n", proper_id_map (fs)->objectids_marked);
/*fsck_progress ("\tblocks marked free %lu\n", stat->free);*/
fsck_progress ("\tallocable %lu blocks\n", stat->allocable);
break;
}
break;
case 1:
fsck_progress ("\t%lu leaves read\n", stat->analyzed);
{
struct pass1_stat * stat;
/* what has been done on pass 1 */
stat = pass_1_stat (fs);
fsck_progress ("\t%lu leaves read\n", stat->leaves);
fsck_progress ("\t\t%lu inserted\n", stat->inserted_leaves);
if (stat->pointed_leaves)
fsck_progress ("\t\t\t- pointers in indirect items pointing to metadata %lu (zeroed)\n",
stat->pointed_leaves);
if (stat->saved_items)
fsck_progress ("\tSaved %lu items\n", stat->saved_items);
if (stat->uninsertable_leaves)
fsck_progress ("\t\t%lu not inserted\n", stat->uninsertable_leaves);
if (stat->saved_on_pass1)
fsck_progress ("\tSaved %lu items\n", stat->saved_on_pass1);
if (stat->wrong_pointers)
fsck_progress ("\tPointers to leaves or non-unique (zeroed) %lu\n",
stat->wrong_pointers);
break;
if (stat->non_unique_pointers)
fsck_progress ("\tnon-unique pointers in indirect items (zeroed) %lu\n",
stat->non_unique_pointers);
}
break;
case 2:
{
struct pass2_stat * stat;
/* what has been done on pass 2 */
stat = pass_2_stat (fs);
if (stat->leaves)
fsck_progress ("\tLeaves inserted item by item %lu\n", stat->leaves);
if (stat->safe_non_unique_pointers)
fsck_progress ("\t%lu \n",
stat->safe_non_unique_pointers);
if (stat->shared_objectids)
fsck_progress ("\t%lu shared objectids\n", stat->shared_objectids);
if (stat->relocated)
fsck_progress ("\tFiles relocated because of key conflicts w/ a directory %lu\n",
stat->relocated);
if (stat->rewritten)
fsck_progress ("\tFiles rewritten %lu\n",
stat->rewritten);
return;
fsck_progress ("\tFiles rewritten %lu\n", stat->rewritten);
}
break;
case 3: /* semantic pass */
case 3: /* semantic */
{
struct semantic_stat * stat;
/* what has been done on the semantic pass */
stat = sem_pass_stat (fs);
fsck_progress ("\tFiles found: %ld\n", stat->regular_files);
fsck_progress ("\tDirectories found: %ld\n", stat->directories);
if (stat->symlinks)
fsck_progress ("\tSymlinks found: %ld\n", stat->symlinks);
if (stat->others)
fsck_progress ("\tOthers: %ld\n", stat->others);
if (stat->broken_files)
fsck_progress ("\tBroken (of files/symlinks/others): %ld\n", stat->broken_files);
if (stat->fixed_sizes)
fsck_progress ("\tFiles with fixed size: %ld\n", stat->fixed_sizes);
if (stat->deleted_entries)
fsck_progress ("\tNames pointing to nowhere (removed): %ld\n", stat->deleted_entries);
if (stat->oid_sharing)
fsck_progress ("\tObjects having used objectids: %lu\n", stat->oid_sharing);
if (stat->oid_sharing_files_relocated)
fsck_progress ("\t\tfiles fixed %lu\n", stat->oid_sharing_files_relocated);
if (stat->oid_sharing_dirs_relocated)
fsck_progress ("\t\tdirs fixed %lu\n", stat->oid_sharing_dirs_relocated);
stat->oid_sharing = 0;
stat->oid_sharing_files_relocated = 0;
stat->oid_sharing_dirs_relocated = 0;
break;
}
break;
case 0x3a: /* lost+found pass */
{
struct lost_found_stat * stat;
case 0x3a: /* looking for lost files */
/* what has been done on the semantic pass */
stat = lost_found_pass_stat (fs);
if (stat->lost_found)
fsck_progress ("\tObjects without names %lu\n",
stat->lost_found);
@@ -116,19 +136,40 @@ void stage_report (int pass, reiserfs_filsys_t fs)
fsck_progress ("\t\tfiles fixed %lu\n", stat->oid_sharing_files_relocated);
if (stat->oid_sharing_dirs_relocated)
fsck_progress ("\t\tdirs fixed %lu\n", stat->oid_sharing_dirs_relocated);
break;
}
break;
case 4: /* removing of unreachable */
{
struct pass_4_stat * stat;
/* what has been done on the semantic pass */
stat = pass_4_stat (fs);
if (stat->deleted_items)
fsck_progress ("\tDeleted unreachable items %lu\n",
stat->deleted_items);
break;
}
break;
case 5:
fsck_progress ("There are on the filesystem:\n"
"\tLeaves %lu\n\tInternal nodes %lu\n"
"\tDirectories %lu\n\tOther files %lu\n"
"\tData block pointers %lu (%lu of them are zero)\n"
"\tSafe links %lu\n",
fsck_check_stat (fs)->leaves,
fsck_check_stat (fs)->internals,
fsck_check_stat (fs)->dirs,
fsck_check_stat (fs)->files,
fsck_check_stat (fs)->unfm_pointers,
fsck_check_stat (fs)->zero_unfm_pointers,
fsck_check_stat (fs)->safe);
} /* switch */
memset (&fsck_data (fs)->rebuild.pass_u, 0, sizeof (fsck_data (fs)->rebuild.pass_u));
if (!fsck_user_confirmed (fs, "Continue? (Yes):", "Yes\n", 1)) {
reiserfs_close (fs);
exit (0);
}
}