From c2dea180fbac39782ed0051205affbb1266642a2 Mon Sep 17 00:00:00 2001 From: David Steele Date: Fri, 26 Jun 2020 16:50:29 -0400 Subject: [PATCH] Remove redundant storage type constants. These constants predate the C storage drivers which now provide their own constants. --- src/storage/helper.c | 6 +++--- src/storage/helper.h | 7 ------- test/src/module/storage/cifsTest.c | 2 +- test/src/module/storage/remoteTest.c | 18 +++++++++--------- test/src/module/storage/s3Test.c | 10 +++++----- 5 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/storage/helper.c b/src/storage/helper.c index 2bdac3c5b..0c0f812e1 100644 --- a/src/storage/helper.c +++ b/src/storage/helper.c @@ -351,19 +351,19 @@ storageRepoGet(const String *type, bool write) protocolRemoteGet(protocolStorageTypeRepo, 1), cfgOptionUInt(cfgOptCompressLevelNetwork)); } // Use CIFS storage - else if (strEqZ(type, STORAGE_TYPE_CIFS)) + else if (strEqZ(type, STORAGE_CIFS_TYPE)) { result = storageCifsNew( cfgOptionStr(cfgOptRepoPath), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, write, storageRepoPathExpression); } // Use Posix storage - else if (strEqZ(type, STORAGE_TYPE_POSIX)) + else if (strEqZ(type, STORAGE_POSIX_TYPE)) { result = storagePosixNewP( cfgOptionStr(cfgOptRepoPath), .write = write, .pathExpressionFunction = storageRepoPathExpression); } // Use S3 storage - else if (strEqZ(type, STORAGE_TYPE_S3)) + else if (strEqZ(type, STORAGE_S3_TYPE)) { // Set the default port unsigned int port = cfgOptionUInt(cfgOptRepoS3Port); diff --git a/src/storage/helper.h b/src/storage/helper.h index 32276c58b..eb637b1f4 100644 --- a/src/storage/helper.h +++ b/src/storage/helper.h @@ -24,13 +24,6 @@ Storage path constants #define STORAGE_PATH_BACKUP "backup" STRING_DECLARE(STORAGE_PATH_BACKUP_STR); -/*********************************************************************************************************************************** -Repository storage types -***********************************************************************************************************************************/ -#define STORAGE_TYPE_CIFS "cifs" -#define STORAGE_TYPE_POSIX "posix" -#define STORAGE_TYPE_S3 "s3" - /*********************************************************************************************************************************** Functions ***********************************************************************************************************************************/ diff --git a/test/src/module/storage/cifsTest.c b/test/src/module/storage/cifsTest.c index 8d4b279d9..f8f760b80 100644 --- a/test/src/module/storage/cifsTest.c +++ b/test/src/module/storage/cifsTest.c @@ -23,7 +23,7 @@ testRun(void) harnessCfgLoad(cfgCmdArchiveGet, argList); const Storage *storage = NULL; - TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_TYPE_CIFS), true), "get cifs repo storage"); + TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_CIFS_TYPE), true), "get cifs repo storage"); TEST_RESULT_STR_Z(storage->type, "cifs", "check storage type"); TEST_RESULT_BOOL(storageFeature(storage, storageFeaturePath), true, " check path feature"); TEST_RESULT_BOOL(storageFeature(storage, storageFeatureCompress), true, " check compress feature"); diff --git a/test/src/module/storage/remoteTest.c b/test/src/module/storage/remoteTest.c index 37028f0c4..e59d34bb6 100644 --- a/test/src/module/storage/remoteTest.c +++ b/test/src/module/storage/remoteTest.c @@ -60,7 +60,7 @@ testRun(void) if (testBegin("storageNew()")) { Storage *storageRemote = NULL; - TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), false), "get remote repo storage"); + TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_POSIX_TYPE), false), "get remote repo storage"); TEST_RESULT_UINT(storageInterface(storageRemote).feature, storageInterface(storageTest).feature, " check features"); TEST_RESULT_BOOL(storageFeature(storageRemote, storageFeaturePath), true, " check path feature"); TEST_RESULT_BOOL(storageFeature(storageRemote, storageFeatureCompress), true, " check compress feature"); @@ -86,7 +86,7 @@ testRun(void) if (testBegin("storageInfo()")) { Storage *storageRemote = NULL; - TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), true), "get remote repo storage"); + TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_POSIX_TYPE), true), "get remote repo storage"); // ------------------------------------------------------------------------------------------------------------------------- TEST_TITLE("storage types that are not tested elsewhere"); @@ -274,7 +274,7 @@ testRun(void) if (testBegin("storageInfoList()")) { Storage *storageRemote = NULL; - TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), true), "get remote repo storage"); + TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_POSIX_TYPE), true), "get remote repo storage"); // ------------------------------------------------------------------------------------------------------------------------- TEST_TITLE("path not found"); @@ -335,7 +335,7 @@ testRun(void) if (testBegin("storageNewRead()")) { Storage *storageRemote = NULL; - TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), false), "get remote repo storage"); + TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_POSIX_TYPE), false), "get remote repo storage"); storagePathCreateP(storageTest, strNew("repo")); Buffer *contentBuf = bufNew(32768); @@ -484,7 +484,7 @@ testRun(void) storagePathCreateP(storageTest, strNew("repo")); Storage *storageRemote = NULL; - TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), true), "get remote repo storage"); + TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_POSIX_TYPE), true), "get remote repo storage"); // Create buffer with plenty of data Buffer *contentBuf = bufNew(32768); @@ -624,7 +624,7 @@ testRun(void) storagePathCreateP(storageTest, strNew("repo")); Storage *storageRemote = NULL; - TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), true), "get remote repo storage"); + TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_POSIX_TYPE), true), "get remote repo storage"); // Create a path via the remote. Check the repo via the local test storage to ensure the remote created it. TEST_RESULT_VOID(storagePathCreateP(storageRemote, path), "new path"); @@ -682,7 +682,7 @@ testRun(void) storagePathCreateP(storageTest, strNew("repo")); Storage *storageRemote = NULL; - TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), true), "get remote repo storage"); + TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_POSIX_TYPE), true), "get remote repo storage"); TEST_RESULT_VOID(storagePathCreateP(storageRemote, path), "new path"); // Check the repo via the local test storage to ensure the remote wrote it, then remove via the remote and confirm removed @@ -722,7 +722,7 @@ testRun(void) storagePathCreateP(storageTest, strNew("repo")); Storage *storageRemote = NULL; - TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), true), "get remote repo storage"); + TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_POSIX_TYPE), true), "get remote repo storage"); String *file = strNew("file.txt"); // Write the file to the repo via the remote so owner is pgbackrest @@ -770,7 +770,7 @@ testRun(void) storagePathCreateP(storageTest, strNew("repo")); Storage *storageRemote = NULL; - TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_TYPE_POSIX), true), "get remote repo storage"); + TEST_ASSIGN(storageRemote, storageRepoGet(strNew(STORAGE_POSIX_TYPE), true), "get remote repo storage"); String *path = strNew("testpath"); TEST_RESULT_VOID(storagePathCreateP(storageRemote, path), "new path"); diff --git a/test/src/module/storage/s3Test.c b/test/src/module/storage/s3Test.c index 8cd092562..e95c38c24 100644 --- a/test/src/module/storage/s3Test.c +++ b/test/src/module/storage/s3Test.c @@ -179,7 +179,7 @@ testRun(void) harnessCfgLoad(cfgCmdArchiveGet, argList); Storage *storage = NULL; - TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_TYPE_S3), false), "get S3 repo storage"); + TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_S3_TYPE), false), "get S3 repo storage"); TEST_RESULT_STR(storage->path, path, " check path"); TEST_RESULT_STR(((StorageS3 *)storage->driver)->bucket, bucket, " check bucket"); TEST_RESULT_STR(((StorageS3 *)storage->driver)->region, region, " check region"); @@ -211,7 +211,7 @@ testRun(void) setenv("PGBACKREST_REPO1_S3_TOKEN", strPtr(securityToken), true); harnessCfgLoad(cfgCmdArchiveGet, argList); - TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_TYPE_S3), false), "get S3 repo storage with options"); + TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_S3_TYPE), false), "get S3 repo storage with options"); TEST_RESULT_STR(((StorageS3 *)storage->driver)->bucket, bucket, " check bucket"); TEST_RESULT_STR(((StorageS3 *)storage->driver)->region, region, " check region"); TEST_RESULT_STR( @@ -236,7 +236,7 @@ testRun(void) setenv("PGBACKREST_REPO1_S3_TOKEN", strPtr(securityToken), true); harnessCfgLoad(cfgCmdArchiveGet, argList); - TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_TYPE_S3), false), "get S3 repo storage with options"); + TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_S3_TYPE), false), "get S3 repo storage with options"); TEST_RESULT_STR(((StorageS3 *)storage->driver)->bucket, bucket, " check bucket"); TEST_RESULT_STR(((StorageS3 *)storage->driver)->region, region, " check region"); TEST_RESULT_STR( @@ -262,7 +262,7 @@ testRun(void) setenv("PGBACKREST_REPO1_S3_TOKEN", strPtr(securityToken), true); harnessCfgLoad(cfgCmdArchiveGet, argList); - TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_TYPE_S3), false), "get S3 repo storage with options"); + TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_S3_TYPE), false), "get S3 repo storage with options"); TEST_RESULT_STR(((StorageS3 *)storage->driver)->bucket, bucket, " check bucket"); TEST_RESULT_STR(((StorageS3 *)storage->driver)->region, region, " check region"); TEST_RESULT_STR( @@ -289,7 +289,7 @@ testRun(void) setenv("PGBACKREST_REPO1_S3_TOKEN", strPtr(securityToken), true); harnessCfgLoad(cfgCmdArchiveGet, argList); - TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_TYPE_S3), false), "get S3 repo storage with options"); + TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_S3_TYPE), false), "get S3 repo storage with options"); TEST_RESULT_STR(((StorageS3 *)storage->driver)->bucket, bucket, " check bucket"); TEST_RESULT_STR(((StorageS3 *)storage->driver)->region, region, " check region"); TEST_RESULT_STR(