Loading include/client/rpc/rpc_types.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -1012,7 +1012,7 @@ struct get_metadentry_size { // Mercury callback to serialize output arguments constexpr static const auto mercury_out_proc_cb = HG_GEN_PROC_NAME(rpc_err_out_t); HG_GEN_PROC_NAME(rpc_get_metadentry_size_out_t); class input { Loading src/client/gkfs_functions.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -319,10 +319,16 @@ off_t gkfs_lseek(shared_ptr<gkfs::filemap::OpenFile> gkfs_fd, off_t offset, unsi case SEEK_END: { off64_t file_size; auto err = gkfs::rpc::forward_get_metadentry_size(gkfs_fd->path(), file_size); if (err < 0) { errno = err; // Negative numbers are explicitly for error codes return -1; } if (offset < 0 and file_size < -offset) { errno = EINVAL; return -1; } gkfs_fd->pos(file_size + offset); break; } Loading tests/integration/CMakeLists.txt +16 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,13 @@ gkfs_add_python_test( SOURCE operations/ ) gkfs_add_python_test( NAME test_lseek PYTHON_VERSION 3.6 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/integration SOURCE position/test_lseek.py ) gkfs_add_python_test( NAME test_shell PYTHON_VERSION 3.6 Loading Loading @@ -71,6 +78,15 @@ if(GKFS_INSTALL_TESTS) PATTERN ".pytest_cache" EXCLUDE ) install(DIRECTORY position DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration FILES_MATCHING REGEX ".*\\.py" PATTERN "__pycache__" EXCLUDE PATTERN ".pytest_cache" EXCLUDE ) install(DIRECTORY shell DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration FILES_MATCHING Loading tests/integration/harness/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ add_executable(gkfs.io gkfs.io/writev.cpp gkfs.io/pwritev.cpp gkfs.io/statx.cpp gkfs.io/lseek.cpp ) include(FetchContent) Loading tests/integration/harness/gkfs.io/commands.hpp +3 −0 Original line number Diff line number Diff line Loading @@ -62,4 +62,7 @@ pwritev_init(CLI::App& app); void statx_init(CLI::App& app); void lseek_init(CLI::App& app); #endif // IO_COMMANDS_HPP Loading
include/client/rpc/rpc_types.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -1012,7 +1012,7 @@ struct get_metadentry_size { // Mercury callback to serialize output arguments constexpr static const auto mercury_out_proc_cb = HG_GEN_PROC_NAME(rpc_err_out_t); HG_GEN_PROC_NAME(rpc_get_metadentry_size_out_t); class input { Loading
src/client/gkfs_functions.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -319,10 +319,16 @@ off_t gkfs_lseek(shared_ptr<gkfs::filemap::OpenFile> gkfs_fd, off_t offset, unsi case SEEK_END: { off64_t file_size; auto err = gkfs::rpc::forward_get_metadentry_size(gkfs_fd->path(), file_size); if (err < 0) { errno = err; // Negative numbers are explicitly for error codes return -1; } if (offset < 0 and file_size < -offset) { errno = EINVAL; return -1; } gkfs_fd->pos(file_size + offset); break; } Loading
tests/integration/CMakeLists.txt +16 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,13 @@ gkfs_add_python_test( SOURCE operations/ ) gkfs_add_python_test( NAME test_lseek PYTHON_VERSION 3.6 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/integration SOURCE position/test_lseek.py ) gkfs_add_python_test( NAME test_shell PYTHON_VERSION 3.6 Loading Loading @@ -71,6 +78,15 @@ if(GKFS_INSTALL_TESTS) PATTERN ".pytest_cache" EXCLUDE ) install(DIRECTORY position DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration FILES_MATCHING REGEX ".*\\.py" PATTERN "__pycache__" EXCLUDE PATTERN ".pytest_cache" EXCLUDE ) install(DIRECTORY shell DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration FILES_MATCHING Loading
tests/integration/harness/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ add_executable(gkfs.io gkfs.io/writev.cpp gkfs.io/pwritev.cpp gkfs.io/statx.cpp gkfs.io/lseek.cpp ) include(FetchContent) Loading
tests/integration/harness/gkfs.io/commands.hpp +3 −0 Original line number Diff line number Diff line Loading @@ -62,4 +62,7 @@ pwritev_init(CLI::App& app); void statx_init(CLI::App& app); void lseek_init(CLI::App& app); #endif // IO_COMMANDS_HPP