mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-29 03:16:56 -05:00
Add new debug printing routines
This commit is contained in:
parent
2082357d3a
commit
18dead4d86
11 changed files with 1443 additions and 24 deletions
|
|
@ -91,6 +91,7 @@ Config::Config()
|
|||
inodecalc("hybrid-hash"),
|
||||
link_cow(false),
|
||||
link_exdev(LinkEXDEV::ENUM::PASSTHROUGH),
|
||||
log_metrics(false),
|
||||
mount(),
|
||||
moveonenospc(false),
|
||||
nfsopenhack(NFSOpenHack::ENUM::OFF),
|
||||
|
|
@ -155,6 +156,7 @@ Config::Config()
|
|||
_map["kernel_cache"] = &kernel_cache;
|
||||
_map["link_cow"] = &link_cow;
|
||||
_map["link-exdev"] = &link_exdev;
|
||||
_map["log.metrics"] = &log_metrics;
|
||||
_map["minfreespace"] = &minfreespace;
|
||||
_map["mount"] = &mount;
|
||||
_map["moveonenospc"] = &moveonenospc;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "config_follow_symlinks.hpp"
|
||||
#include "config_inodecalc.hpp"
|
||||
#include "config_link_exdev.hpp"
|
||||
#include "config_log_metrics.hpp"
|
||||
#include "config_moveonenospc.hpp"
|
||||
#include "config_nfsopenhack.hpp"
|
||||
#include "config_readdir.hpp"
|
||||
|
|
@ -121,6 +122,7 @@ public:
|
|||
ConfigBOOL kernel_cache;
|
||||
ConfigBOOL link_cow;
|
||||
LinkEXDEV link_exdev;
|
||||
LogMetrics log_metrics;
|
||||
ConfigSTR mount;
|
||||
MoveOnENOSPC moveonenospc;
|
||||
NFSOpenHack nfsopenhack;
|
||||
|
|
|
|||
53
src/config_log_metrics.cpp
Normal file
53
src/config_log_metrics.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2021, Antonio SJ Musumeci <trapexit@spawn.link>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "config_log_metrics.hpp"
|
||||
#include "from_string.hpp"
|
||||
#include "to_string.hpp"
|
||||
|
||||
#include "fuse.h"
|
||||
|
||||
LogMetrics::LogMetrics(const bool val_)
|
||||
{
|
||||
fuse_log_metrics_set(val_);
|
||||
}
|
||||
|
||||
std::string
|
||||
LogMetrics::to_string(void) const
|
||||
{
|
||||
bool val;
|
||||
|
||||
val = fuse_log_metrics_get();
|
||||
|
||||
return str::to(val);
|
||||
}
|
||||
|
||||
int
|
||||
LogMetrics::from_string(const std::string &s_)
|
||||
{
|
||||
int rv;
|
||||
bool val;
|
||||
|
||||
rv = str::from(s_,&val);
|
||||
if(rv < 0)
|
||||
return rv;
|
||||
|
||||
fuse_log_metrics_set(val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
31
src/config_log_metrics.hpp
Normal file
31
src/config_log_metrics.hpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2021, Antonio SJ Musumeci <trapexit@spawn.link>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tofrom_string.hpp"
|
||||
|
||||
class LogMetrics : public ToFromString
|
||||
{
|
||||
public:
|
||||
LogMetrics(const bool);
|
||||
|
||||
public:
|
||||
std::string to_string(void) const final;
|
||||
int from_string(const std::string &) final;
|
||||
};
|
||||
|
|
@ -27,8 +27,6 @@
|
|||
#include "str.hpp"
|
||||
#include "ugid.hpp"
|
||||
|
||||
#include "fuse.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -43,14 +41,8 @@ using std::vector;
|
|||
#endif
|
||||
|
||||
typedef char IOCTL_BUF[4096];
|
||||
#define IOCTL_APP_TYPE 0xDF
|
||||
#define IOCTL_FILE_INFO _IOWR(IOCTL_APP_TYPE,0,IOCTL_BUF)
|
||||
#define IOCTL_METRICS_ENABLE _IOWR(IOCTL_APP_TYPE,1,IOCTL_BUF)
|
||||
#define IOCTL_METRICS_DISABLE _IOWR(IOCTL_APP_TYPE,2,IOCTL_BUF)
|
||||
|
||||
static_assert(IOCTL_FILE_INFO == 0xD000DF00,"");
|
||||
static_assert(IOCTL_METRICS_ENABLE == 0xD000DF01,"");
|
||||
static_assert(IOCTL_METRICS_DISABLE == 0xD000DF02,"");
|
||||
#define IOCTL_APP_TYPE 0xDF
|
||||
#define IOCTL_FILE_INFO _IOWR(IOCTL_APP_TYPE,0,IOCTL_BUF)
|
||||
|
||||
#ifndef FS_IOC_GETFLAGS
|
||||
# define FS_IOC_GETFLAGS _IOR('f',1,long)
|
||||
|
|
@ -332,12 +324,6 @@ namespace l
|
|||
{
|
||||
case IOCTL_FILE_INFO:
|
||||
return l::file_info(ffi_,data_);
|
||||
case IOCTL_METRICS_ENABLE:
|
||||
fuse_log_metrics(1);
|
||||
return 0;
|
||||
case IOCTL_METRICS_DISABLE:
|
||||
fuse_log_metrics(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -ENOTTY;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue