summaryrefslogtreecommitdiff
path: root/lib/backupstore/BackupStoreCheck2.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2008-05-06 22:20:10 +0000
committerChris Wilson <chris+github@qwirx.com>2008-05-06 22:20:10 +0000
commit690087a61fe64b092054e1bca3fc185c65e6c358 (patch)
tree82d39f001f38dd777b188cec06f924faf24fd08a /lib/backupstore/BackupStoreCheck2.cpp
parent74bf79de0f0b1d9b1a5197f9ce88b51506c872e7 (diff)
Remove obsolete BackupStoreCheck::InsertObjectIntoDirectory class,
replaced with BackupStoreDirectoryFixer.
Diffstat (limited to 'lib/backupstore/BackupStoreCheck2.cpp')
-rw-r--r--lib/backupstore/BackupStoreCheck2.cpp85
1 files changed, 0 insertions, 85 deletions
diff --git a/lib/backupstore/BackupStoreCheck2.cpp b/lib/backupstore/BackupStoreCheck2.cpp
index 3cd957ea..9615516c 100644
--- a/lib/backupstore/BackupStoreCheck2.cpp
+++ b/lib/backupstore/BackupStoreCheck2.cpp
@@ -472,91 +472,6 @@ int64_t BackupStoreCheck::GetLostAndFoundDirID()
// --------------------------------------------------------------------------
//
// Function
-// Name: BackupStoreCheck::InsertObjectIntoDirectory(int64_t, int64_t, bool)
-// Purpose:
-// Created: 22/4/04
-//
-// --------------------------------------------------------------------------
-void BackupStoreCheck::InsertObjectIntoDirectory(int64_t ObjectID, int64_t DirectoryID, bool IsDirectory)
-{
- if(!mFixErrors)
- {
- // Don't do anything if we're not supposed to fix errors
- return;
- }
-
- // Data for the object
- BackupStoreFilename objectStoreFilename;
- int64_t modTime = 100; // something which isn't zero or a special time
- int32_t sizeInBlocks = 0; // suitable for directories
-
- if(IsDirectory)
- {
- // Directory -- simply generate a name for it.
- char name[32];
- ::sprintf(name, "dir%08x", mLostDirNameSerial++);
- objectStoreFilename.SetAsClearFilename(name);
- }
- else
- {
- // Files require a little more work...
- // Open file
- std::string fileFilename;
- StoreStructure::MakeObjectFilename(ObjectID, mStoreRoot, mDiscSetNumber, fileFilename, false /* don't make sure the dir exists */);
- std::auto_ptr<RaidFileRead> file(RaidFileRead::Open(mDiscSetNumber, fileFilename));
- // Fill in size information
- sizeInBlocks = file->GetDiscUsageInBlocks();
- // Read in header
- file_StreamFormat hdr;
- if(file->Read(&hdr, sizeof(hdr)) != sizeof(hdr) || (ntohl(hdr.mMagicValue) != OBJECTMAGIC_FILE_MAGIC_VALUE_V1
-#ifndef BOX_DISABLE_BACKWARDS_COMPATIBILITY_BACKUPSTOREFILE
- && ntohl(hdr.mMagicValue) != OBJECTMAGIC_FILE_MAGIC_VALUE_V0
-#endif
- ))
- {
- // This should never happen, everything has been checked before.
- THROW_EXCEPTION(BackupStoreException, Internal)
- }
- // This tells us nice things
- modTime = box_ntoh64(hdr.mModificationTime);
- // And the filename comes next
- objectStoreFilename.ReadFromStream(*file, IOStream::TimeOutInfinite);
- }
-
- // Directory object
- BackupStoreDirectory dir;
-
- // Generate filename
- std::string filename;
- StoreStructure::MakeObjectFilename(DirectoryID, mStoreRoot, mDiscSetNumber, filename, false /* don't make sure the dir exists */);
-
- // Read it in
- {
- std::auto_ptr<RaidFileRead> file(RaidFileRead::Open(mDiscSetNumber, filename));
- dir.ReadFromStream(*file, IOStream::TimeOutInfinite);
- }
-
- // Add a new entry in an appropriate place
- dir.AddUnattactedObject(objectStoreFilename, modTime, ObjectID, sizeInBlocks,
- IsDirectory?(BackupStoreDirectory::Entry::Flags_Dir):(BackupStoreDirectory::Entry::Flags_File));
-
- // Fix any flags which have been broken, which there's a good chance of doing
- dir.CheckAndFix();
-
- // Write it out
- if(mFixErrors)
- {
- RaidFileWrite root(mDiscSetNumber, filename);
- root.Open(true /* allow overwriting */);
- dir.WriteToStream(root);
- root.Commit(true /* convert to raid now */);
- }
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Function
// Name: BackupStoreCheck::FixDirsWithWrongContainerID()
// Purpose: Rewrites container IDs where required
// Created: 22/4/04