mirror of https://github.com/trapexit/mergerfs.git
Browse Source
Misc changes (#1513)
Misc changes (#1513)
* Start moving to string_view where possible * Rework readdir object to use atomic load/storepull/1514/head
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
61 changed files with 853 additions and 757 deletions
-
2src/branch.cpp
-
2src/branch.hpp
-
28src/branches.cpp
-
13src/branches.hpp
-
2src/category.cpp
-
2src/category.hpp
-
3src/config.hpp
-
2src/config_cachefiles.cpp
-
2src/config_flushonclose.cpp
-
2src/config_follow_symlinks.cpp
-
4src/config_gidcache.cpp
-
4src/config_gidcache.hpp
-
2src/config_inodecalc.cpp
-
2src/config_inodecalc.hpp
-
2src/config_link_exdev.cpp
-
2src/config_log_metrics.cpp
-
2src/config_log_metrics.hpp
-
2src/config_moveonenospc.cpp
-
2src/config_moveonenospc.hpp
-
2src/config_nfsopenhack.cpp
-
2src/config_pagesize.cpp
-
2src/config_pagesize.hpp
-
2src/config_passthrough.cpp
-
2src/config_pid.hpp
-
2src/config_rename_exdev.cpp
-
2src/config_set.cpp
-
2src/config_set.hpp
-
2src/config_statfs.cpp
-
2src/config_statfsignore.cpp
-
2src/config_xattr.cpp
-
2src/enum.hpp
-
254src/from_string.cpp
-
17src/from_string.hpp
-
2src/fs_inode.cpp
-
2src/fs_inode.hpp
-
6src/func.cpp
-
6src/func.hpp
-
2src/fuse_init.cpp
-
55src/fuse_readdir.cpp
-
23src/fuse_readdir.hpp
-
2src/fuse_readdir_base.hpp
-
71src/fuse_readdir_factory.cpp
-
3src/fuse_readdir_factory.hpp
-
12src/fuse_statx_supported.icpp
-
1src/mergerfs.cpp
-
2src/mergerfs_api.cpp
-
81src/num.cpp
-
8src/num.hpp
-
59src/option_parser.cpp
-
6src/policies.cpp
-
10src/policies.hpp
-
145src/resources.cpp
-
63src/state.cpp
-
24src/state.hpp
-
501src/str.cpp
-
33src/str.hpp
-
42src/symlinkify.hpp
-
65src/to_string.cpp
-
6src/to_string.hpp
-
3src/tofrom_string.hpp
-
2src/tofrom_wrapper.hpp
@ -1,3 +1,66 @@ |
|||
#include "state.hpp"
|
|||
|
|||
#include "fmt/core.h"
|
|||
|
|||
#include "errno.hpp"
|
|||
|
|||
|
|||
State state; |
|||
|
|||
// static
|
|||
// void
|
|||
// _register_getattr(State *state_)
|
|||
// {
|
|||
// State::GetSet x;
|
|||
|
|||
// x.get = [state_]() -> std::string
|
|||
// {
|
|||
// return state_->getattr.to_string();
|
|||
// };
|
|||
// x.set = [state_](const std::string_view s_) -> int
|
|||
// {
|
|||
// return state_->getattr.from_string(s_);
|
|||
// };
|
|||
|
|||
// state_->set_getset("user.mergerfs.func.getattr",x);
|
|||
// }
|
|||
|
|||
State::State() |
|||
{ |
|||
// _register_getattr(this);
|
|||
} |
|||
|
|||
void |
|||
State::set_getset(const std::string &name_, |
|||
const State::GetSet &gs_) |
|||
{ |
|||
_getset[name_] = gs_; |
|||
} |
|||
|
|||
int |
|||
State::get(const std::string &key_, |
|||
std::string &val_) |
|||
{ |
|||
std::map<std::string,State::GetSet>::iterator i; |
|||
|
|||
i = _getset.find(key_); |
|||
if((i == _getset.end()) || (!i->second.get)) |
|||
return -ENOATTR; |
|||
|
|||
val_ = i->second.get(); |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
int |
|||
State::set(const std::string &key_, |
|||
const std::string_view val_) |
|||
{ |
|||
std::map<std::string,State::GetSet>::iterator i; |
|||
|
|||
i = _getset.find(key_); |
|||
if((i == _getset.end()) || (!i->second.set)) |
|||
return -ENOATTR; |
|||
|
|||
return i->second.set(val_); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue