From 2bf38286bab2ec3dbae8067e2642cdef6b5a04b9 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 19 Apr 2020 00:26:54 -0700 Subject: [PATCH] ircd::fs: Callsite changes for fs::base reorg. --- include/ircd/m/m.h | 5 ++++- ircd/db.cc | 19 +++++++++++-------- ircd/fs.cc | 10 ---------- ircd/mods.cc | 2 +- matrix/dbs.cc | 15 ++++++++------- 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/include/ircd/m/m.h b/include/ircd/m/m.h index 7d76c439c..f1de4bc7e 100644 --- a/include/ircd/m/m.h +++ b/include/ircd/m/m.h @@ -104,7 +104,10 @@ struct ircd::m::matrix std::string module_path { - fs::path_string(fs::base::LIB, "libircd_matrix") + fs::path_string(fs::path_views + { + fs::base::lib, "libircd_matrix" + }) }; ircd::module module diff --git a/ircd/db.cc b/ircd/db.cc index bba1a24f8..17a9d1705 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -164,9 +164,9 @@ void ircd::db::init::directory() try { - const auto dbdir + const string_view &dbdir { - fs::path(fs::base::db) + fs::base::db }; if(!fs::is_dir(dbdir) && (ircd::read_only || ircd::write_avoid)) @@ -215,7 +215,7 @@ try { log, "Direct-IO is not supported in the database directory `%s'" "; Concurrent database queries will not be possible.", - fs::basepath::get(fs::base::DB) + string_view{fs::base::db} }; } catch(const std::exception &e) @@ -237,7 +237,10 @@ ircd::db::direct_io_test_file_path() "SUPPORTS_DIRECT_IO"_sv }; - return fs::path_string(fs::base::DB, test_file_name); + return fs::path_string(fs::path_views + { + fs::base::db, test_file_name + }); } namespace rocksdb::crc32c @@ -3498,7 +3501,7 @@ ircd::db::database::sst::dump::dump(db::column column, { const string_view path_parts[] { - fs::path(fs::base::DB), db::name(d), db::name(c) + fs::base::db, db::name(d), db::name(c) }; path = fs::path_string(path_parts); @@ -8195,9 +8198,9 @@ ircd::db::operator+=(rocksdb::WriteOptions &ret, std::vector ircd::db::available() { - const auto &prefix + const string_view &prefix { - fs::path(fs::base::DB) + fs::base::db }; const auto dirs @@ -8261,7 +8264,7 @@ ircd::db::path(const string_view &name, { const auto &prefix { - fs::path(fs::base::DB) + fs::base::db }; const string_view parts[] diff --git a/ircd/fs.cc b/ircd/fs.cc index 4e4ef10bd..4c3e7f323 100644 --- a/ircd/fs.cc +++ b/ircd/fs.cc @@ -282,16 +282,6 @@ ircd::fs::support::dump_info() { log, "Current working directory: `%s'", cwd(buf) }; - - for_each([](const base &base) - { - log::debug - { - log, "Working %s is `%s'", - basepath::get(base).name, - basepath::get(base).path, - }; - }); #endif } diff --git a/ircd/mods.cc b/ircd/mods.cc index 933659f62..c88b0fefe 100644 --- a/ircd/mods.cc +++ b/ircd/mods.cc @@ -1146,7 +1146,7 @@ catch(const boost::system::system_error &e) decltype(ircd::mods::prefix) ircd::mods::prefix { - fs::path(fs::base::MODULES) + fs::base::modules }; decltype(ircd::mods::suffix) diff --git a/matrix/dbs.cc b/matrix/dbs.cc index f056eb205..bc2a54287 100644 --- a/matrix/dbs.cc +++ b/matrix/dbs.cc @@ -81,19 +81,20 @@ ircd::m::dbs::init::init(const string_view &servername, std::string dbopts) :our_dbpath { - ircd::string(fs::PATH_MAX_LEN | SHRINK_TO_FIT, [&servername] - (const mutable_buffer &buf) + fs::path_string(fs::path_views { - return fs::path(buf, fs::base::DB, servername); + fs::base::db, servername }) } ,their_dbpath { - // NOTE that this is a global change that leaks outside of ircd::m. The - // database directory for the entire process is being changed here. - fs::basepath::set(fs::base::DB, our_dbpath) + fs::base::db } { + // NOTE that this is a global change that leaks outside of ircd::m. The + // database directory for the entire process is being changed here. + fs::base::db.set(our_dbpath); + // Recall the db directory init manually with the now-updated basepath db::init::directory(); @@ -138,7 +139,7 @@ noexcept events = {}; // restore the fs::base::DB path the way we found it. - fs::basepath::set(fs::base::DB, their_dbpath); + fs::base::db.set(their_dbpath); } //