LCOV - code coverage report
Current view: top level - src/daemon/handler - srv_management.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 19 21 90.5 %
Date: 2024-04-30 13:21:35 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   Copyright 2018-2024, Barcelona Supercomputing Center (BSC), Spain
       3             :   Copyright 2015-2024, Johannes Gutenberg Universitaet Mainz, Germany
       4             : 
       5             :   This software was partially supported by the
       6             :   EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).
       7             : 
       8             :   This software was partially supported by the
       9             :   ADA-FS project under the SPPEXA project funded by the DFG.
      10             : 
      11             :   This file is part of GekkoFS.
      12             : 
      13             :   GekkoFS is free software: you can redistribute it and/or modify
      14             :   it under the terms of the GNU General Public License as published by
      15             :   the Free Software Foundation, either version 3 of the License, or
      16             :   (at your option) any later version.
      17             : 
      18             :   GekkoFS is distributed in the hope that it will be useful,
      19             :   but WITHOUT ANY WARRANTY; without even the implied warranty of
      20             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      21             :   GNU General Public License for more details.
      22             : 
      23             :   You should have received a copy of the GNU General Public License
      24             :   along with GekkoFS.  If not, see <https://www.gnu.org/licenses/>.
      25             : 
      26             :   SPDX-License-Identifier: GPL-3.0-or-later
      27             : */
      28             : /**
      29             :  * @brief Provides all Margo RPC handler definitions called by Mercury on client
      30             :  * request for all file system management operations.
      31             :  * @internal
      32             :  * The end of the file defines the associates the Margo RPC handler functions
      33             :  * and associates them with their corresponding GekkoFS handler functions.
      34             :  * @endinternal
      35             :  */
      36             : #include <daemon/daemon.hpp>
      37             : #include <daemon/handler/rpc_defs.hpp>
      38             : 
      39             : #include <common/rpc/rpc_types.hpp>
      40             : 
      41             : extern "C" {
      42             : #include <unistd.h>
      43             : }
      44             : 
      45             : using namespace std;
      46             : 
      47             : namespace {
      48             : 
      49             : /**
      50             :  * @brief Responds with general file system meta information requested on client
      51             :  * startup.
      52             :  * @internal
      53             :  * Most notably this is where the client gets the information on which path
      54             :  * GekkoFS is accessible.
      55             :  * @endinteral
      56             :  * @param handle Mercury RPC handle
      57             :  * @return Mercury error code to Mercury
      58             :  */
      59             : hg_return_t
      60         248 : rpc_srv_get_fs_config(hg_handle_t handle) {
      61         248 :     rpc_config_out_t out{};
      62             : 
      63         248 :     GKFS_DATA->spdlogger()->debug("{}() Got config RPC", __func__);
      64             : 
      65             :     // get fs config
      66         248 :     out.mountdir = GKFS_DATA->mountdir().c_str();
      67         248 :     out.rootdir = GKFS_DATA->rootdir().c_str();
      68         248 :     out.atime_state = static_cast<hg_bool_t>(GKFS_DATA->atime_state());
      69         248 :     out.mtime_state = static_cast<hg_bool_t>(GKFS_DATA->mtime_state());
      70         248 :     out.ctime_state = static_cast<hg_bool_t>(GKFS_DATA->ctime_state());
      71         248 :     out.link_cnt_state = static_cast<hg_bool_t>(GKFS_DATA->link_cnt_state());
      72         248 :     out.blocks_state = static_cast<hg_bool_t>(GKFS_DATA->blocks_state());
      73         248 :     out.uid = getuid();
      74         248 :     out.gid = getgid();
      75         248 :     GKFS_DATA->spdlogger()->debug("{}() Sending output configs back to library",
      76         248 :                                   __func__);
      77         248 :     auto hret = margo_respond(handle, &out);
      78         248 :     if(hret != HG_SUCCESS) {
      79           0 :         GKFS_DATA->spdlogger()->error(
      80             :                 "{}() Failed to respond to client to serve file system configurations",
      81           0 :                 __func__);
      82             :     }
      83             : 
      84             :     // Destroy handle when finished
      85         248 :     margo_destroy(handle);
      86         248 :     return HG_SUCCESS;
      87             : }
      88             : 
      89             : } // namespace
      90             : 
      91         496 : DEFINE_MARGO_RPC_HANDLER(rpc_srv_get_fs_config)

Generated by: LCOV version 1.16