Rename FuseFile -> File and so on

This commit is contained in:
Sebastian Messmer 2014-11-15 23:47:38 +01:00
parent 70dbe8108a
commit 3f318281ec
20 changed files with 126 additions and 126 deletions

View File

@ -21,7 +21,7 @@ CryDevice::CryDevice(const bf::path &root_path): _root_path(root_path) {
CryDevice::~CryDevice() {
}
unique_ptr<fusepp::FuseNode> CryDevice::Load(const bf::path &path) {
unique_ptr<fusepp::Node> CryDevice::Load(const bf::path &path) {
auto real_path = RootDir() / path;
if(bf::is_directory(real_path)) {
return make_unique<CryDir>(this, path);

View File

@ -3,15 +3,15 @@
#define CRYFS_LIB_CRYDEVICE_H_
#include <boost/filesystem.hpp>
#include <fusepp/fs_interface/Device.h>
#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<fusepp::FuseNode> Load(const bf::path &path) override;
std::unique_ptr<fusepp::Node> Load(const bf::path &path) override;
const bf::path _root_path;

View File

@ -29,7 +29,7 @@ CryDir::CryDir(CryDevice *device, const bf::path &path)
CryDir::~CryDir() {
}
unique_ptr<fusepp::FuseFile> CryDir::createFile(const string &name, mode_t mode) {
unique_ptr<fusepp::File> 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<fusepp::FuseFile> CryDir::createFile(const string &name, mode_t mode)
return make_unique<CryFile>(device(), path() / name);
}
unique_ptr<fusepp::FuseDir> CryDir::createDir(const string &name, mode_t mode) {
unique_ptr<fusepp::Dir> CryDir::createDir(const string &name, mode_t mode) {
auto dir_path = base_path() / name;
//Create dir
int retval = ::mkdir(dir_path.c_str(), mode);

View File

@ -2,19 +2,19 @@
#ifndef CRYFS_LIB_CRYDIR_H_
#define CRYFS_LIB_CRYDIR_H_
#include "fusepp/fs_interface/FuseDir.h"
#include <fusepp/fs_interface/Dir.h>
#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<fusepp::FuseFile> createFile(const std::string &name, mode_t mode) override;
std::unique_ptr<fusepp::FuseDir> createDir(const std::string &name, mode_t mode) override;
std::unique_ptr<fusepp::File> createFile(const std::string &name, mode_t mode) override;
std::unique_ptr<fusepp::Dir> createDir(const std::string &name, mode_t mode) override;
void rmdir() override;
std::unique_ptr<std::vector<std::string>> children() const override;

View File

@ -22,7 +22,7 @@ CryFile::CryFile(CryDevice *device, const bf::path &path)
CryFile::~CryFile() {
}
unique_ptr<fusepp::FuseOpenFile> CryFile::open(int flags) const {
unique_ptr<fusepp::OpenFile> CryFile::open(int flags) const {
return make_unique<CryOpenFile>(device(), path(), flags);
}

View File

@ -2,17 +2,17 @@
#ifndef CRYFS_LIB_CRYFILE_H_
#define CRYFS_LIB_CRYFILE_H_
#include <fusepp/fs_interface/File.h>
#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<fusepp::FuseOpenFile> open(int flags) const override;
std::unique_ptr<fusepp::OpenFile> open(int flags) const override;
void truncate(off_t size) const override;
void unlink() override;

View File

@ -2,14 +2,14 @@
#ifndef CRYFS_LIB_CRYNODE_H_
#define CRYFS_LIB_CRYNODE_H_
#include "fusepp/fs_interface/FuseNode.h"
#include <fusepp/fs_interface/Node.h>
#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();

View File

@ -2,13 +2,13 @@
#ifndef CRYFS_LIB_CRYOPENFILE_H_
#define CRYFS_LIB_CRYOPENFILE_H_
#include "fusepp/fs_interface/FuseOpenFile.h"
#include <fusepp/fs_interface/OpenFile.h>
#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();

View File

@ -0,0 +1,22 @@
#pragma once
#ifndef FUSEPP_DEVICE_H_
#define FUSEPP_DEVICE_H_
#include <boost/filesystem.hpp>
#include <memory>
#include <sys/statvfs.h>
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<Node> Load(const boost::filesystem::path &path) = 0;
};
}
#endif /* FUSEPP_DEVICE_H_ */

View File

@ -0,0 +1,26 @@
#pragma once
#ifndef FUSEPP_DIR_H_
#define FUSEPP_DIR_H_
#include <fusepp/fs_interface/Node.h>
#include <memory>
#include <string>
namespace fusepp {
class Device;
class File;
class Dir: public virtual Node {
public:
virtual ~Dir() {}
virtual std::unique_ptr<File> createFile(const std::string &name, mode_t mode) = 0;
virtual std::unique_ptr<Dir> createDir(const std::string &name, mode_t mode) = 0;
virtual void rmdir() = 0;
virtual std::unique_ptr<std::vector<std::string>> children() const = 0;
};
} /* namespace fusepp */
#endif /* FUSEPP_DIR_H_ */

View File

@ -0,0 +1,23 @@
#pragma once
#ifndef FUSEPP_FILE_H_
#define FUSEPP_FILE_H_
#include <fusepp/fs_interface/Node.h>
#include <memory>
namespace fusepp {
class Device;
class OpenFile;
class File: public virtual Node {
public:
virtual ~File() {}
virtual std::unique_ptr<OpenFile> open(int flags) const = 0;
virtual void truncate(off_t size) const = 0;
virtual void unlink() = 0;
};
} /* namespace fusepp */
#endif /* FUSEPP_FILE_H_ */

View File

@ -1,22 +0,0 @@
#pragma once
#ifndef FUSEPP_FUSEDEVICE_H_
#define FUSEPP_FUSEDEVICE_H_
#include <boost/filesystem.hpp>
#include <memory>
#include <sys/statvfs.h>
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<FuseNode> Load(const boost::filesystem::path &path) = 0;
};
}
#endif /* FUSEPP_FUSEDEVICE_H_ */

View File

@ -1,26 +0,0 @@
#pragma once
#ifndef FUSEPP_FUSEDIR_H_
#define FUSEPP_FUSEDIR_H_
#include "FuseNode.h"
#include <memory>
#include <string>
namespace fusepp {
class FuseDevice;
class FuseFile;
class FuseDir: public virtual FuseNode {
public:
virtual ~FuseDir() {}
virtual std::unique_ptr<FuseFile> createFile(const std::string &name, mode_t mode) = 0;
virtual std::unique_ptr<FuseDir> createDir(const std::string &name, mode_t mode) = 0;
virtual void rmdir() = 0;
virtual std::unique_ptr<std::vector<std::string>> children() const = 0;
};
} /* namespace fusepp */
#endif /* FUSEPP_FUSEDIR_H_ */

View File

@ -1,23 +0,0 @@
#pragma once
#ifndef FUSEPP_FUSEFILE_H_
#define FUSEPP_FUSEFILE_H_
#include "FuseNode.h"
#include <memory>
namespace fusepp {
class FuseDevice;
class FuseOpenFile;
class FuseFile: public virtual FuseNode {
public:
virtual ~FuseFile() {}
virtual std::unique_ptr<FuseOpenFile> open(int flags) const = 0;
virtual void truncate(off_t size) const = 0;
virtual void unlink() = 0;
};
} /* namespace fusepp */
#endif /* FUSEPP_FUSEFILE_H_ */

View File

@ -1,6 +1,6 @@
#pragma once
#ifndef FUSEPP_FUSENODE_H_
#define FUSEPP_FUSENODE_H_
#ifndef FUSEPP_NODE_H_
#define FUSEPP_NODE_H_
#include <boost/filesystem.hpp>
@ -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_ */

View File

@ -1,16 +1,16 @@
#pragma once
#ifndef FUSEPP_FUSEOPENFILE_H_
#define FUSEPP_FUSEOPENFILE_H_
#ifndef FUSEPP_OPENFILE_H_
#define FUSEPP_OPENFILE_H_
#include <boost/filesystem.hpp>
#include <sys/stat.h>
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_ */

View File

@ -11,7 +11,7 @@
#include "../utils/macros.h"
namespace fusepp {
class FuseDevice;
class Device;
class FilesystemImpl;
namespace fusebindings {

View File

@ -2,11 +2,11 @@
#include <memory>
#include <fcntl.h>
#include <fusepp/fs_interface/Device.h>
#include <fusepp/fs_interface/Dir.h>
#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<FuseFile> FilesystemImpl::LoadFile(const bf::path &path) {
unique_ptr<File> FilesystemImpl::LoadFile(const bf::path &path) {
auto node = _device->Load(path);
auto file = dynamic_pointer_move<FuseFile>(node);
auto file = dynamic_pointer_move<File>(node);
if (!file) {
throw FuseErrnoException(EISDIR);
}
return file;
}
unique_ptr<FuseDir> FilesystemImpl::LoadDir(const bf::path &path) {
unique_ptr<Dir> FilesystemImpl::LoadDir(const bf::path &path) {
auto node = _device->Load(path);
auto dir = dynamic_pointer_move<FuseDir>(node);
auto dir = dynamic_pointer_move<Dir>(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);
}

View File

@ -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<FuseFile> LoadFile(const boost::filesystem::path &path);
std::unique_ptr<FuseDir> LoadDir(const boost::filesystem::path &path);
int openFile(const FuseFile &file, int flags);
std::unique_ptr<File> LoadFile(const boost::filesystem::path &path);
std::unique_ptr<Dir> 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);

View File

@ -2,10 +2,10 @@
#ifndef FUSEPP_FUSEOPENFILELIST_H_
#define FUSEPP_FUSEOPENFILELIST_H_
#include <fusepp/fs_interface/File.h>
#include <fusepp/fs_interface/OpenFile.h>
#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<FuseOpenFile> _open_files;
IdList<OpenFile> _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);
}