Loading CMake/gkfs-options.cmake +7 −0 Original line number Diff line number Diff line Loading @@ -248,6 +248,13 @@ gkfs_define_option( DEFAULT_VALUE ON ) #build python bindings gkfs_define_option( GKFS_BUILD_PYTHON_BINDINGS HELP_TEXT "Build Python bindings package with pybind11" DEFAULT_VALUE OFF ) # use old resolve function gkfs_define_option( GKFS_USE_LEGACY_PATH_RESOLVE Loading CMakeLists.txt +10 −0 Original line number Diff line number Diff line Loading @@ -261,6 +261,16 @@ if (GKFS_ENABLE_CLIENT_METRICS) ) endif () if (GKFS_BUILD_PYTHON_BINDINGS) ### pybind11: for Python bindings include_from_source(pybind11 MESSAGE "[${PROJECT_NAME}] Searching for pybind11" SOURCE_DIR ${GKFS_DEPENDENCIES_PATH}/pybind11 GIT_REPOSITORY https://github.com/pybind/pybind11.git GIT_TAG v2.12.0 ) endif () ### GSL: Guidelines Support Library include_from_source(gsl MESSAGE "[${PROJECT_NAME}] Searching for GSL" Loading src/client/CMakeLists.txt +22 −3 Original line number Diff line number Diff line Loading @@ -73,6 +73,25 @@ if (GKFS_BUILD_LIBC_INTERCEPTION) add_library(gkfs_libc_intercept SHARED) endif() if (GKFS_BUILD_PYTHON_BINDINGS) pybind11_add_module(gkfs_python_bindings gkfs_python.cpp) target_include_directories(gkfs_python_bindings PRIVATE ${INCLUDE_DIR} ${CMAKE_BINARY_DIR}/include ) target_link_libraries(gkfs_python_bindings PRIVATE gkfs_user_lib ) install( TARGETS gkfs_python_bindings LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) endif() target_sources(gkfs_intercept PRIVATE gkfs_functions.cpp intercept.cpp Loading src/client/gkfs_python.cpp 0 → 100644 +34 −0 Original line number Diff line number Diff line #include <pybind11/pybind11.h> #include <pybind11/stl.h> #include <client/open_file_map.hpp> #include <common/metadata.hpp> #include <client/intercept.hpp> #include <sys/stat.h> #include <sys/vfs.h> #include <client/user_functions.hpp> namespace py = pybind11; PYBIND11_MODULE(gkfs_python, m) { m.doc() = "Python bindings for GekkoFS POSIX interface"; m.def("gkfs_open", &gkfs::syscall::gkfs_open); m.def("gkfs_create", &gkfs::syscall::gkfs_create); m.def("gkfs_remove", &gkfs::syscall::gkfs_remove); m.def("gkfs_access", &gkfs::syscall::gkfs_access, py::arg("path"), py::arg("mask"), py::arg("follow_links") = true); // Wrap gkfs_stat manually (complex signature) m.def("gkfs_stat", [](const std::string& path, bool follow_links, bool bypass_rename) { struct stat buf; int res = gkfs::syscall::gkfs_stat(path, &buf, follow_links, bypass_rename); return std::make_tuple(res, buf); }); // Example vector-returning function m.def("gkfs_get_file_list", &gkfs::syscall::gkfs_get_file_list); // Example: wrap close m.def("gkfs_close", &gkfs::syscall::gkfs_close); } Loading
CMake/gkfs-options.cmake +7 −0 Original line number Diff line number Diff line Loading @@ -248,6 +248,13 @@ gkfs_define_option( DEFAULT_VALUE ON ) #build python bindings gkfs_define_option( GKFS_BUILD_PYTHON_BINDINGS HELP_TEXT "Build Python bindings package with pybind11" DEFAULT_VALUE OFF ) # use old resolve function gkfs_define_option( GKFS_USE_LEGACY_PATH_RESOLVE Loading
CMakeLists.txt +10 −0 Original line number Diff line number Diff line Loading @@ -261,6 +261,16 @@ if (GKFS_ENABLE_CLIENT_METRICS) ) endif () if (GKFS_BUILD_PYTHON_BINDINGS) ### pybind11: for Python bindings include_from_source(pybind11 MESSAGE "[${PROJECT_NAME}] Searching for pybind11" SOURCE_DIR ${GKFS_DEPENDENCIES_PATH}/pybind11 GIT_REPOSITORY https://github.com/pybind/pybind11.git GIT_TAG v2.12.0 ) endif () ### GSL: Guidelines Support Library include_from_source(gsl MESSAGE "[${PROJECT_NAME}] Searching for GSL" Loading
src/client/CMakeLists.txt +22 −3 Original line number Diff line number Diff line Loading @@ -73,6 +73,25 @@ if (GKFS_BUILD_LIBC_INTERCEPTION) add_library(gkfs_libc_intercept SHARED) endif() if (GKFS_BUILD_PYTHON_BINDINGS) pybind11_add_module(gkfs_python_bindings gkfs_python.cpp) target_include_directories(gkfs_python_bindings PRIVATE ${INCLUDE_DIR} ${CMAKE_BINARY_DIR}/include ) target_link_libraries(gkfs_python_bindings PRIVATE gkfs_user_lib ) install( TARGETS gkfs_python_bindings LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) endif() target_sources(gkfs_intercept PRIVATE gkfs_functions.cpp intercept.cpp Loading
src/client/gkfs_python.cpp 0 → 100644 +34 −0 Original line number Diff line number Diff line #include <pybind11/pybind11.h> #include <pybind11/stl.h> #include <client/open_file_map.hpp> #include <common/metadata.hpp> #include <client/intercept.hpp> #include <sys/stat.h> #include <sys/vfs.h> #include <client/user_functions.hpp> namespace py = pybind11; PYBIND11_MODULE(gkfs_python, m) { m.doc() = "Python bindings for GekkoFS POSIX interface"; m.def("gkfs_open", &gkfs::syscall::gkfs_open); m.def("gkfs_create", &gkfs::syscall::gkfs_create); m.def("gkfs_remove", &gkfs::syscall::gkfs_remove); m.def("gkfs_access", &gkfs::syscall::gkfs_access, py::arg("path"), py::arg("mask"), py::arg("follow_links") = true); // Wrap gkfs_stat manually (complex signature) m.def("gkfs_stat", [](const std::string& path, bool follow_links, bool bypass_rename) { struct stat buf; int res = gkfs::syscall::gkfs_stat(path, &buf, follow_links, bypass_rename); return std::make_tuple(res, buf); }); // Example vector-returning function m.def("gkfs_get_file_list", &gkfs::syscall::gkfs_get_file_list); // Example: wrap close m.def("gkfs_close", &gkfs::syscall::gkfs_close); }