From 3f318281ec567f7c8209f684fccee64b6238ab86 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sat, 15 Nov 2014 23:47:38 +0100 Subject: [PATCH] Rename FuseFile -> File and so on --- src/cryfs_lib/CryDevice.cpp | 2 +- src/cryfs_lib/CryDevice.h | 6 ++--- src/cryfs_lib/CryDir.cpp | 4 +-- src/cryfs_lib/CryDir.h | 8 +++--- src/cryfs_lib/CryFile.cpp | 2 +- src/cryfs_lib/CryFile.h | 6 ++--- src/cryfs_lib/CryNode.h | 4 +-- src/cryfs_lib/CryOpenFile.h | 4 +-- src/fusepp/fs_interface/Device.h | 22 ++++++++++++++++ src/fusepp/fs_interface/Dir.h | 26 +++++++++++++++++++ src/fusepp/fs_interface/File.h | 23 ++++++++++++++++ src/fusepp/fs_interface/FuseDevice.h | 22 ---------------- src/fusepp/fs_interface/FuseDir.h | 26 ------------------- src/fusepp/fs_interface/FuseFile.h | 23 ---------------- .../fs_interface/{FuseNode.h => Node.h} | 10 +++---- .../{FuseOpenFile.h => OpenFile.h} | 12 ++++----- src/fusepp/fusebindings/Fuse.h | 2 +- src/fusepp/impl/FilesystemImpl.cpp | 18 ++++++------- src/fusepp/impl/FilesystemImpl.h | 18 ++++++------- src/fusepp/impl/FuseOpenFileList.h | 14 +++++----- 20 files changed, 126 insertions(+), 126 deletions(-) create mode 100644 src/fusepp/fs_interface/Device.h create mode 100644 src/fusepp/fs_interface/Dir.h create mode 100644 src/fusepp/fs_interface/File.h delete mode 100644 src/fusepp/fs_interface/FuseDevice.h delete mode 100644 src/fusepp/fs_interface/FuseDir.h delete mode 100644 src/fusepp/fs_interface/FuseFile.h rename src/fusepp/fs_interface/{FuseNode.h => Node.h} (72%) rename src/fusepp/fs_interface/{FuseOpenFile.h => OpenFile.h} (70%) diff --git a/src/cryfs_lib/CryDevice.cpp b/src/cryfs_lib/CryDevice.cpp index e7c324a5..fbb2b751 100644 --- a/src/cryfs_lib/CryDevice.cpp +++ b/src/cryfs_lib/CryDevice.cpp @@ -21,7 +21,7 @@ CryDevice::CryDevice(const bf::path &root_path): _root_path(root_path) { CryDevice::~CryDevice() { } -unique_ptr CryDevice::Load(const bf::path &path) { +unique_ptr CryDevice::Load(const bf::path &path) { auto real_path = RootDir() / path; if(bf::is_directory(real_path)) { return make_unique(this, path); diff --git a/src/cryfs_lib/CryDevice.h b/src/cryfs_lib/CryDevice.h index 025813e6..74ca5051 100644 --- a/src/cryfs_lib/CryDevice.h +++ b/src/cryfs_lib/CryDevice.h @@ -3,15 +3,15 @@ #define CRYFS_LIB_CRYDEVICE_H_ #include +#include -#include "fusepp/fs_interface/FuseDevice.h" #include "fusepp/utils/macros.h" namespace cryfs { namespace bf = boost::filesystem; -class CryDevice: public fusepp::FuseDevice { +class CryDevice: public fusepp::Device { public: CryDevice(const bf::path &rootdir); virtual ~CryDevice(); @@ -20,7 +20,7 @@ public: const bf::path &RootDir() const; private: - std::unique_ptr Load(const bf::path &path) override; + std::unique_ptr Load(const bf::path &path) override; const bf::path _root_path; diff --git a/src/cryfs_lib/CryDir.cpp b/src/cryfs_lib/CryDir.cpp index e1258371..ebe1c839 100644 --- a/src/cryfs_lib/CryDir.cpp +++ b/src/cryfs_lib/CryDir.cpp @@ -29,7 +29,7 @@ CryDir::CryDir(CryDevice *device, const bf::path &path) CryDir::~CryDir() { } -unique_ptr CryDir::createFile(const string &name, mode_t mode) { +unique_ptr CryDir::createFile(const string &name, mode_t mode) { auto file_path = base_path() / name; //Create file int fd = ::creat(file_path.c_str(), mode); @@ -38,7 +38,7 @@ unique_ptr CryDir::createFile(const string &name, mode_t mode) return make_unique(device(), path() / name); } -unique_ptr CryDir::createDir(const string &name, mode_t mode) { +unique_ptr CryDir::createDir(const string &name, mode_t mode) { auto dir_path = base_path() / name; //Create dir int retval = ::mkdir(dir_path.c_str(), mode); diff --git a/src/cryfs_lib/CryDir.h b/src/cryfs_lib/CryDir.h index cc03b6f4..a7274256 100644 --- a/src/cryfs_lib/CryDir.h +++ b/src/cryfs_lib/CryDir.h @@ -2,19 +2,19 @@ #ifndef CRYFS_LIB_CRYDIR_H_ #define CRYFS_LIB_CRYDIR_H_ -#include "fusepp/fs_interface/FuseDir.h" +#include #include "CryNode.h" namespace cryfs { -class CryDir: public fusepp::FuseDir, CryNode { +class CryDir: public fusepp::Dir, CryNode { public: CryDir(CryDevice *device, const bf::path &path); virtual ~CryDir(); //TODO return type variance to CryFile/CryDir? - std::unique_ptr createFile(const std::string &name, mode_t mode) override; - std::unique_ptr createDir(const std::string &name, mode_t mode) override; + std::unique_ptr createFile(const std::string &name, mode_t mode) override; + std::unique_ptr createDir(const std::string &name, mode_t mode) override; void rmdir() override; std::unique_ptr> children() const override; diff --git a/src/cryfs_lib/CryFile.cpp b/src/cryfs_lib/CryFile.cpp index 563816d0..0f537473 100644 --- a/src/cryfs_lib/CryFile.cpp +++ b/src/cryfs_lib/CryFile.cpp @@ -22,7 +22,7 @@ CryFile::CryFile(CryDevice *device, const bf::path &path) CryFile::~CryFile() { } -unique_ptr CryFile::open(int flags) const { +unique_ptr CryFile::open(int flags) const { return make_unique(device(), path(), flags); } diff --git a/src/cryfs_lib/CryFile.h b/src/cryfs_lib/CryFile.h index 5636c82f..56a19808 100644 --- a/src/cryfs_lib/CryFile.h +++ b/src/cryfs_lib/CryFile.h @@ -2,17 +2,17 @@ #ifndef CRYFS_LIB_CRYFILE_H_ #define CRYFS_LIB_CRYFILE_H_ +#include #include "CryNode.h" -#include "fusepp/fs_interface/FuseFile.h" namespace cryfs { -class CryFile: public fusepp::FuseFile, CryNode { +class CryFile: public fusepp::File, CryNode { public: CryFile(CryDevice *device, const boost::filesystem::path &path); virtual ~CryFile(); - std::unique_ptr open(int flags) const override; + std::unique_ptr open(int flags) const override; void truncate(off_t size) const override; void unlink() override; diff --git a/src/cryfs_lib/CryNode.h b/src/cryfs_lib/CryNode.h index d3b7263e..10e774d8 100644 --- a/src/cryfs_lib/CryNode.h +++ b/src/cryfs_lib/CryNode.h @@ -2,14 +2,14 @@ #ifndef CRYFS_LIB_CRYNODE_H_ #define CRYFS_LIB_CRYNODE_H_ -#include "fusepp/fs_interface/FuseNode.h" +#include #include "fusepp/utils/macros.h" #include "CryDevice.h" namespace cryfs { -class CryNode: public virtual fusepp::FuseNode { +class CryNode: public virtual fusepp::Node { public: CryNode(CryDevice *device, const boost::filesystem::path &path); virtual ~CryNode(); diff --git a/src/cryfs_lib/CryOpenFile.h b/src/cryfs_lib/CryOpenFile.h index 89b1ad0f..c32f2a3c 100644 --- a/src/cryfs_lib/CryOpenFile.h +++ b/src/cryfs_lib/CryOpenFile.h @@ -2,13 +2,13 @@ #ifndef CRYFS_LIB_CRYOPENFILE_H_ #define CRYFS_LIB_CRYOPENFILE_H_ -#include "fusepp/fs_interface/FuseOpenFile.h" +#include #include "fusepp/utils/macros.h" namespace cryfs { class CryDevice; -class CryOpenFile: public fusepp::FuseOpenFile { +class CryOpenFile: public fusepp::OpenFile { public: CryOpenFile(const CryDevice *device, const boost::filesystem::path &path, int flags); virtual ~CryOpenFile(); diff --git a/src/fusepp/fs_interface/Device.h b/src/fusepp/fs_interface/Device.h new file mode 100644 index 00000000..ddb49c29 --- /dev/null +++ b/src/fusepp/fs_interface/Device.h @@ -0,0 +1,22 @@ +#pragma once +#ifndef FUSEPP_DEVICE_H_ +#define FUSEPP_DEVICE_H_ + +#include +#include +#include + +namespace fusepp { +class Node; + +class Device { +public: + virtual ~Device() {} + + virtual void statfs(const boost::filesystem::path &path, struct ::statvfs *fsstat) = 0; + virtual std::unique_ptr Load(const boost::filesystem::path &path) = 0; +}; + +} + +#endif /* FUSEPP_DEVICE_H_ */ diff --git a/src/fusepp/fs_interface/Dir.h b/src/fusepp/fs_interface/Dir.h new file mode 100644 index 00000000..1b6666ad --- /dev/null +++ b/src/fusepp/fs_interface/Dir.h @@ -0,0 +1,26 @@ +#pragma once +#ifndef FUSEPP_DIR_H_ +#define FUSEPP_DIR_H_ + +#include +#include +#include + +namespace fusepp { +class Device; +class File; + +class Dir: public virtual Node { +public: + virtual ~Dir() {} + + virtual std::unique_ptr createFile(const std::string &name, mode_t mode) = 0; + virtual std::unique_ptr createDir(const std::string &name, mode_t mode) = 0; + virtual void rmdir() = 0; + + virtual std::unique_ptr> children() const = 0; +}; + +} /* namespace fusepp */ + +#endif /* FUSEPP_DIR_H_ */ diff --git a/src/fusepp/fs_interface/File.h b/src/fusepp/fs_interface/File.h new file mode 100644 index 00000000..1aaa4495 --- /dev/null +++ b/src/fusepp/fs_interface/File.h @@ -0,0 +1,23 @@ +#pragma once +#ifndef FUSEPP_FILE_H_ +#define FUSEPP_FILE_H_ + +#include +#include + +namespace fusepp { +class Device; +class OpenFile; + +class File: public virtual Node { +public: + virtual ~File() {} + + virtual std::unique_ptr open(int flags) const = 0; + virtual void truncate(off_t size) const = 0; + virtual void unlink() = 0; +}; + +} /* namespace fusepp */ + +#endif /* FUSEPP_FILE_H_ */ diff --git a/src/fusepp/fs_interface/FuseDevice.h b/src/fusepp/fs_interface/FuseDevice.h deleted file mode 100644 index f0a3a991..00000000 --- a/src/fusepp/fs_interface/FuseDevice.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once -#ifndef FUSEPP_FUSEDEVICE_H_ -#define FUSEPP_FUSEDEVICE_H_ - -#include -#include -#include - -namespace fusepp { -class FuseNode; - -class FuseDevice { -public: - virtual ~FuseDevice() {} - - virtual void statfs(const boost::filesystem::path &path, struct ::statvfs *fsstat) = 0; - virtual std::unique_ptr Load(const boost::filesystem::path &path) = 0; -}; - -} - -#endif /* FUSEPP_FUSEDEVICE_H_ */ diff --git a/src/fusepp/fs_interface/FuseDir.h b/src/fusepp/fs_interface/FuseDir.h deleted file mode 100644 index 7a83e887..00000000 --- a/src/fusepp/fs_interface/FuseDir.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#ifndef FUSEPP_FUSEDIR_H_ -#define FUSEPP_FUSEDIR_H_ - -#include "FuseNode.h" -#include -#include - -namespace fusepp { -class FuseDevice; -class FuseFile; - -class FuseDir: public virtual FuseNode { -public: - virtual ~FuseDir() {} - - virtual std::unique_ptr createFile(const std::string &name, mode_t mode) = 0; - virtual std::unique_ptr createDir(const std::string &name, mode_t mode) = 0; - virtual void rmdir() = 0; - - virtual std::unique_ptr> children() const = 0; -}; - -} /* namespace fusepp */ - -#endif /* FUSEPP_FUSEDIR_H_ */ diff --git a/src/fusepp/fs_interface/FuseFile.h b/src/fusepp/fs_interface/FuseFile.h deleted file mode 100644 index 1f73fd83..00000000 --- a/src/fusepp/fs_interface/FuseFile.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once -#ifndef FUSEPP_FUSEFILE_H_ -#define FUSEPP_FUSEFILE_H_ - -#include "FuseNode.h" -#include - -namespace fusepp { -class FuseDevice; -class FuseOpenFile; - -class FuseFile: public virtual FuseNode { -public: - virtual ~FuseFile() {} - - virtual std::unique_ptr open(int flags) const = 0; - virtual void truncate(off_t size) const = 0; - virtual void unlink() = 0; -}; - -} /* namespace fusepp */ - -#endif /* FUSEPP_FUSEFILE_H_ */ diff --git a/src/fusepp/fs_interface/FuseNode.h b/src/fusepp/fs_interface/Node.h similarity index 72% rename from src/fusepp/fs_interface/FuseNode.h rename to src/fusepp/fs_interface/Node.h index 4bdc98fb..a4951a8c 100644 --- a/src/fusepp/fs_interface/FuseNode.h +++ b/src/fusepp/fs_interface/Node.h @@ -1,6 +1,6 @@ #pragma once -#ifndef FUSEPP_FUSENODE_H_ -#define FUSEPP_FUSENODE_H_ +#ifndef FUSEPP_NODE_H_ +#define FUSEPP_NODE_H_ #include @@ -8,9 +8,9 @@ namespace fusepp { -class FuseNode { +class Node { public: - virtual ~FuseNode() {} + virtual ~Node() {} virtual void stat(struct ::stat *result) const = 0; virtual void access(int mask) const = 0; @@ -20,4 +20,4 @@ public: } /* namespace fusepp */ -#endif /* FUSEPP_FUSENODE_H_ */ +#endif /* FUSEPP_NODE_H_ */ diff --git a/src/fusepp/fs_interface/FuseOpenFile.h b/src/fusepp/fs_interface/OpenFile.h similarity index 70% rename from src/fusepp/fs_interface/FuseOpenFile.h rename to src/fusepp/fs_interface/OpenFile.h index 2d5d748c..bd60a64b 100644 --- a/src/fusepp/fs_interface/FuseOpenFile.h +++ b/src/fusepp/fs_interface/OpenFile.h @@ -1,16 +1,16 @@ #pragma once -#ifndef FUSEPP_FUSEOPENFILE_H_ -#define FUSEPP_FUSEOPENFILE_H_ +#ifndef FUSEPP_OPENFILE_H_ +#define FUSEPP_OPENFILE_H_ #include #include namespace fusepp { -class FuseDevice; +class Device; -class FuseOpenFile { +class OpenFile { public: - virtual ~FuseOpenFile() {} + virtual ~OpenFile() {} virtual void stat(struct ::stat *result) const = 0; virtual void truncate(off_t size) const = 0; @@ -22,4 +22,4 @@ public: } -#endif /* FUSEPP_FUSEOPENFILE_H_ */ +#endif /* FUSEPP_OPENFILE_H_ */ diff --git a/src/fusepp/fusebindings/Fuse.h b/src/fusepp/fusebindings/Fuse.h index 4b6bba72..9e4fa06f 100644 --- a/src/fusepp/fusebindings/Fuse.h +++ b/src/fusepp/fusebindings/Fuse.h @@ -11,7 +11,7 @@ #include "../utils/macros.h" namespace fusepp { -class FuseDevice; +class Device; class FilesystemImpl; namespace fusebindings { diff --git a/src/fusepp/impl/FilesystemImpl.cpp b/src/fusepp/impl/FilesystemImpl.cpp index 5cfa6b68..627abe15 100644 --- a/src/fusepp/impl/FilesystemImpl.cpp +++ b/src/fusepp/impl/FilesystemImpl.cpp @@ -2,11 +2,11 @@ #include #include +#include +#include -#include "fusepp/fs_interface/FuseDevice.h" -#include "fusepp/fs_interface/FuseDir.h" #include "FuseErrnoException.h" -#include "fusepp/fs_interface/FuseFile.h" +#include "fusepp/fs_interface/File.h" #include "fusepp/utils/pointer.h" @@ -20,25 +20,25 @@ using std::string; namespace bf = boost::filesystem; -FilesystemImpl::FilesystemImpl(FuseDevice *device) +FilesystemImpl::FilesystemImpl(Device *device) :_device(device), _open_files() { } FilesystemImpl::~FilesystemImpl() { } -unique_ptr FilesystemImpl::LoadFile(const bf::path &path) { +unique_ptr FilesystemImpl::LoadFile(const bf::path &path) { auto node = _device->Load(path); - auto file = dynamic_pointer_move(node); + auto file = dynamic_pointer_move(node); if (!file) { throw FuseErrnoException(EISDIR); } return file; } -unique_ptr FilesystemImpl::LoadDir(const bf::path &path) { +unique_ptr FilesystemImpl::LoadDir(const bf::path &path) { auto node = _device->Load(path); - auto dir = dynamic_pointer_move(node); + auto dir = dynamic_pointer_move(node); if (!dir) { throw FuseErrnoException(ENOTDIR); } @@ -50,7 +50,7 @@ int FilesystemImpl::openFile(const bf::path &path, int flags) { return openFile(*file, flags); } -int FilesystemImpl::openFile(const FuseFile &file, int flags) { +int FilesystemImpl::openFile(const File &file, int flags) { return _open_files.open(file, flags); } diff --git a/src/fusepp/impl/FilesystemImpl.h b/src/fusepp/impl/FilesystemImpl.h index 0ed97afb..86cb8364 100644 --- a/src/fusepp/impl/FilesystemImpl.h +++ b/src/fusepp/impl/FilesystemImpl.h @@ -11,14 +11,14 @@ #include "fusepp/utils/macros.h" namespace fusepp { -class FuseNode; -class FuseFile; -class FuseOpenFile; -class FuseDir; +class Node; +class File; +class OpenFile; +class Dir; class FilesystemImpl { public: - FilesystemImpl(FuseDevice *device); + FilesystemImpl(Device *device); virtual ~FilesystemImpl(); int openFile(const boost::filesystem::path &path, int flags); @@ -42,11 +42,11 @@ public: void statfs(const boost::filesystem::path &path, struct statvfs *fsstat); private: - std::unique_ptr LoadFile(const boost::filesystem::path &path); - std::unique_ptr LoadDir(const boost::filesystem::path &path); - int openFile(const FuseFile &file, int flags); + std::unique_ptr LoadFile(const boost::filesystem::path &path); + std::unique_ptr LoadDir(const boost::filesystem::path &path); + int openFile(const File &file, int flags); - FuseDevice *_device; + Device *_device; FuseOpenFileList _open_files; DISALLOW_COPY_AND_ASSIGN(FilesystemImpl); diff --git a/src/fusepp/impl/FuseOpenFileList.h b/src/fusepp/impl/FuseOpenFileList.h index e3fe9642..02d139f4 100644 --- a/src/fusepp/impl/FuseOpenFileList.h +++ b/src/fusepp/impl/FuseOpenFileList.h @@ -2,10 +2,10 @@ #ifndef FUSEPP_FUSEOPENFILELIST_H_ #define FUSEPP_FUSEOPENFILELIST_H_ +#include +#include #include "fusepp/utils/macros.h" #include "IdList.h" -#include "fusepp/fs_interface/FuseFile.h" -#include "fusepp/fs_interface/FuseOpenFile.h" namespace fusepp { @@ -14,12 +14,12 @@ public: FuseOpenFileList(); virtual ~FuseOpenFileList(); - int open(const FuseFile &rhs, int flags); - FuseOpenFile *get(int descriptor); + int open(const File &rhs, int flags); + OpenFile *get(int descriptor); void close(int descriptor); private: - IdList _open_files; + IdList _open_files; DISALLOW_COPY_AND_ASSIGN(FuseOpenFileList); }; @@ -28,11 +28,11 @@ inline FuseOpenFileList::FuseOpenFileList() :_open_files() { } -inline int FuseOpenFileList::open(const FuseFile &file, int flags) { +inline int FuseOpenFileList::open(const File &file, int flags) { return _open_files.add(file.open(flags)); } -inline FuseOpenFile *FuseOpenFileList::get(int descriptor) { +inline OpenFile *FuseOpenFileList::get(int descriptor) { return _open_files.get(descriptor); }