1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-02-21 19:48:29 +02:00

Fix formatting errors.

Errors in our current (manually-maintained) code format discovered by uncrustify.
This commit is contained in:
David Steele 2023-01-30 11:16:31 +07:00
parent a96837d2ed
commit b2202c36d9
144 changed files with 1033 additions and 935 deletions

View File

@ -165,7 +165,6 @@ yamlEventPeek(Yaml *const this)
FUNCTION_TEST_RETURN_TYPE(YamlEvent, this->eventNext);
}
YamlEvent
yamlEventNext(Yaml *this)
{

View File

@ -12,8 +12,8 @@ Yaml object
typedef struct Yaml Yaml;
#include "common/memContext.h"
#include "common/type/object.h"
#include "common/type/buffer.h"
#include "common/type/object.h"
#include "common/type/stringId.h"
/***********************************************************************************************************************************

View File

@ -10,12 +10,12 @@ Annotate Command
#include "command/annotate/annotate.h"
#include "command/backup/backup.h"
#include "common/crypto/cipherBlock.h"
#include "common/debug.h"
#include "common/log.h"
#include "common/memContext.h"
#include "common/regExp.h"
#include "config/config.h"
#include "common/crypto/cipherBlock.h"
#include "info/infoBackup.h"
#include "storage/helper.h"

View File

@ -119,7 +119,7 @@ archiveAsyncStatus(ArchiveMode archiveMode, const String *walSegment, bool throw
if (okFileExists || errorFileExists)
{
// Get the status file content
const String *statusFile = okFileExists ? okFile: errorFile;
const String *statusFile = okFileExists ? okFile : errorFile;
String *content = strNewBuf(
storageGetP(storageNewReadP(storageSpool(), strNewFmt("%s/%s", strZ(spoolQueue), strZ(statusFile)))));
@ -265,7 +265,7 @@ archiveAsyncExec(ArchiveMode archiveMode, const StringList *commandExec)
// Execute the binary. This statement will not return if it is successful.
THROW_ON_SYS_ERROR_FMT(
execvp(strZ(strLstGet(commandExec, 0)), (char ** const)strLstPtr(commandExec)) == -1, ExecuteError,
execvp(strZ(strLstGet(commandExec, 0)), (char **const)strLstPtr(commandExec)) == -1, ExecuteError,
"unable to execute asynchronous '%s'", archiveMode == archiveModeGet ? CFGCMD_ARCHIVE_GET : CFGCMD_ARCHIVE_PUSH);
}
@ -301,7 +301,7 @@ archiveIdComparator(const void *item1, const void *item2)
int int1 = atoi(strZ(strLstGet(archiveSort1, 1)));
int int2 = atoi(strZ(strLstGet(archiveSort2, 1)));
return (int1 - int2);
return int1 - int2;
}
/**********************************************************************************************************************************/
@ -434,7 +434,7 @@ walSegmentFind(const Storage *storage, const String *archiveId, const String *wa
storage, strNewFmt(STORAGE_REPO_ARCHIVE "/%s/%s", strZ(archiveId), strZ(strSubN(walSegment, 0, 16))),
.expression = strNewFmt(
"^%s%s-[0-f]{40}" COMPRESS_TYPE_REGEXP "{0,1}$", strZ(strSubN(walSegment, 0, 24)),
walIsPartial(walSegment) ? WAL_SEGMENT_PARTIAL_EXT : ""),
walIsPartial(walSegment) ? WAL_SEGMENT_PARTIAL_EXT : ""),
.nullOnMissing = true);
// If there are results

View File

@ -3,8 +3,8 @@ Archive Get File
***********************************************************************************************************************************/
#include "build.auto.h"
#include "command/archive/get/file.h"
#include "command/archive/common.h"
#include "command/archive/get/file.h"
#include "command/control/common.h"
#include "common/compress/helper.h"
#include "common/crypto/cipherBlock.h"

View File

@ -156,7 +156,7 @@ archiveGetFind(
strNewFmt(STORAGE_REPO_ARCHIVE "/%s/%s", strZ(cacheArchive->archiveId), strZ(path)),
.expression = strNewFmt(
"^%s%s-[0-f]{40}" COMPRESS_TYPE_REGEXP "{0,1}$", strZ(strSubN(archiveFileRequest, 0, 24)),
walIsPartial(archiveFileRequest) ? WAL_SEGMENT_PARTIAL_EXT : ""));
walIsPartial(archiveFileRequest) ? WAL_SEGMENT_PARTIAL_EXT : ""));
}
// Else multiple files will be requested so cache list results
else
@ -218,9 +218,10 @@ archiveGetFind(
}
}
// Else if not a WAL segment, see if it exists in the archiveId path
else if (storageExistsP(
storageRepoIdx(cacheRepo->repoIdx), strNewFmt(STORAGE_REPO_ARCHIVE "/%s/%s", strZ(cacheArchive->archiveId),
strZ(archiveFileRequest))))
else if (
storageExistsP(
storageRepoIdx(cacheRepo->repoIdx),
strNewFmt(STORAGE_REPO_ARCHIVE "/%s/%s", strZ(cacheArchive->archiveId), strZ(archiveFileRequest))))
{
MEM_CONTEXT_BEGIN(lstMemContext(getCheckResult->archiveFileMapList))
{
@ -264,7 +265,6 @@ archiveGetFind(
getCheckResult->warnList = strLstMove(fileWarnList, memContextCurrent());
}
MEM_CONTEXT_END();
}
// Else if a file was found
else if (!lstEmpty(matchList))

View File

@ -3,8 +3,8 @@ Archive Push File
***********************************************************************************************************************************/
#include "build.auto.h"
#include "command/archive/push/file.h"
#include "command/archive/common.h"
#include "command/archive/push/file.h"
#include "command/control/common.h"
#include "common/crypto/cipherBlock.h"
#include "common/crypto/hash.h"

View File

@ -17,8 +17,8 @@ Archive Push Command
#include "common/memContext.h"
#include "common/wait.h"
#include "config/config.h"
#include "config/load.h"
#include "config/exec.h"
#include "config/load.h"
#include "info/infoArchive.h"
#include "postgres/interface.h"
#include "postgres/version.h"

View File

@ -9,15 +9,15 @@ Backup Command
#include <unistd.h>
#include "command/archive/common.h"
#include "command/control/common.h"
#include "command/backup/backup.h"
#include "command/backup/common.h"
#include "command/backup/file.h"
#include "command/backup/protocol.h"
#include "command/check/common.h"
#include "command/control/common.h"
#include "command/stanza/common.h"
#include "common/crypto/cipherBlock.h"
#include "common/compress/helper.h"
#include "common/crypto/cipherBlock.h"
#include "common/debug.h"
#include "common/io/filter/size.h"
#include "common/lock.h"
@ -257,8 +257,8 @@ backupInit(const InfoBackup *infoBackup)
if (cfgOptionBool(cfgOptArchiveCheck))
{
result->archiveInfo = infoArchiveLoadFile(
storageRepo(), INFO_ARCHIVE_PATH_FILE_STR, cfgOptionStrId(cfgOptRepoCipherType),
cfgOptionStrNull(cfgOptRepoCipherPass));
storageRepo(), INFO_ARCHIVE_PATH_FILE_STR, cfgOptionStrId(cfgOptRepoCipherType),
cfgOptionStrNull(cfgOptRepoCipherPass));
result->archiveId = infoArchiveId(result->archiveInfo);
}
@ -343,7 +343,7 @@ backupBuildIncrPrior(const InfoBackup *infoBackup)
for (unsigned int backupIdx = backupTotal - 1; backupIdx < backupTotal; backupIdx--)
{
InfoBackupData backupPrior = infoBackupData(infoBackup, backupIdx);
InfoBackupData backupPrior = infoBackupData(infoBackup, backupIdx);
// The prior backup for a diff must be full
if (type == backupTypeDiff && backupPrior.backupType != backupTypeFull)
@ -1625,7 +1625,7 @@ backupProcessQueue(const BackupData *const backupData, Manifest *const manifest,
FileMissingError,
PG_FILE_PGCONTROL " must be present in all online backups\n"
"HINT: is something wrong with the clock or filesystem timestamps?");
}
}
// If there are no files to backup then we'll exit with an error. This could happen if the database is down and backup is
// called with --no-online twice in a row.
@ -1671,7 +1671,8 @@ backupJobQueueNext(unsigned int clientIdx, int queueIdx, unsigned int queueTotal
}
// Callback to fetch backup jobs for the parallel executor
static ProtocolParallelJob *backupJobCallback(void *data, unsigned int clientIdx)
static ProtocolParallelJob *
backupJobCallback(void *data, unsigned int clientIdx)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM_P(VOID, data);
@ -2212,17 +2213,17 @@ backupComplete(InfoBackup *const infoBackup, Manifest *const manifest)
// encryption in order to be efficient. Compression will always be gz for compatibility and since it is always available.
// -------------------------------------------------------------------------------------------------------------------------
StorageRead *manifestRead = storageNewReadP(
storageRepo(), strNewFmt(STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE, strZ(backupLabel)));
storageRepo(), strNewFmt(STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE, strZ(backupLabel)));
cipherBlockFilterGroupAdd(
ioReadFilterGroup(storageReadIo(manifestRead)), cfgOptionStrId(cfgOptRepoCipherType), cipherModeDecrypt,
infoPgCipherPass(infoBackupPg(infoBackup)));
StorageWrite *manifestWrite = storageNewWriteP(
storageRepoWrite(),
strNewFmt(
STORAGE_REPO_BACKUP "/" BACKUP_PATH_HISTORY "/%s/%s.manifest%s", strZ(strSubN(backupLabel, 0, 4)),
strZ(backupLabel), strZ(compressExtStr(compressTypeGz))));
storageRepoWrite(),
strNewFmt(
STORAGE_REPO_BACKUP "/" BACKUP_PATH_HISTORY "/%s/%s.manifest%s", strZ(strSubN(backupLabel, 0, 4)),
strZ(backupLabel), strZ(compressExtStr(compressTypeGz))));
ioFilterGroupAdd(ioWriteFilterGroup(storageWriteIo(manifestWrite)), compressFilter(compressTypeGz, 9));

View File

@ -16,8 +16,8 @@ Block Incremental Filter
#include "common/io/filter/size.h"
#include "common/io/io.h"
#include "common/log.h"
#include "common/type/pack.h"
#include "common/type/object.h"
#include "common/type/pack.h"
/***********************************************************************************************************************************
Object type
@ -374,7 +374,7 @@ blockIncrNew(
MEM_CONTEXT_PRIOR_BEGIN()
{
driver->blockMapPrior = blockMapNewRead(read);
driver->blockMapPrior = blockMapNewRead(read);
}
MEM_CONTEXT_PRIOR_END();
}

View File

@ -28,9 +28,9 @@ The block map is terminated by a varint-128 encoded zero stop byte.
***********************************************************************************************************************************/
#include "build.auto.h"
#include "command/backup/blockMap.h"
#include "common/debug.h"
#include "common/log.h"
#include "command/backup/blockMap.h"
/**********************************************************************************************************************************/
typedef struct BlockMapRef

View File

@ -245,11 +245,10 @@ backupFile(
// Add block incremental filter
ioFilterGroupAdd(
ioReadFilterGroup(
storageReadIo(read)),
blockIncrNew(
(size_t)file->blockIncrSize, blockIncrReference, bundleId, bundleOffset, blockMap, compress,
encrypt));
ioReadFilterGroup(storageReadIo(read)),
blockIncrNew(
(size_t)file->blockIncrSize, blockIncrReference, bundleId, bundleOffset, blockMap, compress,
encrypt));
repoChecksum = true;
}

View File

@ -3,9 +3,9 @@ Page Checksum Filter
***********************************************************************************************************************************/
#include "build.auto.h"
#include "command/backup/pageChecksum.h"
#include "common/debug.h"
#include "common/io/filter/filter.h"
#include "command/backup/pageChecksum.h"
#include "common/log.h"
#include "common/macro.h"
#include "common/type/json.h"

View File

@ -154,9 +154,12 @@ checkPrimary(const DbGetResult dbGroup)
storageRepo, repoArchiveId[repoIdx], walSegment, cfgOptionUInt64(cfgOptArchiveTimeout));
LOG_INFO_FMT(
"WAL segment %s successfully archived to '%s' on %s", strZ(walSegment),
strZ(storagePathP(storageRepo, strNewFmt(STORAGE_REPO_ARCHIVE "/%s/%s", strZ(repoArchiveId[repoIdx]),
strZ(walSegmentFile)))), cfgOptionGroupName(cfgOptGrpRepo, repoIdx));
"WAL segment %s successfully archived to '%s' on %s",
strZ(walSegment),
strZ(
storagePathP(
storageRepo, strNewFmt(STORAGE_REPO_ARCHIVE "/%s/%s", strZ(repoArchiveId[repoIdx]), strZ(walSegmentFile)))),
cfgOptionGroupName(cfgOptGrpRepo, repoIdx));
}
dbFree(dbGroup.primary);

View File

@ -151,9 +151,11 @@ checkStanzaInfoPg(
// Check that the version and system id match the current database
if (pgVersion != archiveInfoPg.version || pgSystemId != archiveInfoPg.systemId)
{
THROW(FileInvalidError, "backup and archive info files exist but do not match the database\n"
"HINT: is this the correct stanza?\n"
"HINT: did an error occur during stanza-upgrade?");
THROW(
FileInvalidError,
"backup and archive info files exist but do not match the database\n"
"HINT: is this the correct stanza?\n"
"HINT: did an error occur during stanza-upgrade?");
}
}
MEM_CONTEXT_TEMP_END();

View File

@ -4,8 +4,8 @@ Exit Routines
#ifndef COMMAND_EXIT_H
#define COMMAND_EXIT_H
#include <stdbool.h>
#include <signal.h>
#include <stdbool.h>
/***********************************************************************************************************************************
Signal type

View File

@ -6,10 +6,10 @@ Expire Command
#include "command/archive/common.h"
#include "command/backup/common.h"
#include "command/control/common.h"
#include "common/time.h"
#include "common/type/list.h"
#include "common/debug.h"
#include "common/regExp.h"
#include "common/time.h"
#include "common/type/list.h"
#include "config/config.h"
#include "info/infoArchive.h"
#include "info/infoBackup.h"
@ -497,7 +497,7 @@ removeExpiredArchive(InfoBackup *infoBackup, bool timeBasedFullRetention, unsign
// this archiveId (e.g. 9.4-1), e.g. If globalBackupRetention has 4F, 3F, 2F, 1F then
// localBackupRetentionList will have 1F, 2F, 3F, 4F (assuming they all have same history id)
for (unsigned int retentionIdx = strLstSize(globalBackupRetentionList) - 1;
(int)retentionIdx >=0; retentionIdx--)
(int)retentionIdx >= 0; retentionIdx--)
{
for (unsigned int backupIdx = 0; backupIdx < infoBackupDataTotal(infoBackup); backupIdx++)
{
@ -717,6 +717,7 @@ removeExpiredArchive(InfoBackup *infoBackup, bool timeBasedFullRetention, unsign
// Track that this archive was removed
archiveExpire.total++;
archiveExpire.stop = strDup(strSubN(walSubPath, 0, 24));
if (archiveExpire.start == NULL)
archiveExpire.start = strDup(strSubN(walSubPath, 0, 24));
}
@ -746,7 +747,6 @@ removeExpiredArchive(InfoBackup *infoBackup, bool timeBasedFullRetention, unsign
.expression = WAL_TIMELINE_HISTORY_REGEXP_STR),
sortOrderAsc);
for (unsigned int historyFileIdx = 0; historyFileIdx < strLstSize(historyFilesList); historyFileIdx++)
{
String *historyFile = strLstGet(historyFilesList, historyFileIdx);
@ -767,7 +767,6 @@ removeExpiredArchive(InfoBackup *infoBackup, bool timeBasedFullRetention, unsign
strZ(archiveId), strZ(historyFile));
}
}
}
}
}

View File

@ -532,8 +532,9 @@ backupListAdd(
{
kvPut(varKv(link), KEY_NAME_VAR, varNewStr(target->file));
kvPut(
varKv(link), KEY_DESTINATION_VAR, varNewStr(strNewFmt("%s/%s", strZ(target->path),
strZ(target->file))));
varKv(link), KEY_DESTINATION_VAR,
varNewStr(strNewFmt("%s/%s", strZ(target->path), strZ(target->file))));
varLstAdd(linkSection, link);
}
else
@ -1552,7 +1553,6 @@ infoRender(void)
}
else
{
strCatFmt(
resultStr, INFO_STANZA_STATUS_ERROR " (%s)\n",
strZ(varStr(kvGet(repoStatus, STATUS_KEY_MESSAGE_VAR))));

View File

@ -8,9 +8,9 @@ Repository Create Command
#include "common/memContext.h"
#include "common/type/json.h"
#include "config/config.h"
#include "storage/helper.h"
#include "storage/azure/storage.intern.h"
#include "storage/gcs/storage.intern.h"
#include "storage/helper.h"
#include "storage/s3/storage.intern.h"
/**********************************************************************************************************************************/

View File

@ -121,8 +121,11 @@ storageGetProcess(IoWrite *destination)
!strEndsWithZ(file, BACKUP_MANIFEST_FILE INFO_COPY_EXT))
{
const Manifest *manifest = manifestLoadFile(
storageRepo(), strNewFmt(STORAGE_PATH_BACKUP "/%s/%s/%s", strZ(stanza),
strZ(strLstGet(filePathSplitLst, 2)), BACKUP_MANIFEST_FILE), repoCipherType, cipherPass);
storageRepo(),
strNewFmt(
STORAGE_PATH_BACKUP "/%s/%s/%s", strZ(stanza), strZ(strLstGet(filePathSplitLst, 2)),
BACKUP_MANIFEST_FILE),
repoCipherType, cipherPass);
cipherPass = manifestCipherSubPass(manifest);
}
}

View File

@ -347,7 +347,8 @@ restoreBackupSet(void)
if (latestBackup.backupPgId < backupInfoPg.id)
{
THROW_FMT(BackupSetInvalidError,
THROW_FMT(
BackupSetInvalidError,
"the latest backup set found '%s' is from a prior version of " PG_NAME "\n"
"HINT: was a backup created after the stanza-upgrade?\n"
"HINT: specify --" CFGOPT_SET " or --" CFGOPT_TYPE "=time/lsn to restore from a prior version of "
@ -1353,7 +1354,7 @@ restoreSelectiveExpression(Manifest *manifest)
const String *tablespaceId = pgTablespaceId(
manifestData(manifest)->pgVersion, manifestData(manifest)->pgCatalogVersion);
RegExp *tablespaceRegExp = regExpNew(
strNewFmt("^" MANIFEST_TARGET_PGTBLSPC "/[0-9]+/%s/[0-9]+/" PG_FILE_PGVERSION, strZ(tablespaceId)));
strNewFmt("^" MANIFEST_TARGET_PGTBLSPC "/[0-9]+/%s/[0-9]+/" PG_FILE_PGVERSION, strZ(tablespaceId)));
// Generate a list of databases in base or in a tablespace and get all standard system databases, even in cases where
// users have recreated them
@ -2193,7 +2194,6 @@ restoreJobResult(const Manifest *manifest, ProtocolParallelJob *job, RegExp *zer
}
}
// Add bundle info
strCatZ(log, " (");
@ -2269,7 +2269,8 @@ restoreJobQueueNext(unsigned int clientIdx, int queueIdx, unsigned int queueTota
}
// Callback to fetch restore jobs for the parallel executor
static ProtocolParallelJob *restoreJobCallback(void *data, unsigned int clientIdx)
static ProtocolParallelJob *
restoreJobCallback(void *data, unsigned int clientIdx)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM_P(VOID, data);

View File

@ -5,8 +5,8 @@ Server Ping Command
#include "command/server/ping.h"
#include "common/debug.h"
#include "common/io/tls/client.h"
#include "common/io/socket/client.h"
#include "common/io/tls/client.h"
#include "config/config.h"
#include "protocol/client.h"
#include "protocol/helper.h"

View File

@ -3,9 +3,9 @@ Stanza Create Command
***********************************************************************************************************************************/
#include "build.auto.h"
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "command/check/common.h"
#include "command/control/common.h"
@ -145,8 +145,8 @@ cmdStanzaCreate(void)
FileMissingError,
"%s on %s\n"
"HINT: this may be a symptom of repository corruption!",
((archiveInfoFileExists || archiveInfoFileCopyExists) ?
"archive.info exists but backup.info is missing" : "backup.info exists but archive.info is missing"),
(archiveInfoFileExists || archiveInfoFileCopyExists) ?
"archive.info exists but backup.info is missing" : "backup.info exists but archive.info is missing",
cfgOptionGroupName(cfgOptGrpRepo, repoIdx));
}
}

View File

@ -3,9 +3,9 @@ Stanza Delete Command
***********************************************************************************************************************************/
#include "build.auto.h"
#include "command/backup/common.h"
#include "command/control/common.h"
#include "command/stanza/delete.h"
#include "command/backup/common.h"
#include "common/debug.h"
#include "common/memContext.h"
#include "config/config.h"

View File

@ -3,9 +3,9 @@ Stanza Update Command
***********************************************************************************************************************************/
#include "build.auto.h"
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "command/check/common.h"
#include "command/control/common.h"

View File

@ -978,8 +978,8 @@ verifyBackup(VerifyJobData *const jobData)
PackWrite *const param = protocolCommandParam(command);
const String *const filePathName = strNewFmt(
STORAGE_REPO_BACKUP "/%s/%s%s", strZ(fileBackupLabel), strZ(fileData.name),
strZ(compressExtStr((manifestData(jobData->manifest))->backupOptionCompressType)));
STORAGE_REPO_BACKUP "/%s/%s%s", strZ(fileBackupLabel), strZ(fileData.name),
strZ(compressExtStr((manifestData(jobData->manifest))->backupOptionCompressType)));
if (fileData.bundleId != 0)
{
@ -1341,6 +1341,7 @@ verifyRender(const List *const archiveIdResultList, const List *const backupResu
for (unsigned int archiveIdx = 0; archiveIdx < lstSize(archiveIdResultList); archiveIdx++)
{
VerifyArchiveResult *archiveIdResult = lstGet(archiveIdResultList, archiveIdx);
if (verboseText || archiveIdResult->totalWalFile - archiveIdResult->totalValidWal != 0)
{
strCatFmt(
@ -1631,8 +1632,8 @@ verifyProcess(const bool verboseText)
// Add invalid file to the WAL range
verifyAddInvalidWalFile(
archiveIdResult->walRangeList, verifyResult, filePathName,
strSubN(strLstGet(filePathLst, strLstSize(filePathLst) - 1), 0,
WAL_SEGMENT_NAME_SIZE));
strSubN(
strLstGet(filePathLst, strLstSize(filePathLst) - 1), 0, WAL_SEGMENT_NAME_SIZE));
}
}
else

View File

@ -3,8 +3,8 @@ BZ2 Compress
***********************************************************************************************************************************/
#include "build.auto.h"
#include <stdio.h>
#include <bzlib.h>
#include <stdio.h>
#include "common/compress/bz2/common.h"
#include "common/compress/bz2/compress.h"

View File

@ -3,8 +3,8 @@ BZ2 Decompress
***********************************************************************************************************************************/
#include "build.auto.h"
#include <stdio.h>
#include <bzlib.h>
#include <stdio.h>
#include "common/compress/bz2/common.h"
#include "common/compress/bz2/decompress.h"

View File

@ -5,13 +5,13 @@ Compression Helper
#include <string.h>
#include "common/compress/helper.h"
#include "common/compress/bz2/common.h"
#include "common/compress/bz2/compress.h"
#include "common/compress/bz2/decompress.h"
#include "common/compress/gz/common.h"
#include "common/compress/gz/compress.h"
#include "common/compress/gz/decompress.h"
#include "common/compress/helper.h"
#include "common/compress/lz4/common.h"
#include "common/compress/lz4/compress.h"
#include "common/compress/lz4/decompress.h"

View File

@ -26,8 +26,8 @@ typedef enum
compressTypeXz, // xz/lzma
} CompressType;
#include <common/type/stringId.h>
#include <common/io/filter/group.h>
#include <common/type/stringId.h>
/***********************************************************************************************************************************
Compression types as a regexp. In the future this regexp will be generated automatically at build time but we want to wait until the

View File

@ -7,8 +7,8 @@ Developed against version r131 using the documentation in https://github.com/lz4
#ifdef HAVE_LIBLZ4
#include <stdio.h>
#include <lz4frame.h>
#include <stdio.h>
#include <string.h>
#include "common/compress/lz4/common.h"

View File

@ -5,8 +5,8 @@ LZ4 Decompress
#ifdef HAVE_LIBLZ4
#include <stdio.h>
#include <lz4frame.h>
#include <stdio.h>
#include "common/compress/lz4/common.h"
#include "common/compress/lz4/decompress.h"

View File

@ -5,8 +5,8 @@ Block Cipher
#include <string.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include "common/crypto/cipherBlock.h"
#include "common/crypto/common.h"
@ -196,9 +196,8 @@ cipherBlockProcessBlock(CipherBlock *this, const unsigned char *source, size_t s
// Initialize cipher
cryptoError(
!EVP_CipherInit_ex(
this->cipherContext, this->cipher, NULL, key, initVector, this->mode == cipherModeEncrypt),
"unable to initialize cipher");
!EVP_CipherInit_ex(this->cipherContext, this->cipher, NULL, key, initVector, this->mode == cipherModeEncrypt),
"unable to initialize cipher");
this->saltDone = true;
}

View File

@ -4,8 +4,8 @@ Block Cipher Header
#ifndef COMMON_CRYPTO_CIPHERBLOCK_H
#define COMMON_CRYPTO_CIPHERBLOCK_H
#include "common/io/filter/group.h"
#include "common/crypto/common.h"
#include "common/io/filter/group.h"
/***********************************************************************************************************************************
Filter type constant

View File

@ -9,10 +9,10 @@ Crypto Common
#include <openssl/rand.h>
#include <openssl/ssl.h>
#include "common/crypto/common.h"
#include "common/debug.h"
#include "common/error.h"
#include "common/log.h"
#include "common/crypto/common.h"
/***********************************************************************************************************************************
Flag to indicate if OpenSSL has already been initialized

View File

@ -5,17 +5,17 @@ Cryptographic Hash
#include <string.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include "common/crypto/common.h"
#include "common/crypto/hash.h"
#include "common/debug.h"
#include "common/io/filter/filter.h"
#include "common/log.h"
#include "common/type/object.h"
#include "common/type/pack.h"
#include "common/crypto/common.h"
/***********************************************************************************************************************************
Hashes for zero-length files (i.e., seed value)

View File

@ -8,7 +8,8 @@ Debug Routines
#include "common/debug.h"
/**********************************************************************************************************************************/
FN_EXTERN size_t objToLog(const void *const object, ObjToLogFormat formatFunc, char *const buffer, const size_t bufferSize)
FN_EXTERN size_t
objToLog(const void *const object, ObjToLogFormat formatFunc, char *const buffer, const size_t bufferSize)
{
StringStatic debugLog = strStcInit(buffer, bufferSize);

View File

@ -6,8 +6,8 @@ Binary to String Encode/Decode
#include <stdbool.h>
#include <string.h>
#include "common/encode.h"
#include "common/debug.h"
#include "common/encode.h"
#include "common/error.h"
/***********************************************************************************************************************************
@ -181,14 +181,16 @@ decodeToBinBase64(const char *source, unsigned char *destination)
// Second character is optional
if (source[sourceIdx + 2] != 0x3d)
{
destination[destinationIdx++] = (unsigned char)
(decodeBase64Lookup[(int)source[sourceIdx + 1]] << 4 | decodeBase64Lookup[(int)source[sourceIdx + 2]] >> 2);
destination[destinationIdx++] =
(unsigned char)
((decodeBase64Lookup[(int)source[sourceIdx + 1]] << 4) | (decodeBase64Lookup[(int)source[sourceIdx + 2]] >> 2));
}
// Third character is optional
if (source[sourceIdx + 3] != 0x3d)
{
destination[destinationIdx++] = (unsigned char)
destination[destinationIdx++] =
(unsigned char)
(((decodeBase64Lookup[(int)source[sourceIdx + 2]] << 6) & 0xc0) | decodeBase64Lookup[(int)source[sourceIdx + 3]]);
}
}

View File

@ -99,7 +99,8 @@ static char messageBufferTemp[ERROR_MESSAGE_BUFFER_SIZE];
static char stackTraceBuffer[ERROR_MESSAGE_BUFFER_SIZE];
/**********************************************************************************************************************************/
FN_EXTERN void errorHandlerSet(ErrorHandlerFunction *list, unsigned int total)
FN_EXTERN void
errorHandlerSet(ErrorHandlerFunction *list, unsigned int total)
{
assert(total == 0 || list != NULL);
@ -159,7 +160,8 @@ errorTypeParent(const ErrorType *errorType)
}
/**********************************************************************************************************************************/
FN_EXTERN unsigned int errorTryDepth(void)
FN_EXTERN unsigned int
errorTryDepth(void)
{
return (unsigned int)errorContext.tryTotal;
}
@ -434,6 +436,7 @@ errorInternalThrowSys(
}
#ifdef DEBUG_COVERAGE
FN_EXTERN void
errorInternalThrowOnSys(
bool error, int errNo, const ErrorType *errorType, const char *fileName, const char *functionName, int fileLine,
@ -442,6 +445,7 @@ errorInternalThrowOnSys(
if (error)
errorInternalThrowSys(errNo, errorType, fileName, functionName, fileLine, message);
}
#endif
FN_EXTERN void
@ -462,6 +466,7 @@ errorInternalThrowSysFmt(
}
#ifdef DEBUG_COVERAGE
FN_EXTERN void
errorInternalThrowOnSysFmt(
bool error, int errNo, const ErrorType *errorType, const char *fileName, const char *functionName, int fileLine,
@ -485,4 +490,5 @@ errorInternalThrowOnSysFmt(
errorInternalThrow(errorType, fileName, functionName, fileLine, messageBufferTemp, NULL);
}
}
#endif

View File

@ -11,7 +11,6 @@ Execute Process
#include <unistd.h>
#include "common/debug.h"
#include "common/log.h"
#include "common/exec.h"
#include "common/fork.h"
#include "common/io/fdRead.h"
@ -19,6 +18,7 @@ Execute Process
#include "common/io/io.h"
#include "common/io/read.h"
#include "common/io/write.h"
#include "common/log.h"
#include "common/wait.h"
/***********************************************************************************************************************************
@ -336,7 +336,7 @@ execOpen(Exec *this)
PIPE_DUP2(pipeError, 1, STDERR_FILENO);
// Execute the binary. This statement will not return if it is successful
execvp(strZ(this->command), (char ** const)strLstPtr(this->param));
execvp(strZ(this->command), (char **const)strLstPtr(this->param));
// If we got here then there was an error. We can't use a throw as we normally would because we have already shutdown
// logging and we don't want to execute exit paths that might free parent resources which we still have references to.

View File

@ -8,8 +8,8 @@ Ini Handler
#include <string.h>
#include "common/debug.h"
#include "common/log.h"
#include "common/ini.h"
#include "common/log.h"
#include "common/type/json.h"
#include "common/type/keyValue.h"

View File

@ -551,12 +551,12 @@ ioFilterGroupToLog(const IoFilterGroup *const this, StringStatic *const debugLog
debugLog,
"{inputSame: %s, done: %s"
#ifdef DEBUG
", opened %s, flushing %s, closed %s"
", opened %s, flushing %s, closed %s"
#endif
"}",
"}",
cvtBoolToConstZ(this->pub.inputSame), cvtBoolToConstZ(this->pub.done)
#ifdef DEBUG
, cvtBoolToConstZ(this->pub.opened), cvtBoolToConstZ(this->flushing), cvtBoolToConstZ(this->pub.closed)
#endif
);
);
}

View File

@ -11,8 +11,8 @@ Object type
***********************************************************************************************************************************/
typedef struct HttpSession HttpSession;
#include "common/io/read.h"
#include "common/io/http/client.h"
#include "common/io/read.h"
#include "common/io/session.h"
#include "common/io/write.h"
#include "common/type/object.h"

View File

@ -5,8 +5,8 @@ HTTP URL
#include "common/debug.h"
#include "common/io/http/url.h"
#include "common/type/stringList.h"
#include "common/regExp.h"
#include "common/type/stringList.h"
/***********************************************************************************************************************************
Regular expression for URLs. This is not intended to be completely comprehensive, e.g. it is still possible to enter bad hostnames.

View File

@ -11,8 +11,8 @@ Object type
***********************************************************************************************************************************/
typedef struct HttpUrl HttpUrl;
#include "common/type/param.h"
#include "common/type/object.h"
#include "common/type/param.h"
#include "common/type/string.h"
/***********************************************************************************************************************************

View File

@ -4,16 +4,16 @@ Socket Client
#include "build.auto.h"
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include "common/debug.h"
#include "common/log.h"
#include "common/io/client.h"
#include "common/io/socket/client.h"
#include "common/io/socket/common.h"
#include "common/io/socket/session.h"
#include "common/log.h"
#include "common/stat.h"
#include "common/type/object.h"
#include "common/wait.h"

View File

@ -121,7 +121,7 @@ sckOptionSet(int fd)
// Automatically close the socket (in the child process) on a successful execve() call. Connections are never shared between
// processes so there is no reason to leave them open.
#ifdef F_SETFD
THROW_ON_SYS_ERROR(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1, ProtocolError, "unable to set FD_CLOEXEC");
THROW_ON_SYS_ERROR(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1, ProtocolError, "unable to set FD_CLOEXEC");
#endif
// Enable TCP keepalives

View File

@ -4,16 +4,16 @@ Socket Server
#include "build.auto.h"
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include "common/debug.h"
#include "common/log.h"
#include "common/io/server.h"
#include "common/io/socket/server.h"
#include "common/io/socket/common.h"
#include "common/io/socket/server.h"
#include "common/io/socket/session.h"
#include "common/log.h"
#include "common/memContext.h"
#include "common/stat.h"
#include "common/type/object.h"

View File

@ -6,11 +6,11 @@ Socket Session
#include <unistd.h>
#include "common/debug.h"
#include "common/log.h"
#include "common/io/fdRead.h"
#include "common/io/fdWrite.h"
#include "common/io/socket/client.h"
#include "common/io/session.h"
#include "common/io/socket/client.h"
#include "common/log.h"
#include "common/type/object.h"
/***********************************************************************************************************************************

View File

@ -7,12 +7,12 @@ TLS Client
#include "common/crypto/common.h"
#include "common/debug.h"
#include "common/log.h"
#include "common/io/client.h"
#include "common/io/io.h"
#include "common/io/tls/client.h"
#include "common/io/tls/common.h"
#include "common/io/tls/session.h"
#include "common/log.h"
#include "common/stat.h"
#include "common/type/object.h"
#include "common/wait.h"

View File

@ -79,8 +79,10 @@ tlsCertCommonName(X509 *const certificate)
static int
tlsCertPwd(char *buffer, const int size, const int rwFlag, void *const userData)
{
(void)rwFlag;
(void)userData;
CHECK(ServiceError, size > 0, "buffer has zero size");
(void)rwFlag; (void)userData;
// No password is currently supplied
buffer[0] = '\0';

View File

@ -4,19 +4,19 @@ TLS Server
#include "build.auto.h"
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <openssl/err.h>
#include "common/crypto/common.h"
#include "common/debug.h"
#include "common/log.h"
#include "common/io/server.h"
#include "common/io/tls/common.h"
#include "common/io/tls/server.h"
#include "common/io/tls/session.h"
#include "common/log.h"
#include "common/stat.h"
#include "common/type/object.h"
@ -102,14 +102,14 @@ tlsServerDh(SSL_CTX *const context)
SSL_CTX_set_options(context, SSL_OP_SINGLE_DH_USE);
BIO *const bio = BIO_new_mem_buf(DH_2048, sizeof(DH_2048));
BIO *const bio = BIO_new_mem_buf(DH_2048, sizeof(DH_2048));
cryptoError(bio == NULL, "unable create buffer for DH parameters");
TRY_BEGIN()
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
DH *const dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
DH *const dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
#pragma GCC diagnostic pop
TRY_BEGIN()
@ -309,7 +309,8 @@ tlsServerNew(
memContextCallbackSet(objMemContext(driver), tlsServerFreeResource, driver);
// Set options
SSL_CTX_set_options(driver->context,
SSL_CTX_set_options(
driver->context,
// Disable SSL and TLS v1/v1.1
SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 |
// Let server set cipher order
@ -317,10 +318,10 @@ tlsServerNew(
#ifdef SSL_OP_NO_RENEGOTIATION
// Disable renegotiation, available since 1.1.0h. This affects only TLSv1.2 and older protocol versions as TLSv1.3 has
// no support for renegotiation.
SSL_OP_NO_RENEGOTIATION |
SSL_OP_NO_RENEGOTIATION |
#endif
// Disable session tickets
SSL_OP_NO_TICKET);
SSL_OP_NO_TICKET);
// Disable session caching
SSL_CTX_set_session_cache_mode(driver->context, SSL_SESS_CACHE_OFF);

View File

@ -41,7 +41,7 @@ tlsSessionToLog(const THIS_VOID, StringStatic *const debugLog)
strStcCat(debugLog, "{ioSession: ");
ioSessionToLog(this->ioSession, debugLog);
strStcFmt(debugLog, ", timeout: %" PRIu64", shutdownOnClose: %s}", this->timeout, cvtBoolToConstZ(this->shutdownOnClose));
strStcFmt(debugLog, ", timeout: %" PRIu64 ", shutdownOnClose: %s}", this->timeout, cvtBoolToConstZ(this->shutdownOnClose));
}
#define FUNCTION_LOG_TLS_SESSION_TYPE \

View File

@ -177,8 +177,9 @@ static MemContextCallbackOne *
memContextCallbackOne(MemContext *const memContext)
{
return
(MemContextCallbackOne *)((unsigned char *)(memContext + 1) +
memContextSizePossible[memContext->childQty][memContext->allocQty][0] + memContext->allocExtra);
(MemContextCallbackOne *)
((unsigned char *)(memContext + 1) +
memContextSizePossible[memContext->childQty][memContext->allocQty][0] + memContext->allocExtra);
}
/***********************************************************************************************************************************

View File

@ -8,8 +8,8 @@ Stack Trace Handler
#include <string.h>
#ifdef HAVE_LIBBACKTRACE
#include <backtrace.h>
#include <backtrace-supported.h>
#include <backtrace.h>
#endif
#include "common/assert.h"

View File

@ -84,5 +84,4 @@ blbAdd(Blob *const this, const void *const data, const size_t size)
MEM_CONTEXT_OBJ_END();
FUNCTION_TEST_RETURN_P(VOID, result);
}

View File

@ -349,6 +349,6 @@ FN_EXTERN void
bufToLog(const Buffer *const this, StringStatic *const debugLog)
{
strStcFmt(
debugLog, "{used: %zu, size: %zu%s", bufUsed(this), bufSize(this), bufSizeLimit(this) ? zNewFmt(", sizeAlloc: %zu}",
bufSizeAlloc(this)) : "}");
debugLog, "{used: %zu, size: %zu%s", bufUsed(this), bufSize(this),
bufSizeLimit(this) ? zNewFmt(", sizeAlloc: %zu}", bufSizeAlloc(this)) : "}");
}

View File

@ -115,7 +115,7 @@ cvtZSubNToUInt(const char *const value, const size_t offset, const size_t size)
FN_EXTERN size_t cvtUInt64ToZ(uint64_t value, char *buffer, size_t bufferSize);
FN_EXTERN uint64_t cvtZToUInt64(const char *value);
FN_EXTERN uint64_t cvtZToUInt64Base(const char *value, int base);
FN_EXTERN uint64_t cvtZSubNToUInt64Base(const char* value, size_t offset, size_t size, int base);
FN_EXTERN uint64_t cvtZSubNToUInt64Base(const char *value, size_t offset, size_t size, int base);
FN_INLINE_ALWAYS uint64_t
cvtZSubNToUInt64(const char *const value, const size_t offset, const size_t size)

View File

@ -572,7 +572,7 @@ jsonReadKeyZN(JsonRead *const this)
THROW(JsonFormatError, "expected '\"' but found null delimiter");
this->json++;
};
}
// Set key size
result.size = (size_t)(this->json - result.buffer);
@ -845,7 +845,7 @@ jsonReadSkipStr(JsonRead *const this)
THROW(JsonFormatError, "expected '\"' but found null delimiter");
this->json++;
};
}
// Advance the character array pointer to the next element after the string
this->json++;

View File

@ -218,7 +218,7 @@ lstFindDefault(const List *this, const void *item, void *itemDefault)
ASSERT(this != NULL);
ASSERT(item != NULL);
void *result= lstFind(this, item);
void *result = lstFind(this, item);
FUNCTION_TEST_RETURN_P(VOID, result == NULL ? itemDefault : result);
}
@ -236,9 +236,9 @@ lstIdx(const List *this, const void *item)
ASSERT(item != NULL);
// Item pointers should always be aligned with the beginning of an item in the list
ASSERT((size_t)((unsigned char * const)item - this->list) % this->itemSize == 0);
ASSERT((size_t)((unsigned char *const)item - this->list) % this->itemSize == 0);
size_t result = (size_t)((unsigned char * const)item - this->list) / this->itemSize;
size_t result = (size_t)((unsigned char *const)item - this->list) / this->itemSize;
// Item pointers should always be in range
ASSERT(result < lstSize(this));

View File

@ -170,7 +170,8 @@ strNewZ(const char *const string)
}
/**********************************************************************************************************************************/
FN_EXTERN String *strNewDbl(double value)
FN_EXTERN String *
strNewDbl(double value)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(DOUBLE, value);

View File

@ -43,7 +43,8 @@ messages need to be accumulated and then returned together.
This empty function is required because without it libxml2 will dump errors to stdout. Really.
***********************************************************************************************************************************/
static void xmlErrorHandler(void *ctx, const char *format, ...)
static void
xmlErrorHandler(void *ctx, const char *format, ...)
{
(void)ctx;
(void)format;

View File

@ -460,7 +460,6 @@ cfgOptionDefaultSet(ConfigOption optionId, const Variant *defaultValue)
FUNCTION_TEST_RETURN_VOID();
}
/**********************************************************************************************************************************/
FN_EXTERN const String *
cfgOptionDisplayVar(const Variant *const value, const ConfigOptionType optionType)
@ -524,7 +523,6 @@ cfgOptionIdxDisplay(const ConfigOption optionId, const unsigned int optionIdx)
}
MEM_CONTEXT_END();
FUNCTION_TEST_RETURN_CONST(STRING, option->display);
}

View File

@ -10,19 +10,19 @@ Configuration Load
#include "command/command.h"
#include "common/compress/helper.intern.h"
#include "common/crypto/common.h"
#include "common/memContext.h"
#include "common/debug.h"
#include "common/io/io.h"
#include "common/io/socket/common.h"
#include "common/lock.h"
#include "common/log.h"
#include "common/memContext.h"
#include "config/config.intern.h"
#include "config/load.h"
#include "config/parse.h"
#include "info/infoBackup.h"
#include "storage/cifs/storage.h"
#include "storage/posix/storage.h"
#include "storage/helper.h"
#include "storage/posix/storage.h"
/***********************************************************************************************************************************
Load log settings
@ -219,11 +219,11 @@ cfgLoadUpdateOption(void)
{
case backupTypeFull:
{
if (cfgOptionIdxStrId(cfgOptRepoRetentionFullType, optionIdx) ==
CFGOPTVAL_REPO_RETENTION_FULL_TYPE_COUNT &&
if (cfgOptionIdxStrId(cfgOptRepoRetentionFullType, optionIdx) == CFGOPTVAL_REPO_RETENTION_FULL_TYPE_COUNT &&
cfgOptionIdxTest(cfgOptRepoRetentionFull, optionIdx))
{
cfgOptionIdxSet(cfgOptRepoRetentionArchive, optionIdx, cfgSourceDefault,
cfgOptionIdxSet(
cfgOptRepoRetentionArchive, optionIdx, cfgSourceDefault,
VARINT64(cfgOptionIdxInt64(cfgOptRepoRetentionFull, optionIdx)));
}
@ -235,7 +235,8 @@ cfgLoadUpdateOption(void)
// if repo-retention-diff is set then user must have set it
if (cfgOptionIdxTest(cfgOptRepoRetentionDiff, optionIdx))
{
cfgOptionIdxSet(cfgOptRepoRetentionArchive, optionIdx, cfgSourceDefault,
cfgOptionIdxSet(
cfgOptRepoRetentionArchive, optionIdx, cfgSourceDefault,
VARINT64(cfgOptionIdxInt64(cfgOptRepoRetentionDiff, optionIdx)));
}
else
@ -396,7 +397,7 @@ cfgLoadLogFileName(const ConfigCommandRole commandRole)
String *const result = strCatFmt(
strNew(),
"%s/%s-%s", strZ(cfgOptionStr(cfgOptLogPath)),
cfgOptionTest(cfgOptStanza) ? strZ(cfgOptionStr(cfgOptStanza)): "all", cfgCommandName());
cfgOptionTest(cfgOptStanza) ? strZ(cfgOptionStr(cfgOptStanza)) : "all", cfgCommandName());
// ??? Append async for local/remote archive async commands. It would be good to find a more generic way to do this in case the
// async role is added to more commands.

View File

@ -1252,9 +1252,10 @@ cfgFileLoadPart(String **config, const Buffer *configPart)
}
static String *
cfgFileLoad( // NOTE: Passing defaults to enable more complete test coverage
cfgFileLoad(
const Storage *storage, // Storage to load configs
const ParseOption *optionList, // All options and their current settings
// NOTE: Passing defaults to enable more complete test coverage
const String *optConfigDefault, // Current default for --config option
const String *optConfigIncludePathDefault, // Current default for --config-include-path option
const String *origConfigDefault) // Original --config option default (/etc/pgbackrest.conf)
@ -2056,7 +2057,7 @@ configParse(const Storage *storage, unsigned int argListSize, const char *argLis
// Is the value set for this option?
bool optionSet =
parseOptionValue->found && (optionType == cfgOptTypeBoolean || !parseOptionValue->negate) &&
parseOptionValue->found && (optionType == cfgOptTypeBoolean || !parseOptionValue->negate) &&
!parseOptionValue->reset;
// Initialize option value and set negate and reset flag

View File

@ -618,7 +618,6 @@ dbReplayWait(Db *const this, const String *const targetLsn, const uint32_t targe
MEM_CONTEXT_TEMP_BEGIN()
{
// Standby checkpoint before the backup started must be <= the target LSN. If not, it indicates that the standby was ahead
// of the primary and cannot be following it.
if (dbPgControl(this).checkpoint > pgLsnFromStr(targetLsn))

View File

@ -7,12 +7,12 @@ Info Handler
#include <stdlib.h>
#include <string.h>
#include "common/type/convert.h"
#include "common/crypto/hash.h"
#include "common/debug.h"
#include "common/io/filter/filter.h"
#include "common/ini.h"
#include "common/io/filter/filter.h"
#include "common/log.h"
#include "common/type/convert.h"
#include "common/type/json.h"
#include "common/type/object.h"
#include "info/info.h"

View File

@ -3,17 +3,17 @@ Archive Info Handler
***********************************************************************************************************************************/
#include "build.auto.h"
#include <inttypes.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "common/crypto/cipherBlock.h"
#include "common/debug.h"
#include "common/log.h"
#include "common/ini.h"
#include "common/io/bufferWrite.h"
#include "common/io/io.h"
#include "common/log.h"
#include "info/infoArchive.h"
#include "info/infoPg.h"
#include "postgres/interface.h"

View File

@ -3,10 +3,10 @@ Backup Info Handler
***********************************************************************************************************************************/
#include "build.auto.h"
#include <inttypes.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "command/backup/common.h"
#include "common/crypto/cipherBlock.h"
@ -150,7 +150,6 @@ infoBackupLoadCallback(void *data, const String *section, const String *key, con
InfoBackupData info =
{
.backupLabel = strDup(key),
};
// Format and version
@ -457,7 +456,7 @@ infoBackupDataAdd(const InfoBackup *this, const Manifest *manifest)
.backupInfoSizeDelta = backupSizeDelta,
.backupPgId = manData->pgId,
.backupTimestampStart = manData->backupTimestampStart,
.backupTimestampStop= manData->backupTimestampStop,
.backupTimestampStop = manData->backupTimestampStop,
.backupType = manData->backupType,
.backupError = varNewBool(backupError),

View File

@ -6,8 +6,8 @@ PostgreSQL Info Handler
#include <limits.h>
#include <stdarg.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common/debug.h"
@ -140,7 +140,7 @@ infoPgLoadCallback(void *const data, const String *const section, const String *
// System id
infoPgData.systemId = jsonReadUInt64(
jsonReadKeyRequireZ(json, loadData->infoPg->type == infoPgArchive ? INFO_KEY_DB_ID : INFO_KEY_DB_SYSTEM_ID));
jsonReadKeyRequireZ(json, loadData->infoPg->type == infoPgArchive ? INFO_KEY_DB_ID : INFO_KEY_DB_SYSTEM_ID));
// PostgreSQL version
infoPgData.version = pgVersionFromStr(jsonReadStr(jsonReadKeyRequireZ(json, INFO_KEY_DB_VERSION)));

View File

@ -125,5 +125,4 @@ FN_EXTERN void infoPgDataToLog(const InfoPgData *this, StringStatic *debugLog);
#define FUNCTION_LOG_INFO_PG_DATA_FORMAT(value, buffer, bufferSize) \
FUNCTION_LOG_OBJECT_FORMAT(&value, infoPgDataToLog, buffer, bufferSize)
#endif

View File

@ -1528,7 +1528,8 @@ manifestBuildValidate(Manifest *this, bool delta, time_t copyStart, CompressType
{
LOG_WARN_FMT(
"file '%s' has timestamp (%" PRId64 ") in the future (relative to copy start %" PRId64 "), enabling delta"
" checksum", strZ(manifestPathPg(file.name)), (int64_t)file.timestamp, (int64_t)copyStart);
" checksum",
strZ(manifestPathPg(file.name)), (int64_t)file.timestamp, (int64_t)copyStart);
this->pub.data.backupOptionDelta = BOOL_TRUE_VAR;
break;
@ -1744,7 +1745,6 @@ manifestBuildComplete(
pckReadArrayEndP(read);
manifestDbAdd(this, &(ManifestDb){.id = id, .name = name, .lastSystemId = lastSystemId});
}
lstSort(this->pub.dbList, sortOrderAsc);
@ -2051,7 +2051,6 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
manifestFileAdd(manifest, &file);
}
// -----------------------------------------------------------------------------------------------------------------------------
else if (strEqZ(section, MANIFEST_SECTION_TARGET_PATH))
{
@ -2082,7 +2081,6 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
lstAdd(loadData->pathFoundList, &valueFound);
manifestPathAdd(manifest, &path);
}
// -----------------------------------------------------------------------------------------------------------------------------
else if (strEqZ(section, MANIFEST_SECTION_TARGET_LINK))
{
@ -2112,7 +2110,6 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
lstAdd(loadData->linkFoundList, &valueFound);
manifestLinkAdd(manifest, &link);
}
// -----------------------------------------------------------------------------------------------------------------------------
else if (strEqZ(section, MANIFEST_SECTION_TARGET_FILE_DEFAULT))
{
@ -2127,7 +2124,6 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
}
MEM_CONTEXT_END();
}
// -----------------------------------------------------------------------------------------------------------------------------
else if (strEqZ(section, MANIFEST_SECTION_TARGET_PATH_DEFAULT))
{
@ -2142,7 +2138,6 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
}
MEM_CONTEXT_END();
}
// -----------------------------------------------------------------------------------------------------------------------------
else if (strEqZ(section, MANIFEST_SECTION_TARGET_LINK_DEFAULT))
{
@ -2155,7 +2150,6 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
}
MEM_CONTEXT_END();
}
// -----------------------------------------------------------------------------------------------------------------------------
else if (strEqZ(section, MANIFEST_SECTION_BACKUP_TARGET))
{
@ -2186,7 +2180,6 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
manifestTargetAdd(manifest, &target);
}
// -----------------------------------------------------------------------------------------------------------------------------
else if (strEqZ(section, MANIFEST_SECTION_DB))
{
@ -2203,7 +2196,6 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
manifestDbAdd(manifest, &db);
}
// -----------------------------------------------------------------------------------------------------------------------------
else if (strEqZ(section, MANIFEST_SECTION_METADATA))
{
@ -2214,7 +2206,6 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
}
MEM_CONTEXT_END();
}
// -----------------------------------------------------------------------------------------------------------------------------
else if (strEqZ(section, MANIFEST_SECTION_BACKUP))
{
@ -2257,7 +2248,6 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
}
MEM_CONTEXT_END();
}
// -----------------------------------------------------------------------------------------------------------------------------
else if (strEqZ(section, MANIFEST_SECTION_BACKUP_DB))
{
@ -2270,7 +2260,6 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
else if (strEqZ(key, MANIFEST_KEY_DB_VERSION))
manifest->pub.data.pgVersion = pgVersionFromStr(varStr(jsonToVar(value)));
}
// -----------------------------------------------------------------------------------------------------------------------------
else if (strEqZ(section, MANIFEST_SECTION_BACKUP_OPTION))
{
@ -2485,7 +2474,8 @@ manifestSaveCallback(void *const callbackData, const String *const sectionNext,
if (manifest->pub.data.lsnStart != NULL)
{
infoSaveValue(
infoSaveData, MANIFEST_SECTION_BACKUP, MANIFEST_KEY_BACKUP_LSN_START, jsonFromVar(VARSTR(manifest->pub.data.lsnStart)));
infoSaveData, MANIFEST_SECTION_BACKUP, MANIFEST_KEY_BACKUP_LSN_START,
jsonFromVar(VARSTR(manifest->pub.data.lsnStart)));
}
if (manifest->pub.data.lsnStop != NULL)

View File

@ -36,8 +36,8 @@ typedef struct Manifest Manifest;
#include "common/compress/helper.h"
#include "common/crypto/common.h"
#include "common/crypto/hash.h"
#include "common/type/variant.h"
#include "common/type/object.h"
#include "common/type/variant.h"
#include "info/info.h"
#include "info/infoBackup.h"
#include "storage/storage.h"

View File

@ -8,10 +8,10 @@ casts to queries to output one of these types.
#ifndef POSTGRES_QUERY_H
#define POSTGRES_QUERY_H
#include "common/time.h"
#include "common/type/object.h"
#include "common/type/pack.h"
#include "common/type/string.h"
#include "common/time.h"
/***********************************************************************************************************************************
Query result types

View File

@ -22,6 +22,7 @@ If a comment has changed in a way that implies a difference in the way the type
should be created. See the CheckPoint type difference between 9.5 and 9.6 as an example.
***********************************************************************************************************************************/
#include "postgres/interface/static.vendor.h"
#include "postgres/version.h"
/***********************************************************************************************************************************
Types from src/include/c.h

View File

@ -6,8 +6,8 @@ Protocol Command
#include "common/debug.h"
#include "common/log.h"
#include "common/type/keyValue.h"
#include "protocol/command.h"
#include "protocol/client.h"
#include "protocol/command.h"
/***********************************************************************************************************************************
Object type

View File

@ -165,8 +165,10 @@ storageAzureAuth(
// Generate authorization header
httpHeaderPut(
httpHeader, HTTP_HEADER_AUTHORIZATION_STR, strNewFmt("SharedKey %s:%s", strZ(this->account),
strZ(strNewEncode(encodingBase64, cryptoHmacOne(hashTypeSha256, this->sharedKey, BUFSTR(stringToSign))))));
httpHeader, HTTP_HEADER_AUTHORIZATION_STR,
strNewFmt(
"SharedKey %s:%s", strZ(this->account),
strZ(strNewEncode(encodingBase64, cryptoHmacOne(hashTypeSha256, this->sharedKey, BUFSTR(stringToSign))))));
}
// SAS authentication
else

View File

@ -6,8 +6,8 @@ GCS Storage
#include <string.h>
#include <openssl/bio.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/x509.h>
#include "common/crypto/common.h"
#include "common/crypto/hash.h"

View File

@ -256,7 +256,6 @@ storageWriteGcs(THIS_VOID, const Buffer *buffer)
}
while (bytesTotal != bufUsed(buffer));
FUNCTION_LOG_RETURN_VOID();
}

View File

@ -11,9 +11,9 @@ Storage Helper
#include "common/regExp.h"
#include "config/config.h"
#include "protocol/helper.h"
#include "storage/helper.h"
#include "storage/posix/storage.h"
#include "storage/remote/storage.h"
#include "storage/helper.h"
/***********************************************************************************************************************************
Storage path constants
@ -84,7 +84,8 @@ storageHelperContextInit(void)
}
/**********************************************************************************************************************************/
FN_EXTERN void storageHelperInit(const StorageHelper *const helperList)
FN_EXTERN void
storageHelperInit(const StorageHelper *const helperList)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM_P(VOID, helperList);

View File

@ -87,8 +87,12 @@ storageItrPathAdd(StorageIterator *const this, const String *const pathSub)
OBJ_NEW_BEGIN(StorageIteratorInfo, .childQty = MEM_CONTEXT_QTY_MAX, .allocQty = 1)
{
StorageIteratorInfo *const listInfo = OBJ_NEW_ALLOC();
*listInfo = (StorageIteratorInfo){
.pathSub = strDup(pathSub), .list = storageLstMove(list, memContextCurrent())};
*listInfo = (StorageIteratorInfo)
{
.pathSub = strDup(pathSub),
.list = storageLstMove(list, memContextCurrent()),
};
lstAdd(this->stack, &listInfo);
}
@ -259,7 +263,8 @@ storageItrMore(StorageIterator *const this)
}
/**********************************************************************************************************************************/
FN_EXTERN StorageInfo storageItrNext(StorageIterator *const this)
FN_EXTERN StorageInfo
storageItrNext(StorageIterator *const this)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(STORAGE_ITERATOR, this);

View File

@ -21,6 +21,8 @@ typedef struct StorageReadInterface
IoReadInterface ioInterface;
} StorageReadInterface;
#include "storage/read.h"
FN_EXTERN StorageRead *storageReadNew(void *driver, const StorageReadInterface *interface);
#endif

View File

@ -11,8 +11,8 @@ Remote Storage Protocol Handler
#include "common/type/pack.h"
#include "config/config.h"
#include "protocol/helper.h"
#include "storage/remote/protocol.h"
#include "storage/helper.h"
#include "storage/remote/protocol.h"
#include "storage/storage.intern.h"
/***********************************************************************************************************************************

View File

@ -13,9 +13,9 @@ Remote Storage Read
#include "common/log.h"
#include "common/type/convert.h"
#include "common/type/object.h"
#include "storage/read.intern.h"
#include "storage/remote/protocol.h"
#include "storage/remote/read.h"
#include "storage/read.intern.h"
/***********************************************************************************************************************************
Object type

View File

@ -5,8 +5,8 @@ Remote Storage Read
#define STORAGE_REMOTE_READ_H
#include "protocol/client.h"
#include "storage/remote/storage.intern.h"
#include "storage/read.h"
#include "storage/remote/storage.intern.h"
/***********************************************************************************************************************************
Constructors

View File

@ -81,14 +81,14 @@ storageS3Helper(const unsigned int repoIdx, const bool write, StoragePathExpress
MEM_CONTEXT_PRIOR_BEGIN()
{
result = storageS3New(
cfgOptionIdxStr(cfgOptRepoPath, repoIdx), write, pathExpressionCallback, cfgOptionIdxStr(cfgOptRepoS3Bucket, repoIdx),
endPoint, (StorageS3UriStyle)cfgOptionIdxStrId(cfgOptRepoS3UriStyle, repoIdx),
cfgOptionIdxStr(cfgOptRepoS3Region, repoIdx), keyType, cfgOptionIdxStrNull(cfgOptRepoS3Key, repoIdx),
cfgOptionIdxStrNull(cfgOptRepoS3KeySecret, repoIdx), cfgOptionIdxStrNull(cfgOptRepoS3Token, repoIdx),
cfgOptionIdxStrNull(cfgOptRepoS3KmsKeyId, repoIdx), role, webIdToken,
(size_t)cfgOptionIdxUInt64(cfgOptRepoStorageUploadChunkSize, repoIdx), host, port, ioTimeoutMs(),
cfgOptionIdxBool(cfgOptRepoStorageVerifyTls, repoIdx), cfgOptionIdxStrNull(cfgOptRepoStorageCaFile, repoIdx),
cfgOptionIdxStrNull(cfgOptRepoStorageCaPath, repoIdx));
cfgOptionIdxStr(cfgOptRepoPath, repoIdx), write, pathExpressionCallback,
cfgOptionIdxStr(cfgOptRepoS3Bucket, repoIdx), endPoint,
(StorageS3UriStyle)cfgOptionIdxStrId(cfgOptRepoS3UriStyle, repoIdx), cfgOptionIdxStr(cfgOptRepoS3Region, repoIdx),
keyType, cfgOptionIdxStrNull(cfgOptRepoS3Key, repoIdx), cfgOptionIdxStrNull(cfgOptRepoS3KeySecret, repoIdx),
cfgOptionIdxStrNull(cfgOptRepoS3Token, repoIdx), cfgOptionIdxStrNull(cfgOptRepoS3KmsKeyId, repoIdx), role,
webIdToken, (size_t)cfgOptionIdxUInt64(cfgOptRepoStorageUploadChunkSize, repoIdx), host, port, ioTimeoutMs(),
cfgOptionIdxBool(cfgOptRepoStorageVerifyTls, repoIdx), cfgOptionIdxStrNull(cfgOptRepoStorageCaFile, repoIdx),
cfgOptionIdxStrNull(cfgOptRepoStorageCaPath, repoIdx));
}
MEM_CONTEXT_PRIOR_END();
}

View File

@ -7,8 +7,8 @@ S3 Storage Read
#include "common/io/http/client.h"
#include "common/log.h"
#include "common/type/object.h"
#include "storage/s3/read.h"
#include "storage/read.intern.h"
#include "storage/s3/read.h"
/***********************************************************************************************************************************
Object type

View File

@ -4,8 +4,8 @@ S3 Storage Read
#ifndef STORAGE_S3_READ_H
#define STORAGE_S3_READ_H
#include "storage/s3/storage.intern.h"
#include "storage/read.h"
#include "storage/s3/storage.intern.h"
/***********************************************************************************************************************************
Constructors

View File

@ -13,8 +13,8 @@ S3 Storage
#include "common/io/tls/client.h"
#include "common/log.h"
#include "common/regExp.h"
#include "common/type/object.h"
#include "common/type/json.h"
#include "common/type/object.h"
#include "common/type/xml.h"
#include "storage/s3/read.h"
#include "storage/s3/write.h"

View File

@ -8,10 +8,10 @@ Storage Interface
#include "common/debug.h"
#include "common/io/io.h"
#include "common/type/list.h"
#include "common/log.h"
#include "common/memContext.h"
#include "common/regExp.h"
#include "common/type/list.h"
#include "common/wait.h"
#include "storage/storage.h"
@ -329,7 +329,8 @@ storageNewItr(const Storage *const this, const String *const pathExp, StorageNew
}
/**********************************************************************************************************************************/
FN_EXTERN void storageLinkCreate(
FN_EXTERN void
storageLinkCreate(
const Storage *const this, const String *const target, const String *const linkPath, const StorageLinkCreateParam param)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
@ -536,8 +537,9 @@ storagePath(const Storage *this, const String *pathExp, StoragePathParam param)
// Make sure the base storage path is contained within the path expression
if (!strEqZ(this->path, "/"))
{
if (!param.noEnforce && (!strBeginsWith(pathExp, this->path) ||
!(strSize(pathExp) == strSize(this->path) || *(strZ(pathExp) + strSize(this->path)) == '/')))
if (!param.noEnforce &&
(!strBeginsWith(pathExp, this->path) ||
!(strSize(pathExp) == strSize(this->path) || *(strZ(pathExp) + strSize(this->path)) == '/')))
{
THROW_FMT(AssertError, "absolute path '%s' is not in base path '%s'", strZ(pathExp), strZ(this->path));
}
@ -692,7 +694,8 @@ storagePathRemove(const Storage *this, const String *pathExp, StoragePathRemoveP
}
/**********************************************************************************************************************************/
FN_EXTERN void storagePathSync(const Storage *this, const String *pathExp)
FN_EXTERN void
storagePathSync(const Storage *this, const String *pathExp)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(STORAGE, this);

View File

@ -23,11 +23,11 @@ Object type
***********************************************************************************************************************************/
typedef struct Storage Storage;
#include "common/type/buffer.h"
#include "common/type/stringList.h"
#include "common/io/filter/group.h"
#include "common/time.h"
#include "common/type/buffer.h"
#include "common/type/param.h"
#include "common/type/stringList.h"
#include "storage/info.h"
#include "storage/iterator.h"
#include "storage/read.h"

View File

@ -89,7 +89,6 @@ testBldVmId(const TestBuild *const this)
return THIS_PUB(TestBuild)->vmId;
}
// Test Definition
FN_INLINE_ALWAYS const TestDefModule *
testBldModule(const TestBuild *const this)

View File

@ -4,8 +4,8 @@ Parse Define Yaml
#ifndef TEST_COMMAND_TEST_DEFINE_H
#define TEST_COMMAND_TEST_DEFINE_H
#include "common/type/list.h"
#include "build/common/string.h"
#include "common/type/list.h"
#include "storage/storage.h"
// Test definition types

View File

@ -14,7 +14,8 @@ Harness for Creating Test Backups
#include "common/harnessTest.h"
/**********************************************************************************************************************************/
void hrnCmdBackup(void)
void
hrnCmdBackup(void)
{
FUNCTION_HARNESS_VOID();

View File

@ -18,8 +18,8 @@ Harness for Loading Test Configurations
#include "common/harnessConfig.h"
#include "common/harnessDebug.h"
#include "common/harnessLog.h"
#include "common/harnessTest.h"
#include "common/harnessStorageHelper.h"
#include "common/harnessTest.h"
/**********************************************************************************************************************************/
void

View File

@ -3,8 +3,8 @@ Harness for Loading Test Configurations
***********************************************************************************************************************************/
#include "build.auto.h"
#include "common/harnessError.h"
#include "common/harnessDebug.h"
#include "common/harnessError.h"
#include "common/harnessLog.h"
#include "common/harnessTest.h"
@ -14,7 +14,8 @@ Include shimmed C modules
{[SHIM_MODULE]}
/**********************************************************************************************************************************/
void hrnErrorThrow(const HrnErrorThrowParam param)
void
hrnErrorThrow(const HrnErrorThrowParam param)
{
errorContext.error.errorType = param.errorType != NULL ? param.errorType : &AssertError;
errorContext.error.fileName = param.fileName != NULL ? param.fileName : "ERR_FILE";

View File

@ -4,10 +4,10 @@ Log Test Harness
#include "build.auto.h"
#include <fcntl.h>
#include <unistd.h>
#include <regex.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "build/common/regExp.h"
#include "common/log.h"
@ -95,7 +95,8 @@ hrnLogLevelFile(void)
return logLevelFile;
}
void hrnLogLevelFileSet(unsigned int logLevel)
void
hrnLogLevelFileSet(unsigned int logLevel)
{
logLevelFile = logLevel;
}
@ -106,7 +107,8 @@ hrnLogLevelStdOut(void)
return logLevelStdOut;
}
void hrnLogLevelStdOutSet(unsigned int logLevel)
void
hrnLogLevelStdOutSet(unsigned int logLevel)
{
logLevelStdOut = logLevel;
}
@ -117,7 +119,8 @@ hrnLogLevelStdErr(void)
return logLevelStdErr;
}
void hrnLogLevelStdErrSet(unsigned int logLevel)
void
hrnLogLevelStdErrSet(unsigned int logLevel)
{
logLevelStdErr = logLevel;
}
@ -173,7 +176,8 @@ harnessLogLevelDefaultSet(LogLevel logLevel)
}
/**********************************************************************************************************************************/
void hrnLogProcessIdSet(unsigned int processId)
void
hrnLogProcessIdSet(unsigned int processId)
{
logProcessId = processId;
}

View File

@ -4,8 +4,8 @@ Harness for Manifest Testing
#ifndef TEST_COMMON_HARNESS_MANIFEST_H
#define TEST_COMMON_HARNESS_MANIFEST_H
#include "info/manifest.h"
#include "common/user.h"
#include "info/manifest.h"
/***********************************************************************************************************************************
Add db to manifest

View File

@ -12,7 +12,8 @@ Harness for Loading Test Configurations
#include "common/harnessPack.h"
/**********************************************************************************************************************************/
String *hrnPackToStr(const Pack *const pack)
String *
hrnPackToStr(const Pack *const pack)
{
FUNCTION_HARNESS_BEGIN();
FUNCTION_HARNESS_PARAM(PACK, pack);
@ -22,7 +23,8 @@ String *hrnPackToStr(const Pack *const pack)
}
/**********************************************************************************************************************************/
String *hrnPackReadToStr(PackRead *read)
String *
hrnPackReadToStr(PackRead *read)
{
FUNCTION_HARNESS_BEGIN();
FUNCTION_HARNESS_PARAM(PACK_READ, read);

View File

@ -6,7 +6,6 @@ Macros to create harness functions per PostgreSQL version.
#ifndef TEST_COMMON_HARNESS_POSTGRES_VERSIONINTERN_H
#define TEST_COMMON_HARNESS_POSTGRES_VERSIONINTERN_H
#include "postgres/version.h"
#include "postgres/interface/version.vendor.h"
#include "common/harnessPostgres.h"

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