1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-10-30 23:37:45 +02:00

Add meson unity build and tests.

This is immediately useful because it will detect any extern'd functions or variables that are not being used. It also detects functions or variables that are declared but not defined.

If a FV/VR_EXTERN macro is missing it will be detected either because of a mismatch in the declaration/definition or because a new defined symbol will appear in the nm test.

Eventually the unity build will be used to create a more optimized pgbackrest binary but that will need to wait.
This commit is contained in:
David Steele
2022-12-31 17:13:41 +07:00
parent 8aa2b101bb
commit 4fb8a0ecdd
365 changed files with 1990 additions and 1885 deletions

17
.github/workflows/symbol.out vendored Normal file
View File

@@ -0,0 +1,17 @@
_IO_stdin_used
__TMC_END__
__bss_start
__data_start
__dso_handle
__environ@GLIBC_2.2.5
_edata
_end
_fini
_init
_start
data_start
environ@GLIBC_2.2.5
main
stderr@GLIBC_2.2.5
stdout@GLIBC_2.2.5
xmlFree@LIBXML2_2.4.30

View File

@@ -100,6 +100,30 @@ jobs:
${GITHUB_WORKSPACE?}/pgbackrest/test/test.pl --vm=none --min-gen --no-valgrind --no-coverage --no-optimize --build-max=2 --module=command --test=backup
${GITHUB_WORKSPACE?}/pgbackrest/test/test.pl --vm=none --min-gen --no-valgrind --no-coverage --no-optimize --build-max=2 --module=postgres --test=interface
# Run meson unity build to check for errors, unused functions, and extern'd functions
unity:
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
path: pgbackrest
- name: Install
run: |
sudo apt-get update
DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive sudo apt-get install -y zlib1g-dev libssl-dev libxml2-dev libpq-dev libyaml-dev pkg-config meson liblz4-dev libzstd-dev libbz2-dev
- name: Build
run: |
meson setup --unity=on -Dforce-release=true -Dwerror=true build ${GITHUB_WORKSPACE?}/pgbackrest
ninja -vC build
- name: Check
run: |
diff ${GITHUB_WORKSPACE?}/pgbackrest/.github/workflows/symbol.out <(nm -gj --defined-only build/src/pgbackrest)
codeql:
runs-on: ubuntu-latest

View File

@@ -76,6 +76,27 @@
<p>Add repository checksum to make verify and resume more efficient.</p>
</release-item>
<release-item>
<commit subject="Mark functions not used externally as static."/>
<commit subject="Remove declaration for function that is no longer defined."/>
<commit subject="Remove unused functions."/>
<commit subject="Put memContextSize() in a DEBUG block."/>
<commit subject="Add explicit keyword for covered modules included in other modules."/>
<commit subject="Move strReplace() and strUpper() to build/common/string module."/>
<commit subject="Move xmlNodeAttribute() to build/common/xml module."/>
<commit subject="Use error*() getters where possible."/>
<commit subject="Move regExpMatchPtr()/regExpMatchStr() to build/common/regExp module."/>
<commit subject="Move storageHelperFree() to storageHelper test harness."/>
<commit subject="Use memcpy() instead of strncpy when source size is known."/>
<commit subject="Put logging functions unused by release builds into DEBUG blocks."/>
<release-item-contributor-list>
<release-item-contributor id="david.steele"/>
</release-item-contributor-list>
<p>Add meson unity build and tests.</p>
</release-item>
</release-development-list>
</release-core-list>

View File

@@ -15,6 +15,9 @@ project(
# Base options
'b_ndebug=if-release',
# Perform unity builds in a single file
'unity_size=100000',
# Compiler options
'c_std=c99',
],

View File

@@ -1,2 +1,3 @@
option('configdir', type: 'string', value: '/etc/pgbackrest', description: 'Configuration directory')
option('fatal-errors', type: 'boolean', value: false, description: 'Stop compilation on first error')
option('force-release', type: 'boolean', value: false, description: 'Force a release build (for testing only!)')

View File

@@ -31,3 +31,7 @@ Build Flags Generated by Configure
// Indicate that a function should always be inlined
#define FN_INLINE_ALWAYS __attribute__((always_inline)) static inline
// Leave extern'd functions/variables alone. Changing these to static is a meson-only feature.
#define FV_EXTERN extern
#define VR_EXTERN

View File

@@ -20,7 +20,7 @@ Annotate Command
#include "storage/helper.h"
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdAnnotate(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Annotate Command
Functions
***********************************************************************************************************************************/
// Add or modify backup annotations
void cmdAnnotate(void);
FV_EXTERN void cmdAnnotate(void);
#endif

View File

@@ -55,7 +55,7 @@ archiveAsyncSpoolQueue(ArchiveMode archiveMode)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
archiveAsyncErrorClear(const ArchiveMode archiveMode, const String *const archiveFile)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
@@ -76,7 +76,7 @@ archiveAsyncErrorClear(const ArchiveMode archiveMode, const String *const archiv
}
/**********************************************************************************************************************************/
bool
FV_EXTERN bool
archiveAsyncStatus(ArchiveMode archiveMode, const String *walSegment, bool throwOnError, bool warnOnOk)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
@@ -182,7 +182,7 @@ archiveAsyncStatus(ArchiveMode archiveMode, const String *walSegment, bool throw
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
archiveAsyncStatusErrorWrite(ArchiveMode archiveMode, const String *walSegment, int code, const String *message)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
@@ -211,7 +211,7 @@ archiveAsyncStatusErrorWrite(ArchiveMode archiveMode, const String *walSegment,
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
archiveAsyncStatusOkWrite(ArchiveMode archiveMode, const String *walSegment, const String *warning)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
@@ -236,7 +236,7 @@ archiveAsyncStatusOkWrite(ArchiveMode archiveMode, const String *walSegment, con
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
archiveAsyncExec(ArchiveMode archiveMode, const StringList *commandExec)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
@@ -293,7 +293,7 @@ archiveAsyncExec(ArchiveMode archiveMode, const StringList *commandExec)
}
/**********************************************************************************************************************************/
int
FV_EXTERN int
archiveIdComparator(const void *item1, const void *item2)
{
StringList *archiveSort1 = strLstNewSplitZ(*(String **)item1, "-");
@@ -305,7 +305,7 @@ archiveIdComparator(const void *item1, const void *item2)
}
/**********************************************************************************************************************************/
bool
FV_EXTERN bool
walIsPartial(const String *walSegment)
{
FUNCTION_LOG_BEGIN(logLevelTrace);
@@ -319,7 +319,7 @@ walIsPartial(const String *walSegment)
}
/**********************************************************************************************************************************/
String *
FV_EXTERN String *
walPath(const String *walFile, const String *pgPath, const String *command)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
@@ -381,7 +381,7 @@ walPath(const String *walFile, const String *pgPath, const String *command)
}
/**********************************************************************************************************************************/
bool
FV_EXTERN bool
walIsSegment(const String *walSegment)
{
FUNCTION_LOG_BEGIN(logLevelTrace);
@@ -406,7 +406,7 @@ walIsSegment(const String *walSegment)
}
/**********************************************************************************************************************************/
String *
FV_EXTERN String *
walSegmentFind(const Storage *storage, const String *archiveId, const String *walSegment, TimeMSec timeout)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
@@ -477,7 +477,7 @@ walSegmentFind(const Storage *storage, const String *archiveId, const String *wa
}
/**********************************************************************************************************************************/
String *
FV_EXTERN String *
walSegmentNext(const String *walSegment, size_t walSegmentSize, unsigned int pgVersion)
{
FUNCTION_LOG_BEGIN(logLevelTrace);
@@ -517,7 +517,7 @@ walSegmentNext(const String *walSegment, size_t walSegmentSize, unsigned int pgV
}
/**********************************************************************************************************************************/
StringList *
FV_EXTERN StringList *
walSegmentRange(const String *walSegmentBegin, size_t walSegmentSize, unsigned int pgVersion, unsigned int range)
{
FUNCTION_LOG_BEGIN(logLevelDebug);

View File

@@ -67,42 +67,43 @@ Functions
***********************************************************************************************************************************/
// Remove errors for an archive file. This should be done before forking the async process to prevent a race condition where an
// old error may be reported rather than waiting for the async process to succeed or fail.
void archiveAsyncErrorClear(ArchiveMode archiveMode, const String *archiveFile);
FV_EXTERN void archiveAsyncErrorClear(ArchiveMode archiveMode, const String *archiveFile);
// Check for ok/error status files in the spool in/out directory. throwOnError determines whether an error will be thrown when an
// error file is found. warnOnOk determines whether a warning will be output when found in an ok file.
bool archiveAsyncStatus(ArchiveMode archiveMode, const String *walSegment, bool throwOnError, bool warnOnOk);
FV_EXTERN bool archiveAsyncStatus(ArchiveMode archiveMode, const String *walSegment, bool throwOnError, bool warnOnOk);
// Write an ok status file
void archiveAsyncStatusOkWrite(ArchiveMode archiveMode, const String *walSegment, const String *warning);
FV_EXTERN void archiveAsyncStatusOkWrite(ArchiveMode archiveMode, const String *walSegment, const String *warning);
// Write an error status file
void archiveAsyncStatusErrorWrite(ArchiveMode archiveMode, const String *walSegment, int code, const String *message);
FV_EXTERN void archiveAsyncStatusErrorWrite(ArchiveMode archiveMode, const String *walSegment, int code, const String *message);
// Execute the async process. This function will only return in the calling process and the implementation is platform dependent.
void archiveAsyncExec(ArchiveMode archiveMode, const StringList *commandExec);
FV_EXTERN void archiveAsyncExec(ArchiveMode archiveMode, const StringList *commandExec);
// Comparator function for sorting archive ids by the database history id (the number after the dash) e.g. 9.4-1, 10-2
int archiveIdComparator(const void *item1, const void *item2);
FV_EXTERN int archiveIdComparator(const void *item1, const void *item2);
// Is the segment partial?
bool walIsPartial(const String *walSegment);
FV_EXTERN bool walIsPartial(const String *walSegment);
// Is the file a segment or some other file (e.g. .history, .backup, etc)
bool walIsSegment(const String *walSegment);
FV_EXTERN bool walIsSegment(const String *walSegment);
// Generates the location of the wal directory using a relative wal path and the supplied pg path
String *walPath(const String *walFile, const String *pgPath, const String *command);
FV_EXTERN String *walPath(const String *walFile, const String *pgPath, const String *command);
// Find a WAL segment in the repository. The file name can have several things appended such as a hash, compression extension, and
// partial extension so it is possible to have multiple files that match the segment, though more than one match is not a good
// thing.
String *walSegmentFind(const Storage *storage, const String *archiveId, const String *walSegment, TimeMSec timeout);
FV_EXTERN String *walSegmentFind(const Storage *storage, const String *archiveId, const String *walSegment, TimeMSec timeout);
// Get the next WAL segment given a WAL segment and WAL segment size
String *walSegmentNext(const String *walSegment, size_t walSegmentSize, unsigned int pgVersion);
FV_EXTERN String *walSegmentNext(const String *walSegment, size_t walSegmentSize, unsigned int pgVersion);
// Build a list of WAL segments based on a beginning WAL and number of WAL in the range (inclusive)
StringList *walSegmentRange(const String *walSegmentBegin, size_t walSegmentSize, unsigned int pgVersion, unsigned int range);
FV_EXTERN StringList *walSegmentRange(
const String *walSegmentBegin, size_t walSegmentSize, unsigned int pgVersion, unsigned int range);
#endif

View File

@@ -17,7 +17,7 @@ Archive Get File
#include "storage/helper.h"
/**********************************************************************************************************************************/
ArchiveGetFileResult archiveGetFile(
FV_EXTERN ArchiveGetFileResult archiveGetFile(
const Storage *storage, const String *request, const List *actualList, const String *walDestination)
{
FUNCTION_LOG_BEGIN(logLevelDebug);

View File

@@ -27,7 +27,7 @@ typedef struct ArchiveGetFileResult
StringList *warnList; // Warnings from a successful operation
} ArchiveGetFileResult;
ArchiveGetFileResult archiveGetFile(
FV_EXTERN ArchiveGetFileResult archiveGetFile(
const Storage *storage, const String *request, const List *actualList, const String *walDestination);
#endif

View File

@@ -597,7 +597,7 @@ queueNeed(const String *walSegment, bool found, uint64_t queueSize, size_t walSe
}
/**********************************************************************************************************************************/
int
FV_EXTERN int
cmdArchiveGet(void)
{
FUNCTION_LOG_VOID(logLevelDebug);
@@ -894,7 +894,7 @@ static ProtocolParallelJob *archiveGetAsyncCallback(void *data, unsigned int cli
FUNCTION_TEST_RETURN(PROTOCOL_PARALLEL_JOB, result);
}
void
FV_EXTERN void
cmdArchiveGetAsync(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,9 +8,9 @@ Archive Get Command
Functions
***********************************************************************************************************************************/
// Get an archive file from the repository (WAL segment, history file, etc.)
int cmdArchiveGet(void);
FV_EXTERN int cmdArchiveGet(void);
// Async version of archive get that runs in parallel for performance
void cmdArchiveGetAsync(void);
FV_EXTERN void cmdArchiveGetAsync(void);
#endif

View File

@@ -14,7 +14,7 @@ Archive Get Protocol Handler
#include "storage/write.intern.h"
/**********************************************************************************************************************************/
void
FV_EXTERN void
archiveGetFileProtocol(PackRead *const param, ProtocolServer *const server)
{
FUNCTION_LOG_BEGIN(logLevelDebug);

View File

@@ -11,7 +11,7 @@ Archive Get Protocol Handler
Functions
***********************************************************************************************************************************/
// Process protocol requests
void archiveGetFileProtocol(PackRead *param, ProtocolServer *server);
FV_EXTERN void archiveGetFileProtocol(PackRead *param, ProtocolServer *server);
/***********************************************************************************************************************************
Protocol commands for ProtocolServerHandler arrays passed to protocolServerProcess()

View File

@@ -90,7 +90,7 @@ archivePushFileIo(ArchivePushFileIoType type, IoWrite *write, const Buffer *buff
}
/**********************************************************************************************************************************/
ArchivePushFileResult
FV_EXTERN ArchivePushFileResult
archivePushFile(
const String *const walSource, const bool headerCheck, const bool modeCheck, const unsigned int pgVersion,
const uint64_t pgSystemId, const String *const archiveFile, const CompressType compressType, const int compressLevel,

View File

@@ -30,7 +30,7 @@ typedef struct ArchivePushFileResult
} ArchivePushFileResult;
// Copy a file from the source to the archive
ArchivePushFileResult archivePushFile(
FV_EXTERN ArchivePushFileResult archivePushFile(
const String *walSource, bool headerCheck, bool modeCheck, unsigned int pgVersion, uint64_t pgSystemId,
const String *archiveFile, CompressType compressType, int compressLevel, const List *repoList,
const StringList *priorErrorList);

View File

@@ -13,7 +13,7 @@ Archive Push Protocol Handler
#include "storage/helper.h"
/**********************************************************************************************************************************/
void
FV_EXTERN void
archivePushFileProtocol(PackRead *const param, ProtocolServer *const server)
{
FUNCTION_LOG_BEGIN(logLevelDebug);

View File

@@ -11,7 +11,7 @@ Archive Push Protocol Handler
Functions
***********************************************************************************************************************************/
// Process protocol requests
void archivePushFileProtocol(PackRead *param, ProtocolServer *server);
FV_EXTERN void archivePushFileProtocol(PackRead *param, ProtocolServer *server);
/***********************************************************************************************************************************
Protocol commands for ProtocolServerHandler arrays passed to protocolServerProcess()

View File

@@ -304,7 +304,7 @@ archivePushCheck(bool pgPathSet)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdArchivePush(void)
{
FUNCTION_LOG_VOID(logLevelDebug);
@@ -513,7 +513,7 @@ archivePushAsyncCallback(void *data, unsigned int clientIdx)
FUNCTION_TEST_RETURN(PROTOCOL_PARALLEL_JOB, result);
}
void
FV_EXTERN void
cmdArchivePushAsync(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,9 +8,9 @@ Archive Push Command
Functions
***********************************************************************************************************************************/
// Push a WAL segment to the repository
void cmdArchivePush(void);
FV_EXTERN void cmdArchivePush(void);
// Async version of archive push that runs in parallel for performance
void cmdArchivePushAsync(void);
FV_EXTERN void cmdArchivePushAsync(void);
#endif

View File

@@ -2217,7 +2217,7 @@ backupComplete(InfoBackup *const infoBackup, Manifest *const manifest)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdBackup(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Backup Command
Functions
***********************************************************************************************************************************/
// Make a backup
void cmdBackup(void);
FV_EXTERN void cmdBackup(void);
#endif

View File

@@ -17,7 +17,7 @@ Constants
#define BACKUP_LINK_LATEST "latest"
/**********************************************************************************************************************************/
String *
FV_EXTERN String *
backupFileRepoPath(const String *const backupLabel, const BackupFileRepoPathParam param)
{
FUNCTION_TEST_BEGIN();
@@ -41,7 +41,7 @@ backupFileRepoPath(const String *const backupLabel, const BackupFileRepoPathPara
}
/**********************************************************************************************************************************/
String *
FV_EXTERN String *
backupLabelFormat(BackupType type, const String *backupLabelPrior, time_t timestamp)
{
FUNCTION_LOG_BEGIN(logLevelTrace);
@@ -79,7 +79,7 @@ backupLabelFormat(BackupType type, const String *backupLabelPrior, time_t timest
}
/**********************************************************************************************************************************/
String *
FV_EXTERN String *
backupRegExp(const BackupRegExpParam param)
{
FUNCTION_LOG_BEGIN(logLevelTrace);
@@ -142,7 +142,7 @@ backupRegExp(const BackupRegExpParam param)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
backupLinkLatest(const String *backupLabel, unsigned int repoIdx)
{
FUNCTION_TEST_BEGIN();

View File

@@ -30,10 +30,10 @@ typedef struct BackupFileRepoPathParam
#define backupFileRepoPathP(backupLabel, ...) \
backupFileRepoPath(backupLabel, (BackupFileRepoPathParam){__VA_ARGS__})
String *backupFileRepoPath(const String *backupLabel, BackupFileRepoPathParam param);
FV_EXTERN String *backupFileRepoPath(const String *backupLabel, BackupFileRepoPathParam param);
// Format a backup label from a type and timestamp with an optional prior label
String *backupLabelFormat(BackupType type, const String *backupLabelPrior, time_t timestamp);
FV_EXTERN String *backupLabelFormat(BackupType type, const String *backupLabelPrior, time_t timestamp);
// Returns an anchored regex string for filtering backups based on the type (at least one type is required to be true)
typedef struct BackupRegExpParam
@@ -47,9 +47,9 @@ typedef struct BackupRegExpParam
#define backupRegExpP(...) \
backupRegExp((BackupRegExpParam){__VA_ARGS__})
String *backupRegExp(BackupRegExpParam param);
FV_EXTERN String *backupRegExp(BackupRegExpParam param);
// Create a symlink to the specified backup (if symlinks are supported)
void backupLinkLatest(const String *backupLabel, unsigned int repoIdx);
FV_EXTERN void backupLinkLatest(const String *backupLabel, unsigned int repoIdx);
#endif

View File

@@ -36,7 +36,7 @@ segmentNumber(const String *pgFile)
}
/**********************************************************************************************************************************/
List *
FV_EXTERN List *
backupFile(
const String *const repoFile, const CompressType repoFileCompressType, const int repoFileCompressLevel,
const CipherType cipherType, const String *const cipherPass, const List *const fileList)

View File

@@ -52,7 +52,7 @@ typedef struct BackupFileResult
Pack *pageChecksumResult;
} BackupFileResult;
List *backupFile(
FV_EXTERN List *backupFile(
const String *repoFile, CompressType repoFileCompressType, int repoFileCompressLevel, CipherType cipherType,
const String *cipherPass, const List *fileList);

View File

@@ -35,7 +35,7 @@ typedef struct PageChecksum
/***********************************************************************************************************************************
Macros for function logging
***********************************************************************************************************************************/
String *
FV_EXTERN String *
pageChecksumToLog(const PageChecksum *this)
{
return strNewFmt("{valid: %s, align: %s}", cvtBoolToConstZ(this->valid), cvtBoolToConstZ(this->align));
@@ -224,7 +224,7 @@ pageChecksumResult(THIS_VOID)
}
/**********************************************************************************************************************************/
IoFilter *
FV_EXTERN IoFilter *
pageChecksumNew(const unsigned int segmentNo, const unsigned int segmentPageTotal, const String *const fileName)
{
FUNCTION_LOG_BEGIN(logLevelTrace);
@@ -273,7 +273,7 @@ pageChecksumNew(const unsigned int segmentNo, const unsigned int segmentPageTota
FUNCTION_LOG_RETURN(IO_FILTER, this);
}
IoFilter *
FV_EXTERN IoFilter *
pageChecksumNewPack(const Pack *const paramList)
{
IoFilter *result = NULL;

View File

@@ -16,7 +16,7 @@ Filter type constant
/***********************************************************************************************************************************
Constructors
***********************************************************************************************************************************/
IoFilter *pageChecksumNew(unsigned int segmentNo, unsigned int segmentPageTotal, const String *fileName);
IoFilter *pageChecksumNewPack(const Pack *paramList);
FV_EXTERN IoFilter *pageChecksumNew(unsigned int segmentNo, unsigned int segmentPageTotal, const String *fileName);
FV_EXTERN IoFilter *pageChecksumNewPack(const Pack *paramList);
#endif

View File

@@ -14,7 +14,7 @@ Backup Protocol Handler
#include "storage/helper.h"
/**********************************************************************************************************************************/
void
FV_EXTERN void
backupFileProtocol(PackRead *const param, ProtocolServer *const server)
{
FUNCTION_LOG_BEGIN(logLevelDebug);

View File

@@ -11,7 +11,7 @@ Backup Protocol Handler
Functions
***********************************************************************************************************************************/
// Process protocol requests
void backupFileProtocol(PackRead *param, ProtocolServer *server);
FV_EXTERN void backupFileProtocol(PackRead *param, ProtocolServer *server);
/***********************************************************************************************************************************
Protocol commands for ProtocolServerHandler arrays passed to protocolServerProcess()

View File

@@ -164,7 +164,7 @@ checkPrimary(const DbGetResult dbGroup)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdCheck(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Check Command
Functions
***********************************************************************************************************************************/
// Perform standard checks
void cmdCheck(void);
FV_EXTERN void cmdCheck(void);
#endif

View File

@@ -41,7 +41,7 @@ checkArchiveCommand(const String *archiveCommand)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
checkDbConfig(const unsigned int pgVersion, const unsigned int pgIdx, const Db *dbObject, bool isStandby)
{
FUNCTION_TEST_BEGIN();
@@ -94,7 +94,7 @@ checkDbConfig(const unsigned int pgVersion, const unsigned int pgIdx, const Db *
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
checkStanzaInfo(const InfoPgData *archiveInfo, const InfoPgData *backupInfo)
{
FUNCTION_TEST_BEGIN();
@@ -122,7 +122,7 @@ checkStanzaInfo(const InfoPgData *archiveInfo, const InfoPgData *backupInfo)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
checkStanzaInfoPg(
const Storage *storage, const unsigned int pgVersion, const uint64_t pgSystemId, CipherType cipherType,
const String *cipherPass)

View File

@@ -12,13 +12,13 @@ Check Command Common
Functions
***********************************************************************************************************************************/
// Check the database path and version are configured correctly
void checkDbConfig(const unsigned int pgVersion, const unsigned int pgIdx, const Db *dbObject, bool isStandby);
FV_EXTERN void checkDbConfig(const unsigned int pgVersion, const unsigned int pgIdx, const Db *dbObject, bool isStandby);
// Validate the archive and backup info files
void checkStanzaInfo(const InfoPgData *archiveInfo, const InfoPgData *backupInfo);
FV_EXTERN void checkStanzaInfo(const InfoPgData *archiveInfo, const InfoPgData *backupInfo);
// Load and validate the database data of the info files against each other and the current database
void checkStanzaInfoPg(
FV_EXTERN void checkStanzaInfoPg(
const Storage *storage, const unsigned int pgVersion, const uint64_t pgSystemId, CipherType cipherType,
const String *cipherPass);

View File

@@ -23,7 +23,7 @@ static TimeMSec timeBegin;
static String *cmdOptionStr;
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdInit(void)
{
FUNCTION_LOG_VOID(logLevelTrace);
@@ -34,7 +34,7 @@ cmdInit(void)
}
/**********************************************************************************************************************************/
const String *
FV_EXTERN const String *
cmdOption(void)
{
FUNCTION_TEST_VOID();
@@ -157,7 +157,7 @@ cmdOption(void)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdBegin(void)
{
FUNCTION_LOG_VOID(logLevelTrace);
@@ -189,7 +189,7 @@ cmdBegin(void)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdEnd(int code, const String *errorMessage)
{
FUNCTION_LOG_BEGIN(logLevelTrace);

View File

@@ -10,16 +10,16 @@ Common Command Routines
Functions
***********************************************************************************************************************************/
// Capture time at the very start of main so total time is more accurate
void cmdInit(void);
FV_EXTERN void cmdInit(void);
// Begin the command
void cmdBegin(void);
FV_EXTERN void cmdBegin(void);
// Get the command options as a string. This is output in cmdBegin() if the log level is high enough but can also be used for
// debugging or error reporting later on.
const String *cmdOption(void);
FV_EXTERN const String *cmdOption(void);
// End the command
void cmdEnd(int code, const String *errorMessage);
FV_EXTERN void cmdEnd(int code, const String *errorMessage);
#endif

View File

@@ -9,7 +9,7 @@ Common Handler for Control Commands
#include "storage/helper.h"
/**********************************************************************************************************************************/
String *
FV_EXTERN String *
lockStopFileName(const String *stanza)
{
FUNCTION_TEST_BEGIN();
@@ -22,7 +22,7 @@ lockStopFileName(const String *stanza)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
lockStopTest(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -15,9 +15,9 @@ Constants
Functions
***********************************************************************************************************************************/
// Create the stop filename
String *lockStopFileName(const String *stanza);
FV_EXTERN String *lockStopFileName(const String *stanza);
// Test for the existence of a stop file
void lockStopTest(void);
FV_EXTERN void lockStopTest(void);
#endif

View File

@@ -10,7 +10,7 @@ Start Command
#include "storage/storage.h"
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdStart(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -7,6 +7,6 @@ Start Command
/***********************************************************************************************************************************
Functions
***********************************************************************************************************************************/
void cmdStart(void);
FV_EXTERN void cmdStart(void);
#endif

View File

@@ -20,7 +20,7 @@ Stop Command
#include "storage/storage.intern.h"
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdStop(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -7,6 +7,6 @@ Stop Command
/***********************************************************************************************************************************
Functions
***********************************************************************************************************************************/
void cmdStop(void);
FV_EXTERN void cmdStop(void);
#endif

View File

@@ -65,7 +65,7 @@ exitOnSignal(int signalType)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
exitInit(void)
{
FUNCTION_LOG_VOID(logLevelTrace);
@@ -105,7 +105,7 @@ exitErrorDetail(void)
FUNCTION_TEST_RETURN(STRING, result);
}
int
FV_EXTERN int
exitSafe(int result, bool error, SignalType signalType)
{
FUNCTION_LOG_BEGIN(logLevelDebug);

View File

@@ -22,9 +22,9 @@ typedef enum
Functions
***********************************************************************************************************************************/
// Setup signal handlers
void exitInit(void);
FV_EXTERN void exitInit(void);
// Do cleanup and return result code
int exitSafe(int result, bool error, SignalType signalType);
FV_EXTERN int exitSafe(int result, bool error, SignalType signalType);
#endif

View File

@@ -959,7 +959,7 @@ removeExpiredHistory(InfoBackup *infoBackup, unsigned int repoIdx)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdExpire(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Expire Command
Functions
***********************************************************************************************************************************/
// Expire backups and archives
void cmdExpire(void);
FV_EXTERN void cmdExpire(void);
#endif

View File

@@ -559,7 +559,7 @@ helpRender(const Buffer *const helpData)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdHelp(const Buffer *const helpData)
{
FUNCTION_LOG_BEGIN(logLevelDebug);

View File

@@ -10,6 +10,6 @@ Help Command
Functions
***********************************************************************************************************************************/
// Render help and output to stdout
void cmdHelp(const Buffer *const helpData);
FV_EXTERN void cmdHelp(const Buffer *const helpData);
#endif

View File

@@ -1614,7 +1614,7 @@ infoRender(void)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdInfo(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Info Command
Functions
***********************************************************************************************************************************/
// Render info and output to stdout
void cmdInfo(void);
FV_EXTERN void cmdInfo(void);
#endif

View File

@@ -28,7 +28,7 @@ static const ProtocolServerHandler commandLocalHandlerList[] =
};
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdLocal(ProtocolServer *server)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -10,6 +10,6 @@ Local Command
Functions
***********************************************************************************************************************************/
// Local command
void cmdLocal(ProtocolServer *server);
FV_EXTERN void cmdLocal(ProtocolServer *server);
#endif

View File

@@ -43,7 +43,7 @@ static const StorageRemoteFilterHandler storageRemoteFilterHandlerList[] =
};
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdRemote(ProtocolServer *const server)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -10,6 +10,6 @@ Remote Command
Functions
***********************************************************************************************************************************/
// Remote command
void cmdRemote(ProtocolServer *server);
FV_EXTERN void cmdRemote(ProtocolServer *server);
#endif

View File

@@ -9,7 +9,7 @@ Common Functions and Definitions for Repo Commands
#include "storage/helper.h"
/**********************************************************************************************************************************/
String *
FV_EXTERN String *
repoPathIsValid(const String *path)
{
FUNCTION_LOG_BEGIN(logLevelDebug);

View File

@@ -10,6 +10,6 @@ Repo Command Common
Functions and Definitions
***********************************************************************************************************************************/
// Path cannot contain //. Strip trailing /. Absolute path must fall under repo path. Throw error or return validated relative path.
String *repoPathIsValid(const String *path);
FV_EXTERN String *repoPathIsValid(const String *path);
#endif

View File

@@ -14,7 +14,7 @@ Repository Create Command
#include "storage/s3/storage.intern.h"
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdRepoCreate(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Repository Create Command
Functions
***********************************************************************************************************************************/
// Create the repository (create path, bucket, etc.)
void cmdRepoCreate(void);
FV_EXTERN void cmdRepoCreate(void);
#endif

View File

@@ -162,7 +162,7 @@ storageGetProcess(IoWrite *destination)
}
/**********************************************************************************************************************************/
int
FV_EXTERN int
cmdStorageGet(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Repository Get Command
Functions
***********************************************************************************************************************************/
// Get a file from the repository
int cmdStorageGet(void);
FV_EXTERN int cmdStorageGet(void);
#endif

View File

@@ -173,7 +173,7 @@ storageListRender(IoWrite *write)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdStorageList(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Repository List Command
Functions
***********************************************************************************************************************************/
// List files in the repository
void cmdStorageList(void);
FV_EXTERN void cmdStorageList(void);
#endif

View File

@@ -77,7 +77,7 @@ storagePutProcess(IoRead *source)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdStoragePut(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Repository Put Command
Functions
***********************************************************************************************************************************/
// Put a file into the repository
void cmdStoragePut(void);
FV_EXTERN void cmdStoragePut(void);
#endif

View File

@@ -11,7 +11,7 @@ Repository Remove Command
#include "storage/helper.h"
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdStorageRemove(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Repository Remove Command
Functions
***********************************************************************************************************************************/
// Remove paths/files from the repository
void cmdStorageRemove(void);
FV_EXTERN void cmdStorageRemove(void);
#endif

View File

@@ -20,7 +20,7 @@ Restore File
#include "storage/helper.h"
/**********************************************************************************************************************************/
List *restoreFile(
FV_EXTERN List *restoreFile(
const String *const repoFile, const unsigned int repoIdx, const CompressType repoFileCompressType, const time_t copyTimeBegin,
const bool delta, const bool deltaForce, const String *const cipherPass, const List *const fileList)
{

View File

@@ -42,7 +42,7 @@ typedef struct RestoreFileResult
RestoreResult result; // Restore result (e.g. preserve, copy)
} RestoreFileResult;
List *restoreFile(
FV_EXTERN List *restoreFile(
const String *repoFile, unsigned int repoIdx, CompressType repoFileCompressType, time_t copyTimeBegin, bool delta,
bool deltaForce, const String *cipherPass, const List *fileList);

View File

@@ -13,7 +13,7 @@ Restore Protocol Handler
#include "storage/helper.h"
/**********************************************************************************************************************************/
void
FV_EXTERN void
restoreFileProtocol(PackRead *const param, ProtocolServer *const server)
{
FUNCTION_LOG_BEGIN(logLevelDebug);

View File

@@ -11,7 +11,7 @@ Restore Protocol Handler
Functions
***********************************************************************************************************************************/
// Process protocol requests
void restoreFileProtocol(PackRead *param, ProtocolServer *server);
FV_EXTERN void restoreFileProtocol(PackRead *param, ProtocolServer *server);
/***********************************************************************************************************************************
Protocol commands for ProtocolServerHandler arrays passed to protocolServerProcess()

View File

@@ -2381,7 +2381,7 @@ static ProtocolParallelJob *restoreJobCallback(void *data, unsigned int clientId
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdRestore(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Restore Command
Functions
***********************************************************************************************************************************/
// Restore a backup
void cmdRestore(void);
FV_EXTERN void cmdRestore(void);
#endif

View File

@@ -11,7 +11,7 @@ Server Ping Command
#include "protocol/client.h"
#include "protocol/helper.h"
void
FV_EXTERN void
cmdServerPing(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -7,6 +7,6 @@ Server Ping Command
/***********************************************************************************************************************************
Functions
***********************************************************************************************************************************/
void cmdServerPing(void);
FV_EXTERN void cmdServerPing(void);
#endif

View File

@@ -109,7 +109,7 @@ cmdServerSigChild(const int signalType, siginfo_t *signalInfo, void *context)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdServer(const unsigned int argListSize, const char *argList[])
{
FUNCTION_LOG_BEGIN(logLevelDebug);

View File

@@ -9,6 +9,6 @@ Server Command
/***********************************************************************************************************************************
Functions
***********************************************************************************************************************************/
void cmdServer(unsigned int argListSize, const char *argList[]);
FV_EXTERN void cmdServer(unsigned int argListSize, const char *argList[]);
#endif

View File

@@ -14,7 +14,7 @@ Stanza Commands Handler
#include "storage/helper.h"
/**********************************************************************************************************************************/
String *
FV_EXTERN String *
cipherPassGen(CipherType cipherType)
{
FUNCTION_TEST_BEGIN();
@@ -35,7 +35,7 @@ cipherPassGen(CipherType cipherType)
}
/**********************************************************************************************************************************/
PgControl
FV_EXTERN PgControl
pgValidate(void)
{
FUNCTION_TEST_VOID();

View File

@@ -11,9 +11,9 @@ Stanza Commands Handler
Functions
***********************************************************************************************************************************/
// Generate a cipher
String *cipherPassGen(CipherType cipherType);
FV_EXTERN String *cipherPassGen(CipherType cipherType);
// Validate and return database information
PgControl pgValidate(void);
FV_EXTERN PgControl pgValidate(void);
#endif

View File

@@ -24,7 +24,7 @@ Stanza Create Command
#include "storage/helper.h"
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdStanzaCreate(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Stanza Create Command
Functions
***********************************************************************************************************************************/
// Process stanza-create
void cmdStanzaCreate(void);
FV_EXTERN void cmdStanzaCreate(void);
#endif

View File

@@ -18,7 +18,7 @@ Stanza Delete Command
#include "storage/helper.h"
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdStanzaDelete(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Stanza Delete Command
Functions
***********************************************************************************************************************************/
// Process stanza-delete
void cmdStanzaDelete(void);
FV_EXTERN void cmdStanzaDelete(void);
#endif

View File

@@ -24,7 +24,7 @@ Stanza Update Command
#include "storage/helper.h"
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdStanzaUpgrade(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Stanza Upgrade Command
Functions
***********************************************************************************************************************************/
// Process stanza-upgrade
void cmdStanzaUpgrade(void);
FV_EXTERN void cmdStanzaUpgrade(void);
#endif

View File

@@ -15,7 +15,7 @@ Verify File
#include "storage/helper.h"
/**********************************************************************************************************************************/
VerifyResult
FV_EXTERN VerifyResult
verifyFile(
const String *const filePathName, const uint64_t offset, const Variant *const limit, const CompressType compressType,
const Buffer *const fileChecksum, const uint64_t fileSize, const String *const cipherPass)

View File

@@ -23,7 +23,7 @@ typedef enum
Functions
***********************************************************************************************************************************/
// Verify a file in the pgBackRest repository
VerifyResult verifyFile(
FV_EXTERN VerifyResult verifyFile(
const String *filePathName, uint64_t offset, const Variant *limit, CompressType compressType, const Buffer *fileChecksum,
uint64_t fileSize, const String *cipherPass);

View File

@@ -13,7 +13,7 @@ Verify Protocol Handler
#include "storage/helper.h"
/**********************************************************************************************************************************/
void
FV_EXTERN void
verifyFileProtocol(PackRead *const param, ProtocolServer *const server)
{
FUNCTION_LOG_BEGIN(logLevelDebug);

View File

@@ -11,7 +11,7 @@ Verify Protocol Handler
Functions
***********************************************************************************************************************************/
// Process protocol requests
void verifyFileProtocol(PackRead *param, ProtocolServer *server);
FV_EXTERN void verifyFileProtocol(PackRead *param, ProtocolServer *server);
/***********************************************************************************************************************************
Protocol commands for ProtocolServerHandler arrays passed to protocolServerProcess()

View File

@@ -1711,7 +1711,7 @@ verifyProcess(const bool verboseText)
}
/**********************************************************************************************************************************/
void
FV_EXTERN void
cmdVerify(void)
{
FUNCTION_LOG_VOID(logLevelDebug);

View File

@@ -8,6 +8,6 @@ Verify Command
Functions
***********************************************************************************************************************************/
// Verify the contents of the repository
void cmdVerify(void);
FV_EXTERN void cmdVerify(void);
#endif

View File

@@ -10,7 +10,7 @@ BZ2 Common
#include "common/memContext.h"
/**********************************************************************************************************************************/
int
FV_EXTERN int
bz2Error(int error)
{
FUNCTION_TEST_BEGIN();

View File

@@ -16,6 +16,6 @@ BZ2 extension
/***********************************************************************************************************************************
Functions
***********************************************************************************************************************************/
int bz2Error(int error);
FV_EXTERN int bz2Error(int error);
#endif

View File

@@ -156,7 +156,7 @@ bz2CompressInputSame(const THIS_VOID)
}
/**********************************************************************************************************************************/
IoFilter *
FV_EXTERN IoFilter *
bz2CompressNew(int level)
{
FUNCTION_LOG_BEGIN(logLevelTrace);

View File

@@ -23,6 +23,6 @@ Level constants
/***********************************************************************************************************************************
Constructors
***********************************************************************************************************************************/
IoFilter *bz2CompressNew(int level);
FV_EXTERN IoFilter *bz2CompressNew(int level);
#endif

View File

@@ -143,7 +143,7 @@ bz2DecompressInputSame(const THIS_VOID)
}
/**********************************************************************************************************************************/
IoFilter *
FV_EXTERN IoFilter *
bz2DecompressNew(void)
{
FUNCTION_LOG_VOID(logLevelTrace);

View File

@@ -16,6 +16,6 @@ Filter type constant
/***********************************************************************************************************************************
Constructors
***********************************************************************************************************************************/
IoFilter *bz2DecompressNew(void);
FV_EXTERN IoFilter *bz2DecompressNew(void);
#endif

View File

@@ -10,7 +10,7 @@ Gz Common
#include "common/memContext.h"
/**********************************************************************************************************************************/
int
FV_EXTERN int
gzError(int error)
{
if (error != Z_OK && error != Z_STREAM_END)

View File

@@ -19,6 +19,6 @@ Constants
Functions
***********************************************************************************************************************************/
// Process gz errors
int gzError(int error);
FV_EXTERN int gzError(int error);
#endif

Some files were not shown because too many files have changed in this diff Show More