From 732370e12192a3b66a8b0a3e1f66eed3ebcdc3d3 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 15 Aug 2014 22:47:14 +0000 Subject: Whitespace, wrapping, comments and dead code cleanups. Conflicts: bin/bbackupd/BackupDaemon.cpp bin/bbackupd/BackupDaemon.h test/bbackupd/testbbackupd.cpp --- bin/bbackupd/BackupClientContext.cpp | 4 +- bin/bbackupd/BackupClientDirectoryRecord.cpp | 18 ++-- bin/bbackupd/BackupDaemon.cpp | 12 +-- bin/bbackupd/BackupDaemon.h | 146 +++++++++++++-------------- bin/bbackupd/BackupDaemonInterface.h | 6 -- 5 files changed, 90 insertions(+), 96 deletions(-) (limited to 'bin/bbackupd') diff --git a/bin/bbackupd/BackupClientContext.cpp b/bin/bbackupd/BackupClientContext.cpp index ca4200c4..5025bf5c 100644 --- a/bin/bbackupd/BackupClientContext.cpp +++ b/bin/bbackupd/BackupClientContext.cpp @@ -126,8 +126,8 @@ BackupProtocolClient &BackupClientContext::GetConnection() mapConnection.reset(); // Log intention - BOX_INFO("Opening connection to server '" << - mHostname << "'..."); + BOX_INFO("Opening connection to server '" << mHostname << + "'..."); // Connect! ((SocketStreamTLS *)(apSocket.get()))->Open(mrTLSContext, diff --git a/bin/bbackupd/BackupClientDirectoryRecord.cpp b/bin/bbackupd/BackupClientDirectoryRecord.cpp index e8dddd6f..820cfbaf 100644 --- a/bin/bbackupd/BackupClientDirectoryRecord.cpp +++ b/bin/bbackupd/BackupClientDirectoryRecord.cpp @@ -1368,7 +1368,7 @@ bool BackupClientDirectoryRecord::UpdateItems( // Note: if we have exceeded our storage limit, then // we should not upload any more data, nor create any // DirectoryRecord representing data that would have - // been uploaded. This step will be repeated when + // been uploaded. This step will be repeated when // there is some space available. bool doCreateDirectoryRecord = true; @@ -1388,13 +1388,13 @@ bool BackupClientDirectoryRecord::UpdateItems( else { // Yes, creation required! - // It is known that the it doesn't exist: + // It is known that it doesn't exist: // // if en == 0 and pDirOnStore == 0, then the // directory has had an initial sync, and // hasn't been modified (Really? then why // are we here? TODO FIXME) - // so it has definately been created already + // so it has definitely been created already // (so why create it again?) // // if en == 0 but pDirOnStore != 0, well... obviously it doesn't exist. @@ -1515,7 +1515,7 @@ bool BackupClientDirectoryRecord::UpdateItems( { // New an object for this psubDirRecord = new BackupClientDirectoryRecord(subDirObjectID, *d); - + // Store in list try { @@ -1547,7 +1547,7 @@ bool BackupClientDirectoryRecord::UpdateItems( if(rEntriesLeftOver[l] != 0) { BackupStoreDirectory::Entry *en = rEntriesLeftOver[l]; - + // These entries can't be deleted immediately, as it would prevent // renaming and moving of objects working properly. So we add them // to a list, which is actually deleted at the very end of the session. @@ -1574,7 +1574,7 @@ bool BackupClientDirectoryRecord::UpdateItems( filenameClear); std::string nonVssLocalName = ConvertVssPathToRealPath(localName, rBackupLocation); - + // Delete this entry -- file or directory? if((en->GetFlags() & BackupStoreDirectory::Entry::Flags_File) != 0) { @@ -1588,7 +1588,7 @@ bool BackupClientDirectoryRecord::UpdateItems( rdel.AddDirectoryDelete(en->GetObjectID(), localName); - // If there's a directory record for it in + // If there's a directory record for it in // the sub directory map, delete it now BackupStoreFilenameClear dirname(en->GetName()); std::map::iterator @@ -1602,7 +1602,7 @@ bool BackupClientDirectoryRecord::UpdateItems( BOX_TRACE("Deleted directory record for " << nonVssLocalName); - } + } } } } @@ -1778,7 +1778,7 @@ int64_t BackupClientDirectoryRecord::UploadFile( rContext.SetNiceMode(false); - // Get object ID from the result + // Get object ID from the result objID = stored->GetObjectID(); uploadedSize = apStreamToUpload->GetTotalBytesSent(); } diff --git a/bin/bbackupd/BackupDaemon.cpp b/bin/bbackupd/BackupDaemon.cpp index 8aeb18b2..3d352286 100644 --- a/bin/bbackupd/BackupDaemon.cpp +++ b/bin/bbackupd/BackupDaemon.cpp @@ -858,13 +858,13 @@ void BackupDaemon::RunSyncNow() { extendedLogFile = conf.GetKeyValue("ExtendedLogFile"); } - + if (conf.KeyExists("LogAllFileAccess")) { mLogAllFileAccess = conf.GetKeyValueBool("LogAllFileAccess"); } - - // Then create a client context object (don't + + // Then create a client context object (don't // just connect, as this may be unnecessary) BackupClientContext clientContext ( @@ -872,14 +872,14 @@ void BackupDaemon::RunSyncNow() mTlsContext, conf.GetKeyValue("StoreHostname"), conf.GetKeyValueInt("StorePort"), - conf.GetKeyValueUint32("AccountNumber"), + conf.GetKeyValueUint32("AccountNumber"), conf.GetKeyValueBool("ExtendedLogging"), conf.KeyExists("ExtendedLogFile"), extendedLogFile, *mpProgressNotifier, conf.GetKeyValueBool("TcpNice") ); - + // The minimum age a file needs to be before it will be // considered for uploading box_time_t minimumFileAge = SecondsToBoxTime( @@ -2414,7 +2414,7 @@ void BackupDaemon::SetupLocations(BackupClientContext &rClientContext, const Con // Does this exist on the server? // Remove from dir object early, so that if we fail - // to stat the local directory, we still don't + // to stat the local directory, we still don't // consider to remote one for deletion. BackupStoreDirectory::Iterator iter(dir); BackupStoreFilenameClear dirname(pLoc->mName); // generate the filename diff --git a/bin/bbackupd/BackupDaemon.h b/bin/bbackupd/BackupDaemon.h index 5a811f7e..7b1771fa 100644 --- a/bin/bbackupd/BackupDaemon.h +++ b/bin/bbackupd/BackupDaemon.h @@ -196,10 +196,10 @@ private: #endif IOStreamGetLine *mpGetLine; }; - + // Using a socket? std::auto_ptr mapCommandSocketInfo; - + // Stop notifications being repeated. SysadminNotifier::EventCode mLastNotifiedEvent; @@ -220,7 +220,7 @@ private: public: int GetMaxBandwidthFromSyncAllowScript() { return mMaxBandwidthFromSyncAllowScript; } - bool StopRun() { return this->Daemon::StopRun(); } + bool StopRun() { return this->Daemon::StopRun(); } bool StorageLimitExceeded() { return mStorageLimitExceeded; } private: @@ -249,9 +249,9 @@ private: public: virtual void NotifyIDMapsSetup(BackupClientContext& rContext) { } - virtual void NotifyScanDirectory( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) + virtual void NotifyScanDirectory( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) { if (mLogAllFileAccess) { @@ -264,30 +264,30 @@ public: CancelledByBackgroundTask); } } - virtual void NotifyDirStatFailed( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - const std::string& rErrorMsg) - { + virtual void NotifyDirStatFailed( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + const std::string& rErrorMsg) + { BOX_WARNING("Failed to access directory: " << rLocalPath << ": " << rErrorMsg); - } - virtual void NotifyFileStatFailed( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - const std::string& rErrorMsg) - { + } + virtual void NotifyFileStatFailed( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + const std::string& rErrorMsg) + { BOX_WARNING("Failed to access file: " << rLocalPath << ": " << rErrorMsg); - } - virtual void NotifyDirListFailed( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - const std::string& rErrorMsg) - { + } + virtual void NotifyDirListFailed( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + const std::string& rErrorMsg) + { BOX_WARNING("Failed to list directory: " << rLocalPath << ": " << rErrorMsg); - } + } virtual void NotifyMountPointSkipped( const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath) @@ -309,7 +309,7 @@ public: if (mLogAllFileAccess) { BOX_INFO("Skipping excluded file: " << rLocalPath); - } + } } virtual void NotifyDirExcluded( const BackupClientDirectoryRecord* pDirRecord, @@ -318,7 +318,7 @@ public: if (mLogAllFileAccess) { BOX_INFO("Skipping excluded directory: " << rLocalPath); - } + } } virtual void NotifyUnsupportedFileType( const BackupClientDirectoryRecord* pDirRecord, @@ -326,43 +326,43 @@ public: { BOX_WARNING("Ignoring file of unknown type: " << rLocalPath); } - virtual void NotifyFileReadFailed( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - const std::string& rErrorMsg) - { + virtual void NotifyFileReadFailed( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + const std::string& rErrorMsg) + { BOX_WARNING("Error reading file: " << rLocalPath << ": " << rErrorMsg); - } - virtual void NotifyFileModifiedInFuture( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) - { + } + virtual void NotifyFileModifiedInFuture( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) + { BOX_WARNING("Some files have modification times excessively " "in the future. Check clock synchronisation. " "Example file (only one shown): " << rLocalPath); - } - virtual void NotifyFileSkippedServerFull( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) + } + virtual void NotifyFileSkippedServerFull( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) { BOX_WARNING("Skipped file: server is full: " << rLocalPath); } - virtual void NotifyFileUploadException( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - const BoxException& rException) - { + virtual void NotifyFileUploadException( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + const BoxException& rException) + { if (rException.GetType() == CommonException::ExceptionType && rException.GetSubType() == CommonException::AccessDenied) { - BOX_ERROR("Failed to upload file: " << rLocalPath + BOX_ERROR("Failed to upload file: " << rLocalPath << ": Access denied"); } else { - BOX_ERROR("Failed to upload file: " << rLocalPath - << ": caught exception: " << rException.what() + BOX_ERROR("Failed to upload file: " << rLocalPath + << ": caught exception: " << rException.what() << " (" << rException.GetType() << "/" << rException.GetSubType() << ")"); } @@ -428,41 +428,41 @@ public: } } - BOX_ERROR("Failed to upload file: " << rLocalPath + BOX_ERROR("Failed to upload file: " << rLocalPath << ": server error: " << msgs.str()); - } - virtual void NotifyFileUploading( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) - { + } + virtual void NotifyFileUploading( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) + { if (mLogAllFileAccess) { BOX_NOTICE("Uploading complete file: " << rLocalPath); - } + } } - virtual void NotifyFileUploadingPatch( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) + virtual void NotifyFileUploadingPatch( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) { if (mLogAllFileAccess) { BOX_NOTICE("Uploading patch to file: " << rLocalPath); - } + } } - virtual void NotifyFileUploadingAttributes( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) + virtual void NotifyFileUploadingAttributes( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) { if (mLogAllFileAccess) { - BOX_NOTICE("Uploading new file attributes: " << + BOX_NOTICE("Uploading new file attributes: " << rLocalPath); - } + } } - virtual void NotifyFileUploaded( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - int64_t FileSize, int64_t UploadedSize) + virtual void NotifyFileUploaded( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + int64_t FileSize, int64_t UploadedSize) { if (mLogAllFileAccess) { @@ -472,10 +472,10 @@ public: } mNumFilesUploaded++; } - virtual void NotifyFileSynchronised( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - int64_t FileSize) + virtual void NotifyFileSynchronised( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + int64_t FileSize) { if (mLogAllFileAccess) { @@ -489,7 +489,7 @@ public: { if (mLogAllFileAccess) { - BOX_NOTICE("Created directory: " << rRemotePath << + BOX_NOTICE("Created directory: " << rRemotePath << " (ID " << BOX_FORMAT_OBJECTID(ObjectID) << ")"); } diff --git a/bin/bbackupd/BackupDaemonInterface.h b/bin/bbackupd/BackupDaemonInterface.h index a847b264..2e603b96 100644 --- a/bin/bbackupd/BackupDaemonInterface.h +++ b/bin/bbackupd/BackupDaemonInterface.h @@ -11,14 +11,8 @@ #define BACKUPDAEMONINTERFACE__H #include -// #include -// #include "BackupClientFileAttributes.h" -// #include "BackupStoreDirectory.h" #include "BoxTime.h" -// #include "MD5Digest.h" -// #include "ReadLoggingStream.h" -// #include "RunStatusProvider.h" class Archive; class BackupClientContext; -- cgit v1.2.3