diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | README | 11 | ||||
-rw-r--r-- | include/librefop.h | 2 | ||||
-rw-r--r-- | lib/libredundancyfileop.c | 4 | ||||
-rw-r--r-- | test/fileop_test_set_get_remove.cpp | 4 | ||||
-rw-r--r-- | test/fileop_test_utils.cpp | 8 | ||||
-rw-r--r-- | test/interface_test_filebreak.cpp | 30 | ||||
-rw-r--r-- | test/mock/libpthread_mock.hpp | 3 | ||||
-rw-r--r-- | test/mock/libsystemd_mock.hpp | 3 | ||||
-rw-r--r-- | test/mock/memory_mock.hpp | 3 | ||||
-rw-r--r-- | test/mock/syscall_io_mock.hpp | 3 |
11 files changed, 40 insertions, 33 deletions
diff --git a/Makefile.am b/Makefile.am index 5c70312..13f3d69 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,6 +4,8 @@ if ENABLE_TEST SUBDIRS += test endif +include_HEADERS = include/librefop.h + pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = librefop.pc @@ -114,14 +114,7 @@ New data write - case 2. | file | | file | -------- -------- -2-5. Remove oldest backup file. - - -------- -------- -| New | | backup | -| file | | file | - -------- -------- - -2-6. Done. +2-5. Done. Recovery from abnormal conditions. @@ -179,7 +172,7 @@ ac5. Latest file and new file. -------- p1 -Return data from a new file. Typically new file may not completed write operation. +Return data from a latest file. Typically new file may not completed write operation. ac6. Backup file and new file. diff --git a/include/librefop.h b/include/librefop.h index 896494a..25e3dbe 100644 --- a/include/librefop.h +++ b/include/librefop.h @@ -30,7 +30,7 @@ typedef enum refop_error { REFOP_NOENT = -1, //! This operation was failed. Because all recovery method was failed. - REFOP_BROAKEN = -2, + REFOP_BROKEN = -2, //! Argument error. REFOP_ARGERROR = -3, diff --git a/lib/libredundancyfileop.c b/lib/libredundancyfileop.c index 2a0dc87..cf545cb 100644 --- a/lib/libredundancyfileop.c +++ b/lib/libredundancyfileop.c @@ -169,7 +169,7 @@ refop_error_t refop_set_redundancy_data(refop_handle_t handle, uint8_t *data, in * @retval REFOP_SUCCESS This operation was succeeded. * @retval REFOP_RECOVER This operation was succeeded within recovery. * @retval REFOP_NOENT The target file/directroy was nothing. - * @retval REFOP_BROAKEN This operation was failed. Because all recovery method was failed. + * @retval REFOP_BROKEN This operation was failed. Because all recovery method was failed. * @retval REFOP_ARGERROR Argument error. * @retval REFOP_SYSERROR Internal operation was failed such as no memory, no disk space and etc. */ @@ -190,7 +190,7 @@ refop_error_t refop_get_redundancy_data(refop_handle_t handle, uint8_t *data, in else if (ret == -2) result = REFOP_NOENT; else if (ret == -3) - result = REFOP_BROAKEN; + result = REFOP_BROKEN; else result = REFOP_SYSERROR; diff --git a/test/fileop_test_set_get_remove.cpp b/test/fileop_test_set_get_remove.cpp index ae3d9f0..1428871 100644 --- a/test/fileop_test_set_get_remove.cpp +++ b/test/fileop_test_set_get_remove.cpp @@ -203,11 +203,11 @@ TEST_F(fileop_test_set_get_remove_test, unit_test_refop_get_redundancy_data__ref * @retval 1 Succeeded with recover. * @retval -1 Abnormal fail. Shall not continue. * @retval -2 No data. - * @retval -3 Broaken data. + * @retval -3 Broken data. */ g_refop_file_pickup_ret = -3; ret = refop_get_redundancy_data(handle, dmybuf, 100, &getsize); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); g_refop_file_pickup_ret = -2; ret = refop_get_redundancy_data(handle, dmybuf, 100, &getsize); diff --git a/test/fileop_test_utils.cpp b/test/fileop_test_utils.cpp index f95fa6f..9a6d116 100644 --- a/test/fileop_test_utils.cpp +++ b/test/fileop_test_utils.cpp @@ -33,13 +33,13 @@ TEST_F(fileop_test_utils, fileop_test_utils_refop_header_validation__invalid_hea s_refop_file_header *head = &header; int ret = -1; - // broaken magic + // broken magic refop_header_create(head, 0x1234, 64*1024*1024); head->magic = 0; ret = refop_header_validation(head); ASSERT_EQ(-1, ret); - // broaken version + // broken version refop_header_create(head, 0x1234, 64*1024*1024); head->version = 0x88888888; head->version_inv = 0x88888888; @@ -53,14 +53,14 @@ TEST_F(fileop_test_utils, fileop_test_utils_refop_header_validation__invalid_hea ret = refop_header_validation(head); ASSERT_EQ(-1, ret); - // broaken crc + // broken crc refop_header_create(head, 0x1234, 64*1024*1024); head->crc16 = 0x8888; head->crc16_inv = 0x8888; ret = refop_header_validation(head); ASSERT_EQ(-1, ret); - // broaken size + // broken size refop_header_create(head, 0x1234, 64*1024*1024); head->size_inv = head->size; ret = refop_header_validation(head); diff --git a/test/interface_test_filebreak.cpp b/test/interface_test_filebreak.cpp index fb37411..0226266 100644 --- a/test/interface_test_filebreak.cpp +++ b/test/interface_test_filebreak.cpp @@ -140,7 +140,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_file_rotate) iret = breakfile_header_magic(latestfile); ASSERT_EQ(0, ret); ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); memset(pbuf,0xa4,sz); ret = refop_set_redundancy_data(handle, pbuf, sz); @@ -193,7 +193,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_file_break_all) ASSERT_EQ(0, ret); ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); //-------------------------------------------------------------------------------------------------------- // version break @@ -205,7 +205,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_file_break_all) ASSERT_EQ(0, ret); ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); // version_inv break memset(pbuf,0,sz); @@ -216,7 +216,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_file_break_all) ASSERT_EQ(0, ret); ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); // version val break memset(pbuf,0,sz); @@ -227,7 +227,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_file_break_all) ASSERT_EQ(0, ret); ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); //-------------------------------------------------------------------------------------------------------- // crc16 break @@ -239,7 +239,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_file_break_all) ASSERT_EQ(0, ret); ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); // crc16_inv break memset(pbuf,0,sz); @@ -250,7 +250,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_file_break_all) ASSERT_EQ(0, ret); ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); // crc16 val break memset(pbuf,0,sz); @@ -261,7 +261,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_file_break_all) ASSERT_EQ(0, ret); ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); //-------------------------------------------------------------------------------------------------------- // size break @@ -273,7 +273,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_file_break_all) ASSERT_EQ(0, ret); ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); // size inv break memset(pbuf,0,sz); @@ -284,7 +284,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_file_break_all) ASSERT_EQ(0, ret); ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); // size val break 1 memset(pbuf,0,sz); @@ -295,7 +295,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_file_break_all) ASSERT_EQ(0, ret); ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); // size val break 2 memset(pbuf,0,sz); @@ -306,7 +306,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_file_break_all) ASSERT_EQ(0, ret); ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); ret = refop_release_redundancy_handle(handle); ASSERT_EQ(REFOP_SUCCESS, ret); @@ -720,7 +720,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_break_file_f4) // f4 ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); ret = refop_remove_redundancy_data(handle); ASSERT_EQ(REFOP_SUCCESS, ret); @@ -780,7 +780,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_del_and_break_file_f2) // f2 ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); ret = refop_remove_redundancy_data(handle); ASSERT_EQ(REFOP_SUCCESS, ret); @@ -840,7 +840,7 @@ TEST_F(interface_test_filebreak, interface_test_filebreak_del_and_break_file_f3) // f3 ret = refop_get_redundancy_data(handle, prbuf, sz, &szr); - ASSERT_EQ(REFOP_BROAKEN, ret); + ASSERT_EQ(REFOP_BROKEN, ret); ret = refop_remove_redundancy_data(handle); ASSERT_EQ(REFOP_SUCCESS, ret); diff --git a/test/mock/libpthread_mock.hpp b/test/mock/libpthread_mock.hpp index 61ce43c..a7a1b93 100644 --- a/test/mock/libpthread_mock.hpp +++ b/test/mock/libpthread_mock.hpp @@ -1,3 +1,6 @@ +/** + * SPDX-License-Identifier: Apache-2.0 + */ #include <gmock/gmock.h> #include <functional> diff --git a/test/mock/libsystemd_mock.hpp b/test/mock/libsystemd_mock.hpp index 34de9a0..889bb8c 100644 --- a/test/mock/libsystemd_mock.hpp +++ b/test/mock/libsystemd_mock.hpp @@ -1,3 +1,6 @@ +/** + * SPDX-License-Identifier: Apache-2.0 + */ #include <gmock/gmock.h> #include <functional> diff --git a/test/mock/memory_mock.hpp b/test/mock/memory_mock.hpp index e140840..a1f14b6 100644 --- a/test/mock/memory_mock.hpp +++ b/test/mock/memory_mock.hpp @@ -1,3 +1,6 @@ +/** + * SPDX-License-Identifier: Apache-2.0 + */ #include <gmock/gmock.h> #include <functional> diff --git a/test/mock/syscall_io_mock.hpp b/test/mock/syscall_io_mock.hpp index 6eb021a..f600068 100644 --- a/test/mock/syscall_io_mock.hpp +++ b/test/mock/syscall_io_mock.hpp @@ -1,3 +1,6 @@ +/** + * SPDX-License-Identifier: Apache-2.0 + */ #include <gmock/gmock.h> #include <functional> |