Skip to content
Permalink
Browse files

Expose storage type.

Code calling the storage should be driver agnostic but knowing the storage type can be useful for debugging and error reporting.
  • Loading branch information...
dwsteele committed Jun 5, 2019
1 parent 6ff3325 commit e701e8fd846539ec20f2a9be90b0590ceb6a7be6
Showing with 21 additions and 0 deletions.
  1. +15 −0 src/storage/storage.c
  2. +5 −0 src/storage/storage.h
  3. +1 −0 test/src/module/storage/posixTest.c
@@ -787,6 +787,21 @@ storageInterface(const Storage *this)
FUNCTION_TEST_RETURN(this->interface);
}

/***********************************************************************************************************************************
Get the storage type (posix, cifs, etc.)
***********************************************************************************************************************************/
const String *
storageType(const Storage *this)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(STORAGE, this);
FUNCTION_TEST_END();

ASSERT(this != NULL);

FUNCTION_TEST_RETURN(this->type);
}

/***********************************************************************************************************************************
Render as string for logging
***********************************************************************************************************************************/
@@ -260,6 +260,11 @@ typedef struct StorageRemoveParam

void storageRemove(const Storage *this, const String *fileExp, StorageRemoveParam param);

/***********************************************************************************************************************************
Getters
***********************************************************************************************************************************/
const String *storageType(const Storage *this);

/***********************************************************************************************************************************
Macros for function logging
***********************************************************************************************************************************/
@@ -100,6 +100,7 @@ testRun(void)

TEST_RESULT_PTR(storageInterface(storageTest).exists, storageTest->interface.exists, " check interface");
TEST_RESULT_PTR(storageDriver(storageTest), storageTest->driver, " check driver");
TEST_RESULT_PTR(storageType(storageTest), storageTest->type, " check type");

TEST_RESULT_VOID(storageFree(storageTest), "free storage");
}

0 comments on commit e701e8f

Please sign in to comment.
You can’t perform that action at this time.