diff --git a/src/add-ons/disk_systems/bfs/BFSAddOn.cpp b/src/add-ons/disk_systems/bfs/BFSAddOn.cpp index a129dbb7c5..c284fe1c81 100644 --- a/src/add-ons/disk_systems/bfs/BFSAddOn.cpp +++ b/src/add-ons/disk_systems/bfs/BFSAddOn.cpp @@ -230,7 +230,8 @@ BFSPartitionHandle::Repair(bool checkOnly) result.flags = !checkOnly ? BFS_FIX_BITMAP_ERRORS : 0; if (!checkOnly) { //printf("will fix any severe errors!\n"); - result.flags |= BFS_REMOVE_WRONG_TYPES | BFS_REMOVE_INVALID; + result.flags |= BFS_REMOVE_WRONG_TYPES | BFS_REMOVE_INVALID + | BFS_FIX_NAME_MISMATCHES; } // start checking diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp index d295a2e187..090aac7390 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp @@ -1433,7 +1433,7 @@ BlockAllocator::CheckNextNode(check_control* control) } else status = B_ERROR; - control->status = B_ERROR; + control->status = status; return B_OK; } @@ -1447,6 +1447,21 @@ BlockAllocator::CheckNextNode(check_control* control) control->errors |= BFS_NAMES_DONT_MATCH; FATAL(("Names differ: tree \"%s\", inode \"%s\"\n", name, localName)); + + if ((control->flags & BFS_FIX_NAME_MISMATCHES) != 0) { + // Rename the inode + Transaction transaction(fVolume, inode->BlockNumber()); + + status = inode->SetName(transaction, name); + if (status == B_OK) + status = inode->WriteBack(transaction); + if (status == B_OK) + status = transaction.Done(); + if (status != B_OK) { + control->status = status; + return B_OK; + } + } } } diff --git a/src/add-ons/kernel/file_systems/bfs/bfs_control.h b/src/add-ons/kernel/file_systems/bfs/bfs_control.h index 48451c3976..d261273d24 100644 --- a/src/add-ons/kernel/file_systems/bfs/bfs_control.h +++ b/src/add-ons/kernel/file_systems/bfs/bfs_control.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2008, Axel Dörfler, axeld@pinc-software.de + * Copyright 2001-2009, Axel Dörfler, axeld@pinc-software.de * This file may be used under the terms of the MIT License. */ #ifndef BFS_CONTROL_H @@ -51,7 +51,7 @@ struct check_control { uint64 freed; } stats; status_t status; - void *cookie; + void* cookie; }; /* values for the flags field */ @@ -66,6 +66,7 @@ struct check_control { * directory. * Also requires the B_FIX_BITMAP_ERRORS to be set. */ +#define BFS_FIX_NAME_MISMATCHES 8 /* values for the errors field */ #define BFS_MISSING_BLOCKS 1