Commit ded36979 authored by Ramon Nou's avatar Ramon Nou
Browse files

Symlink and rename support, compss

parent 6eff2d97
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
  - Dup3 is supported if O_CLOEXEC is not used (i.e. hexdump) ([!228](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/228))
  - gkfs_do_write uses int instead of ssize_t causing overflow ([!229](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/229))
  - proxy remove metadata has inverted return values ([!237](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/237))
  - Rename and symlink support leveraged ([!246](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/246))

## [0.9.4] - 2025-03
### New
+2 −1
Original line number Diff line number Diff line
@@ -67,7 +67,8 @@ gkfs_access(const std::string& path, int mask, bool follow_links = true);
// Implementation of stat,
// Follow links is true by default
int
gkfs_stat(const std::string& path, struct stat* buf, bool follow_links = true);
gkfs_stat(const std::string& path, struct stat* buf, bool follow_links = true,
          bool bypass_rename = false);

// Implementation of statx, it uses the normal stat and maps the information to
// the statx structure Follow links is true by default
+2 −0
Original line number Diff line number Diff line
@@ -54,10 +54,12 @@ resolve(const std::string& path, bool resolve_last_link = true);
std::pair<bool, std::string>
resolve_new(const std::string& path, bool resolve_last_link = true);

#ifdef GKFS_USE_LEGACY_PATH_RESOLVE
[[deprecated(
        "Use GKFS_USE_LEGACY_PATH_RESOLVE to use old implementation")]] bool
resolve(const std::string& path, std::string& resolved,
        bool resolve_last_link = true);
#endif

std::string
get_sys_cwd();
+122 −0
Original line number Diff line number Diff line
@@ -1343,6 +1343,128 @@ struct mk_symlink {

#endif // HAS_SYMLINKS


#ifdef HAS_RENAME

//==============================================================================
// definitions for rename
struct rename {

    // forward declarations of public input/output types for this RPC
    class input;

    class output;

    // traits used so that the engine knows what to do with the RPC
    using self_type = rename;
    using handle_type = hermes::rpc_handle<self_type>;
    using input_type = input;
    using output_type = output;
    using mercury_input_type = rpc_rename_in_t;
    using mercury_output_type = rpc_err_out_t;

    // RPC public identifier
    // (N.B: we reuse the same IDs assigned by Margo so that the daemon
    // understands Hermes RPCs)
    constexpr static const uint64_t public_id = 40;

    // RPC internal Mercury identifier
    constexpr static const hg_id_t mercury_id = 0;

    // RPC name
    constexpr static const auto name = gkfs::rpc::tag::rename;

    // requires response?
    constexpr static const auto requires_response = true;

    // Mercury callback to serialize input arguments
    constexpr static const auto mercury_in_proc_cb =
            HG_GEN_PROC_NAME(rpc_rename_in_t);

    // Mercury callback to serialize output arguments
    constexpr static const auto mercury_out_proc_cb =
            HG_GEN_PROC_NAME(rpc_err_out_t);

    class input {

        template <typename ExecutionContext>
        friend hg_return_t
        hermes::detail::post_to_mercury(ExecutionContext*);

    public:
        input(const std::string& path, const std::string& target_path)
            : m_path(path), m_target_path(target_path) {}

        input(input&& rhs) = default;

        input(const input& other) = default;

        input&
        operator=(input&& rhs) = default;

        input&
        operator=(const input& other) = default;

        std::string
        path() const {
            return m_path;
        }

        std::string
        target_path() const {
            return m_target_path;
        }

        explicit input(const rpc_rename_in_t& other)
            : m_path(other.path), m_target_path(other.target_path) {}

        explicit
        operator rpc_rename_in_t() {
            return {m_path.c_str(), m_target_path.c_str()};
        }

    private:
        std::string m_path;
        std::string m_target_path;
    };

    class output {

        template <typename ExecutionContext>
        friend hg_return_t
        hermes::detail::post_to_mercury(ExecutionContext*);

    public:
        output() : m_err() {}

        output(int32_t err) : m_err(err) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

        output&
        operator=(output&& rhs) = default;

        output&
        operator=(const output& other) = default;

        explicit output(const rpc_err_out_t& out) {
            m_err = out.err;
        }

        int32_t
        err() const {
            return m_err;
        }

    private:
        int32_t m_err;
    };
};

#endif // HAS_RENAME

//==============================================================================
// definitions for remove data
struct remove_data {
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sched.h>
#include <syscall.h>
#include <unistd.h>
#include <optional>
Loading