mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-11 13:30:47 -04:00
refactor(dwarfs_main): replace maps with sorted_array_map
This commit is contained in:
parent
830bed5d39
commit
f1f57e9bc2
@ -19,7 +19,6 @@
|
|||||||
* along with dwarfs. If not, see <https://www.gnu.org/licenses/>.
|
* along with dwarfs. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@ -97,6 +96,7 @@
|
|||||||
#include <dwarfs/reader/iovec_read_buf.h>
|
#include <dwarfs/reader/iovec_read_buf.h>
|
||||||
#include <dwarfs/reader/mlock_mode.h>
|
#include <dwarfs/reader/mlock_mode.h>
|
||||||
#include <dwarfs/scope_exit.h>
|
#include <dwarfs/scope_exit.h>
|
||||||
|
#include <dwarfs/sorted_array_map.h>
|
||||||
#include <dwarfs/string.h>
|
#include <dwarfs/string.h>
|
||||||
#include <dwarfs/tool/iolayer.h>
|
#include <dwarfs/tool/iolayer.h>
|
||||||
#include <dwarfs/tool/tool.h>
|
#include <dwarfs/tool/tool.h>
|
||||||
@ -108,6 +108,8 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
using namespace std::string_view_literals;
|
||||||
|
|
||||||
#ifdef DWARFS_FSP_COMPAT
|
#ifdef DWARFS_FSP_COMPAT
|
||||||
using native_stat = struct ::fuse_stat;
|
using native_stat = struct ::fuse_stat;
|
||||||
using native_statvfs = struct ::fuse_statvfs;
|
using native_statvfs = struct ::fuse_statvfs;
|
||||||
@ -269,12 +271,11 @@ constexpr struct ::fuse_opt dwarfs_opts[] = {
|
|||||||
#endif
|
#endif
|
||||||
FUSE_OPT_END};
|
FUSE_OPT_END};
|
||||||
|
|
||||||
std::unordered_map<std::string_view, reader::cache_tidy_strategy> const
|
constexpr sorted_array_map cache_tidy_strategy_map{
|
||||||
cache_tidy_strategy_map{
|
std::pair{"none"sv, reader::cache_tidy_strategy::NONE},
|
||||||
{"none", reader::cache_tidy_strategy::NONE},
|
std::pair{"time"sv, reader::cache_tidy_strategy::EXPIRY_TIME},
|
||||||
{"time", reader::cache_tidy_strategy::EXPIRY_TIME},
|
std::pair{"swap"sv, reader::cache_tidy_strategy::BLOCK_SWAPPED_OUT},
|
||||||
{"swap", reader::cache_tidy_strategy::BLOCK_SWAPPED_OUT},
|
};
|
||||||
};
|
|
||||||
|
|
||||||
constexpr std::string_view pid_xattr{"user.dwarfs.driver.pid"};
|
constexpr std::string_view pid_xattr{"user.dwarfs.driver.pid"};
|
||||||
constexpr std::string_view perfmon_xattr{"user.dwarfs.driver.perfmon"};
|
constexpr std::string_view perfmon_xattr{"user.dwarfs.driver.perfmon"};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user