diff --git a/src/storage/helper.c b/src/storage/helper.c index 019b207a9..2bdac3c5b 100644 --- a/src/storage/helper.c +++ b/src/storage/helper.c @@ -132,8 +132,7 @@ storageLocal(void) MEM_CONTEXT_BEGIN(storageHelper.memContext) { - storageHelper.storageLocal = storagePosixNew( - FSLASH_STR, STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, false, NULL); + storageHelper.storageLocal = storagePosixNewP(FSLASH_STR); } MEM_CONTEXT_END(); } @@ -152,8 +151,7 @@ storageLocalWrite(void) MEM_CONTEXT_BEGIN(storageHelper.memContext) { - storageHelper.storageLocalWrite = storagePosixNew( - FSLASH_STR, STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + storageHelper.storageLocalWrite = storagePosixNewP(FSLASH_STR, .write = true); } MEM_CONTEXT_END(); } @@ -184,8 +182,7 @@ storagePgGet(unsigned int hostId, bool write) // Use Posix storage else { - result = storagePosixNew( - cfgOptionStr(cfgOptPgPath + hostId - 1), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, write, NULL); + result = storagePosixNewP(cfgOptionStr(cfgOptPgPath + hostId - 1), .write = write); } FUNCTION_TEST_RETURN(result); @@ -362,8 +359,8 @@ storageRepoGet(const String *type, bool write) // Use Posix storage else if (strEqZ(type, STORAGE_TYPE_POSIX)) { - result = storagePosixNew( - cfgOptionStr(cfgOptRepoPath), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, write, storageRepoPathExpression); + result = storagePosixNewP( + cfgOptionStr(cfgOptRepoPath), .write = write, .pathExpressionFunction = storageRepoPathExpression); } // Use S3 storage else if (strEqZ(type, STORAGE_TYPE_S3)) @@ -488,9 +485,8 @@ storageSpool(void) MEM_CONTEXT_BEGIN(storageHelper.memContext) { - storageHelper.storageSpool = storagePosixNew( - cfgOptionStr(cfgOptSpoolPath), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, false, - storageSpoolPathExpression); + storageHelper.storageSpool = storagePosixNewP( + cfgOptionStr(cfgOptSpoolPath), .pathExpressionFunction = storageSpoolPathExpression); } MEM_CONTEXT_END(); } @@ -514,9 +510,8 @@ storageSpoolWrite(void) MEM_CONTEXT_BEGIN(storageHelper.memContext) { - storageHelper.storageSpoolWrite = storagePosixNew( - cfgOptionStr(cfgOptSpoolPath), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, - storageSpoolPathExpression); + storageHelper.storageSpoolWrite = storagePosixNewP( + cfgOptionStr(cfgOptSpoolPath), .write = true, .pathExpressionFunction = storageSpoolPathExpression); } MEM_CONTEXT_END(); } diff --git a/src/storage/posix/storage.c b/src/storage/posix/storage.c index a40253ab4..32140d602 100644 --- a/src/storage/posix/storage.c +++ b/src/storage/posix/storage.c @@ -614,17 +614,19 @@ storagePosixNewInternal( } Storage * -storagePosixNew( - const String *path, mode_t modeFile, mode_t modePath, bool write, StoragePathExpressionCallback pathExpressionFunction) +storagePosixNew(const String *path, StoragePosixNewParam param) { FUNCTION_LOG_BEGIN(logLevelDebug); FUNCTION_LOG_PARAM(STRING, path); - FUNCTION_LOG_PARAM(MODE, modeFile); - FUNCTION_LOG_PARAM(MODE, modePath); - FUNCTION_LOG_PARAM(BOOL, write); - FUNCTION_LOG_PARAM(FUNCTIONP, pathExpressionFunction); + FUNCTION_LOG_PARAM(MODE, param.modeFile); + FUNCTION_LOG_PARAM(MODE, param.modePath); + FUNCTION_LOG_PARAM(BOOL, param.write); + FUNCTION_LOG_PARAM(FUNCTIONP, param.pathExpressionFunction); FUNCTION_LOG_END(); FUNCTION_LOG_RETURN( - STORAGE, storagePosixNewInternal(STORAGE_POSIX_TYPE_STR, path, modeFile, modePath, write, pathExpressionFunction, true)); + STORAGE, + storagePosixNewInternal( + STORAGE_POSIX_TYPE_STR, path, param.modeFile == 0 ? STORAGE_MODE_FILE_DEFAULT : param.modeFile, + param.modePath == 0 ? STORAGE_MODE_PATH_DEFAULT : param.modePath, param.write, param.pathExpressionFunction, true)); } diff --git a/src/storage/posix/storage.h b/src/storage/posix/storage.h index fa7a0a221..b30206814 100644 --- a/src/storage/posix/storage.h +++ b/src/storage/posix/storage.h @@ -20,7 +20,18 @@ Storage type /*********************************************************************************************************************************** Constructors ***********************************************************************************************************************************/ -Storage *storagePosixNew( - const String *path, mode_t modeFile, mode_t modePath, bool write, StoragePathExpressionCallback pathExpressionFunction); +typedef struct StoragePosixNewParam +{ + VAR_PARAM_HEADER; + bool write; + mode_t modeFile; + mode_t modePath; + StoragePathExpressionCallback *pathExpressionFunction; +} StoragePosixNewParam; + +#define storagePosixNewP(path, ...) \ + storagePosixNew(path, (StoragePosixNewParam){VAR_PARAM_INIT, __VA_ARGS__}) + +Storage *storagePosixNew(const String *path, StoragePosixNewParam param); #endif diff --git a/test/src/module/command/archiveCommonTest.c b/test/src/module/command/archiveCommonTest.c index 86c72466e..f9ad5528b 100644 --- a/test/src/module/command/archiveCommonTest.c +++ b/test/src/module/command/archiveCommonTest.c @@ -18,8 +18,7 @@ testRun(void) FUNCTION_HARNESS_VOID(); // Create default storage object for testing - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); // ***************************************************************************************************************************** if (testBegin("archiveAsyncErrorClear() and archiveAsyncStatus()")) diff --git a/test/src/module/command/archiveGetTest.c b/test/src/module/command/archiveGetTest.c index 70905eb8d..798049dc6 100644 --- a/test/src/module/command/archiveGetTest.c +++ b/test/src/module/command/archiveGetTest.c @@ -20,8 +20,7 @@ testRun(void) { FUNCTION_HARNESS_VOID(); - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); // Start a protocol server to test the protocol directly Buffer *serverWrite = bufNew(8192); diff --git a/test/src/module/command/archivePushTest.c b/test/src/module/command/archivePushTest.c index 0589dfcd2..04b8e9b74 100644 --- a/test/src/module/command/archivePushTest.c +++ b/test/src/module/command/archivePushTest.c @@ -22,8 +22,7 @@ testRun(void) FUNCTION_HARNESS_VOID(); // Create default storage object for testing - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); // Start a protocol server to test the protocol directly Buffer *serverWrite = bufNew(8192); diff --git a/test/src/module/command/backupTest.c b/test/src/module/command/backupTest.c index e6c543c30..67cbe06c8 100644 --- a/test/src/module/command/backupTest.c +++ b/test/src/module/command/backupTest.c @@ -456,8 +456,7 @@ testRun(void) // The tests expect the timezone to be UTC setenv("TZ", "UTC", true); - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); // Start a protocol server to test the protocol directly Buffer *serverWrite = bufNew(8192); diff --git a/test/src/module/command/checkTest.c b/test/src/module/command/checkTest.c index 835fa9db9..bfcde4750 100644 --- a/test/src/module/command/checkTest.c +++ b/test/src/module/command/checkTest.c @@ -24,8 +24,7 @@ testRun(void) // PQfinish() is strictly checked harnessPqScriptStrictSet(true); - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); String *pg1 = strNew("pg1"); String *pg1Path = strNewFmt("%s/%s", testPath(), strPtr(pg1)); diff --git a/test/src/module/command/controlTest.c b/test/src/module/command/controlTest.c index 28bdbf935..c0868cf30 100644 --- a/test/src/module/command/controlTest.c +++ b/test/src/module/command/controlTest.c @@ -16,8 +16,7 @@ testRun(void) FUNCTION_HARNESS_VOID(); // Create default storage object for testing - Storage *storageData = storagePosixNew( - strNew(testDataPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageData = storagePosixNewP(strNew(testDataPath()), .write = true); // ***************************************************************************************************************************** if (testBegin("lockStopFileName()")) diff --git a/test/src/module/command/expireTest.c b/test/src/module/command/expireTest.c index c26229ed0..da29199fe 100644 --- a/test/src/module/command/expireTest.c +++ b/test/src/module/command/expireTest.c @@ -71,8 +71,7 @@ testRun(void) { FUNCTION_HARNESS_VOID(); - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); String *backupStanzaPath = strNew("repo/backup/db"); String *backupInfoFileName = strNewFmt("%s/backup.info", strPtr(backupStanzaPath)); diff --git a/test/src/module/command/helpTest.c b/test/src/module/command/helpTest.c index f1e328e61..1bd561f1e 100644 --- a/test/src/module/command/helpTest.c +++ b/test/src/module/command/helpTest.c @@ -413,8 +413,7 @@ testRun(void) // Restore normal stdout dup2(stdoutSave, STDOUT_FILENO); - Storage *storage = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, false, NULL); + Storage *storage = storagePosixNewP(strNew(testPath())); TEST_RESULT_STR_Z(strNewBuf(storageGetP(storageNewReadP(storage, stdoutFile))), generalHelp, " check text"); } diff --git a/test/src/module/command/infoTest.c b/test/src/module/command/infoTest.c index bccdb18f5..6eebbec57 100644 --- a/test/src/module/command/infoTest.c +++ b/test/src/module/command/infoTest.c @@ -1312,8 +1312,7 @@ testRun(void) // Restore normal stdout dup2(stdoutSave, STDOUT_FILENO); - Storage *storage = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, false, NULL); + Storage *storage = storagePosixNewP(strNew(testPath())); TEST_RESULT_STR_Z( strNewBuf(storageGetP(storageNewReadP(storage, stdoutFile))), "No stanzas exist in the repository.\n", " check text"); diff --git a/test/src/module/command/remoteTest.c b/test/src/module/command/remoteTest.c index 8587d31a3..23ff650ec 100644 --- a/test/src/module/command/remoteTest.c +++ b/test/src/module/command/remoteTest.c @@ -19,8 +19,7 @@ testRun(void) FUNCTION_HARNESS_VOID(); // Create default storage object for testing - Storage *storageData = storagePosixNew( - strNew(testDataPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageData = storagePosixNewP(strNew(testDataPath()), .write = true); // ***************************************************************************************************************************** if (testBegin("cmdRemote()")) @@ -157,9 +156,7 @@ testRun(void) protocolClientNoOp(client); TEST_RESULT_BOOL( - storageExistsP( - storagePosixNew(strNew(testDataPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, false, NULL), - STRDEF("lock/test-archive" LOCK_FILE_EXT)), + storageExistsP(storagePosixNewP(strNew(testDataPath())), STRDEF("lock/test-archive" LOCK_FILE_EXT)), true, "lock exists"); protocolClientFree(client); diff --git a/test/src/module/command/repoTest.c b/test/src/module/command/repoTest.c index 4d201ef4d..07dd9cb56 100644 --- a/test/src/module/command/repoTest.c +++ b/test/src/module/command/repoTest.c @@ -16,8 +16,7 @@ testRun(void) FUNCTION_HARNESS_VOID(); // Create default storage object for testing - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); // ***************************************************************************************************************************** if (testBegin("cmdRepoCreate()")) diff --git a/test/src/module/command/restoreTest.c b/test/src/module/command/restoreTest.c index fc77727b3..af672ad67 100644 --- a/test/src/module/command/restoreTest.c +++ b/test/src/module/command/restoreTest.c @@ -148,8 +148,7 @@ testRun(void) FUNCTION_HARNESS_VOID(); // Create default storage object for testing - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); // ***************************************************************************************************************************** if (testBegin("restoreFile()")) diff --git a/test/src/module/command/stanzaTest.c b/test/src/module/command/stanzaTest.c index 1c41e98e3..07a4504b6 100644 --- a/test/src/module/command/stanzaTest.c +++ b/test/src/module/command/stanzaTest.c @@ -17,8 +17,7 @@ testRun(void) { FUNCTION_HARNESS_VOID(); - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); String *stanza = strNew("db"); String *fileName = strNew("test.info"); diff --git a/test/src/module/common/compressTest.c b/test/src/module/common/compressTest.c index 9c7d7b18a..5b646f263 100644 --- a/test/src/module/common/compressTest.c +++ b/test/src/module/common/compressTest.c @@ -83,7 +83,7 @@ testSuite(CompressType type, const char *decompressCmd) varLstAdd(compressParamList, varNewUInt(1)); // Create default storage object for testing - Storage *storageTest = storagePosixNew(strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); TEST_TITLE("simple data"); diff --git a/test/src/module/common/lockTest.c b/test/src/module/common/lockTest.c index fa2e80219..5eb74b8a4 100644 --- a/test/src/module/common/lockTest.c +++ b/test/src/module/common/lockTest.c @@ -15,8 +15,7 @@ testRun(void) FUNCTION_HARNESS_VOID(); // Create default storage object for testing - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); // ***************************************************************************************************************************** if (testBegin("lockAcquireFile() and lockReleaseFile()")) diff --git a/test/src/module/info/infoArchiveTest.c b/test/src/module/info/infoArchiveTest.c index 3bb5a1690..b896d28a5 100644 --- a/test/src/module/info/infoArchiveTest.c +++ b/test/src/module/info/infoArchiveTest.c @@ -16,8 +16,7 @@ void testRun(void) { // Create default storage object for testing - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); // ***************************************************************************************************************************** if (testBegin("InfoArchive")) diff --git a/test/src/module/info/infoBackupTest.c b/test/src/module/info/infoBackupTest.c index 1edec7418..65a22a4b9 100644 --- a/test/src/module/info/infoBackupTest.c +++ b/test/src/module/info/infoBackupTest.c @@ -16,8 +16,7 @@ void testRun(void) { // Create default storage object for testing - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); // ***************************************************************************************************************************** if (testBegin("InfoBackup")) diff --git a/test/src/module/info/manifestTest.c b/test/src/module/info/manifestTest.c index 5eadede6e..be7971cfc 100644 --- a/test/src/module/info/manifestTest.c +++ b/test/src/module/info/manifestTest.c @@ -21,8 +21,7 @@ Test Run void testRun(void) { - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); // ***************************************************************************************************************************** if (testBegin("struct sizes")) @@ -174,10 +173,8 @@ testRun(void) storagePathCreateP(storageTest, strNew("pg"), .mode = 0700, .noParentCreate = true); - Storage *storagePg = storagePosixNew( - strNewFmt("%s/pg", testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, false, NULL); - Storage *storagePgWrite = storagePosixNew( - strNewFmt("%s/pg", testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storagePg = storagePosixNewP(strNewFmt("%s/pg", testPath())); + Storage *storagePgWrite = storagePosixNewP(strNewFmt("%s/pg", testPath()), .write = true); // ------------------------------------------------------------------------------------------------------------------------- TEST_TITLE("8.3 with custom exclusions and special file"); diff --git a/test/src/module/performance/storageTest.c b/test/src/module/performance/storageTest.c index 5f0809e26..6fc362558 100644 --- a/test/src/module/performance/storageTest.c +++ b/test/src/module/performance/storageTest.c @@ -277,11 +277,7 @@ testRun(void) uint64_t rateOut = 100000; // Get the sample pages from disk - Buffer *block = storageGetP( - storageNewReadP( - storagePosixNew(STR(testRepoPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, false, NULL), - STRDEF("test/data/filecopy.table.bin"))); - + Buffer *block = storageGetP(storageNewReadP(storagePosixNewP(STR(testRepoPath())), STRDEF("test/data/filecopy.table.bin"))); ASSERT(bufUsed(block) == 1024 * 1024); // ------------------------------------------------------------------------------------------------------------------------- diff --git a/test/src/module/postgres/interfaceTest.c b/test/src/module/postgres/interfaceTest.c index 2a316c6ba..0eb8d7e8d 100644 --- a/test/src/module/postgres/interfaceTest.c +++ b/test/src/module/postgres/interfaceTest.c @@ -11,8 +11,7 @@ testRun(void) { FUNCTION_HARNESS_VOID(); - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); // ***************************************************************************************************************************** if (testBegin("pgVersionFromStr() and pgVersionToStr()")) diff --git a/test/src/module/protocol/protocolTest.c b/test/src/module/protocol/protocolTest.c index ece59d3fc..6c7800c4f 100644 --- a/test/src/module/protocol/protocolTest.c +++ b/test/src/module/protocol/protocolTest.c @@ -97,8 +97,7 @@ testRun(void) { FUNCTION_HARNESS_VOID(); - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); // ***************************************************************************************************************************** if (testBegin("protocolStorageTypeEnum() and protocolStorageTypeEnum()")) diff --git a/test/src/module/storage/posixTest.c b/test/src/module/storage/posixTest.c index d284aa8fd..745927586 100644 --- a/test/src/module/storage/posixTest.c +++ b/test/src/module/storage/posixTest.c @@ -48,10 +48,8 @@ testRun(void) FUNCTION_HARNESS_VOID(); // Create default storage object for testing - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); - Storage *storageTmp = storagePosixNew( - strNew("/tmp"), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); + Storage *storageTmp = storagePosixNewP(strNew("/tmp"), .write = true); ioBufferSizeSet(2); // Directory and file that cannot be accessed to test permissions errors @@ -86,7 +84,7 @@ testRun(void) if (testBegin("storageNew() and storageFree()")) { Storage *storageTest = NULL; - TEST_ASSIGN(storageTest, storagePosixNew(strNew("/"), 0640, 0750, false, NULL), "new storage (defaults)"); + TEST_ASSIGN(storageTest, storagePosixNewP(strNew("/")), "new storage (defaults)"); TEST_RESULT_STR_Z(storageTest->path, "/", " check path"); TEST_RESULT_INT(storageTest->modeFile, 0640, " check file mode"); TEST_RESULT_INT(storageTest->modePath, 0750, " check path mode"); @@ -94,7 +92,10 @@ testRun(void) TEST_RESULT_BOOL(storageTest->pathExpressionFunction == NULL, true, " check expression function is not set"); TEST_ASSIGN( - storageTest, storagePosixNew(strNew("/path/to"), 0600, 0700, true, storageTestPathExpression), + storageTest, + storagePosixNewP( + strNew("/path/to"), .modeFile = 0600, .modePath = 0700, .write = true, + .pathExpressionFunction = storageTestPathExpression), "new storage (non-default)"); TEST_RESULT_STR_Z(storageTest->path, "/path/to", " check path"); TEST_RESULT_INT(storageTest->modeFile, 0600, " check file mode"); @@ -543,7 +544,7 @@ testRun(void) { Storage *storageTest = NULL; - TEST_ASSIGN(storageTest, storagePosixNew(strNew("/"), 0640, 0750, false, NULL), "new storage /"); + TEST_ASSIGN(storageTest, storagePosixNewP(strNew("/")), "new storage /"); TEST_RESULT_STR_Z(storagePathP(storageTest, NULL), "/", " root dir"); TEST_RESULT_STR_Z(storagePathP(storageTest, strNew("/")), "/", " same as root dir"); TEST_RESULT_STR_Z(storagePathP(storageTest, strNew("subdir")), "/subdir", " simple subdir"); @@ -553,7 +554,7 @@ testRun(void) // ------------------------------------------------------------------------------------------------------------------------- TEST_ASSIGN( - storageTest, storagePosixNew(strNew("/path/to"), 0640, 0750, false, storageTestPathExpression), + storageTest, storagePosixNewP(strNew("/path/to"), .pathExpressionFunction = storageTestPathExpression), "new storage /path/to with expression"); TEST_RESULT_STR_Z(storagePathP(storageTest, NULL), "/path/to", " root dir"); TEST_RESULT_STR_Z(storagePathP(storageTest, strNew("/path/to")), "/path/to", " absolute root dir"); @@ -682,8 +683,7 @@ testRun(void) // ------------------------------------------------------------------------------------------------------------------------- TEST_ERROR_FMT( - storagePathSyncP( - storagePosixNew(strNew("/"), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL), strNew("/proc")), + storagePathSyncP(storagePosixNewP(strNew("/"), .write = true), strNew("/proc")), PathSyncError, STORAGE_ERROR_PATH_SYNC ": [22] Invalid argument", "/proc"); // ------------------------------------------------------------------------------------------------------------------------- @@ -767,7 +767,7 @@ testRun(void) // ***************************************************************************************************************************** if (testBegin("storagePut() and storageGet()")) { - Storage *storageTest = storagePosixNew(strNew("/"), 0640, 0750, true, NULL); + Storage *storageTest = storagePosixNewP(strNew("/"), .write = true); TEST_ERROR_FMT( storageGetP(storageNewReadP(storageTest, strNew(testPath()))), FileReadError, diff --git a/test/src/module/storage/remoteTest.c b/test/src/module/storage/remoteTest.c index b138515b9..1927eb128 100644 --- a/test/src/module/storage/remoteTest.c +++ b/test/src/module/storage/remoteTest.c @@ -22,8 +22,7 @@ testRun(void) FUNCTION_HARNESS_VOID(); // Test storage - Storage *storageTest = storagePosixNew( - strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL); + Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true); // Load configuration to set repo-path and stanza StringList *argList = strLstNew();