2008-01-07 09:09:04 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* Author: Valient Gough <vgough@pobox.com>
|
|
|
|
*
|
|
|
|
*****************************************************************************
|
|
|
|
* Copyright (c) 2004, Valient Gough
|
|
|
|
*
|
2012-10-03 07:12:17 +02:00
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
2013-10-20 00:35:26 +02:00
|
|
|
* option) any later version.
|
2008-01-07 09:09:04 +01:00
|
|
|
*
|
2012-10-03 07:12:17 +02:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
2008-01-07 09:09:04 +01:00
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
2012-10-03 07:12:17 +02:00
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2008-01-07 09:09:04 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _RawFileIO_incl_
|
|
|
|
#define _RawFileIO_incl_
|
|
|
|
|
2013-03-05 07:29:58 +01:00
|
|
|
#include "fs/FileIO.h"
|
2008-01-07 09:09:04 +01:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2013-03-05 07:29:58 +01:00
|
|
|
namespace encfs {
|
|
|
|
|
2013-10-20 00:35:26 +02:00
|
|
|
class RawFileIO : public FileIO {
|
|
|
|
public:
|
|
|
|
RawFileIO();
|
|
|
|
RawFileIO(const std::string &fileName);
|
|
|
|
virtual ~RawFileIO();
|
2008-01-07 09:09:04 +01:00
|
|
|
|
2013-10-20 00:35:26 +02:00
|
|
|
virtual Interface interface() const;
|
2008-01-07 09:09:04 +01:00
|
|
|
|
2013-10-20 00:35:26 +02:00
|
|
|
virtual void setFileName(const char *fileName);
|
|
|
|
virtual const char *getFileName() const;
|
2008-01-07 09:09:04 +01:00
|
|
|
|
2013-10-20 00:35:26 +02:00
|
|
|
virtual int open(int flags);
|
2008-01-07 09:09:04 +01:00
|
|
|
|
2013-10-20 00:35:26 +02:00
|
|
|
virtual int getAttr(struct stat *stbuf) const;
|
|
|
|
virtual off_t getSize() const;
|
2008-01-07 09:09:04 +01:00
|
|
|
|
2013-10-20 00:35:26 +02:00
|
|
|
virtual ssize_t read(const IORequest &req) const;
|
|
|
|
virtual bool write(const IORequest &req);
|
2008-01-07 09:09:04 +01:00
|
|
|
|
2013-10-20 00:35:26 +02:00
|
|
|
virtual int truncate(off_t size);
|
2008-01-07 09:09:04 +01:00
|
|
|
|
2013-10-20 00:35:26 +02:00
|
|
|
virtual bool isWritable() const;
|
2008-01-07 09:09:04 +01:00
|
|
|
|
2013-10-20 00:35:26 +02:00
|
|
|
protected:
|
|
|
|
std::string name;
|
2008-01-07 09:09:04 +01:00
|
|
|
|
2013-10-20 00:35:26 +02:00
|
|
|
mutable bool knownSize;
|
|
|
|
mutable off_t fileSize;
|
|
|
|
|
|
|
|
int fd;
|
|
|
|
int oldfd;
|
|
|
|
bool canWrite;
|
2008-01-07 09:09:04 +01:00
|
|
|
};
|
|
|
|
|
2013-03-05 07:29:58 +01:00
|
|
|
} // namespace encfs
|
|
|
|
|
2008-01-07 09:09:04 +01:00
|
|
|
#endif
|