00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _STORAGE_VFS_FILE_H
00014 #define _STORAGE_VFS_FILE_H
00015
00016 #include <support/IStorage.h>
00017 #include <support/URL.h>
00018
00019 #include <VFSMgr.h>
00020
00021 #if _SUPPORTS_NAMESPACE
00022 namespace palmos {
00023 namespace storage {
00024 using namespace palmos::support;
00025 #endif
00026
00027 class BVFSFile : public BnStorage
00028 {
00029 public:
00030 enum flags
00031 {
00032 DELETE_IF_EMPTY = 1
00033 };
00034
00035
00036 BVFSFile();
00037 BVFSFile(const char* path, int flags, int mode=0, status_t * outResult=0);
00038 BVFSFile(const SUrl & url, int flags, int mode=0, status_t * outResult=0);
00039
00040 status_t InitCheck() const;
00041
00042
00043 status_t SetTo(const char* path, int flags, int mode=0);
00044 status_t SetTo(const SUrl & url, int flags, int mode=0);
00045
00046 bool IsReadable() const;
00047 bool IsWritable() const;
00048
00049 uint16_t VolRefNum() const;
00050
00051 status_t Delete();
00052
00053 virtual off_t Size() const;
00054 virtual status_t SetSize(off_t size);
00055
00056 virtual ssize_t ReadAtV(off_t position, const struct iovec *vector, ssize_t count);
00057 virtual ssize_t WriteAtV(off_t position, const struct iovec *vector, ssize_t count);
00058
00059 virtual status_t Sync();
00060
00061 protected:
00062 virtual ~BVFSFile();
00063
00064 private:
00065 status_t m_initStatus;
00066 int m_fd;
00067 int m_flags;
00068 off_t m_pos;
00069 };
00070
00071
00072
00073 #if _SUPPORTS_NAMESPACE
00074 } }
00075 #endif
00076
00077 #endif