From aac1cd48513724618d5c46cff7643984448b2b9d Mon Sep 17 00:00:00 2001 From: Marc Vef Date: Wed, 1 Mar 2023 18:27:34 +0100 Subject: [PATCH 1/4] Updating check_format.sh to using version 15 if available Version 11 is dropped as it is incompatible. --- scripts/check_format.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/check_format.sh b/scripts/check_format.sh index d1fc05d9a..ed70da414 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -32,6 +32,13 @@ PROJECT_INCLUDE="$(pwd)/include" RUN_FORMAT=false CLANG_FORMAT_BIN="" VERBOSE=false +# Mac special treatment for readlink. greadlink must be installed... +READLINK_BIN=$(which readlink) +case "$(uname -s)" in + Linux*) READLINK_BIN=$(which readlink);; + Darwin*) READLINK_BIN=$(which greadlink);; + *) READLINK_BIN="readlink" +esac usage_short() { echo " @@ -68,17 +75,17 @@ while [[ $# -gt 0 ]]; do case ${key} in -s | --src) - PROJECT_SRC="$(readlink -mn "${2}")" + PROJECT_SRC="$($READLINK_BIN -mn "${2}")" shift # past argument shift # past value ;; -i | --include) - PROJECT_INCLUDE="$(readlink -mn "${2}")" + PROJECT_INCLUDE="$($READLINK_BIN -mn "${2}")" shift # past argument shift # past value ;; -c | --clang_format_path) - CLANG_FORMAT_BIN="$(readlink -mn "${2}")" + CLANG_FORMAT_BIN="$($READLINK_BIN -mn "${2}")" if [[ ! -x $CLANG_FORMAT_BIN ]]; then echo "*** ERR: clang-format path $CLANG_FORMAT_BIN is not an executable! Exiting ..." exit 1 @@ -110,7 +117,7 @@ set -- "${POSITIONAL[@]}" # restore positional parameters if [[ -z $CLANG_FORMAT_BIN ]]; then CLANG_FORMAT_BIN=$(command -v clang-format) if [[ -z $CLANG_FORMAT_BIN ]]; then - CLANG_FORMAT_BIN=$(command -v clang-format-11) + CLANG_FORMAT_BIN=$(command -v clang-format-15) # if it still doesn't exist exit if [[ -z $CLANG_FORMAT_BIN ]]; then echo "*** ERR: clang-format not found! Exiting ..." @@ -118,6 +125,8 @@ if [[ -z $CLANG_FORMAT_BIN ]]; then fi fi fi +echo "* Using clang-format binary: $CLANG_FORMAT_BIN" +echo "* Using version: $($CLANG_FORMAT_BIN --version)" FAIL=false -- GitLab From 9d411e8eee27803308eb8649c62d3e33dbad602d Mon Sep 17 00:00:00 2001 From: Marc Vef Date: Wed, 1 Mar 2023 18:29:53 +0100 Subject: [PATCH 2/4] Reformat code adhering to clang-format-15 --- include/common/rpc/rpc_types.hpp | 90 +++++++++++++++++--------------- src/common/path_util.cpp | 3 +- 2 files changed, 50 insertions(+), 43 deletions(-) diff --git a/include/common/rpc/rpc_types.hpp b/include/common/rpc/rpc_types.hpp index 7c05d68c1..81450ba68 100644 --- a/include/common/rpc/rpc_types.hpp +++ b/include/common/rpc/rpc_types.hpp @@ -37,87 +37,93 @@ extern "C" { /* visible API for RPC data types used in RPCS */ // misc generic rpc types -MERCURY_GEN_PROC(rpc_err_out_t, ((hg_int32_t)(err))) +MERCURY_GEN_PROC(rpc_err_out_t, ((hg_int32_t) (err))) // Metadentry MERCURY_GEN_PROC(rpc_mk_node_in_t, - ((hg_const_string_t)(path))((uint32_t)(mode))) + ((hg_const_string_t) (path))((uint32_t) (mode))) -MERCURY_GEN_PROC(rpc_path_only_in_t, ((hg_const_string_t)(path))) +MERCURY_GEN_PROC(rpc_path_only_in_t, ((hg_const_string_t) (path))) MERCURY_GEN_PROC(rpc_stat_out_t, - ((hg_int32_t)(err))((hg_const_string_t)(db_val))) + ((hg_int32_t) (err))((hg_const_string_t) (db_val))) -MERCURY_GEN_PROC(rpc_rm_node_in_t, ((hg_const_string_t)(path))) +MERCURY_GEN_PROC(rpc_rm_node_in_t, ((hg_const_string_t) (path))) -MERCURY_GEN_PROC(rpc_rm_metadata_out_t, - ((hg_int32_t)(err))((hg_int64_t)(size))((hg_uint32_t)(mode))) +MERCURY_GEN_PROC( + rpc_rm_metadata_out_t, + ((hg_int32_t) (err))((hg_int64_t) (size))((hg_uint32_t) (mode))) MERCURY_GEN_PROC(rpc_trunc_in_t, - ((hg_const_string_t)(path))((hg_uint64_t)(length))) + ((hg_const_string_t) (path))((hg_uint64_t) (length))) MERCURY_GEN_PROC( rpc_update_metadentry_in_t, - ((hg_const_string_t)(path))((uint64_t)(nlink))((hg_uint32_t)(mode))( - (hg_uint32_t)(uid))((hg_uint32_t)(gid))((hg_int64_t)(size))( - (hg_int64_t)(blocks))((hg_int64_t)(atime))((hg_int64_t)(mtime))( - (hg_int64_t)(ctime))((hg_bool_t)(nlink_flag))( - (hg_bool_t)(mode_flag))((hg_bool_t)(size_flag))( - (hg_bool_t)(block_flag))((hg_bool_t)(atime_flag))( - (hg_bool_t)(mtime_flag))((hg_bool_t)(ctime_flag))) + ((hg_const_string_t) (path))((uint64_t) (nlink))((hg_uint32_t) (mode))( + (hg_uint32_t) (uid))((hg_uint32_t) (gid))((hg_int64_t) (size))( + (hg_int64_t) (blocks))((hg_int64_t) (atime))( + (hg_int64_t) (mtime))((hg_int64_t) (ctime))( + (hg_bool_t) (nlink_flag))((hg_bool_t) (mode_flag))( + (hg_bool_t) (size_flag))((hg_bool_t) (block_flag))( + (hg_bool_t) (atime_flag))((hg_bool_t) (mtime_flag))( + (hg_bool_t) (ctime_flag))) MERCURY_GEN_PROC(rpc_update_metadentry_size_in_t, - ((hg_const_string_t)(path))((hg_uint64_t)(size))( - (hg_int64_t)(offset))((hg_bool_t)(append))) + ((hg_const_string_t) (path))((hg_uint64_t) (size))( + (hg_int64_t) (offset))((hg_bool_t) (append))) MERCURY_GEN_PROC(rpc_update_metadentry_size_out_t, - ((hg_int32_t)(err))((hg_int64_t)(ret_size))) + ((hg_int32_t) (err))((hg_int64_t) (ret_size))) MERCURY_GEN_PROC(rpc_get_metadentry_size_out_t, - ((hg_int32_t)(err))((hg_int64_t)(ret_size))) + ((hg_int32_t) (err))((hg_int64_t) (ret_size))) #ifdef HAS_SYMLINKS -MERCURY_GEN_PROC(rpc_mk_symlink_in_t, - ((hg_const_string_t)(path))((hg_const_string_t)(target_path))) +MERCURY_GEN_PROC(rpc_mk_symlink_in_t, ((hg_const_string_t) (path))(( + hg_const_string_t) (target_path))) #endif // data MERCURY_GEN_PROC( rpc_read_data_in_t, - ((hg_const_string_t)(path))((int64_t)(offset))((hg_uint64_t)(host_id))( - (hg_uint64_t)(host_size))((hg_uint64_t)(chunk_n))( - (hg_uint64_t)(chunk_start))((hg_uint64_t)(chunk_end))( - (hg_uint64_t)(total_chunk_size))((hg_bulk_t)(bulk_handle))) + ((hg_const_string_t) (path))((int64_t) (offset))( + (hg_uint64_t) (host_id))((hg_uint64_t) (host_size))( + (hg_uint64_t) (chunk_n))((hg_uint64_t) (chunk_start))( + (hg_uint64_t) (chunk_end))((hg_uint64_t) (total_chunk_size))( + (hg_bulk_t) (bulk_handle))) -MERCURY_GEN_PROC(rpc_data_out_t, ((int32_t)(err))((hg_size_t)(io_size))) +MERCURY_GEN_PROC(rpc_data_out_t, ((int32_t) (err))((hg_size_t) (io_size))) MERCURY_GEN_PROC( rpc_write_data_in_t, - ((hg_const_string_t)(path))((int64_t)(offset))((hg_uint64_t)(host_id))( - (hg_uint64_t)(host_size))((hg_uint64_t)(chunk_n))( - (hg_uint64_t)(chunk_start))((hg_uint64_t)(chunk_end))( - (hg_uint64_t)(total_chunk_size))((hg_bulk_t)(bulk_handle))) + ((hg_const_string_t) (path))((int64_t) (offset))( + (hg_uint64_t) (host_id))((hg_uint64_t) (host_size))( + (hg_uint64_t) (chunk_n))((hg_uint64_t) (chunk_start))( + (hg_uint64_t) (chunk_end))((hg_uint64_t) (total_chunk_size))( + (hg_bulk_t) (bulk_handle))) MERCURY_GEN_PROC(rpc_get_dirents_in_t, - ((hg_const_string_t)(path))((hg_bulk_t)(bulk_handle))) + ((hg_const_string_t) (path))((hg_bulk_t) (bulk_handle))) MERCURY_GEN_PROC(rpc_get_dirents_out_t, - ((hg_int32_t)(err))((hg_size_t)(dirents_size))) + ((hg_int32_t) (err))((hg_size_t) (dirents_size))) -MERCURY_GEN_PROC(rpc_config_out_t, - ((hg_const_string_t)(mountdir))((hg_const_string_t)(rootdir))( - (hg_bool_t)(atime_state))((hg_bool_t)(mtime_state))( - (hg_bool_t)(ctime_state))((hg_bool_t)(link_cnt_state))( - (hg_bool_t)(blocks_state))((hg_uint32_t)(uid))( - (hg_uint32_t)(gid))) +MERCURY_GEN_PROC( + rpc_config_out_t, + ((hg_const_string_t) (mountdir))((hg_const_string_t) (rootdir))( + (hg_bool_t) (atime_state))((hg_bool_t) (mtime_state))( + (hg_bool_t) (ctime_state))((hg_bool_t) (link_cnt_state))( + (hg_bool_t) (blocks_state))((hg_uint32_t) (uid))( + (hg_uint32_t) (gid))) -MERCURY_GEN_PROC(rpc_chunk_stat_in_t, ((hg_int32_t)(dummy))) +MERCURY_GEN_PROC(rpc_chunk_stat_in_t, ((hg_int32_t) (dummy))) -MERCURY_GEN_PROC(rpc_chunk_stat_out_t, - ((hg_int32_t)(err))((hg_uint64_t)(chunk_size))( - (hg_uint64_t)(chunk_total))((hg_uint64_t)(chunk_free))) +MERCURY_GEN_PROC( + rpc_chunk_stat_out_t, + ((hg_int32_t) (err))((hg_uint64_t) (chunk_size))( + (hg_uint64_t) (chunk_total))((hg_uint64_t) (chunk_free))) #endif // LFS_RPC_TYPES_HPP diff --git a/src/common/path_util.cpp b/src/common/path_util.cpp index 6ff0bf112..b21df037f 100644 --- a/src/common/path_util.cpp +++ b/src/common/path_util.cpp @@ -133,7 +133,8 @@ absolute_to_relative(const string& root_path, const string& absolute_path) { auto rel_it_end = absolute_path.cend(); // relative path start exactly after the root_path prefix - assert((size_t)(rel_it_begin - absolute_path.cbegin()) == root_path.size()); + assert((size_t) (rel_it_begin - absolute_path.cbegin()) == + root_path.size()); if(rel_it_begin == rel_it_end) { // relative path is empty, @absolute_path was equal to @root_path -- GitLab From 1adb19cfc077dc6361867440494e437da19ee484 Mon Sep 17 00:00:00 2001 From: Marc Vef Date: Thu, 2 Mar 2023 12:42:08 +0100 Subject: [PATCH 3/4] Update linter Docker file for clang-15 --- docker/0.9.2/linter/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/0.9.2/linter/Dockerfile b/docker/0.9.2/linter/Dockerfile index c36dd4e5d..9f661e87d 100644 --- a/docker/0.9.2/linter/Dockerfile +++ b/docker/0.9.2/linter/Dockerfile @@ -4,15 +4,15 @@ LABEL Description="Debian-based environment to check the formatting of GekkoFS c RUN apt-get update && \ apt-get install -y --no-install-recommends \ - # clang 10 deps for clang-format + # clang 15 deps for clang-format lsb-release \ wget \ software-properties-common \ gnupg2 && \ - # add clang-10 repos - wget https://apt.llvm.org/llvm.sh -P /tmp && chmod +x /tmp/llvm.sh && /tmp/llvm.sh 11 && \ + # add clang-15 repos + wget https://apt.llvm.org/llvm.sh -P /tmp && chmod +x /tmp/llvm.sh && /tmp/llvm.sh 15 && \ # install clang-format - apt-get update && apt-get install -y --no-install-recommends clang-format-11 && \ + apt-get update && apt-get install -y --no-install-recommends clang-format-15 && \ # Clean apt cache to reduce image layer size rm -rf /var/lib/apt/lists/* && rm /tmp/llvm.sh && \ # Clean apt caches of packages -- GitLab From a6f94b105079f9e23f4e86c2fcff849dd062e060 Mon Sep 17 00:00:00 2001 From: Marc Vef Date: Thu, 2 Mar 2023 14:22:09 +0100 Subject: [PATCH 4/4] Added changelog entry --- CHANGELOG.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5faf35a73..6818f1da8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,15 +10,20 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### New - Additional tests to increase code coverage ([!141](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/141)). -- GKFS_ENABLE_UNUSED_FUNCTIONS added to disable code to increase code coverage. -- Updated Parallax version to new API (parallax option needs kv_format.parallax in the path, and the database in a device with O_DIRECT) -- Support for increasing file size via `truncate()` added ([!159](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/159) +- GKFS_ENABLE_UNUSED_FUNCTIONS added to disable code to increase code + coverage. ([!141](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/141)). +- Updated Parallax version to new API (parallax option needs kv_format.parallax in the path, and the database in a + device with O_DIRECT) ([!158](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/158) +- Support for increasing file size via `truncate()` + added ([!159](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/159) - Added PowerPC support ([!151](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/151)). + ### Changed -- Support parallelism for path resolution tests ([!145](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/145)). +- Support parallelism for path resolution + tests ([!145](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/145)). - Support parallelism for symlink tests ([!147](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/147)). -- Updatd Parallax release (PARALLAX-exp) +- Update Parallax release (PARALLAX-exp) ([!158](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/158) ### Removed @@ -45,6 +50,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). pthread_create ([!156](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/156) - Fixed an issue where compilation of syscall_intercept would fail for newer kernels using the `clone3()` system call ([!157](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/157) +- Updated code formatter to support the most recent clang-format-15 + version ([!162](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/162)). ## [0.9.1] - 2022-04-29 -- GitLab