libcryfs/impl/FilesystemImpl.h

61 lines
2.6 KiB
C
Raw Normal View History

#pragma once
2014-11-16 00:05:28 +01:00
#ifndef FSPP_IMPL_FILESYSTEMIMPL_H_
#define FSPP_IMPL_FILESYSTEMIMPL_H_
#include "FuseOpenFileList.h"
2015-02-17 00:48:49 +01:00
#include "../fuse/Filesystem.h"
2015-06-21 17:44:30 +02:00
#include <messmer/cpp-utils/pointer/unique_ref.h>
2014-11-16 00:05:28 +01:00
namespace fspp {
2014-11-15 23:47:38 +01:00
class Node;
class File;
2015-04-22 16:00:14 +02:00
class Symlink;
2014-11-15 23:47:38 +01:00
class OpenFile;
class FilesystemImpl: public fuse::Filesystem {
public:
explicit FilesystemImpl(Device *device);
virtual ~FilesystemImpl();
int openFile(const boost::filesystem::path &path, int flags) override;
2014-11-21 01:11:24 +01:00
void flush(int descriptor) override;
void closeFile(int descriptor) override;
void lstat(const boost::filesystem::path &path, struct ::stat *stbuf) override;
void fstat(int descriptor, struct ::stat *stbuf) override;
2015-04-21 21:08:23 +02:00
void chmod(const boost::filesystem::path &path, mode_t mode) override;
void chown(const boost::filesystem::path &path, uid_t uid, gid_t gid) override;
void truncate(const boost::filesystem::path &path, off_t size) override;
void ftruncate(int descriptor, off_t size) override;
int read(int descriptor, void *buf, size_t count, off_t offset) override;
void write(int descriptor, const void *buf, size_t count, off_t offset) override;
void fsync(int descriptor) override;
void fdatasync(int descriptor) override;
void access(const boost::filesystem::path &path, int mask) override;
int createAndOpenFile(const boost::filesystem::path &path, mode_t mode, uid_t uid, gid_t gid) override;
void mkdir(const boost::filesystem::path &path, mode_t mode, uid_t uid, gid_t gid) override;
void rmdir(const boost::filesystem::path &path) override;
void unlink(const boost::filesystem::path &path) override;
void rename(const boost::filesystem::path &from, const boost::filesystem::path &to) override;
cpputils::unique_ref<std::vector<Dir::Entry>> readDir(const boost::filesystem::path &path) override;
void utimens(const boost::filesystem::path &path, const timespec times[2]) override;
void statfs(const boost::filesystem::path &path, struct statvfs *fsstat) override;
void createSymlink(const boost::filesystem::path &to, const boost::filesystem::path &from, uid_t uid, gid_t gid) override;
void readSymlink(const boost::filesystem::path &path, char *buf, size_t size) override;
private:
cpputils::unique_ref<File> LoadFile(const boost::filesystem::path &path);
cpputils::unique_ref<Dir> LoadDir(const boost::filesystem::path &path);
cpputils::unique_ref<Symlink> LoadSymlink(const boost::filesystem::path &path);
2014-11-15 23:47:38 +01:00
int openFile(const File &file, int flags);
2014-11-15 23:47:38 +01:00
Device *_device;
FuseOpenFileList _open_files;
DISALLOW_COPY_AND_ASSIGN(FilesystemImpl);
};
}
2014-11-16 00:05:28 +01:00
#endif /* FSPP_IMPL_FILESYSTEMIMPL_H_ */