Rename FuseFile -> File and so on

This commit is contained in:
Sebastian Messmer 2014-11-15 23:47:38 +01:00
parent a8dbcbc5f1
commit c730fb5ebf
12 changed files with 108 additions and 108 deletions

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);
}