mirror of
https://github.com/mhx/dwarfs.git
synced 2025-08-04 02:06:22 -04:00
refactor: use filesystem_v2_lite
in FUSE driver
This commit is contained in:
parent
fedb708d6a
commit
7978d31b67
@ -295,7 +295,7 @@ struct dwarfs_userdata {
|
|||||||
std::filesystem::path progname;
|
std::filesystem::path progname;
|
||||||
options opts;
|
options opts;
|
||||||
stream_logger lgr;
|
stream_logger lgr;
|
||||||
reader::filesystem_v2 fs;
|
reader::filesystem_v2_lite fs;
|
||||||
iolayer const& iol;
|
iolayer const& iol;
|
||||||
std::optional<dwarfs_analysis> analysis;
|
std::optional<dwarfs_analysis> analysis;
|
||||||
std::shared_ptr<performance_monitor> perfmon;
|
std::shared_ptr<performance_monitor> perfmon;
|
||||||
@ -365,7 +365,7 @@ constexpr std::string_view inodeinfo_xattr{"user.dwarfs.inodeinfo"};
|
|||||||
|
|
||||||
#if !DWARFS_FUSE_LOWLEVEL
|
#if !DWARFS_FUSE_LOWLEVEL
|
||||||
std::optional<reader::inode_view>
|
std::optional<reader::inode_view>
|
||||||
find_inode(PERFMON_SECTION_PARAM_ reader::filesystem_v2& fs,
|
find_inode(PERFMON_SECTION_PARAM_ reader::filesystem_v2_lite& fs,
|
||||||
std::string_view path) {
|
std::string_view path) {
|
||||||
auto dev = fs.find(path);
|
auto dev = fs.find(path);
|
||||||
if (dev) {
|
if (dev) {
|
||||||
@ -793,7 +793,7 @@ class readdir_lowlevel_policy {
|
|||||||
buf_.resize(size);
|
buf_.resize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto find(reader::filesystem_v2& fs) const { return fs.find(ino_); }
|
auto find(reader::filesystem_v2_lite& fs) const { return fs.find(ino_); }
|
||||||
|
|
||||||
bool keep_going() const { return written_ < buf_.size(); }
|
bool keep_going() const { return written_ < buf_.size(); }
|
||||||
|
|
||||||
@ -828,7 +828,7 @@ class readdir_policy {
|
|||||||
, buf_{buf}
|
, buf_{buf}
|
||||||
, filler_{filler} {}
|
, filler_{filler} {}
|
||||||
|
|
||||||
auto find(reader::filesystem_v2& fs) const {
|
auto find(reader::filesystem_v2_lite& fs) const {
|
||||||
std::optional<reader::inode_view> iv;
|
std::optional<reader::inode_view> iv;
|
||||||
if (auto dev = fs.find(path_)) {
|
if (auto dev = fs.find(path_)) {
|
||||||
iv = dev->inode();
|
iv = dev->inode();
|
||||||
@ -853,8 +853,8 @@ class readdir_policy {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename Policy, typename OnInode>
|
template <typename Policy, typename OnInode>
|
||||||
int op_readdir_common(reader::filesystem_v2& fs, Policy& policy, file_off_t off,
|
int op_readdir_common(reader::filesystem_v2_lite& fs, Policy& policy,
|
||||||
OnInode&& on_inode) {
|
file_off_t off, OnInode&& on_inode) {
|
||||||
auto iv = policy.find(fs);
|
auto iv = policy.find(fs);
|
||||||
|
|
||||||
if (!iv) {
|
if (!iv) {
|
||||||
@ -1579,8 +1579,8 @@ void load_filesystem(dwarfs_userdata& userdata) {
|
|||||||
|
|
||||||
LOG_DEBUG << "attempting to load filesystem from " << fsimage;
|
LOG_DEBUG << "attempting to load filesystem from " << fsimage;
|
||||||
|
|
||||||
userdata.fs = reader::filesystem_v2(userdata.lgr, *userdata.iol.os, fsimage,
|
userdata.fs = reader::filesystem_v2_lite(userdata.lgr, *userdata.iol.os,
|
||||||
fsopts, userdata.perfmon);
|
fsimage, fsopts, userdata.perfmon);
|
||||||
|
|
||||||
ti << "file system initialized";
|
ti << "file system initialized";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user