2014-11-15 16:33:24 +01:00
|
|
|
#pragma once
|
|
|
|
#ifndef CRYFS_LIB_CRYOPENFILE_H_
|
|
|
|
#define CRYFS_LIB_CRYOPENFILE_H_
|
|
|
|
|
2014-11-15 23:47:38 +01:00
|
|
|
#include <fusepp/fs_interface/OpenFile.h>
|
2014-11-15 16:33:24 +01:00
|
|
|
#include "fusepp/utils/macros.h"
|
|
|
|
|
|
|
|
namespace cryfs {
|
|
|
|
class CryDevice;
|
|
|
|
|
2014-11-16 00:05:28 +01:00
|
|
|
class CryOpenFile: public fspp::OpenFile {
|
2014-11-15 16:33:24 +01:00
|
|
|
public:
|
|
|
|
CryOpenFile(const CryDevice *device, const boost::filesystem::path &path, int flags);
|
|
|
|
virtual ~CryOpenFile();
|
|
|
|
|
|
|
|
void stat(struct ::stat *result) const override;
|
|
|
|
void truncate(off_t size) const override;
|
|
|
|
int read(void *buf, size_t count, off_t offset) override;
|
|
|
|
void write(const void *buf, size_t count, off_t offset) override;
|
|
|
|
void fsync() override;
|
|
|
|
void fdatasync() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
int _descriptor;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CryOpenFile);
|
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace cryfs */
|
|
|
|
|
|
|
|
#endif
|