diff --git a/src/storage/read.c b/src/storage/read.c index 258d7e9d9..7ca4765e1 100644 --- a/src/storage/read.c +++ b/src/storage/read.c @@ -60,21 +60,6 @@ storageReadNew(void *driver, const StorageReadInterface *interface) FUNCTION_LOG_RETURN(STORAGE_READ, this); } -/*********************************************************************************************************************************** -Get file driver -***********************************************************************************************************************************/ -void * -storageRead(const StorageRead *this) -{ - FUNCTION_TEST_BEGIN(); - FUNCTION_TEST_PARAM(STORAGE_READ, this); - FUNCTION_TEST_END(); - - ASSERT(this != NULL); - - FUNCTION_TEST_RETURN(this->driver); -} - /*********************************************************************************************************************************** Should a missing file be ignored? ***********************************************************************************************************************************/ diff --git a/src/storage/read.intern.h b/src/storage/read.intern.h index 1a00c7a3f..1a44f33a4 100644 --- a/src/storage/read.intern.h +++ b/src/storage/read.intern.h @@ -23,9 +23,4 @@ typedef struct StorageReadInterface StorageRead *storageReadNew(void *driver, const StorageReadInterface *interface); -/*********************************************************************************************************************************** -Constructor -***********************************************************************************************************************************/ -void *storageRead(const StorageRead *this); - #endif diff --git a/src/storage/write.c b/src/storage/write.c index a6d0d7f7e..0cd5f833e 100644 --- a/src/storage/write.c +++ b/src/storage/write.c @@ -93,21 +93,6 @@ storageWriteCreatePath(const StorageWrite *this) FUNCTION_TEST_RETURN(this->interface->createPath); } -/*********************************************************************************************************************************** -Get file driver -***********************************************************************************************************************************/ -void * -storageWriteDriver(const StorageWrite *this) -{ - FUNCTION_TEST_BEGIN(); - FUNCTION_TEST_PARAM(STORAGE_WRITE, this); - FUNCTION_TEST_END(); - - ASSERT(this != NULL); - - FUNCTION_TEST_RETURN(this->driver); -} - /*********************************************************************************************************************************** Get the IO object ***********************************************************************************************************************************/ diff --git a/src/storage/write.intern.h b/src/storage/write.intern.h index b36820ad4..cb9570a53 100644 --- a/src/storage/write.intern.h +++ b/src/storage/write.intern.h @@ -38,9 +38,4 @@ typedef struct StorageWriteInterface StorageWrite *storageWriteNew(void *driver, const StorageWriteInterface *interface); -/*********************************************************************************************************************************** -Functions -***********************************************************************************************************************************/ -void *storageWriteDriver(const StorageWrite *this); - #endif diff --git a/test/define.yaml b/test/define.yaml index 347f321a3..bec11fdce 100644 --- a/test/define.yaml +++ b/test/define.yaml @@ -443,6 +443,9 @@ unit: storage/helper: full storage/storage: full + include: + - storage/write + # ******************************************************************************************************************************** - name: protocol diff --git a/test/src/module/storage/posixTest.c b/test/src/module/storage/posixTest.c index f7e2a4244..369ab9f89 100644 --- a/test/src/module/storage/posixTest.c +++ b/test/src/module/storage/posixTest.c @@ -756,7 +756,7 @@ testRun(void) "new write file (set mode)"); TEST_RESULT_VOID(ioWriteOpen(storageWriteIo(file)), " open file"); TEST_RESULT_VOID(ioWriteClose(storageWriteIo(file)), " close file"); - TEST_RESULT_VOID(storageWritePosixClose(storageWriteDriver(file)), " close file again"); + TEST_RESULT_VOID(storageWritePosixClose(file->driver), " close file again"); TEST_RESULT_INT(storageInfoP(storageTest, strPath(fileName)).mode, 0700, " check path mode"); TEST_RESULT_INT(storageInfoP(storageTest, fileName).mode, 0600, " check file mode"); } @@ -853,7 +853,6 @@ testRun(void) StorageRead *file = NULL; TEST_ASSIGN(file, storageNewReadP(storageTest, fileNoPerm, .ignoreMissing = true, .limit = VARUINT64(44)), "new read file"); - TEST_RESULT_PTR(storageRead(file), file->driver, " check driver"); TEST_RESULT_BOOL(storageReadIgnoreMissing(file), true, " check ignore missing"); TEST_RESULT_STR(storageReadName(file), fileNoPerm, " check name"); TEST_RESULT_UINT(varUInt64(storageReadLimit(file)), 44, " check limit"); @@ -925,9 +924,7 @@ testRun(void) TEST_RESULT_VOID(ioRead(storageReadIo(file), outBuffer), " no data to load"); TEST_RESULT_UINT(bufUsed(outBuffer), 0, " buffer is empty"); - TEST_RESULT_VOID( - storageReadPosix(storageRead(file), outBuffer, true), - " no data to load from driver either"); + TEST_RESULT_VOID(storageReadPosix(file->driver, outBuffer, true), " no data to load from driver either"); TEST_RESULT_UINT(bufUsed(outBuffer), 0, " buffer is empty"); TEST_RESULT_BOOL(bufEq(buffer, expectedBuffer), true, " check file contents (all loaded)"); @@ -957,7 +954,6 @@ testRun(void) TEST_RESULT_BOOL(storageWriteAtomic(file), false, " check atomic"); TEST_RESULT_BOOL(storageWriteCreatePath(file), false, " check create path"); - TEST_RESULT_PTR(storageWriteDriver(file), file->driver, " check file driver"); TEST_RESULT_INT(storageWriteModeFile(file), 0444, " check mode file"); TEST_RESULT_INT(storageWriteModePath(file), 0555, " check mode path"); TEST_RESULT_STR(storageWriteName(file), fileNoPerm, " check name"); @@ -990,17 +986,17 @@ testRun(void) storageRemoveP(storageTest, fileTmp, .errorOnMissing = true); TEST_ERROR_FMT( - storageWritePosix(storageWriteDriver(file), buffer), FileWriteError, + storageWritePosix(file->driver, buffer), FileWriteError, "unable to write '%s.pgbackrest.tmp': [9] Bad file descriptor", strPtr(fileName)); TEST_ERROR_FMT( - storageWritePosixClose(storageWriteDriver(file)), FileSyncError, STORAGE_ERROR_WRITE_SYNC ": [9] Bad file descriptor", + storageWritePosixClose(file->driver), FileSyncError, STORAGE_ERROR_WRITE_SYNC ": [9] Bad file descriptor", strPtr(fileTmp)); // Disable file sync so close() can be reached ((StorageWritePosix *)file->driver)->interface.syncFile = false; TEST_ERROR_FMT( - storageWritePosixClose(storageWriteDriver(file)), FileCloseError, STORAGE_ERROR_WRITE_CLOSE ": [9] Bad file descriptor", + storageWritePosixClose(file->driver), FileCloseError, STORAGE_ERROR_WRITE_CLOSE ": [9] Bad file descriptor", strPtr(fileTmp)); // Set file handle to -1 so the close on free with not fail diff --git a/test/src/module/storage/remoteTest.c b/test/src/module/storage/remoteTest.c index 4e34652c9..4f655c750 100644 --- a/test/src/module/storage/remoteTest.c +++ b/test/src/module/storage/remoteTest.c @@ -395,9 +395,7 @@ testRun(void) TEST_RESULT_BOOL(bufEq(storageGetP(fileRead), contentBuf), true, "get file"); TEST_RESULT_BOOL(storageReadIgnoreMissing(fileRead), false, "check ignore missing"); TEST_RESULT_STR_Z(storageReadName(fileRead), hrnReplaceKey("{[path]}/repo/test.txt"), "check name"); - TEST_RESULT_UINT( - storageReadRemote(storageRead(fileRead), bufNew(32), false), 0, - "nothing more to read"); + TEST_RESULT_UINT(storageReadRemote(fileRead->driver, bufNew(32), false), 0, "nothing more to read"); TEST_ASSIGN(fileRead, storageNewReadP(storageRemote, strNew("test.txt")), "get file"); TEST_RESULT_BOOL(bufEq(storageGetP(fileRead), contentBuf), true, " check contents"); @@ -549,7 +547,7 @@ testRun(void) TEST_RESULT_VOID(storagePutP(write, contentBuf), "write file"); TEST_RESULT_UINT(((StorageWriteRemote *)write->driver)->protocolWriteBytes, bufSize(contentBuf), " check write size"); - TEST_RESULT_VOID(storageWriteRemoteClose((StorageWriteRemote *)storageWriteDriver(write)), "close file again"); + TEST_RESULT_VOID(storageWriteRemoteClose(write->driver), "close file again"); TEST_RESULT_VOID(storageWriteFree(write), "free file"); // Make sure the file was written correctly diff --git a/test/src/module/storage/s3Test.c b/test/src/module/storage/s3Test.c index 784ad5522..85e039309 100644 --- a/test/src/module/storage/s3Test.c +++ b/test/src/module/storage/s3Test.c @@ -813,7 +813,7 @@ testRun(void) TEST_RESULT_BOOL(storageWriteSyncFile(write), true, "file is synced"); TEST_RESULT_BOOL(storageWriteSyncPath(write), true, "path is synced"); - TEST_RESULT_VOID(storageWriteS3Close((StorageWriteS3 *)storageWriteDriver(write)), "close file again"); + TEST_RESULT_VOID(storageWriteS3Close(write->driver), "close file again"); // Zero-length file TEST_ASSIGN(write, storageNewWriteP(s3, strNew("file.txt")), "new write file");