40 fFd(
"Rw11VirtDiskFile::fFd."),
49 return Open(url,
"file", emsg);
58 if (!
fUrl.
Set(url,
"|wpro|", scheme, emsg))
return false;
63 fWProt ? O_RDONLY : O_RDWR, emsg))
return false;
71 if ((sbuf.st_mode & S_IWUSR) == 0)
fWProt =
true;
88 if (seekpos >=
fSize) {
90 for (
size_t i=0; i<nbyt; i++) *p++ = 0;
94 if (!
fFd.
Seek(seekpos, SEEK_SET, emsg))
return false;
95 ssize_t irc =
fFd.
Read(data, nbyt, emsg);
96 if (irc < 0)
return false;
98 if (irc < ssize_t(nbyt)) {
99 uint8_t* p = data+irc;
100 for (
size_t i=irc; i<nbyt; i++) *p++ = 0;
118 if (!
fFd.
Seek(seekpos, SEEK_SET, emsg))
return false;
120 if (seekpos+nbyt >
fSize)
fSize = seekpos+nbyt;
132 os << bl << (text?text:
"--") <<
"Rw11VirtDiskFile @ " <<
this << endl;
134 os << bl <<
" fFd: " <<
fFd.
Fd() << endl;
135 os << bl <<
" fSize: " <<
fSize << endl;
int Fd() const
FIXME_docs.
bool WriteAll(const void *buf, size_t count, RerrMsg &emsg)
FIXME_docs.
ssize_t Read(void *buf, size_t count, RerrMsg &emsg)
FIXME_docs.
bool Stat(struct stat *sbuf, RerrMsg &emsg)
FIXME_docs.
off_t Seek(off_t offset, int whence, RerrMsg &emsg)
FIXME_docs.
bool Open(const char *fname, int flags, RerrMsg &emsg)
FIXME_docs.
I/O appicator to generate fill characters.
bool FindOpt(const std::string &name) const
FIXME_docs.
bool Set(const std::string &url, const std::string &optlist, RerrMsg &emsg)
FIXME_docs.
const std::string & Path() const
FIXME_docs.
void Inc(size_t ind, double val=1.)
FIXME_docs.
Rw11VirtDiskFile(Rw11Unit *punit)
Default constructor.
virtual bool Write(size_t lba, size_t nblk, const uint8_t *data, RerrMsg &emsg)
FIXME_docs.
virtual bool Read(size_t lba, size_t nblk, uint8_t *data, RerrMsg &emsg)
FIXME_docs.
virtual bool Open(const std::string &url, RerrMsg &emsg)
FIXME_docs.
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
size_t fBlkSize
block size in byte
bool fWProt
write protected
Declaration of class ReventLoop.