From 688eda8b55b57b711020148c5b048de7c06d1744 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 1 Sep 2016 20:46:19 +0100 Subject: Fix case of filenames of "text" files used to generate protocols and docs. --- lib/backupstore/BackupProtocol.txt | 266 +++++++++++++++++++++++++++++++ lib/backupstore/Makefile.extra | 4 +- lib/backupstore/backupprotocol.txt | 266 ------------------------------- lib/bbackupquery/Documentation.txt | 194 ++++++++++++++++++++++ lib/bbackupquery/Makefile.extra | 2 +- lib/bbackupquery/documentation.txt | 194 ---------------------- lib/bbackupquery/makedocumentation.pl.in | 2 +- 7 files changed, 464 insertions(+), 464 deletions(-) create mode 100644 lib/backupstore/BackupProtocol.txt delete mode 100644 lib/backupstore/backupprotocol.txt create mode 100644 lib/bbackupquery/Documentation.txt delete mode 100644 lib/bbackupquery/documentation.txt (limited to 'lib') diff --git a/lib/backupstore/BackupProtocol.txt b/lib/backupstore/BackupProtocol.txt new file mode 100644 index 00000000..5921d009 --- /dev/null +++ b/lib/backupstore/BackupProtocol.txt @@ -0,0 +1,266 @@ +# +# backup protocol definition +# + +Name Backup +IdentString Box-Backup:v=C +ServerContextClass BackupStoreContext BackupStoreContext.h + +AddType Filename BackupStoreFilenameClear BackupStoreFilenameClear.h +AddType String std::string + +ImplementLog Server syslog +ImplementLog Client syslog +ImplementLog Client file + +LogTypeToText Filename "%s" VAR.GetClearFilenameIfPossible("OPAQUE").c_str() + +BEGIN_OBJECTS + +# ------------------------------------------------------------------------------------- +# Session commands +# ------------------------------------------------------------------------------------- + +Error 0 IsError(Type,SubType) Reply + int32 Type + int32 SubType + CONSTANT ErrorType 1000 + CONSTANT Err_WrongVersion 1 + CONSTANT Err_NotInRightProtocolPhase 2 + CONSTANT Err_BadLogin 3 + CONSTANT Err_CannotLockStoreForWriting 4 + CONSTANT Err_SessionReadOnly 5 + CONSTANT Err_FileDoesNotVerify 6 + CONSTANT Err_DoesNotExist 7 + CONSTANT Err_DirectoryAlreadyExists 8 + CONSTANT Err_CannotDeleteRoot 9 + CONSTANT Err_TargetNameExists 10 + CONSTANT Err_StorageLimitExceeded 11 + CONSTANT Err_DiffFromFileDoesNotExist 12 + CONSTANT Err_DoesNotExistInDirectory 13 + CONSTANT Err_PatchConsistencyError 14 + CONSTANT Err_MultiplyReferencedObject 15 + CONSTANT Err_DisabledAccount 16 + +Version 1 Command(Version) Reply + int32 Version + + +Login 2 Command(LoginConfirmed) + int32 ClientID + int32 Flags + CONSTANT Flags_ReadOnly 1 + + +LoginConfirmed 3 Reply + int64 ClientStoreMarker + int64 BlocksUsed + int64 BlocksSoftLimit + int64 BlocksHardLimit + + +Finished 4 Command(Finished) Reply EndsConversation + + +# generic success object +Success 5 Reply + int64 ObjectID + + +SetClientStoreMarker 6 Command(Success) + int64 ClientStoreMarker + + +# ------------------------------------------------------------------------------------- +# Generic object commands +# ------------------------------------------------------------------------------------- + +GetObject 10 Command(Success) + int64 ObjectID + # reply has stream following (if successful) + + +MoveObject 11 Command(Success) + int64 ObjectID + int64 MoveFromDirectory + int64 MoveToDirectory + int32 Flags + Filename NewFilename + + CONSTANT Flags_MoveAllWithSameName 1 + CONSTANT Flags_AllowMoveOverDeletedObject 2 + +# consider this an object command as, although it deals with directory entries, +# it's not specific to either a file or a directory + + +GetObjectName 12 Command(ObjectName) + int64 ObjectID + int64 ContainingDirectoryID + CONSTANT ObjectID_DirectoryOnly 0 + + # set ObjectID to ObjectID_DirectoryOnly to only get info on the directory + + +ObjectName 13 Reply + int32 NumNameElements + int64 ModificationTime + int64 AttributesHash + int16 Flags + # NumNameElements is zero if the object doesn't exist + CONSTANT NumNameElements_ObjectDoesntExist 0 + # a stream of Filename objects follows, if and only if NumNameElements > 0 + + +# ------------------------------------------------------------------------------------- +# Directory commands +# ------------------------------------------------------------------------------------- + +CreateDirectory 20 Command(Success) StreamWithCommand + int64 ContainingDirectoryID + int64 AttributesModTime + Filename DirectoryName + # stream following containing attributes + + +CreateDirectory2 46 Command(Success) StreamWithCommand + int64 ContainingDirectoryID + int64 AttributesModTime + int64 ModificationTime + Filename DirectoryName + # stream following containing attributes + + +ListDirectory 21 Command(Success) + int64 ObjectID + int16 FlagsMustBeSet + int16 FlagsNotToBeSet + bool SendAttributes + # make sure these flags are synced with those in BackupStoreDirectory + CONSTANT Flags_INCLUDE_EVERYTHING -1 + CONSTANT Flags_EXCLUDE_NOTHING 0 + CONSTANT Flags_EXCLUDE_EVERYTHING 15 + CONSTANT Flags_File 1 + CONSTANT Flags_Dir 2 + CONSTANT Flags_Deleted 4 + CONSTANT Flags_OldVersion 8 + # make sure this is the same as in BackupStoreConstants.h + CONSTANT RootDirectory 1 + + # reply has stream following Success object, containing a stored BackupStoreDirectory + + +ChangeDirAttributes 22 Command(Success) StreamWithCommand + int64 ObjectID + int64 AttributesModTime + # stream following containing attributes + + +DeleteDirectory 23 Command(Success) + int64 ObjectID + + +UndeleteDirectory 24 Command(Success) + int64 ObjectID + # may not have exactly the desired effect if files within in have been deleted before the directory was deleted. + + +# ------------------------------------------------------------------------------------- +# File commands +# ------------------------------------------------------------------------------------- + +StoreFile 30 Command(Success) StreamWithCommand + int64 DirectoryObjectID + int64 ModificationTime + int64 AttributesHash + int64 DiffFromFileID # 0 if the file is not a diff + Filename Filename + # then send a stream containing the encoded file + + +GetFile 31 Command(Success) + int64 InDirectory + int64 ObjectID + # error returned if not a file, or does not exist + # reply has stream following, containing an encoded file IN STREAM ORDER + # (use GetObject to get it in file order) + + +SetReplacementFileAttributes 32 Command(Success) StreamWithCommand + int64 InDirectory + int64 AttributesHash + Filename Filename + # stream follows containing attributes + + +DeleteFile 33 Command(Success) + int64 InDirectory + Filename Filename + # will return 0 if the object couldn't be found in the specified directory + + +GetBlockIndexByID 34 Command(Success) + int64 ObjectID + + # stream of the block index follows the reply + # returns an error if the object didn't exist + + +GetBlockIndexByName 35 Command(Success) + int64 InDirectory + Filename Filename + + # Success object contains the found ID -- or 0 if the entry wasn't found in the directory + # stream of the block index follows the reply if found ID != 0 + + +UndeleteFile 36 Command(Success) + int64 InDirectory + int64 ObjectID + # will return 0 if the object couldn't be found in the specified directory + + +# ------------------------------------------------------------------------------------- +# Information commands +# ------------------------------------------------------------------------------------- + +GetAccountUsage 40 Command(AccountUsage) + # no data members + +AccountUsage 41 Reply + int64 BlocksUsed + int64 BlocksInOldFiles + int64 BlocksInDeletedFiles + int64 BlocksInDirectories + int64 BlocksSoftLimit + int64 BlocksHardLimit + int32 BlockSize + +GetIsAlive 42 Command(IsAlive) + # no data members + +IsAlive 43 Reply + # no data members + +GetAccountUsage2 44 Command(AccountUsage2) + # no data members + +AccountUsage2 45 Reply + String AccountName + bool AccountEnabled + int64 ClientStoreMarker + int32 BlockSize + int64 LastObjectIDUsed + int64 BlocksUsed + int64 BlocksInCurrentFiles + int64 BlocksInOldFiles + int64 BlocksInDeletedFiles + int64 BlocksInDirectories + int64 BlocksSoftLimit + int64 BlocksHardLimit + int64 NumCurrentFiles + int64 NumOldFiles + int64 NumDeletedFiles + int64 NumDirectories + +# 46 is CreateDirectory2 diff --git a/lib/backupstore/Makefile.extra b/lib/backupstore/Makefile.extra index c55fd549..6f181abd 100644 --- a/lib/backupstore/Makefile.extra +++ b/lib/backupstore/Makefile.extra @@ -1,9 +1,9 @@ MAKEPROTOCOL = ../../lib/server/makeprotocol.pl -GEN_CMD = $(MAKEPROTOCOL) backupprotocol.txt +GEN_CMD = $(MAKEPROTOCOL) BackupProtocol.txt # AUTOGEN SEEDING -autogen_BackupProtocol.cpp autogen_BackupProtocol.h: $(MAKEPROTOCOL) backupprotocol.txt +autogen_BackupProtocol.cpp autogen_BackupProtocol.h: $(MAKEPROTOCOL) BackupProtocol.txt $(_PERL) $(GEN_CMD) diff --git a/lib/backupstore/backupprotocol.txt b/lib/backupstore/backupprotocol.txt deleted file mode 100644 index 5921d009..00000000 --- a/lib/backupstore/backupprotocol.txt +++ /dev/null @@ -1,266 +0,0 @@ -# -# backup protocol definition -# - -Name Backup -IdentString Box-Backup:v=C -ServerContextClass BackupStoreContext BackupStoreContext.h - -AddType Filename BackupStoreFilenameClear BackupStoreFilenameClear.h -AddType String std::string - -ImplementLog Server syslog -ImplementLog Client syslog -ImplementLog Client file - -LogTypeToText Filename "%s" VAR.GetClearFilenameIfPossible("OPAQUE").c_str() - -BEGIN_OBJECTS - -# ------------------------------------------------------------------------------------- -# Session commands -# ------------------------------------------------------------------------------------- - -Error 0 IsError(Type,SubType) Reply - int32 Type - int32 SubType - CONSTANT ErrorType 1000 - CONSTANT Err_WrongVersion 1 - CONSTANT Err_NotInRightProtocolPhase 2 - CONSTANT Err_BadLogin 3 - CONSTANT Err_CannotLockStoreForWriting 4 - CONSTANT Err_SessionReadOnly 5 - CONSTANT Err_FileDoesNotVerify 6 - CONSTANT Err_DoesNotExist 7 - CONSTANT Err_DirectoryAlreadyExists 8 - CONSTANT Err_CannotDeleteRoot 9 - CONSTANT Err_TargetNameExists 10 - CONSTANT Err_StorageLimitExceeded 11 - CONSTANT Err_DiffFromFileDoesNotExist 12 - CONSTANT Err_DoesNotExistInDirectory 13 - CONSTANT Err_PatchConsistencyError 14 - CONSTANT Err_MultiplyReferencedObject 15 - CONSTANT Err_DisabledAccount 16 - -Version 1 Command(Version) Reply - int32 Version - - -Login 2 Command(LoginConfirmed) - int32 ClientID - int32 Flags - CONSTANT Flags_ReadOnly 1 - - -LoginConfirmed 3 Reply - int64 ClientStoreMarker - int64 BlocksUsed - int64 BlocksSoftLimit - int64 BlocksHardLimit - - -Finished 4 Command(Finished) Reply EndsConversation - - -# generic success object -Success 5 Reply - int64 ObjectID - - -SetClientStoreMarker 6 Command(Success) - int64 ClientStoreMarker - - -# ------------------------------------------------------------------------------------- -# Generic object commands -# ------------------------------------------------------------------------------------- - -GetObject 10 Command(Success) - int64 ObjectID - # reply has stream following (if successful) - - -MoveObject 11 Command(Success) - int64 ObjectID - int64 MoveFromDirectory - int64 MoveToDirectory - int32 Flags - Filename NewFilename - - CONSTANT Flags_MoveAllWithSameName 1 - CONSTANT Flags_AllowMoveOverDeletedObject 2 - -# consider this an object command as, although it deals with directory entries, -# it's not specific to either a file or a directory - - -GetObjectName 12 Command(ObjectName) - int64 ObjectID - int64 ContainingDirectoryID - CONSTANT ObjectID_DirectoryOnly 0 - - # set ObjectID to ObjectID_DirectoryOnly to only get info on the directory - - -ObjectName 13 Reply - int32 NumNameElements - int64 ModificationTime - int64 AttributesHash - int16 Flags - # NumNameElements is zero if the object doesn't exist - CONSTANT NumNameElements_ObjectDoesntExist 0 - # a stream of Filename objects follows, if and only if NumNameElements > 0 - - -# ------------------------------------------------------------------------------------- -# Directory commands -# ------------------------------------------------------------------------------------- - -CreateDirectory 20 Command(Success) StreamWithCommand - int64 ContainingDirectoryID - int64 AttributesModTime - Filename DirectoryName - # stream following containing attributes - - -CreateDirectory2 46 Command(Success) StreamWithCommand - int64 ContainingDirectoryID - int64 AttributesModTime - int64 ModificationTime - Filename DirectoryName - # stream following containing attributes - - -ListDirectory 21 Command(Success) - int64 ObjectID - int16 FlagsMustBeSet - int16 FlagsNotToBeSet - bool SendAttributes - # make sure these flags are synced with those in BackupStoreDirectory - CONSTANT Flags_INCLUDE_EVERYTHING -1 - CONSTANT Flags_EXCLUDE_NOTHING 0 - CONSTANT Flags_EXCLUDE_EVERYTHING 15 - CONSTANT Flags_File 1 - CONSTANT Flags_Dir 2 - CONSTANT Flags_Deleted 4 - CONSTANT Flags_OldVersion 8 - # make sure this is the same as in BackupStoreConstants.h - CONSTANT RootDirectory 1 - - # reply has stream following Success object, containing a stored BackupStoreDirectory - - -ChangeDirAttributes 22 Command(Success) StreamWithCommand - int64 ObjectID - int64 AttributesModTime - # stream following containing attributes - - -DeleteDirectory 23 Command(Success) - int64 ObjectID - - -UndeleteDirectory 24 Command(Success) - int64 ObjectID - # may not have exactly the desired effect if files within in have been deleted before the directory was deleted. - - -# ------------------------------------------------------------------------------------- -# File commands -# ------------------------------------------------------------------------------------- - -StoreFile 30 Command(Success) StreamWithCommand - int64 DirectoryObjectID - int64 ModificationTime - int64 AttributesHash - int64 DiffFromFileID # 0 if the file is not a diff - Filename Filename - # then send a stream containing the encoded file - - -GetFile 31 Command(Success) - int64 InDirectory - int64 ObjectID - # error returned if not a file, or does not exist - # reply has stream following, containing an encoded file IN STREAM ORDER - # (use GetObject to get it in file order) - - -SetReplacementFileAttributes 32 Command(Success) StreamWithCommand - int64 InDirectory - int64 AttributesHash - Filename Filename - # stream follows containing attributes - - -DeleteFile 33 Command(Success) - int64 InDirectory - Filename Filename - # will return 0 if the object couldn't be found in the specified directory - - -GetBlockIndexByID 34 Command(Success) - int64 ObjectID - - # stream of the block index follows the reply - # returns an error if the object didn't exist - - -GetBlockIndexByName 35 Command(Success) - int64 InDirectory - Filename Filename - - # Success object contains the found ID -- or 0 if the entry wasn't found in the directory - # stream of the block index follows the reply if found ID != 0 - - -UndeleteFile 36 Command(Success) - int64 InDirectory - int64 ObjectID - # will return 0 if the object couldn't be found in the specified directory - - -# ------------------------------------------------------------------------------------- -# Information commands -# ------------------------------------------------------------------------------------- - -GetAccountUsage 40 Command(AccountUsage) - # no data members - -AccountUsage 41 Reply - int64 BlocksUsed - int64 BlocksInOldFiles - int64 BlocksInDeletedFiles - int64 BlocksInDirectories - int64 BlocksSoftLimit - int64 BlocksHardLimit - int32 BlockSize - -GetIsAlive 42 Command(IsAlive) - # no data members - -IsAlive 43 Reply - # no data members - -GetAccountUsage2 44 Command(AccountUsage2) - # no data members - -AccountUsage2 45 Reply - String AccountName - bool AccountEnabled - int64 ClientStoreMarker - int32 BlockSize - int64 LastObjectIDUsed - int64 BlocksUsed - int64 BlocksInCurrentFiles - int64 BlocksInOldFiles - int64 BlocksInDeletedFiles - int64 BlocksInDirectories - int64 BlocksSoftLimit - int64 BlocksHardLimit - int64 NumCurrentFiles - int64 NumOldFiles - int64 NumDeletedFiles - int64 NumDirectories - -# 46 is CreateDirectory2 diff --git a/lib/bbackupquery/Documentation.txt b/lib/bbackupquery/Documentation.txt new file mode 100644 index 00000000..b16a6f7c --- /dev/null +++ b/lib/bbackupquery/Documentation.txt @@ -0,0 +1,194 @@ + +bbackupquery utility -- examine store, compare files, restore, etc. + +This file has markers for automatic help generation script -- '>' marks a start of a command/help topic, +and '<' marks the end of a section. + +Command line: +============= + +> bbackupquery [-q] [-c configfile] [commands ...] + + -q -- quiet, no information prompts + -c -- specify another bbackupd configuation file + +The commands following the options are executed, then (if there was no quit +command) an interactive mode is entered. + +If a command contains a space, enclose it in quotes. Example + + bbackupquery "list testdir1" quit + +to list the contents of testdir1, and then exit without interactive mode. +< + +Commands: +========= + +All directory names relative to a "current" directory, or from root if they +start with '/'. The initial directory is always the root directory. + + +> ls [options] [directory-name] + + List contents of current directory, or specified directory. + + -R -- recursively list all files + -d -- list deleted files/directories + -o -- list old versions of files/directories + -I -- don't display object ID + -F -- don't display flags + -t -- show file modification time in local time + (and attr mod time if has the object has attributes, ~ separated) + -T -- show file modification time in GMT + -a -- show updated attribute instead of file modification time + -s -- show file size in blocks used on server + (only very approximate indication of size locally) + -h -- show file attributes hash + -D -- sort directories together with files (not dirs first) + -i -- sort by object ID (the old default) + -S -- sort by object size in blocks + -U -- don't sort the results (new default is to sort by name) + +list can be used as an alias. +< + +> list + + Alias for 'ls'. Type 'help ls' for options. +< + +> cd [options] + + Change directory + + -d -- consider deleted directories for traversal + -o -- consider old versions of directories for traversal + (this option should never be useful in a correctly formed store) +< + +> pwd + + Print current directory, always root relative. +< + +> lcd + + Change local directory. + + Type "sh ls" to list the contents. +< + +> sh + + All of the parameters after the "sh" are run as a shell command. + + For example, to list the contents of the location directory, type "sh ls" +< + +> get [] +get -i + + Gets a file from the store. Object is specified as the filename within + the current directory, and local filename is optional. Ignores old and + deleted files when searching the directory for the file to retrieve. + + To get an old or deleted file, use the -i option and select the object + as a hex object ID (first column in listing). The local filename must + be specified. +< + +> compare -a +compare -l +compare + + Compares the (current) data on the store with the data on the disc. + All the data will be downloaded -- this is potentially a very long + operation. + + -a -- compare all locations + -l -- compare one backup location as specified in the configuration file. + -c -- set return code + -q -- quick compare. Only checks file contents against checksums, + doesn't do a full download + -A -- ignore attribute differences + -E -- ignore exclusion settings + + Comparing with the root directory is an error, use -a option instead. + + If -c is set, then the return code (if quit is the next command) will be + 1 Comparison was exact + 2 Differences were found + 3 An error occured + This can be used for automated tests. +< + +> restore [-drif] [] + + Restores a directory to the local disc. The local directory specified + must not exist (unless a previous restore is being restarted). If the + local directory is omitted, the default is to restore to the same + directory name and path, relative to the current local directory, + as set with the "lcd" command. + + The root cannot be restored -- restore locations individually. + + -d -- restore a deleted directory or deleted files inside + -r -- resume an interrupted restoration + -i -- directory name is actually an ID + -f -- force restore to continue if errors are encountered + + If a restore operation is interrupted for any reason, it can be restarted + using the -r switch. Restore progress information is saved in a file at + regular intervals during the restore operation to allow restarts. +< + +> getobject + + Gets the object specified by the object id (in hex) and stores the raw + contents in the local file specified. + + This is only useful for debugging as it does not decode files from the + stored format, which is encrypted and compressed. +< + +> usage [-m] + + Show space used on the server for this account. + + -m -- display the output in machine-readable form + + Used: Total amount of space used on the server. + Old files: Space used by old files + Deleted files: Space used by deleted files + Directories: Space used by the directory structure. + + When Used exceeds the soft limit, the server will start to remove old and + deleted files until the usage drops below the soft limit. + + After a while, you would expect to see the usage stay at just below the + soft limit. You only need more space if the space used by old and deleted + files is near zero. +< + +> undelete +undelete -i + + Removes the deleted flag from the specified directory name (in the + current directory) or hex object ID. Be careful not to use this + command where a directory already exists with the same name which is + not marked as deleted. +< + +> delete + + Sets the deleted flag on the specified file name (in the current + directory, or with a relative path). +< + +> quit + + End session and exit. +< + + diff --git a/lib/bbackupquery/Makefile.extra b/lib/bbackupquery/Makefile.extra index e1049b6d..5d37c09f 100644 --- a/lib/bbackupquery/Makefile.extra +++ b/lib/bbackupquery/Makefile.extra @@ -1,6 +1,6 @@ # AUTOGEN SEEDING -autogen_Documentation.cpp: makedocumentation.pl documentation.txt +autogen_Documentation.cpp: makedocumentation.pl Documentation.txt $(_PERL) makedocumentation.pl diff --git a/lib/bbackupquery/documentation.txt b/lib/bbackupquery/documentation.txt deleted file mode 100644 index b16a6f7c..00000000 --- a/lib/bbackupquery/documentation.txt +++ /dev/null @@ -1,194 +0,0 @@ - -bbackupquery utility -- examine store, compare files, restore, etc. - -This file has markers for automatic help generation script -- '>' marks a start of a command/help topic, -and '<' marks the end of a section. - -Command line: -============= - -> bbackupquery [-q] [-c configfile] [commands ...] - - -q -- quiet, no information prompts - -c -- specify another bbackupd configuation file - -The commands following the options are executed, then (if there was no quit -command) an interactive mode is entered. - -If a command contains a space, enclose it in quotes. Example - - bbackupquery "list testdir1" quit - -to list the contents of testdir1, and then exit without interactive mode. -< - -Commands: -========= - -All directory names relative to a "current" directory, or from root if they -start with '/'. The initial directory is always the root directory. - - -> ls [options] [directory-name] - - List contents of current directory, or specified directory. - - -R -- recursively list all files - -d -- list deleted files/directories - -o -- list old versions of files/directories - -I -- don't display object ID - -F -- don't display flags - -t -- show file modification time in local time - (and attr mod time if has the object has attributes, ~ separated) - -T -- show file modification time in GMT - -a -- show updated attribute instead of file modification time - -s -- show file size in blocks used on server - (only very approximate indication of size locally) - -h -- show file attributes hash - -D -- sort directories together with files (not dirs first) - -i -- sort by object ID (the old default) - -S -- sort by object size in blocks - -U -- don't sort the results (new default is to sort by name) - -list can be used as an alias. -< - -> list - - Alias for 'ls'. Type 'help ls' for options. -< - -> cd [options] - - Change directory - - -d -- consider deleted directories for traversal - -o -- consider old versions of directories for traversal - (this option should never be useful in a correctly formed store) -< - -> pwd - - Print current directory, always root relative. -< - -> lcd - - Change local directory. - - Type "sh ls" to list the contents. -< - -> sh - - All of the parameters after the "sh" are run as a shell command. - - For example, to list the contents of the location directory, type "sh ls" -< - -> get [] -get -i - - Gets a file from the store. Object is specified as the filename within - the current directory, and local filename is optional. Ignores old and - deleted files when searching the directory for the file to retrieve. - - To get an old or deleted file, use the -i option and select the object - as a hex object ID (first column in listing). The local filename must - be specified. -< - -> compare -a -compare -l -compare - - Compares the (current) data on the store with the data on the disc. - All the data will be downloaded -- this is potentially a very long - operation. - - -a -- compare all locations - -l -- compare one backup location as specified in the configuration file. - -c -- set return code - -q -- quick compare. Only checks file contents against checksums, - doesn't do a full download - -A -- ignore attribute differences - -E -- ignore exclusion settings - - Comparing with the root directory is an error, use -a option instead. - - If -c is set, then the return code (if quit is the next command) will be - 1 Comparison was exact - 2 Differences were found - 3 An error occured - This can be used for automated tests. -< - -> restore [-drif] [] - - Restores a directory to the local disc. The local directory specified - must not exist (unless a previous restore is being restarted). If the - local directory is omitted, the default is to restore to the same - directory name and path, relative to the current local directory, - as set with the "lcd" command. - - The root cannot be restored -- restore locations individually. - - -d -- restore a deleted directory or deleted files inside - -r -- resume an interrupted restoration - -i -- directory name is actually an ID - -f -- force restore to continue if errors are encountered - - If a restore operation is interrupted for any reason, it can be restarted - using the -r switch. Restore progress information is saved in a file at - regular intervals during the restore operation to allow restarts. -< - -> getobject - - Gets the object specified by the object id (in hex) and stores the raw - contents in the local file specified. - - This is only useful for debugging as it does not decode files from the - stored format, which is encrypted and compressed. -< - -> usage [-m] - - Show space used on the server for this account. - - -m -- display the output in machine-readable form - - Used: Total amount of space used on the server. - Old files: Space used by old files - Deleted files: Space used by deleted files - Directories: Space used by the directory structure. - - When Used exceeds the soft limit, the server will start to remove old and - deleted files until the usage drops below the soft limit. - - After a while, you would expect to see the usage stay at just below the - soft limit. You only need more space if the space used by old and deleted - files is near zero. -< - -> undelete -undelete -i - - Removes the deleted flag from the specified directory name (in the - current directory) or hex object ID. Be careful not to use this - command where a directory already exists with the same name which is - not marked as deleted. -< - -> delete - - Sets the deleted flag on the specified file name (in the current - directory, or with a relative path). -< - -> quit - - End session and exit. -< - - diff --git a/lib/bbackupquery/makedocumentation.pl.in b/lib/bbackupquery/makedocumentation.pl.in index 530c4ff6..1def0768 100755 --- a/lib/bbackupquery/makedocumentation.pl.in +++ b/lib/bbackupquery/makedocumentation.pl.in @@ -3,7 +3,7 @@ use strict; print "Creating built-in documentation for bbackupquery...\n"; -open DOC,"documentation.txt" or die "Can't open documentation.txt file"; +open DOC,"Documentation.txt" or die "Can't open Documentation.txt file: $!"; my $section; my %help; my @in_order; -- cgit v1.2.3 From c0125ee22e09a31ae291e42faa817835bd903dbc Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 3 Sep 2016 00:07:23 +0100 Subject: Update platform feature detection to work with CMake. Rewrite some macros in forms that can be parsed by our parser written in CMake language (fake m4 with regexps). Fix incorrect conditional includes and incorrect #if/#ifdef assumptions. --- lib/backupstore/BackupClientFileAttributes.cpp | 6 +++--- lib/backupstore/BackupStoreFileDiff.cpp | 2 +- lib/backupstore/HousekeepStoreAccount.cpp | 2 +- lib/common/BoxConfig-MSVC.h | 9 --------- lib/common/BoxPlatform.h | 23 +++++++++++++---------- lib/common/DebugMemLeakFinder.cpp | 12 ++++++++---- lib/common/ExcludeList.cpp | 4 ++-- lib/common/Logging.cpp | 14 +++++++------- lib/server/Daemon.cpp | 13 ++++++++----- lib/server/TcpNice.cpp | 4 ++-- lib/win32/emu.h | 6 ++++++ 11 files changed, 51 insertions(+), 44 deletions(-) (limited to 'lib') diff --git a/lib/backupstore/BackupClientFileAttributes.cpp b/lib/backupstore/BackupClientFileAttributes.cpp index 7ec6f478..37140301 100644 --- a/lib/backupstore/BackupClientFileAttributes.cpp +++ b/lib/backupstore/BackupClientFileAttributes.cpp @@ -545,7 +545,7 @@ void BackupClientFileAttributes::FillAttributesLink( void BackupClientFileAttributes::FillExtendedAttr(StreamableMemBlock &outputBlock, const std::string& Filename) { -#ifdef HAVE_SYS_XATTR_H +#if defined HAVE_LLISTXATTR && defined HAVE_LGETXATTR int listBufferSize = 10000; char* list = new char[listBufferSize]; @@ -693,7 +693,7 @@ void BackupClientFileAttributes::FillExtendedAttr(StreamableMemBlock &outputBloc throw; } delete[] list; -#endif +#endif // defined HAVE_LLISTXATTR && defined HAVE_LGETXATTR } // -------------------------------------------------------------------------- @@ -992,7 +992,7 @@ void BackupClientFileAttributes::EnsureClearAvailable() const // -------------------------------------------------------------------------- void BackupClientFileAttributes::WriteExtendedAttr(const std::string& Filename, int xattrOffset) const { -#ifdef HAVE_SYS_XATTR_H +#if defined HAVE_LSETXATTR const char* buffer = static_cast(mpClearAttributes->GetBuffer()); uint32_t xattrBlockLength = 0; diff --git a/lib/backupstore/BackupStoreFileDiff.cpp b/lib/backupstore/BackupStoreFileDiff.cpp index 1d83d854..e6df11a6 100644 --- a/lib/backupstore/BackupStoreFileDiff.cpp +++ b/lib/backupstore/BackupStoreFileDiff.cpp @@ -16,7 +16,7 @@ #ifdef HAVE_TIME_H #include -#elif HAVE_SYS_TIME_H +#elif defined HAVE_SYS_TIME_H #include #endif diff --git a/lib/backupstore/HousekeepStoreAccount.cpp b/lib/backupstore/HousekeepStoreAccount.cpp index f24d7227..d5acf62c 100644 --- a/lib/backupstore/HousekeepStoreAccount.cpp +++ b/lib/backupstore/HousekeepStoreAccount.cpp @@ -932,7 +932,7 @@ void HousekeepStoreAccount::UpdateDirectorySize( BackupStoreDirectory& rDirectory, IOStream::pos_type new_size_in_blocks) { -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD { std::string dirFilename; MakeObjectFilename(rDirectory.GetObjectID(), dirFilename); diff --git a/lib/common/BoxConfig-MSVC.h b/lib/common/BoxConfig-MSVC.h index 82ab4997..2ec2edd7 100644 --- a/lib/common/BoxConfig-MSVC.h +++ b/lib/common/BoxConfig-MSVC.h @@ -2,9 +2,6 @@ /* lib/common/BoxConfig.h.in. Generated from configure.ac by autoheader. */ /* Hacked by hand to work for MSVC by Chris Wilson */ -// using std::min/max -#define NOMINMAX - /* Define to major version for BDB_VERSION */ /* #undef BDB_VERSION_MAJOR */ @@ -389,9 +386,6 @@ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ -/* Define to `int' if doesn't define. */ -#define gid_t int - /* Define to `int' if does not define. */ /* #undef mode_t */ @@ -403,6 +397,3 @@ /* Define to `unsigned' if does not define. */ /* #undef size_t */ - -/* Define to `int' if doesn't define. */ -#define uid_t int diff --git a/lib/common/BoxPlatform.h b/lib/common/BoxPlatform.h index 35ad7a2c..f8720587 100644 --- a/lib/common/BoxPlatform.h +++ b/lib/common/BoxPlatform.h @@ -96,16 +96,19 @@ #endif // Handle differing xattr APIs -#ifdef HAVE_SYS_XATTR_H - #if !defined(HAVE_LLISTXATTR) && defined(HAVE_LISTXATTR) && HAVE_DECL_XATTR_NOFOLLOW - #define llistxattr(a,b,c) listxattr(a,b,c,XATTR_NOFOLLOW) - #endif - #if !defined(HAVE_LGETXATTR) && defined(HAVE_GETXATTR) && HAVE_DECL_XATTR_NOFOLLOW - #define lgetxattr(a,b,c,d) getxattr(a,b,c,d,0,XATTR_NOFOLLOW) - #endif - #if !defined(HAVE_LSETXATTR) && defined(HAVE_SETXATTR) && HAVE_DECL_XATTR_NOFOLLOW - #define lsetxattr(a,b,c,d,e) setxattr(a,b,c,d,0,(e)|XATTR_NOFOLLOW) - #endif +#if !defined(HAVE_LLISTXATTR) && defined(HAVE_LISTXATTR) && HAVE_DECL_XATTR_NOFOLLOW + #define llistxattr(a,b,c) listxattr(a,b,c,XATTR_NOFOLLOW) + #define HAVE_LLISTXATTR +#endif + +#if !defined(HAVE_LGETXATTR) && defined(HAVE_GETXATTR) && HAVE_DECL_XATTR_NOFOLLOW + #define lgetxattr(a,b,c,d) getxattr(a,b,c,d,0,XATTR_NOFOLLOW) + #define HAVE_LGETXATTR +#endif + +#if !defined(HAVE_LSETXATTR) && defined(HAVE_SETXATTR) && HAVE_DECL_XATTR_NOFOLLOW + #define lsetxattr(a,b,c,d,e) setxattr(a,b,c,d,0,(e)|XATTR_NOFOLLOW) + #define HAVE_LSETXATTR #endif #if !HAVE_DECL_INFTIM diff --git a/lib/common/DebugMemLeakFinder.cpp b/lib/common/DebugMemLeakFinder.cpp index 81e999c4..58a82c0e 100644 --- a/lib/common/DebugMemLeakFinder.cpp +++ b/lib/common/DebugMemLeakFinder.cpp @@ -15,15 +15,19 @@ #undef realloc #undef free -#ifdef HAVE_UNISTD_H - #include -#endif - #include #include #include #include +#ifdef HAVE_PROCESS_H +# include +#endif + +#ifdef HAVE_UNISTD_H +# include +#endif + #include // for std::atexit #include #include diff --git a/lib/common/ExcludeList.cpp b/lib/common/ExcludeList.cpp index f101782a..4d964021 100644 --- a/lib/common/ExcludeList.cpp +++ b/lib/common/ExcludeList.cpp @@ -10,9 +10,9 @@ #include "Box.h" #ifdef HAVE_REGEX_SUPPORT - #ifdef HAVE_PCREPOSIX_H + #if defined HAVE_PCREPOSIX_H #include - #else + #elif defined HAVE_REGEX_H #include #endif #define EXCLUDELIST_IMPLEMENTATION_REGEX_T_DEFINED diff --git a/lib/common/Logging.cpp b/lib/common/Logging.cpp index a0d1ec8c..0928a4d4 100644 --- a/lib/common/Logging.cpp +++ b/lib/common/Logging.cpp @@ -13,19 +13,19 @@ #include #include // for stderror -// c.f. http://bugs.debian.org/512510 -#include +#ifdef HAVE_PROCESS_H +# include +#endif #ifdef HAVE_SYSLOG_H - #include +# include #endif + #ifdef HAVE_UNISTD_H - #include -#endif -#ifdef WIN32 - #include +# include #endif +#include #include #include diff --git a/lib/server/Daemon.cpp b/lib/server/Daemon.cpp index 836948bf..d3c8441f 100644 --- a/lib/server/Daemon.cpp +++ b/lib/server/Daemon.cpp @@ -9,16 +9,20 @@ #include "Box.h" -#ifdef HAVE_UNISTD_H - #include -#endif - #include #include #include #include #include +#ifdef HAVE_PROCESS_H +# include +#endif + +#ifdef HAVE_UNISTD_H +# include +#endif + #ifdef HAVE_BSD_UNISTD_H #include #endif @@ -26,7 +30,6 @@ #ifdef WIN32 #include #include - #include #endif #include "depot.h" diff --git a/lib/server/TcpNice.cpp b/lib/server/TcpNice.cpp index 40e7a6b5..79e91eeb 100644 --- a/lib/server/TcpNice.cpp +++ b/lib/server/TcpNice.cpp @@ -146,7 +146,7 @@ void NiceSocketStream::Write(const void *pBuffer, int NBytes) int socket = mapSocket->GetSocketHandle(); int rtt = 50; // WAG -# if HAVE_DECL_SOL_TCP && HAVE_DECL_TCP_INFO && HAVE_STRUCT_TCP_INFO_TCPI_RTT +# if HAVE_DECL_SOL_TCP && defined HAVE_STRUCT_TCP_INFO_TCPI_RTT struct tcp_info info; socklen_t optlen = sizeof(info); if(getsockopt(socket, SOL_TCP, TCP_INFO, &info, &optlen) == -1) @@ -164,7 +164,7 @@ void NiceSocketStream::Write(const void *pBuffer, int NBytes) { rtt = info.tcpi_rtt; } -# endif +# endif // HAVE_DECL_SOL_TCP && defined HAVE_STRUCT_TCP_INFO_TCPI_RTT int newWindow = mTcpNice.GetNextWindowSize(mBytesWrittenThisPeriod, elapsed, rtt); diff --git a/lib/win32/emu.h b/lib/win32/emu.h index b8539bb6..d0b7081b 100644 --- a/lib/win32/emu.h +++ b/lib/win32/emu.h @@ -39,8 +39,14 @@ #ifndef __MINGW32__ typedef unsigned int mode_t; typedef unsigned int pid_t; + typedef unsigned int uid_t; + typedef unsigned int gid_t; #endif +// Disable Windows' non-standard implementation of min() and max(): +// http://stackoverflow.com/a/5004874/648162 +#define NOMINMAX + // Windows headers #include -- cgit v1.2.3 From 98a6ad72ee819774a398440055abd87bc44e9ba0 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 3 Sep 2016 00:25:52 +0100 Subject: Fix Unix compilation using CMake. Add platform detection that's compatible with the old buildsystem and its m4 autoconfigury. Make Travis build and test using CMake as a separate target. Remove unused function BoxGetTemporaryDirectoryName() to fixes compile using CMake on Unix. --- lib/bbackupquery/makedocumentation.pl.in | 2 +- lib/common/BoxPlatform.h | 10 ++++++---- lib/common/Test.h | 16 +++++++++------- lib/common/Utils.cpp | 27 --------------------------- lib/win32/emu.h | 4 +++- 5 files changed, 19 insertions(+), 40 deletions(-) (limited to 'lib') diff --git a/lib/bbackupquery/makedocumentation.pl.in b/lib/bbackupquery/makedocumentation.pl.in index 1def0768..503ac9c8 100755 --- a/lib/bbackupquery/makedocumentation.pl.in +++ b/lib/bbackupquery/makedocumentation.pl.in @@ -3,7 +3,7 @@ use strict; print "Creating built-in documentation for bbackupquery...\n"; -open DOC,"Documentation.txt" or die "Can't open Documentation.txt file: $!"; +open DOC, "Documentation.txt" or die "Can't open Documentation.txt file: $!"; my $section; my %help; my @in_order; diff --git a/lib/common/BoxPlatform.h b/lib/common/BoxPlatform.h index f8720587..f7c74bfc 100644 --- a/lib/common/BoxPlatform.h +++ b/lib/common/BoxPlatform.h @@ -21,11 +21,13 @@ #define PLATFORM_DEV_NULL "/dev/null" -#ifdef _MSC_VER -#include "BoxConfig-MSVC.h" -#define NEED_BOX_VERSION_H +#if defined BOX_CMAKE +# include "BoxConfig.cmake.h" +#elif defined _MSC_VER +# include "BoxConfig-MSVC.h" +# define NEED_BOX_VERSION_H #else -#include "BoxConfig.h" +# include "BoxConfig.h" #endif #ifdef WIN32 diff --git a/lib/common/Test.h b/lib/common/Test.h index 36cd6a59..4b5cef61 100644 --- a/lib/common/Test.h +++ b/lib/common/Test.h @@ -243,12 +243,14 @@ void safe_sleep(int seconds); std::auto_ptr load_config_file(const std::string& config_file, const ConfigurationVerify& verify); -#ifdef _MSC_VER - // Our CMakeFiles compile tests to different executable filenames, - // e.g. test_common.exe instead of _test.exe. - #define TEST_EXECUTABLE BOX_MODULE ".exe" -#else - #define TEST_EXECUTABLE "./_test" -#endif +#ifndef TEST_EXECUTABLE +# ifdef _MSC_VER + // Our CMakeFiles compile tests to different executable filenames, + // e.g. test_common.exe instead of _test.exe. + #define TEST_EXECUTABLE BOX_MODULE ".exe" +# else + #define TEST_EXECUTABLE "./_test" +# endif +#endif // TEST_EXECUTABLE #endif // TEST__H diff --git a/lib/common/Utils.cpp b/lib/common/Utils.cpp index 4325dd88..0915f29a 100644 --- a/lib/common/Utils.cpp +++ b/lib/common/Utils.cpp @@ -381,30 +381,3 @@ std::string FormatUsageLineStart(const std::string& rName, return result.str(); } -std::string BoxGetTemporaryDirectoryName() -{ -#ifdef WIN32 - // http://msdn.microsoft.com/library/default.asp? - // url=/library/en-us/fileio/fs/creating_and_using_a_temporary_file.asp - - DWORD dwRetVal; - char lpPathBuffer[1024]; - DWORD dwBufSize = sizeof(lpPathBuffer); - - // Get the temp path. - dwRetVal = GetTempPath(dwBufSize, // length of the buffer - lpPathBuffer); // buffer for path - if (dwRetVal > dwBufSize) - { - THROW_EXCEPTION(CommonException, TempDirPathTooLong) - } - - return std::string(lpPathBuffer); -#elif defined TEMP_DIRECTORY_NAME - return std::string(TEMP_DIRECTORY_NAME); -#else - #error non-static temporary directory names not supported yet -#endif -} - - diff --git a/lib/win32/emu.h b/lib/win32/emu.h index d0b7081b..91793004 100644 --- a/lib/win32/emu.h +++ b/lib/win32/emu.h @@ -18,7 +18,9 @@ #define EMU_INCLUDE // Need feature detection macros below -#ifdef _MSC_VER +#if defined BOX_CMAKE +# include "../common/BoxConfig.cmake.h" +#elif defined _MSC_VER # include "../common/BoxConfig-MSVC.h" # define NEED_BOX_VERSION_H #else -- cgit v1.2.3 From 8ba63a8c197b48504f544bba0a4f8f78be2df577 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 11 Sep 2016 10:59:48 +0100 Subject: Remove unused member variable. --- lib/backupstore/BackupAccountControl.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/backupstore/BackupAccountControl.h b/lib/backupstore/BackupAccountControl.h index bc041794..9f34d194 100644 --- a/lib/backupstore/BackupAccountControl.h +++ b/lib/backupstore/BackupAccountControl.h @@ -42,14 +42,12 @@ public: class S3BackupFileSystem { private: - const Configuration& mConfig; std::string mBasePath; S3Client& mrClient; public: S3BackupFileSystem(const Configuration& config, const std::string& BasePath, S3Client& rClient) - : mConfig(config), - mBasePath(BasePath), + : mBasePath(BasePath), mrClient(rClient) { } std::string GetDirectoryURI(int64_t ObjectID); -- cgit v1.2.3 From cada24ae028dba3699112186d4fe09275ef80d86 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 11 Sep 2016 11:00:02 +0100 Subject: Throw exception with message, instead of logging then throwing. --- lib/common/ExcludeList.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/common/ExcludeList.cpp b/lib/common/ExcludeList.cpp index 4d964021..3f9f69ee 100644 --- a/lib/common/ExcludeList.cpp +++ b/lib/common/ExcludeList.cpp @@ -199,11 +199,9 @@ void ExcludeList::AddRegexEntries(const std::string &rEntries) { char buf[1024]; regerror(errcode, pregex, buf, sizeof(buf)); - BOX_LOG_CATEGORY(Log::ERROR, - ConfigurationVerify::VERIFY_ERROR, + THROW_EXCEPTION_MESSAGE(CommonException, BadRegularExpression, "Invalid regular expression: " << entry << ": " << buf); - THROW_EXCEPTION(CommonException, BadRegularExpression) } // Store in list of regular expressions -- cgit v1.2.3 From 6d9b8278659d1828774af355cda5afeef2b31d57 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 11 Sep 2016 11:00:27 +0100 Subject: Fix infinite loop in RateLimitingStream::Write(). --- lib/common/RateLimitingStream.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/common/RateLimitingStream.h b/lib/common/RateLimitingStream.h index cd9d8271..818c90af 100644 --- a/lib/common/RateLimitingStream.h +++ b/lib/common/RateLimitingStream.h @@ -33,7 +33,7 @@ public: virtual void Write(const void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite) { - Write(pBuffer, NBytes, Timeout); + mrSink.Write(pBuffer, NBytes, Timeout); } virtual pos_type BytesLeftToRead() { -- cgit v1.2.3 From 8b73c13dd60080c701314ac06b6180c88e7a4422 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 11 Sep 2016 11:25:04 +0100 Subject: Simplify AddEventSource usage, avoid strdup(). --- lib/win32/emu.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/win32/emu.cpp b/lib/win32/emu.cpp index c78fe6b2..1f6392d5 100644 --- a/lib/win32/emu.cpp +++ b/lib/win32/emu.cpp @@ -1313,7 +1313,7 @@ int poll (struct pollfd *ufds, unsigned long nfds, int timeout) BOOL AddEventSource ( - LPTSTR pszSrcName, // event source name + const std::string& name, // event source name DWORD dwNum // number of categories ) { @@ -1335,7 +1335,7 @@ BOOL AddEventSource std::string regkey("SYSTEM\\CurrentControlSet\\Services\\EventLog\\" "Application\\"); - regkey += pszSrcName; + regkey += name; HKEY hk; DWORD dwDisp; @@ -1448,10 +1448,7 @@ void openlog(const char * daemonName, int, int) gSyslogH = INVALID_HANDLE_VALUE; } - char* name = strdup(nameStr.c_str()); - BOOL success = AddEventSource(name, 0); - free(name); - + BOOL success = AddEventSource(nameStr, 0); if (!success) { ::syslog(LOG_ERR, "Failed to add our own event source"); -- cgit v1.2.3 From 6eb2a97bad4c7ad87814b54e20c9ba02e6f11bf8 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 19 Sep 2016 23:54:16 +0100 Subject: Remove unused #includes. --- lib/backupstore/BackupAccountControl.h | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/backupstore/BackupAccountControl.h b/lib/backupstore/BackupAccountControl.h index 9f34d194..00118ec2 100644 --- a/lib/backupstore/BackupAccountControl.h +++ b/lib/backupstore/BackupAccountControl.h @@ -14,7 +14,6 @@ #include "BackupStoreAccountDatabase.h" #include "HTTPResponse.h" -#include "NamedLock.h" #include "S3Client.h" class BackupStoreDirectory; -- cgit v1.2.3