From cb788b1cba70caee3b7d1a6716a4074e3acaff0e Mon Sep 17 00:00:00 2001 From: Thomas Jepp Date: Wed, 16 Dec 2015 21:15:39 +0000 Subject: More fixes to cstore-unionfs & cli_shell_api. --- src/cstore/unionfs/cstore-unionfs.cpp | 21 +++++++++++---------- src/cstore/unionfs/cstore-unionfs.hpp | 6 ++++-- 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src/cstore') diff --git a/src/cstore/unionfs/cstore-unionfs.cpp b/src/cstore/unionfs/cstore-unionfs.cpp index 1324d79..858a204 100644 --- a/src/cstore/unionfs/cstore-unionfs.cpp +++ b/src/cstore/unionfs/cstore-unionfs.cpp @@ -393,7 +393,7 @@ UnionfsCstore::setupSession() try { b_fs::directory_iterator di(work_base.path_cstr()); for (; di != b_fs::directory_iterator(); ++di) { - old_config = di->path().c_str(); + old_config = di->path().string().c_str(); if (path_is_directory(old_config)) { directories.push_back(old_config); } @@ -1211,12 +1211,12 @@ UnionfsCstore::unmark_deactivated_descendants() vector markers; b_fs::recursive_directory_iterator di(get_work_path().path_cstr()); for (; di != b_fs::recursive_directory_iterator(); ++di) { - if (!path_is_regular(di->path().c_str()) + if (!path_is_regular(di->path().string().c_str()) || di->path().filename() != C_MARKER_DEACTIVATE) { // not marker continue; } - const char *ppath = di->path().parent_path().c_str(); + const char *ppath = di->path().parent_path().string().c_str(); if (strcmp(ppath, get_work_path().path_cstr()) == 0) { // don't unmark the node itself continue; @@ -1279,7 +1279,7 @@ UnionfsCstore::unmark_changed_with_descendants() vector markers; b_fs::recursive_directory_iterator di(get_work_path().path_cstr()); for (; di != b_fs::recursive_directory_iterator(); ++di) { - if (!path_is_regular(di->path().c_str()) + if (!path_is_regular(di->path().string().c_str()) || di->path().filename() != C_MARKER_CHANGED) { // not marker continue; @@ -1338,7 +1338,7 @@ UnionfsCstore::discard_changes(unsigned long long& num_removed) // iterate through all entries in change root b_fs::directory_iterator di(change_root.path_cstr()); for (; di != b_fs::directory_iterator(); ++di) { - if (path_is_directory(di->path().c_str())) { + if (path_is_directory(di->path().string().c_str())) { directories.push_back(di->path()); } else { files.push_back(di->path()); @@ -1471,10 +1471,10 @@ UnionfsCstore::check_dir_entries(const FsPath& root, vector *cnodes, try { b_fs::directory_iterator di(root.path_cstr()); for (; di != b_fs::directory_iterator(); ++di) { - string cname = di->path().filename().c_str(); + string cname = di->path().filename().string(); if (filter_nodes) { // must be directory - if (!path_is_directory(di->path().c_str())) { + if (!path_is_directory(di->path().string().c_str())) { continue; } // name cannot start with "." @@ -1573,14 +1573,14 @@ UnionfsCstore::recursive_copy_dir(const FsPath& src, const FsPath& dst, b_fs::recursive_directory_iterator di(src_str); for (; di != b_fs::recursive_directory_iterator(); ++di) { - const char *oname = di->path().c_str(); + const char *oname = di->path().string().c_str(); string nname = oname; nname.replace(0, src_str.length(), dst_str); if (path_is_directory(oname)) { b_fs::create_directory(nname); } else { if (filter_dot_entries) { - string of = di->path().filename().c_str(); + string of = di->path().filename().string(); if (!of.empty() && of.at(0) == '.') { // filter dot files (with exceptions) if (of != C_COMMENT_FILE) { @@ -1688,7 +1688,7 @@ UnionfsCstore::do_umount(const FsPath& mdir) const char *fusermount_path, *fusermount_prog; const char *fusermount_umount; - fusermount_path = "/usr/bin/fusermount"; + fusermount_path = "/bin/fusermount"; fusermount_prog = "fusermount"; fusermount_umount = "-u"; @@ -1776,3 +1776,4 @@ UnionfsCstore::remove_dir_content(const char *path) } // end namespace unionfs } // end namespace cstore + diff --git a/src/cstore/unionfs/cstore-unionfs.hpp b/src/cstore/unionfs/cstore-unionfs.hpp index 95c2b63..1196ae9 100644 --- a/src/cstore/unionfs/cstore-unionfs.hpp +++ b/src/cstore/unionfs/cstore-unionfs.hpp @@ -34,6 +34,7 @@ namespace commit { class PrioNode; } +using namespace boost::filesystem; namespace cstore { // begin namespace cstore namespace unionfs { // begin namespace unionfs @@ -291,8 +292,8 @@ private: // boost fs operations wrappers bool b_fs_get_file_status(const char *path, b_fs::file_status& fs) { b_s::error_code ec; - b_s::error_code* p_ec = &ec; - fs = b_fs::detail::status(path, p_ec); + file_status s = status(path, ec); + fs = s; return (!ec); }; bool path_exists(const char *path); @@ -315,3 +316,4 @@ private: #endif /* _CSTORE_UNIONFS_H_ */ + -- cgit v1.2.3