43 lines
1.4 KiB
C++
43 lines
1.4 KiB
C++
#ifndef FUSESANDBOX_H
|
|
#define FUSESANDBOX_H
|
|
|
|
#include <QObject>
|
|
#include <QFileDevice>
|
|
|
|
#include "fusebase.h"
|
|
#include "fuseproxy.h"
|
|
|
|
class FuseAccessorSandbox : public FuseAccessorProxy
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit FuseAccessorSandbox(FuseInterface *parent, const QString &resource);
|
|
virtual ~FuseAccessorSandbox();
|
|
|
|
FuseFHBase *open(const QString &path, QIODeviceBase::OpenMode mode) override;
|
|
|
|
int truncate(const QString &path, off_t offset) override;
|
|
//int rename(const QString &path, const QString &newname) override;
|
|
int rmdir(const QString &path) override;
|
|
int unlink(const QString &path) override;
|
|
int mkdir(const QString &path, QFileDevice::Permissions mode) override;
|
|
int create(const QString &path, QFileDevice::Permissions mode) override;
|
|
|
|
// Help our other friends out~
|
|
FuseFHBase *makeWritableFromSource(const QString &source, const QString &origpath, const QString &dest, QIODeviceBase::OpenMode mode);
|
|
FuseFHBase *makeWritableFromData(const QByteArray &source, const QString &origpath, const QString &dest, QIODeviceBase::OpenMode mode);
|
|
};
|
|
|
|
class FuseFHSandbox : public FuseFHProxy
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit FuseFHSandbox(FuseAccessorSandbox *parent, const QString &path, const QString &newpath);
|
|
virtual ~FuseFHSandbox();
|
|
|
|
int write(const QByteArray &data, off_t offset=0, struct fuse_file_info *fi=nullptr) override;
|
|
};
|
|
|
|
#endif // FUSESANDBOX_H
|