02 20 code maintenance

General code maintenance:

  • remove dead code
  • remove as many #define as possible and use constexpr instead
  • remove adafs occurrences and replace with gkfs
  • reformat code to unify code style as of CPPCoreGuidelines
  • rearrange imports, remove unused imports
  • separate cmake configurations and FS configurations
  • encapsulate non-prefix gkfs functions into namespaces
  • change copyright statement to 2020

Since most code has been merged. This is a good time to tackle this now.

Edited by Marc Vef

Merge request reports

Loading
+14 −13
Changes for include/client/rpc/forward_data.hpp: 14 added lines, 13 removed lines.
Original line number Diff line number Diff line
/*
  Copyright 2018-2019, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2019, Johannes Gutenberg Universitaet Mainz, Germany
  Copyright 2018-2020, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2020, Johannes Gutenberg Universitaet Mainz, Germany

  This software was partially supported by the
  EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).
@@ -12,27 +12,28 @@
*/


#ifndef IFS_PRELOAD_C_DATA_WS_HPP
#define IFS_PRELOAD_C_DATA_WS_HPP
#ifndef GEKKOFS_CLIENT_FORWARD_DATA_HPP
#define GEKKOFS_CLIENT_FORWARD_DATA_HPP

namespace gkfs {
namespace rpc {

namespace rpc_send {

ssize_t write(const std::string& path, const void* buf, const bool append_flag, const off64_t in_offset,
                       const size_t write_size, const int64_t updated_metadentry_size);
struct ChunkStat {
    unsigned long chunk_size;
    unsigned long chunk_total;
    unsigned long chunk_free;
};

ssize_t read(const std::string& path, void* buf, const off64_t offset, const size_t read_size);
ssize_t forward_write(const std::string& path, const void* buf, bool append_flag, off64_t in_offset,
                      size_t write_size, int64_t updated_metadentry_size);

int trunc_data(const std::string& path, size_t current_size, size_t new_size);
ssize_t forward_read(const std::string& path, void* buf, off64_t offset, size_t read_size);

ChunkStat chunk_stat();
int forward_truncate(const std::string& path, size_t current_size, size_t new_size);

}
ChunkStat forward_get_chunk_stat();

} // namespace rpc
} // namespace gkfs

#endif //IFS_PRELOAD_C_DATA_WS_HPP
#endif //GEKKOFS_CLIENT_FORWARD_DATA_HPP
+26 −0
Changes for include/client/rpc/forward_management.hpp: 26 added lines, 0 removed lines.
Original line number Diff line number Diff line
/*
  Copyright 2018-2020, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2020, Johannes Gutenberg Universitaet Mainz, Germany

  This software was partially supported by the
  EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).

  This software was partially supported by the
  ADA-FS project under the SPPEXA project funded by the DFG.

  SPDX-License-Identifier: MIT
*/


#ifndef GEKKOFS_CLIENT_FORWARD_MNGMNT_HPP
#define GEKKOFS_CLIENT_FORWARD_MNGMNT_HPP

namespace gkfs {
namespace rpc {

bool forward_get_fs_config();

} // namespace rpc
} // namespace gkfs

#endif //GEKKOFS_CLIENT_FORWARD_MNGMNT_HPP
+60 −0
Changes for include/client/rpc/forward_metadata.hpp: 60 added lines, 0 removed lines.
Original line number Diff line number Diff line
/*
  Copyright 2018-2020, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2020, Johannes Gutenberg Universitaet Mainz, Germany

  This software was partially supported by the
  EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).

  This software was partially supported by the
  ADA-FS project under the SPPEXA project funded by the DFG.

  SPDX-License-Identifier: MIT
*/


#ifndef GEKKOFS_CLIENT_FORWARD_METADATA_HPP
#define GEKKOFS_CLIENT_FORWARD_METADATA_HPP

#include <string>

/* Forward declaration */
namespace gkfs {
namespace filemap {
class OpenDir;
}
namespace metadata {
struct MetadentryUpdateFlags;
class Metadata;
}

namespace rpc {

int forward_create(const std::string& path, mode_t mode);

int forward_stat(const std::string& path, std::string& attr);

int forward_remove(const std::string& path, bool remove_metadentry_only, ssize_t size);

int forward_decr_size(const std::string& path, size_t length);

int forward_update_metadentry(const std::string& path, const gkfs::metadata::Metadata& md,
                              const gkfs::metadata::MetadentryUpdateFlags& md_flags);

int forward_update_metadentry_size(const std::string& path, size_t size, off64_t offset, bool append_flag,
                                   off64_t& ret_size);

int forward_get_metadentry_size(const std::string& path, off64_t& ret_size);

void forward_get_dirents(gkfs::filemap::OpenDir& open_dir);

#ifdef HAS_SYMLINKS

int forward_mk_symlink(const std::string& path, const std::string& target_path);

#endif


} // namespace rpc
} // namespace gkfs

#endif //GEKKOFS_CLIENT_FORWARD_METADATA_HPP
+0 −52
Changes for include/client/rpc/ld_rpc_metadentry.hpp: 0 added lines, 52 removed lines.
Original line number Diff line number Diff line
/*
  Copyright 2018-2019, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2019, Johannes Gutenberg Universitaet Mainz, Germany

  This software was partially supported by the
  EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).

  This software was partially supported by the
  ADA-FS project under the SPPEXA project funded by the DFG.

  SPDX-License-Identifier: MIT
*/


#ifndef IFS_PRELOAD_C_METADENTRY_HPP
#define IFS_PRELOAD_C_METADENTRY_HPP

#include <string>

/* Forward declaration */
struct MetadentryUpdateFlags;
class OpenDir;
class Metadata;

namespace rpc_send {


int mk_node(const std::string& path, mode_t mode);

int stat(const std::string& path, std::string& attr);

int rm_node(const std::string& path, const bool remove_metadentry_only, const ssize_t size);

int decr_size(const std::string& path, size_t length);

int update_metadentry(const std::string& path, const Metadata& md, const MetadentryUpdateFlags& md_flags);

int update_metadentry_size(const std::string& path, size_t size, off64_t offset, bool append_flag,
                                    off64_t& ret_size);

int get_metadentry_size(const std::string& path, off64_t& ret_size);

void get_dirents(OpenDir& open_dir);

#ifdef HAS_SYMLINKS
int mk_symlink(const std::string& path, const std::string& target_path);
#endif


} // end namespace rpc_send

#endif //IFS_PRELOAD_C_METADENTRY_HPP
+125 −24
Changes for include/client/rpc/rpc_types.hpp: 125 added lines, 24 removed lines.
Original line number Diff line number Diff line
/*
  Copyright 2018-2019, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2019, Johannes Gutenberg Universitaet Mainz, Germany
  Copyright 2018-2020, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2020, Johannes Gutenberg Universitaet Mainz, Germany

  This software was partially supported by the
  EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).
@@ -11,8 +11,8 @@
  SPDX-License-Identifier: MIT
*/

#ifndef GKFS_RPCS_HPP
#define GKFS_RPCS_HPP
#ifndef GKFS_RPCS_TYPES_HPP
#define GKFS_RPCS_TYPES_HPP

// C includes
#include <mercury.h>
@@ -34,20 +34,22 @@
#include <global/global_defs.hpp>
#include <global/rpc/rpc_types.hpp>

namespace hermes { namespace detail {
namespace hermes {
namespace detail {

struct hg_void_t { };
struct hg_void_t {
};

static HG_INLINE hg_return_t
hg_proc_void_t(hg_proc_t proc, void *data) 
{
hg_proc_void_t(hg_proc_t proc, void* data) {
    (void) proc;
    (void) data;

    return HG_SUCCESS;
}

}} // namespace hermes::detail
}
} // namespace hermes::detail

namespace gkfs {
namespace rpc {
@@ -58,6 +60,7 @@ struct fs_config {

    // 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
@@ -77,7 +80,7 @@ struct fs_config {
    constexpr static const hg_id_t mercury_id = public_id;

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

    // requires response?
    constexpr static const auto requires_response = true;
@@ -97,9 +100,13 @@ struct fs_config {

    public:
        input() {}

        input(input&& rhs) = default;

        input(const input& other) = default;

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

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

        explicit
@@ -148,8 +155,11 @@ struct fs_config {
                m_gid(gid) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -237,6 +247,7 @@ struct create {

    // 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
@@ -256,7 +267,7 @@ struct create {
    constexpr static const hg_id_t mercury_id = public_id;

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

    // requires response?
    constexpr static const auto requires_response = true;
@@ -281,8 +292,11 @@ struct create {
                m_mode(mode) {}

        input(input&& rhs) = default;

        input(const input& other) = default;

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

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

        std::string
@@ -323,8 +337,11 @@ struct create {
                m_err(err) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -348,6 +365,7 @@ struct stat {

    // 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
@@ -367,7 +385,7 @@ struct stat {
    constexpr static const hg_id_t mercury_id = public_id;

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

    // requires response?
    constexpr static const auto requires_response = true;
@@ -390,8 +408,11 @@ struct stat {
                m_path(path) {}

        input(input&& rhs) = default;

        input(const input& other) = default;

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

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

        std::string
@@ -427,8 +448,11 @@ struct stat {
                m_db_val(db_val) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -462,6 +486,7 @@ struct remove {

    // 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
@@ -481,7 +506,7 @@ struct remove {
    constexpr static const hg_id_t mercury_id = public_id;

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

    // requires response?
    constexpr static const auto requires_response = true;
@@ -504,8 +529,11 @@ struct remove {
                m_path(path) {}

        input(input&& rhs) = default;

        input(const input& other) = default;

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

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

        std::string
@@ -539,8 +567,11 @@ struct remove {
                m_err(err) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -564,6 +595,7 @@ struct decr_size {

    // 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
@@ -583,7 +615,7 @@ struct decr_size {
    constexpr static const hg_id_t mercury_id = public_id;

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

    // requires response?
    constexpr static const auto requires_response = true;
@@ -607,8 +639,11 @@ struct decr_size {
                m_length(length) {}

        input(input&& rhs) = default;

        input(const input& other) = default;

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

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

        std::string
@@ -649,8 +684,11 @@ struct decr_size {
                m_err(err) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -674,6 +712,7 @@ struct update_metadentry {

    // 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
@@ -693,7 +732,7 @@ struct update_metadentry {
    constexpr static const hg_id_t mercury_id = public_id;

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

    // requires response?
    constexpr static const auto requires_response = true;
@@ -748,8 +787,11 @@ struct update_metadentry {
                m_ctime_flag(ctime_flag) {}

        input(input&& rhs) = default;

        input(const input& other) = default;

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

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

        std::string
@@ -911,8 +953,11 @@ struct update_metadentry {
                m_err(err) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -936,6 +981,7 @@ struct get_metadentry_size {

    // 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
@@ -955,7 +1001,7 @@ struct get_metadentry_size {
    constexpr static const hg_id_t mercury_id = public_id;

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

    // requires response?
    constexpr static const auto requires_response = true;
@@ -978,8 +1024,11 @@ struct get_metadentry_size {
                m_path(path) {}

        input(input&& rhs) = default;

        input(const input& other) = default;

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

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

        std::string
@@ -1015,8 +1064,11 @@ struct get_metadentry_size {
                m_ret_size(ret_size) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -1047,6 +1099,7 @@ struct update_metadentry_size {

    // 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
@@ -1066,7 +1119,7 @@ struct update_metadentry_size {
    constexpr static const hg_id_t mercury_id = public_id;

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

    // requires response?
    constexpr static const auto requires_response = true;
@@ -1095,8 +1148,11 @@ struct update_metadentry_size {
                m_append(append) {}

        input(input&& rhs) = default;

        input(const input& other) = default;

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

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

        std::string
@@ -1153,8 +1209,11 @@ struct update_metadentry_size {
                m_ret_size(ret_size) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -1187,6 +1246,7 @@ struct mk_symlink {

    // 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
@@ -1206,7 +1266,7 @@ struct mk_symlink {
    constexpr static const hg_id_t mercury_id = public_id;

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

    // requires response?
    constexpr static const auto requires_response = true;
@@ -1231,8 +1291,11 @@ struct mk_symlink {
                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
@@ -1273,8 +1336,11 @@ struct mk_symlink {
                m_err(err) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -1300,6 +1366,7 @@ struct write_data {

    // 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
@@ -1319,7 +1386,7 @@ struct write_data {
    constexpr static const hg_id_t mercury_id = public_id;

    // RPC name
    constexpr static const auto name = hg_tag::write_data;
    constexpr static const auto name = gkfs::rpc::tag::write;

    // requires response?
    constexpr static const auto requires_response = true;
@@ -1358,8 +1425,11 @@ struct write_data {
                m_buffers(buffers) {}

        input(input&& rhs) = default;

        input(const input& other) = default;

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

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

        std::string
@@ -1461,8 +1531,11 @@ struct write_data {
                m_io_size(io_size) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -1493,6 +1566,7 @@ struct read_data {

    // 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
@@ -1512,7 +1586,7 @@ struct read_data {
    constexpr static const hg_id_t mercury_id = public_id;

    // RPC name
    constexpr static const auto name = hg_tag::read_data;
    constexpr static const auto name = gkfs::rpc::tag::read;

    // requires response?
    constexpr static const auto requires_response = true;
@@ -1551,8 +1625,11 @@ struct read_data {
                m_buffers(buffers) {}

        input(input&& rhs) = default;

        input(const input& other) = default;

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

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

        std::string
@@ -1654,8 +1731,11 @@ struct read_data {
                m_io_size(io_size) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -1686,6 +1766,7 @@ struct trunc_data {

    // 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
@@ -1705,7 +1786,7 @@ struct trunc_data {
    constexpr static const hg_id_t mercury_id = public_id;

    // RPC name
    constexpr static const auto name = hg_tag::trunc_data;
    constexpr static const auto name = gkfs::rpc::tag::truncate;

    // requires response?
    constexpr static const auto requires_response = true;
@@ -1730,8 +1811,11 @@ struct trunc_data {
                m_length(length) {}

        input(input&& rhs) = default;

        input(const input& other) = default;

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

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

        std::string
@@ -1775,8 +1859,11 @@ struct trunc_data {
                m_err(err) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -1800,6 +1887,7 @@ struct get_dirents {

    // 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
@@ -1819,7 +1907,7 @@ struct get_dirents {
    constexpr static const hg_id_t mercury_id = public_id;

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

    // requires response?
    constexpr static const auto requires_response = true;
@@ -1844,8 +1932,11 @@ struct get_dirents {
                m_buffers(buffers) {}

        input(input&& rhs) = default;

        input(const input& other) = default;

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

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

        std::string
@@ -1891,8 +1982,11 @@ struct get_dirents {
                m_dirents_size(dirents_size) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -1923,6 +2017,7 @@ struct chunk_stat {

    // 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
@@ -1942,7 +2037,7 @@ struct chunk_stat {
    constexpr static const hg_id_t mercury_id = public_id;

    // RPC name
    constexpr static const auto name = hg_tag::chunk_stat;
    constexpr static const auto name = gkfs::rpc::tag::get_chunk_stat;

    // requires response?
    constexpr static const auto requires_response = true;
@@ -1965,8 +2060,11 @@ struct chunk_stat {
                m_dummy(dummy) {}

        input(input&& rhs) = default;

        input(const input& other) = default;

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

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

        int32_t
@@ -2004,8 +2102,11 @@ struct chunk_stat {
                m_chunk_free(chunk_free) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

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

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

        explicit
@@ -2041,4 +2142,4 @@ struct chunk_stat {
} // namespace gkfs


#endif // GKFS_RPCS_HPP
#endif // GKFS_RPCS_TYPES_HPP
Loading
Loading