Skip to content

Commit

Permalink
construct TierEngine before switching log output to notify user of co…
Browse files Browse the repository at this point in the history
…nfiguration errors
  • Loading branch information
joshuaboud committed Apr 20, 2021
1 parent e02d5e9 commit 840bbeb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
12 changes: 3 additions & 9 deletions src/impl/autotierfs/fuseOps/fusePassthrough.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,15 @@
#include "fuseOps.hpp"
#include "config.hpp"
#include "alert.hpp"

namespace Global{
fs::path config_path_;
fs::path mount_point_;
ConfigOverrides config_overrides_;
}
#include "tierEngine.hpp"

FusePassthrough::FusePassthrough(const fs::path &config_path, const ConfigOverrides &config_overrides){
Global::config_path_ = config_path;
Global::config_overrides_ = config_overrides;
fuse_ops::autotier_ptr = new TierEngine(config_path, config_overrides);
}

// methods
int FusePassthrough::mount_fs(fs::path mountpoint, char *fuse_opts){
Global::mount_point_ = mountpoint; // global
fuse_ops::autotier_ptr->mount_point(mountpoint);
Logging::log.message("Mounting filesystem", 2);
static const struct fuse_operations at_oper = {
.getattr = fuse_ops::getattr,
Expand Down
8 changes: 3 additions & 5 deletions src/impl/autotierfs/fuseOps/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ extern "C" {
}

namespace fuse_ops{
TierEngine *autotier_ptr;

void *init(struct fuse_conn_info *conn, struct fuse_config *cfg){
(void) conn;
cfg->use_ino = 1;
Expand All @@ -49,11 +51,7 @@ namespace fuse_ops{

FusePriv *priv = new FusePriv;

priv->autotier_ = new TierEngine(Global::config_path_, Global::config_overrides_);

priv->mount_point_ = Global::mount_point_;

priv->autotier_->mount_point(Global::mount_point_);
priv->autotier_ = autotier_ptr;

for(std::list<Tier>::iterator tptr = priv->autotier_->get_tiers().begin(); tptr != priv->autotier_->get_tiers().end(); ++tptr)
priv->tiers_.push_back(&(*tptr));
Expand Down
2 changes: 2 additions & 0 deletions src/incl/fuseOps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ namespace l{
}

namespace fuse_ops{
extern TierEngine *autotier_ptr;

int getattr(const char *path, struct stat *stbuf, struct fuse_file_info *fi);

int readlink(const char *path, char *buf, size_t size);
Expand Down

0 comments on commit 840bbeb

Please sign in to comment.