Rename namespace fusepp -> fspp

This commit is contained in:
Sebastian Messmer 2014-11-16 00:05:28 +01:00
parent 3f318281ec
commit e863e5b6ce
28 changed files with 88 additions and 88 deletions

View File

@ -11,7 +11,7 @@ using std::unique_ptr;
using std::make_unique; using std::make_unique;
//TODO Get rid of this in favor of exception hierarchy //TODO Get rid of this in favor of exception hierarchy
using fusepp::CHECK_RETVAL; using fspp::CHECK_RETVAL;
namespace cryfs { namespace cryfs {
@ -21,7 +21,7 @@ CryDevice::CryDevice(const bf::path &root_path): _root_path(root_path) {
CryDevice::~CryDevice() { CryDevice::~CryDevice() {
} }
unique_ptr<fusepp::Node> CryDevice::Load(const bf::path &path) { unique_ptr<fspp::Node> CryDevice::Load(const bf::path &path) {
auto real_path = RootDir() / path; auto real_path = RootDir() / path;
if(bf::is_directory(real_path)) { if(bf::is_directory(real_path)) {
return make_unique<CryDir>(this, path); return make_unique<CryDir>(this, path);
@ -29,7 +29,7 @@ unique_ptr<fusepp::Node> CryDevice::Load(const bf::path &path) {
return make_unique<CryFile>(this, path); return make_unique<CryFile>(this, path);
} }
throw fusepp::FuseErrnoException(ENOENT); throw fspp::FuseErrnoException(ENOENT);
} }
void CryDevice::statfs(const bf::path &path, struct statvfs *fsstat) { void CryDevice::statfs(const bf::path &path, struct statvfs *fsstat) {

View File

@ -11,7 +11,7 @@ namespace cryfs {
namespace bf = boost::filesystem; namespace bf = boost::filesystem;
class CryDevice: public fusepp::Device { class CryDevice: public fspp::Device {
public: public:
CryDevice(const bf::path &rootdir); CryDevice(const bf::path &rootdir);
virtual ~CryDevice(); virtual ~CryDevice();
@ -20,7 +20,7 @@ public:
const bf::path &RootDir() const; const bf::path &RootDir() const;
private: private:
std::unique_ptr<fusepp::Node> Load(const bf::path &path) override; std::unique_ptr<fspp::Node> Load(const bf::path &path) override;
const bf::path _root_path; const bf::path _root_path;

View File

@ -10,7 +10,7 @@
#include "CryFile.h" #include "CryFile.h"
//TODO Get rid of this in favor of exception hierarchy //TODO Get rid of this in favor of exception hierarchy
using fusepp::CHECK_RETVAL; using fspp::CHECK_RETVAL;
namespace bf = boost::filesystem; namespace bf = boost::filesystem;
@ -29,7 +29,7 @@ CryDir::CryDir(CryDevice *device, const bf::path &path)
CryDir::~CryDir() { CryDir::~CryDir() {
} }
unique_ptr<fusepp::File> CryDir::createFile(const string &name, mode_t mode) { unique_ptr<fspp::File> CryDir::createFile(const string &name, mode_t mode) {
auto file_path = base_path() / name; auto file_path = base_path() / name;
//Create file //Create file
int fd = ::creat(file_path.c_str(), mode); int fd = ::creat(file_path.c_str(), mode);
@ -38,7 +38,7 @@ unique_ptr<fusepp::File> CryDir::createFile(const string &name, mode_t mode) {
return make_unique<CryFile>(device(), path() / name); return make_unique<CryFile>(device(), path() / name);
} }
unique_ptr<fusepp::Dir> CryDir::createDir(const string &name, mode_t mode) { unique_ptr<fspp::Dir> CryDir::createDir(const string &name, mode_t mode) {
auto dir_path = base_path() / name; auto dir_path = base_path() / name;
//Create dir //Create dir
int retval = ::mkdir(dir_path.c_str(), mode); int retval = ::mkdir(dir_path.c_str(), mode);
@ -54,7 +54,7 @@ void CryDir::rmdir() {
unique_ptr<vector<string>> CryDir::children() const { unique_ptr<vector<string>> CryDir::children() const {
DIR *dir = ::opendir(base_path().c_str()); DIR *dir = ::opendir(base_path().c_str());
if (dir == nullptr) { if (dir == nullptr) {
throw fusepp::FuseErrnoException(errno); throw fspp::FuseErrnoException(errno);
} }
// Set errno=0 so we can detect whether it changed later // Set errno=0 so we can detect whether it changed later
@ -71,7 +71,7 @@ unique_ptr<vector<string>> CryDir::children() const {
if (errno != 0) { if (errno != 0) {
int readdir_errno = errno; int readdir_errno = errno;
::closedir(dir); ::closedir(dir);
throw fusepp::FuseErrnoException(readdir_errno); throw fspp::FuseErrnoException(readdir_errno);
} }
int retval = ::closedir(dir); int retval = ::closedir(dir);
CHECK_RETVAL(retval); CHECK_RETVAL(retval);

View File

@ -7,14 +7,14 @@
namespace cryfs { namespace cryfs {
class CryDir: public fusepp::Dir, CryNode { class CryDir: public fspp::Dir, CryNode {
public: public:
CryDir(CryDevice *device, const bf::path &path); CryDir(CryDevice *device, const bf::path &path);
virtual ~CryDir(); virtual ~CryDir();
//TODO return type variance to CryFile/CryDir? //TODO return type variance to CryFile/CryDir?
std::unique_ptr<fusepp::File> createFile(const std::string &name, mode_t mode) override; std::unique_ptr<fspp::File> createFile(const std::string &name, mode_t mode) override;
std::unique_ptr<fusepp::Dir> createDir(const std::string &name, mode_t mode) override; std::unique_ptr<fspp::Dir> createDir(const std::string &name, mode_t mode) override;
void rmdir() override; void rmdir() override;
std::unique_ptr<std::vector<std::string>> children() const override; std::unique_ptr<std::vector<std::string>> children() const override;

View File

@ -7,7 +7,7 @@
namespace bf = boost::filesystem; namespace bf = boost::filesystem;
//TODO Get rid of this in favor of exception hierarchy //TODO Get rid of this in favor of exception hierarchy
using fusepp::CHECK_RETVAL; using fspp::CHECK_RETVAL;
using std::unique_ptr; using std::unique_ptr;
using std::make_unique; using std::make_unique;
@ -22,7 +22,7 @@ CryFile::CryFile(CryDevice *device, const bf::path &path)
CryFile::~CryFile() { CryFile::~CryFile() {
} }
unique_ptr<fusepp::OpenFile> CryFile::open(int flags) const { unique_ptr<fspp::OpenFile> CryFile::open(int flags) const {
return make_unique<CryOpenFile>(device(), path(), flags); return make_unique<CryOpenFile>(device(), path(), flags);
} }

View File

@ -7,12 +7,12 @@
namespace cryfs { namespace cryfs {
class CryFile: public fusepp::File, CryNode { class CryFile: public fspp::File, CryNode {
public: public:
CryFile(CryDevice *device, const boost::filesystem::path &path); CryFile(CryDevice *device, const boost::filesystem::path &path);
virtual ~CryFile(); virtual ~CryFile();
std::unique_ptr<fusepp::OpenFile> open(int flags) const override; std::unique_ptr<fspp::OpenFile> open(int flags) const override;
void truncate(off_t size) const override; void truncate(off_t size) const override;
void unlink() override; void unlink() override;

View File

@ -8,7 +8,7 @@
namespace bf = boost::filesystem; namespace bf = boost::filesystem;
//TODO Get rid of this in favor of an exception hierarchy //TODO Get rid of this in favor of an exception hierarchy
using fusepp::CHECK_RETVAL; using fspp::CHECK_RETVAL;
namespace cryfs { namespace cryfs {

View File

@ -9,7 +9,7 @@
namespace cryfs { namespace cryfs {
class CryNode: public virtual fusepp::Node { class CryNode: public virtual fspp::Node {
public: public:
CryNode(CryDevice *device, const boost::filesystem::path &path); CryNode(CryDevice *device, const boost::filesystem::path &path);
virtual ~CryNode(); virtual ~CryNode();

View File

@ -9,7 +9,7 @@
namespace bf = boost::filesystem; namespace bf = boost::filesystem;
//TODO Get rid of this in favor of a exception hierarchy //TODO Get rid of this in favor of a exception hierarchy
using fusepp::CHECK_RETVAL; using fspp::CHECK_RETVAL;
namespace cryfs { namespace cryfs {

View File

@ -8,7 +8,7 @@
namespace cryfs { namespace cryfs {
class CryDevice; class CryDevice;
class CryOpenFile: public fusepp::OpenFile { class CryOpenFile: public fspp::OpenFile {
public: public:
CryOpenFile(const CryDevice *device, const boost::filesystem::path &path, int flags); CryOpenFile(const CryDevice *device, const boost::filesystem::path &path, int flags);
virtual ~CryOpenFile(); virtual ~CryOpenFile();

View File

@ -1,12 +1,12 @@
#pragma once #pragma once
#ifndef FUSEPP_DEVICE_H_ #ifndef FSPP_DEVICE_H_
#define FUSEPP_DEVICE_H_ #define FSPP_DEVICE_H_
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <memory> #include <memory>
#include <sys/statvfs.h> #include <sys/statvfs.h>
namespace fusepp { namespace fspp {
class Node; class Node;
class Device { class Device {
@ -19,4 +19,4 @@ public:
} }
#endif /* FUSEPP_DEVICE_H_ */ #endif /* FSPP_DEVICE_H_ */

View File

@ -1,12 +1,12 @@
#pragma once #pragma once
#ifndef FUSEPP_DIR_H_ #ifndef FSPP_DIR_H_
#define FUSEPP_DIR_H_ #define FSPP_DIR_H_
#include <fusepp/fs_interface/Node.h> #include <fusepp/fs_interface/Node.h>
#include <memory> #include <memory>
#include <string> #include <string>
namespace fusepp { namespace fspp {
class Device; class Device;
class File; class File;
@ -21,6 +21,6 @@ public:
virtual std::unique_ptr<std::vector<std::string>> children() const = 0; virtual std::unique_ptr<std::vector<std::string>> children() const = 0;
}; };
} /* namespace fusepp */ } /* namespace fspp */
#endif /* FUSEPP_DIR_H_ */ #endif /* FSPP_DIR_H_ */

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#ifndef FUSEPP_FILE_H_ #ifndef FSPP_FILE_H_
#define FUSEPP_FILE_H_ #define FSPP_FILE_H_
#include <fusepp/fs_interface/Node.h> #include <fusepp/fs_interface/Node.h>
#include <memory> #include <memory>
namespace fusepp { namespace fspp {
class Device; class Device;
class OpenFile; class OpenFile;
@ -18,6 +18,6 @@ public:
virtual void unlink() = 0; virtual void unlink() = 0;
}; };
} /* namespace fusepp */ } /* namespace fspp */
#endif /* FUSEPP_FILE_H_ */ #endif /* FSPP_FILE_H_ */

View File

@ -1,12 +1,12 @@
#pragma once #pragma once
#ifndef FUSEPP_NODE_H_ #ifndef FSPP_NODE_H_
#define FUSEPP_NODE_H_ #define FSPP_NODE_H_
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <sys/stat.h> #include <sys/stat.h>
namespace fusepp { namespace fspp {
class Node { class Node {
public: public:
@ -18,6 +18,6 @@ public:
virtual void utimens(const timespec times[2]) = 0; virtual void utimens(const timespec times[2]) = 0;
}; };
} /* namespace fusepp */ } /* namespace fspp */
#endif /* FUSEPP_NODE_H_ */ #endif /* FSPP_NODE_H_ */

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#ifndef FUSEPP_OPENFILE_H_ #ifndef FSPP_OPENFILE_H_
#define FUSEPP_OPENFILE_H_ #define FSPP_OPENFILE_H_
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <sys/stat.h> #include <sys/stat.h>
namespace fusepp { namespace fspp {
class Device; class Device;
class OpenFile { class OpenFile {
@ -22,4 +22,4 @@ public:
} }
#endif /* FUSEPP_OPENFILE_H_ */ #endif /* FSPP_OPENFILE_H_ */

View File

@ -11,7 +11,7 @@ using std::string;
namespace bf = boost::filesystem; namespace bf = boost::filesystem;
using namespace fusepp::fusebindings; using namespace fspp::fuse;
#define FUSE_OBJ ((Fuse *) fuse_get_context()->private_data) #define FUSE_OBJ ((Fuse *) fuse_get_context()->private_data)
@ -218,7 +218,7 @@ int Fuse::getattr(const bf::path &path, struct stat *stbuf) {
try { try {
_impl->lstat(path, stbuf); _impl->lstat(path, stbuf);
return 0; return 0;
} catch(fusepp::FuseErrnoException &e) { } catch(fspp::FuseErrnoException &e) {
return -e.getErrno(); return -e.getErrno();
} }
} }
@ -238,7 +238,7 @@ int Fuse::fgetattr(const bf::path &path, struct stat *stbuf, fuse_file_info *fil
try { try {
_impl->fstat(fileinfo->fh, stbuf); _impl->fstat(fileinfo->fh, stbuf);
return 0; return 0;
} catch(fusepp::FuseErrnoException &e) { } catch(fspp::FuseErrnoException &e) {
return -e.getErrno(); return -e.getErrno();
} }
} }
@ -265,7 +265,7 @@ int Fuse::mkdir(const bf::path &path, mode_t mode) {
try { try {
_impl->mkdir(path, mode); _impl->mkdir(path, mode);
return 0; return 0;
} catch(fusepp::FuseErrnoException &e) { } catch(fspp::FuseErrnoException &e) {
return -e.getErrno(); return -e.getErrno();
} }
} }
@ -275,7 +275,7 @@ int Fuse::unlink(const bf::path &path) {
try { try {
_impl->unlink(path); _impl->unlink(path);
return 0; return 0;
} catch(fusepp::FuseErrnoException &e) { } catch(fspp::FuseErrnoException &e) {
return -e.getErrno(); return -e.getErrno();
} }
} }
@ -284,7 +284,7 @@ int Fuse::rmdir(const bf::path &path) {
try { try {
_impl->rmdir(path); _impl->rmdir(path);
return 0; return 0;
} catch(fusepp::FuseErrnoException &e) { } catch(fspp::FuseErrnoException &e) {
return -e.getErrno(); return -e.getErrno();
} }
} }
@ -304,7 +304,7 @@ int Fuse::rename(const bf::path &from, const bf::path &to) {
try { try {
_impl->rename(from, to); _impl->rename(from, to);
return 0; return 0;
} catch(fusepp::FuseErrnoException &e) { } catch(fspp::FuseErrnoException &e) {
return -e.getErrno(); return -e.getErrno();
} }
} }

View File

@ -1,20 +1,19 @@
#pragma once #pragma once
#ifndef FUSEPP_FUSE_H_ #ifndef FSPP_FUSE_FUSE_H_
#define FUSEPP_FUSE_H_ #define FSPP_FUSE_FUSE_H_
#include "params.h" #include "params.h"
#include <fuse.h>
#include <cstdio> #include <cstdio>
#include <string> #include <string>
#include <sys/stat.h> #include <sys/stat.h>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include "../utils/macros.h" #include "../utils/macros.h"
namespace fusepp { namespace fspp {
class Device; class Device;
class FilesystemImpl; class FilesystemImpl;
namespace fusebindings { namespace fuse {
class Fuse { class Fuse {
public: public:
@ -62,4 +61,4 @@ private:
} }
} }
#endif /* FUSEPP_FUSE_H_ */ #endif /* FSPP_FUSE_FUSE_H_ */

View File

@ -1,7 +1,8 @@
#pragma once #pragma once
#ifndef FUSEPP_PARAMS_H_ #ifndef FSPP_FUSE_PARAMS_H_
#define FUSEPP_PARAMS_H_ #define FSPP_FUSE_PARAMS_H_
#define FUSE_USE_VERSION 26 #define FUSE_USE_VERSION 26
#include <fuse.h>
#endif /* FUSEPP_PARAMS_H_ */ #endif /* FSPP_FUSE_PARAMS_H_ */

View File

@ -11,7 +11,7 @@
#include "fusepp/utils/pointer.h" #include "fusepp/utils/pointer.h"
using namespace fusepp; using namespace fspp;
using std::unique_ptr; using std::unique_ptr;
using std::make_unique; using std::make_unique;

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#ifndef FUSEPP_FILESYSTEMIMPL_H_ #ifndef FSPP_IMPL_FILESYSTEMIMPL_H_
#define FUSEPP_FILESYSTEMIMPL_H_ #define FSPP_IMPL_FILESYSTEMIMPL_H_
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include "FuseOpenFileList.h" #include "FuseOpenFileList.h"
@ -10,7 +10,7 @@
#include "fusepp/utils/macros.h" #include "fusepp/utils/macros.h"
namespace fusepp { namespace fspp {
class Node; class Node;
class File; class File;
class OpenFile; class OpenFile;
@ -54,4 +54,4 @@ private:
} }
#endif /* FUSEPP_FILESYSTEMIMPL_H_ */ #endif /* FSPP_IMPL_FILESYSTEMIMPL_H_ */

View File

@ -7,7 +7,7 @@
using std::string; using std::string;
using std::runtime_error; using std::runtime_error;
namespace fusepp { namespace fspp {
FuseErrnoException::FuseErrnoException(int errno_) FuseErrnoException::FuseErrnoException(int errno_)
:runtime_error(strerror(errno_)), _errno(errno_) { :runtime_error(strerror(errno_)), _errno(errno_) {

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#ifndef FUSEPP_FUSEERRNOEXCEPTION_H_ #ifndef FSPP_FUSE_FUSEERRNOEXCEPTION_H_
#define FUSEPP_FUSEERRNOEXCEPTION_H_ #define FSPP_FUSE_FUSEERRNOEXCEPTION_H_
#include <stdexcept> #include <stdexcept>
#include <errno.h> #include <errno.h>
namespace fusepp { namespace fspp {
class FuseErrnoException: public std::runtime_error { class FuseErrnoException: public std::runtime_error {
public: public:
@ -23,6 +23,6 @@ inline void CHECK_RETVAL(int retval) {
} }
} }
} /* namespace fusepp */ } /* namespace fspp */
#endif /* FUSEPP_FUSEERRNOEXCEPTION_H_ */ #endif /* FSPP_FUSE_FUSEERRNOEXCEPTION_H_ */

View File

@ -1,6 +1,6 @@
#include "FuseOpenFileList.h" #include "FuseOpenFileList.h"
using namespace fusepp; using namespace fspp;
FuseOpenFileList::~FuseOpenFileList() { FuseOpenFileList::~FuseOpenFileList() {
} }

View File

@ -1,13 +1,13 @@
#pragma once #pragma once
#ifndef FUSEPP_FUSEOPENFILELIST_H_ #ifndef FSPP_IMPL_FUSEOPENFILELIST_H_
#define FUSEPP_FUSEOPENFILELIST_H_ #define FSPP_IMPL_FUSEOPENFILELIST_H_
#include <fusepp/fs_interface/File.h> #include <fusepp/fs_interface/File.h>
#include <fusepp/fs_interface/OpenFile.h> #include <fusepp/fs_interface/OpenFile.h>
#include "fusepp/utils/macros.h" #include "fusepp/utils/macros.h"
#include "IdList.h" #include "IdList.h"
namespace fusepp { namespace fspp {
class FuseOpenFileList { class FuseOpenFileList {
public: public:
@ -43,4 +43,4 @@ inline void FuseOpenFileList::close(int descriptor) {
} }
#endif /* FUSEPP_FUSEOPENFILELIST_H_ */ #endif /* FSPP_IMPL_FUSEOPENFILELIST_H_ */

View File

@ -1,13 +1,13 @@
#pragma once #pragma once
#ifndef FUSEPP_IDLIST_H_ #ifndef FSPP_FUSE_IDLIST_H_
#define FUSEPP_IDLIST_H_ #define FSPP_FUSE_IDLIST_H_
#include <map> #include <map>
#include <memory> #include <memory>
#include <mutex> #include <mutex>
#include "fusepp/utils/macros.h" #include "fusepp/utils/macros.h"
namespace fusepp { namespace fspp {
template<class Entry> template<class Entry>
class IdList { class IdList {
@ -65,4 +65,4 @@ void IdList<Entry>::remove(int id) {
} /* namespace fusepp */ } /* namespace fusepp */
#endif /* FUSEPP_IDLIST_H_ */ #endif /* FSPP_FUSE_IDLIST_H_ */

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#ifndef FUSEPP_UTILS_MACROS_H_ #ifndef FSPP_UTILS_MACROS_H_
#define FUSEPP_UTILS_MACROS_H_ #define FSPP_UTILS_MACROS_H_
#define DISALLOW_COPY_AND_ASSIGN(Class) \ #define DISALLOW_COPY_AND_ASSIGN(Class) \
Class(const Class &rhs) = delete; \ Class(const Class &rhs) = delete; \
@ -8,4 +8,4 @@
#define UNUSED(expr) (void)(expr) #define UNUSED(expr) (void)(expr)
#endif /* FUSEPP_UTILS_MACROS_H_ */ #endif /* FSPP_UTILS_MACROS_H_ */

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#ifndef FUSEPP_UTILS_POINTER_H_ #ifndef FSPP_UTILS_POINTER_H_
#define FUSEPP_UTILS_POINTER_H_ #define FSPP_UTILS_POINTER_H_
#include <memory> #include <memory>
namespace fusepp { namespace fspp {
template<typename DST, typename SRC> template<typename DST, typename SRC>
inline std::unique_ptr<DST> dynamic_pointer_move(std::unique_ptr<SRC> &source) { inline std::unique_ptr<DST> dynamic_pointer_move(std::unique_ptr<SRC> &source) {

View File

@ -13,8 +13,8 @@ int main (int argc, char *argv[])
{ {
printf("Version: %d\n", buildconfig::VERSION::MAJOR); printf("Version: %d\n", buildconfig::VERSION::MAJOR);
cryfs::CryDevice device(bf::path("/home/heinzi/cryfstest/root")); cryfs::CryDevice device(bf::path("/home/heinzi/cryfstest/root"));
fusepp::FilesystemImpl fsimpl(&device); fspp::FilesystemImpl fsimpl(&device);
fusepp::fusebindings::Fuse fuse(&fsimpl); fspp::fuse::Fuse fuse(&fsimpl);
fuse.run(argc, argv); fuse.run(argc, argv);
return 0; return 0;
} }