From 5b791554a5d3f4fcd41edb1416db92a9d4130b31 Mon Sep 17 00:00:00 2001 From: Ramon Nou Date: Thu, 6 Jun 2024 11:57:31 +0200 Subject: [PATCH] integrated xpn --- cmake/FindExpand.cmake | 26 +++++++++------- .../posix_file/fs_plugin/expand_plugin.cpp | 31 +++++++++++++------ .../posix_file/fs_plugin/expand_plugin.hpp | 1 + 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/cmake/FindExpand.cmake b/cmake/FindExpand.cmake index bcf79f3..fd3781f 100644 --- a/cmake/FindExpand.cmake +++ b/cmake/FindExpand.cmake @@ -1,35 +1,39 @@ ################################################################################ -# Copyright 2022-2023, Barcelona Supercomputing Center (BSC), Spain # +# Copyright 2018-2024, Barcelona Supercomputing Center (BSC), Spain # +# Copyright 2015-2024, Johannes Gutenberg Universitaet Mainz, Germany # # # -# This software was partially supported by the EuroHPC-funded project ADMIRE # -# (Project ID: 956748, https://www.admire-eurohpc.eu). # +# This software was partially supported by the # +# EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu). # # # -# This file is part of cargo. # +# This software was partially supported by the # +# ADA-FS project under the SPPEXA project funded by the DFG. # # # -# cargo is free software: you can redistribute it and/or modify # +# This file is part of GekkoFS. # +# # +# GekkoFS is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # -# cargo is distributed in the hope that it will be useful, # +# GekkoFS is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # -# along with cargo. If not, see . # +# along with GekkoFS. If not, see . # # # # SPDX-License-Identifier: GPL-3.0-or-later # ################################################################################ find_path(Expand_INCLUDE_DIR - NAMES user_functions.hpp - PREFIX gkfs + NAMES xpn.h + PREFIX xpn ) find_library(Expand_LIBRARY - NAMES libexpand_user_lib.so + NAMES libxpn.so ) include(FindPackageHandleStandardArgs) @@ -58,4 +62,4 @@ endif() mark_as_advanced( Expand_INCLUDE_DIR Expand_LIBRARY -) +) \ No newline at end of file diff --git a/src/posix_file/posix_file/fs_plugin/expand_plugin.cpp b/src/posix_file/posix_file/fs_plugin/expand_plugin.cpp index ef510b0..03ef64b 100644 --- a/src/posix_file/posix_file/fs_plugin/expand_plugin.cpp +++ b/src/posix_file/posix_file/fs_plugin/expand_plugin.cpp @@ -3,17 +3,28 @@ #include "expand_plugin.hpp" +#ifdef __cplusplus +extern "C" { +#endif + +#include "xpn.h" + +#ifdef __cplusplus +} +#endif + + #include namespace cargo { expand_plugin::expand_plugin() { - int result = expand_init(); + int result = xpn_init(); if (result != 0) { std::cerr << "Failed to initialize expand" << std::endl; } } expand_plugin::~expand_plugin() { - int result = expand_end(); + int result = xpn_destroy(); if (result != 0) { std::cerr << "Failed to finalize expand" << std::endl; } @@ -21,36 +32,38 @@ expand_plugin::~expand_plugin() { // Override the open function int expand_plugin::open(const std::string& path, int flags, unsigned int mode) { - return expand_open(path, flags, mode); + return xpn_open(path, flags, mode); } // Override the pread function ssize_t expand_plugin::pread(int fd, void* buf, size_t count, off_t offset) { - return expand_pread_ws(fd, buf, count, offset); + xpn_lseek(fd, offset, SEEK_SET); + return xpn_read(fd, buf, count); } // Override the pwrite function ssize_t expand_plugin::pwrite(int fd, const void* buf, size_t count, off_t offset) { - return expand_pwrite_ws(fd, buf, count, offset); + xpn_lseek(fd, offset, SEEK_SET); + return xpn_write(fd, buf, count); } bool expand_plugin::mkdir(const std::string& path, mode_t mode) { - int result = expand_create(path, mode | S_IFDIR); + int result = xpn_mkdir(path, mode); return result; } bool expand_plugin::close(int fd) { - return expand_close(fd); + return xpn_close(fd); } off_t expand_plugin::lseek(int fd, off_t offset, int whence) { - return expand_lseek(fd, offset, whence); + return xpn_lseek(fd, offset, whence); } off_t @@ -61,4 +74,4 @@ expand_plugin::fallocate(int fd, int mode, off_t offset, off_t len) { (void) len; return len; } -} // namespace cargo +} // namespace cargo \ No newline at end of file diff --git a/src/posix_file/posix_file/fs_plugin/expand_plugin.hpp b/src/posix_file/posix_file/fs_plugin/expand_plugin.hpp index 78a7dfc..d7229f4 100644 --- a/src/posix_file/posix_file/fs_plugin/expand_plugin.hpp +++ b/src/posix_file/posix_file/fs_plugin/expand_plugin.hpp @@ -1,4 +1,5 @@ + #ifndef EXPAND_PLUGIN_HPP #define EXPAND_PLUGIN_HPP -- GitLab