1
0
mirror of https://github.com/wfjm/w11.git synced 2026-01-31 06:02:37 +00:00

add Rw11VirtDiskOver (simple overlay file container)

- Rw11VirtDiskBuffer: added, disk buffer representation
- Rw11VirtDiskOver: added, a 'keep changes in memory' overlay file container
- Rw11Virt: add fWProt,WProt()
- Rw11VirtDiskFile: adopt WProt handling
- RtclRw11Unit: add fpVirt,DetachCleanup(),AttachDone(),M_virt()
- RtclRw11UnitBase: add AttachDone()
This commit is contained in:
Walter F.J. Mueller
2017-04-02 15:46:03 +02:00
parent 823c03ba3b
commit 5f2301b561
35 changed files with 1137 additions and 80 deletions

View File

@@ -17,6 +17,10 @@ software or firmware builds or that the documentation is consistent.
The full set of tests is only run for tagged releases._
### Summary
- tcl command handling update
- support now sub-command handling
- support dynamically created commands (like 'virt')
- support command info (via '?' option)
- move to Ubuntu 16.04 as development platform
- document urjtag build (jtag in Ubuntu 16.04 is broken)
- add environment sanity wrappers for acroread,awk,firefox to ensure

View File

@@ -1,4 +1,4 @@
# $Id: Makefile 733 2016-02-20 12:24:13Z mueller $
# $Id: Makefile 859 2017-03-11 22:36:45Z mueller $
#
# Revision History:
# Date Rev Version Comment
@@ -37,7 +37,8 @@ OBJ_all += Rw11CntlRHRP.o Rw11UnitRHRP.o
OBJ_all += Rw11CntlTM11.o Rw11UnitTM11.o
OBJ_all += Rw11Virt.o
OBJ_all += Rw11VirtTerm.o Rw11VirtTermPty.o Rw11VirtTermTcp.o
OBJ_all += Rw11VirtDisk.o Rw11VirtDiskFile.o
OBJ_all += Rw11VirtDiskBuffer.o
OBJ_all += Rw11VirtDisk.o Rw11VirtDiskFile.o Rw11VirtDiskOver.o
OBJ_all += Rw11VirtTape.o Rw11VirtTapeTap.o
OBJ_all += Rw11VirtStream.o
OBJ_all += Rw11Rdma.o Rw11RdmaDisk.o

View File

@@ -1,4 +1,4 @@
// $Id: Rw11UnitTapeBase.ipp 686 2015-06-04 21:08:08Z mueller $
// $Id: Rw11UnitTapeBase.ipp 864 2017-04-02 13:20:18Z mueller $
//
// Copyright 2015- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@@ -19,7 +19,7 @@
/*!
\file
\version $Id: Rw11UnitTapeBase.ipp 686 2015-06-04 21:08:08Z mueller $
\version $Id: Rw11UnitTapeBase.ipp 864 2017-04-02 13:20:18Z mueller $
\brief Implemenation (inline) of Rw11UnitTapeBase.
*/
@@ -78,8 +78,7 @@ void Rw11UnitTapeBase<TC>::Dump(std::ostream& os, int ind,
template <class TC>
void Rw11UnitTapeBase<TC>::AttachDone()
{
// transfer, if defined, wprot and capacity from unit to virt
if (WProt()) Virt()->SetWProt(true);
// transfer, if defined capacity from unit to virt
if (Capacity()!=0 && Virt()->Capacity()==0) Virt()->SetCapacity(Capacity());
Cntl().UnitSetup(Index());
return;

View File

@@ -1,6 +1,6 @@
// $Id: Rw11Virt.cpp 495 2013-03-06 17:13:48Z mueller $
// $Id: Rw11Virt.cpp 864 2017-04-02 13:20:18Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,13 +13,14 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-04-02 864 1.1 add fWProt,WProt()
// 2013-03-06 495 1.0 Initial version
// 2013-02-13 488 0.1 First draft
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: Rw11Virt.cpp 495 2013-03-06 17:13:48Z mueller $
\version $Id: Rw11Virt.cpp 864 2017-04-02 13:20:18Z mueller $
\brief Implemenation of Rw11Virt.
*/
@@ -43,6 +44,7 @@ namespace Retro {
Rw11Virt::Rw11Virt(Rw11Unit* punit)
: fpUnit(punit),
fUrl(),
fWProt(false),
fStats()
{}
@@ -55,6 +57,14 @@ Rw11Virt::~Rw11Virt()
//------------------------------------------+-----------------------------------
//! FIXME_docs
bool Rw11Virt::WProt() const
{
return fWProt;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
void Rw11Virt::Dump(std::ostream& os, int ind, const char* text) const
{
RosFill bl(ind);
@@ -62,6 +72,7 @@ void Rw11Virt::Dump(std::ostream& os, int ind, const char* text) const
os << bl << " fpUnit: " << fpUnit << endl;
fUrl.Dump(os, ind+2, "fUrl: ");
os << bl << " fWProt: " << fWProt << endl;
fStats.Dump(os, ind+2, "fStats: ");
return;
}

View File

@@ -1,6 +1,6 @@
// $Id: Rw11Virt.hpp 495 2013-03-06 17:13:48Z mueller $
// $Id: Rw11Virt.hpp 864 2017-04-02 13:20:18Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-04-02 864 1.1 add fWProt,WProt()
// 2013-03-06 495 1.0 Initial version
// 2013-02-13 488 0.1 First draft
// ---------------------------------------------------------------------------
@@ -20,7 +21,7 @@
/*!
\file
\version $Id: Rw11Virt.hpp 495 2013-03-06 17:13:48Z mueller $
\version $Id: Rw11Virt.hpp 864 2017-04-02 13:20:18Z mueller $
\brief Declaration of class Rw11Virt.
*/
@@ -50,6 +51,7 @@ namespace Retro {
Rw11& W11() const;
RlinkServer& Server() const;
RlogFile& LogFile() const;
virtual bool WProt() const;
virtual bool Open(const std::string& url, RerrMsg& emsg) = 0;
@@ -65,7 +67,8 @@ namespace Retro {
protected:
Rw11Unit* fpUnit; //<! back ref to unit
RparseUrl fUrl;
Rstats fStats; //!< statistics
bool fWProt; //<! write protected
Rstats fStats; //<! statistics
};
} // end namespace Retro

View File

@@ -1,6 +1,6 @@
// $Id: Rw11VirtDisk.cpp 509 2013-04-21 20:46:20Z mueller $
// $Id: Rw11VirtDisk.cpp 864 2017-04-02 13:20:18Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,13 +13,14 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-04-02 864 1.1 add Rw11VirtDiskOver
// 2013-03-03 494 1.0 Initial version
// 2013-02-13 488 0.1 First draft
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: Rw11VirtDisk.cpp 509 2013-04-21 20:46:20Z mueller $
\version $Id: Rw11VirtDisk.cpp 864 2017-04-02 13:20:18Z mueller $
\brief Implemenation of Rw11VirtDisk.
*/
#include <memory>
@@ -27,6 +28,7 @@
#include "librtools/RosFill.hpp"
#include "librtools/RparseUrl.hpp"
#include "Rw11VirtDiskFile.hpp"
#include "Rw11VirtDiskOver.hpp"
#include "Rw11VirtDisk.hpp"
@@ -73,6 +75,10 @@ Rw11VirtDisk* Rw11VirtDisk::New(const std::string& url, Rw11Unit* punit,
p.reset(new Rw11VirtDiskFile(punit));
if (p->Open(url, emsg)) return p.release();
} else if (scheme == "over") { // scheme -> over:
p.reset(new Rw11VirtDiskOver(punit));
if (p->Open(url, emsg)) return p.release();
} else { // scheme -> no match
emsg.Init("Rw11VirtDisk::New", string("Scheme '") + scheme +
"' is not supported");

View File

@@ -1,6 +1,6 @@
// $Id: Rw11VirtDisk.hpp 509 2013-04-21 20:46:20Z mueller $
// $Id: Rw11VirtDisk.hpp 864 2017-04-02 13:20:18Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -20,7 +20,7 @@
/*!
\file
\version $Id: Rw11VirtDisk.hpp 509 2013-04-21 20:46:20Z mueller $
\version $Id: Rw11VirtDisk.hpp 864 2017-04-02 13:20:18Z mueller $
\brief Declaration of class Rw11VirtDisk.
*/

View File

@@ -0,0 +1,73 @@
// $Id: Rw11VirtDiskBuffer.cpp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2017-03-10 859 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: Rw11VirtDiskBuffer.cpp 859 2017-03-11 22:36:45Z mueller $
\brief Implemenation of Rw11VirtDiskBuffer.
*/
#include <string.h>
#include "Rw11VirtDiskBuffer.hpp"
using namespace std;
/*!
\class Retro::Rw11VirtDiskBuffer
\brief FIXME_docs
*/
// all method definitions in namespace Retro
namespace Retro {
//------------------------------------------+-----------------------------------
//! Default constructor
Rw11VirtDiskBuffer::Rw11VirtDiskBuffer(size_t blksize)
: fBuf(blksize, 0),
fNWrite(0)
{}
//------------------------------------------+-----------------------------------
//! Destructor
Rw11VirtDiskBuffer::~Rw11VirtDiskBuffer()
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs
void Rw11VirtDiskBuffer::Read(uint8_t* data)
{
::memcpy(data, fBuf.data(), fBuf.size());
return;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
void Rw11VirtDiskBuffer::Write(const uint8_t* data)
{
::memcpy(fBuf.data(), data, fBuf.size());
fNWrite += 1;
if (fNWrite == 0) fNWrite -= 1; // stop at max
return;
}
} // end namespace Retro

View File

@@ -0,0 +1,57 @@
// $Id: Rw11VirtDiskBuffer.hpp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2017-03-10 859 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: Rw11VirtDiskBuffer.hpp 859 2017-03-11 22:36:45Z mueller $
\brief Declaration of class Rw11VirtDiskBuffer.
*/
#ifndef included_Retro_Rw11VirtDiskBuffer
#define included_Retro_Rw11VirtDiskBuffer 1
#include <cstdint>
#include <vector>
namespace Retro {
class Rw11VirtDiskBuffer {
public:
explicit Rw11VirtDiskBuffer(size_t blksize);
~Rw11VirtDiskBuffer();
void Read(uint8_t* data);
void Write(const uint8_t* data);
size_t BlockSize() const;
uint8_t* Data();
const uint8_t* Data() const;
uint32_t NWrite() const;
protected:
std::vector<uint8_t> fBuf;
uint32_t fNWrite;
};
} // end namespace Retro
#include "Rw11VirtDiskBuffer.ipp"
#endif

View File

@@ -0,0 +1,60 @@
// $Id: Rw11VirtDiskBuffer.ipp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2017-03-10 859 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: Rw11VirtDiskBuffer.ipp 859 2017-03-11 22:36:45Z mueller $
\brief Implemenation (inline) of Rw11VirtDiskBuffer.
*/
// all method definitions in namespace Retro
namespace Retro {
//------------------------------------------+-----------------------------------
//! FIXME_docs
inline size_t Rw11VirtDiskBuffer::BlockSize() const
{
return fBuf.size();
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
inline uint8_t* Rw11VirtDiskBuffer::Data()
{
return fBuf.data();
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
inline const uint8_t* Rw11VirtDiskBuffer::Data() const
{
return fBuf.data();
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
inline uint32_t Rw11VirtDiskBuffer::NWrite() const
{
return fNWrite;
}
} // end namespace Retro

View File

@@ -1,6 +1,6 @@
// $Id: Rw11VirtDiskFile.cpp 684 2015-05-24 14:10:59Z mueller $
// $Id: Rw11VirtDiskFile.cpp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,13 +13,14 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-03-11 859 1.1 use fWProt
// 2013-04-14 506 1.0 Initial version
// 2013-02-13 488 0.1 First draft
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: Rw11VirtDiskFile.cpp 684 2015-05-24 14:10:59Z mueller $
\version $Id: Rw11VirtDiskFile.cpp 859 2017-03-11 22:36:45Z mueller $
\brief Implemenation of Rw11VirtDiskFile.
*/
@@ -64,10 +65,10 @@ Rw11VirtDiskFile::~Rw11VirtDiskFile()
bool Rw11VirtDiskFile::Open(const std::string& url, RerrMsg& emsg)
{
if (!fUrl.Set(url, "|wpro|", emsg)) return false;
bool wpro = fUrl.FindOpt("wpro");
int fd = ::open(fUrl.Path().c_str(), wpro ? O_RDONLY : O_RDWR);
fWProt = fUrl.FindOpt("wpro");
int fd = ::open(fUrl.Path().c_str(), fWProt ? O_RDONLY : O_RDWR);
if (fd < 0) {
emsg.InitErrno("Rw11VirtDiskFile::Open()",
string("open() for '") + fUrl.Path() + "' failed: ", errno);
@@ -81,6 +82,8 @@ bool Rw11VirtDiskFile::Open(const std::string& url, RerrMsg& emsg)
return false;
}
if ((sbuf.st_mode & S_IWUSR) == 0) fWProt = true;
fFd = fd;
fSize = sbuf.st_size;
return true;

View File

@@ -1,4 +1,4 @@
// $Id: Rw11VirtDiskFile.hpp 509 2013-04-21 20:46:20Z mueller $
// $Id: Rw11VirtDiskFile.hpp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@@ -20,7 +20,7 @@
/*!
\file
\version $Id: Rw11VirtDiskFile.hpp 509 2013-04-21 20:46:20Z mueller $
\version $Id: Rw11VirtDiskFile.hpp 859 2017-03-11 22:36:45Z mueller $
\brief Declaration of class Rw11VirtDiskFile.
*/
@@ -46,6 +46,11 @@ namespace Retro {
virtual void Dump(std::ostream& os, int ind=0, const char* text=0) const;
// statistics counter indices (now new)
enum stats {
kDimStat = Rw11VirtDisk::kDimStat
};
protected:
bool Seek(size_t seekpos, RerrMsg& emsg);

View File

@@ -0,0 +1,180 @@
// $Id: Rw11VirtDiskOver.cpp 864 2017-04-02 13:20:18Z mueller $
//
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2017-03-10 859 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: Rw11VirtDiskOver.cpp 864 2017-04-02 13:20:18Z mueller $
\brief Implemenation of Rw11VirtDiskOver.
*/
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintf.hpp"
#include "Rw11VirtDiskOver.hpp"
using namespace std;
/*!
\class Retro::Rw11VirtDiskOver
\brief FIXME_docs
*/
// all method definitions in namespace Retro
namespace Retro {
//------------------------------------------+-----------------------------------
//! Default constructor
Rw11VirtDiskOver::Rw11VirtDiskOver(Rw11Unit* punit)
: Rw11VirtDiskFile(punit),
fBlkMap()
{
fStats.Define(kStatNVDReadOver, "NVDReadOver", "Read() calls over");
fStats.Define(kStatNVDReadBlkOver, "NVDReadBlkOver", "blocks read from over");
fStats.Define(kStatNVDWriteOver, "NVDWriteOver", "Write() calls over");
fStats.Define(kStatNVDWriteBlkOver,"NVDWriteBlkOver","blocks written to over");
fStats.Define(kStatNVDFlushOver, "NVDFlushOver", "Flush() calls");
}
//------------------------------------------+-----------------------------------
//! Destructor
Rw11VirtDiskOver::~Rw11VirtDiskOver()
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs
bool Rw11VirtDiskOver::WProt() const
{
return false; // from unit always writable !!
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
bool Rw11VirtDiskOver::Open(const std::string& url, RerrMsg& emsg)
{
// FIXME_code: do we need to handle wpro ?
// FIXME_code: at this point assume that parent ignore proto
return Rw11VirtDiskFile::Open(url, emsg);
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
bool Rw11VirtDiskOver::Read(size_t lba, size_t nblk, uint8_t* data,
RerrMsg& emsg)
{
fStats.Inc(kStatNVDReadOver);
auto it = fBlkMap.lower_bound(lba);
if (it == fBlkMap.end() || it->first >= lba+nblk) { // no match
return Rw11VirtDiskFile::Read(lba, nblk, data, emsg); // one swoop from disk
} else { // match
for (size_t i=0; i<nblk; i++) { // get it blockwise
auto it = fBlkMap.find(lba+i);
if (it == fBlkMap.end()) {
bool rc = Rw11VirtDiskFile::Read(lba+1, 1, data+i*fBlkSize, emsg);
if (!rc) return rc;
} else {
(it->second).Read(data+i*fBlkSize);
fStats.Inc(kStatNVDReadBlkOver);
}
}
}
return true;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
bool Rw11VirtDiskOver::Write(size_t lba, size_t nblk, const uint8_t* data,
RerrMsg& emsg)
{
fStats.Inc(kStatNVDWriteOver);
fStats.Inc(kStatNVDWriteBlkOver, double(nblk));
for (size_t i=0; i<nblk; i++) {
auto it = fBlkMap.find(lba+i);
if (it == fBlkMap.end()) {
auto rc = fBlkMap.emplace(lba+i, Rw11VirtDiskBuffer(fBlkSize));
it = rc.first;
}
(it->second).Write(data+i*fBlkSize);
}
return true;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
bool Rw11VirtDiskOver::Flush(RerrMsg& emsg)
{
if (fWProt) {
emsg.Init("Rw11VirtDiskOver::Flush()", "file write protected");
return false;
}
fStats.Inc(kStatNVDFlushOver);
for (auto& kv: fBlkMap) {
bool rc = Rw11VirtDiskFile::Write(kv.first, 1, kv.second.Data(), emsg);
if (!rc) return rc;
}
fBlkMap.clear();
return true;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
void Rw11VirtDiskOver::List(std::ostream& os) const
{
if (fBlkMap.empty()) return;
uint32_t lbabeg = fBlkMap.begin()->first; // first lba
uint32_t nwrite = 0;
for (auto it=fBlkMap.begin(); it!=fBlkMap.end(); ) {
auto itnext = next(it);
if (itnext == fBlkMap.end() || itnext->first != (it->first)+1) {
os << RosPrintf(lbabeg,"d",8)
<< " .. " << RosPrintf(it->first,"d",8)
<< " : nb=" << RosPrintf(it->first-lbabeg+1,"d",8)
<< " nw=" << RosPrintf(nwrite,"d",8) << endl;
if (itnext != fBlkMap.end()) lbabeg = itnext->first;
nwrite = 0;
} else {
nwrite += (it->second).NWrite();
}
it = itnext;
}
return;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
void Rw11VirtDiskOver::Dump(std::ostream& os, int ind, const char* text) const
{
RosFill bl(ind);
os << bl << (text?text:"--") << "Rw11VirtDiskOver @ " << this << endl;
os << bl << " fBlkMap.size " << fBlkMap.size() << endl;
Rw11VirtDiskFile::Dump(os, ind, " ^");
return;
}
} // end namespace Retro

View File

@@ -0,0 +1,80 @@
// $Id: Rw11VirtDiskOver.hpp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2017-03-10 859 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: Rw11VirtDiskOver.hpp 859 2017-03-11 22:36:45Z mueller $
\brief Declaration of class Rw11VirtDiskOver.
*/
#ifndef included_Retro_Rw11VirtDiskOver
#define included_Retro_Rw11VirtDiskOver 1
#include <map>
#include "Rw11VirtDiskBuffer.hpp"
#include "Rw11VirtDiskFile.hpp"
namespace Retro {
class Rw11VirtDiskOver : public Rw11VirtDiskFile {
public:
typedef std::map<uint32_t,Rw11VirtDiskBuffer> bmap_t;
typedef bmap_t::iterator bmap_it_t;
typedef bmap_t::const_iterator bmap_cit_t;
typedef bmap_t::value_type bmap_val_t;
explicit Rw11VirtDiskOver(Rw11Unit* punit);
~Rw11VirtDiskOver();
virtual bool WProt() const;
bool Open(const std::string& url, RerrMsg& emsg);
virtual bool Read(size_t lba, size_t nblk, uint8_t* data,
RerrMsg& emsg);
virtual bool Write(size_t lba, size_t nblk, const uint8_t* data,
RerrMsg& emsg);
bool Flush(RerrMsg& emsg);
void List(std::ostream& os) const;
virtual void Dump(std::ostream& os, int ind=0, const char* text=0) const;
// statistics counter indices (now new)
enum stats {
kStatNVDReadOver = Rw11VirtDiskFile::kDimStat,
kStatNVDReadBlkOver,
kStatNVDWriteOver,
kStatNVDWriteBlkOver,
kStatNVDFlushOver,
kDimStat
};
protected:
bmap_t fBlkMap;
};
} // end namespace Retro
//#include "Rw11VirtDiskOver.ipp"
#endif

View File

@@ -1,6 +1,6 @@
// $Id: Rw11VirtStream.cpp 516 2013-05-05 21:24:52Z mueller $
// $Id: Rw11VirtStream.cpp 864 2017-04-02 13:20:18Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-04-02 864 1.0.2 signal for input streams WProt
// 2013-05-05 516 1.0.1 Open(): support ?app and ?bck=n options
// 2013-05-04 515 1.0 Initial version
// 2013-05-01 513 0.1 First draft
@@ -20,7 +21,7 @@
/*!
\file
\version $Id: Rw11VirtStream.cpp 516 2013-05-05 21:24:52Z mueller $
\version $Id: Rw11VirtStream.cpp 864 2017-04-02 13:20:18Z mueller $
\brief Implemenation of Rw11VirtStream.
*/
#include <memory>
@@ -88,6 +89,7 @@ bool Rw11VirtStream::Open(const std::string& url, RerrMsg& emsg)
fFile = ::fopen(fUrl.Path().c_str(), fUrl.FindOpt("app") ? "a" : "w");
} else { // handle input streams
fWProt = true;
if (!fUrl.Set(url, "", emsg)) return false;
fFile = ::fopen(fUrl.Path().c_str(), "r");
}

View File

@@ -1,4 +1,4 @@
// $Id: Rw11VirtTape.cpp 686 2015-06-04 21:08:08Z mueller $
// $Id: Rw11VirtTape.cpp 864 2017-04-02 13:20:18Z mueller $
//
// Copyright 2015- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@@ -13,13 +13,14 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-04-02 864 1.1 move fWProt,WProt() to Rw11Virt base
// 2015-06-04 686 1.0 Initial version
// 2015-05-17 683 0.1 First draft
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: Rw11VirtTape.cpp 686 2015-06-04 21:08:08Z mueller $
\version $Id: Rw11VirtTape.cpp 864 2017-04-02 13:20:18Z mueller $
\brief Implemenation of Rw11VirtTape.
*/
#include <memory>
@@ -46,7 +47,6 @@ namespace Retro {
Rw11VirtTape::Rw11VirtTape(Rw11Unit* punit)
: Rw11Virt(punit),
fWProt(false),
fCapacity(0),
fBot(false),
fEot(false),
@@ -157,7 +157,6 @@ void Rw11VirtTape::Dump(std::ostream& os, int ind, const char* text) const
RosFill bl(ind);
os << bl << (text?text:"--") << "Rw11VirtTape @ " << this << endl;
os << bl << " fWProt: " << fWProt << endl;
os << bl << " fCapacity: " << fCapacity << endl;
os << bl << " fBot: " << fBot << endl;
os << bl << " fEot: " << fEot << endl;

View File

@@ -1,6 +1,6 @@
// $Id: Rw11VirtTape.hpp 686 2015-06-04 21:08:08Z mueller $
// $Id: Rw11VirtTape.hpp 864 2017-04-02 13:20:18Z mueller $
//
// Copyright 2015- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2015-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-04-02 864 1.1 move fWProt,WProt() to Rw11Virt base
// 2015-06-04 686 1.0 Initial version
// 2015-05-17 683 0.1 First draft
// ---------------------------------------------------------------------------
@@ -20,7 +21,7 @@
/*!
\file
\version $Id: Rw11VirtTape.hpp 686 2015-06-04 21:08:08Z mueller $
\version $Id: Rw11VirtTape.hpp 864 2017-04-02 13:20:18Z mueller $
\brief Declaration of class Rw11VirtTape.
*/
@@ -36,9 +37,7 @@ namespace Retro {
explicit Rw11VirtTape(Rw11Unit* punit);
~Rw11VirtTape();
void SetWProt(bool wprot);
void SetCapacity(size_t nbyte);
bool WProt() const;
size_t Capacity() const;
virtual bool ReadRecord(size_t nbyte, uint8_t* data, size_t& ndone,
@@ -96,7 +95,6 @@ namespace Retro {
};
protected:
bool fWProt; //<! write protected
size_t fCapacity; //<! capacity in byte (0=unlimited)
bool fBot; //<! tape at bot
bool fEot; //<! tape beyond eot

View File

@@ -1,6 +1,6 @@
// $Id: Rw11VirtTape.ipp 686 2015-06-04 21:08:08Z mueller $
// $Id: Rw11VirtTape.ipp 864 2017-04-02 13:20:18Z mueller $
//
// Copyright 2015- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2015-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,13 +13,14 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-04-02 864 1.1 move fWProt,WProt() to Rw11Virt base
// 2015-06-04 686 1.0 Initial version
// 2015-05-17 683 0.1 First draft
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: Rw11VirtTape.ipp 686 2015-06-04 21:08:08Z mueller $
\version $Id: Rw11VirtTape.ipp 864 2017-04-02 13:20:18Z mueller $
\brief Implemenation (inline) of Rw11VirtTape.
*/
@@ -29,15 +30,6 @@ namespace Retro {
//------------------------------------------+-----------------------------------
//! FIXME_docs
inline void Rw11VirtTape::SetWProt(bool wprot)
{
fWProt = wprot;
return;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
inline void Rw11VirtTape::SetCapacity(size_t nbyte)
{
fCapacity = nbyte;
@@ -47,14 +39,6 @@ inline void Rw11VirtTape::SetCapacity(size_t nbyte)
//------------------------------------------+-----------------------------------
//! FIXME_docs
inline bool Rw11VirtTape::WProt() const
{
return fWProt;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
inline size_t Rw11VirtTape::Capacity() const
{
return fCapacity;

View File

@@ -1,4 +1,4 @@
# $Id: Makefile 733 2016-02-20 12:24:13Z mueller $
# $Id: Makefile 859 2017-03-11 22:36:45Z mueller $
#
# Revision History:
# Date Rev Version Comment
@@ -40,6 +40,9 @@ OBJ_all += RtclRw11CntlRK11.o RtclRw11UnitRK11.o
OBJ_all += RtclRw11CntlRL11.o RtclRw11UnitRL11.o
OBJ_all += RtclRw11CntlRHRP.o RtclRw11UnitRHRP.o
OBJ_all += RtclRw11CntlTM11.o RtclRw11UnitTM11.o
OBJ_all += RtclRw11Virt.o
OBJ_all += RtclRw11VirtFactory.o
OBJ_all += RtclRw11VirtDiskOver.o
#
DEP_all = $(OBJ_all:.o=.dep)
#

View File

@@ -1,6 +1,6 @@
// $Id: RtclRw11Unit.cpp 504 2013-04-13 15:37:24Z mueller $
// $Id: RtclRw11Unit.cpp 863 2017-04-02 11:43:15Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,19 +13,21 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-04-02 863 1.1 add fpVirt; add DetachCleanup()
// 2013-03-03 494 1.0 Initial version
// 2013-02-16 488 0.1 First draft
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: RtclRw11Unit.cpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: RtclRw11Unit.cpp 863 2017-04-02 11:43:15Z mueller $
\brief Implemenation of RtclRw11Unit.
*/
#include "boost/thread/locks.hpp"
#include "boost/bind.hpp"
#include "librtools/Rexception.hpp"
#include "librtcltools/RtclStats.hpp"
#include "RtclRw11Unit.hpp"
@@ -47,7 +49,8 @@ RtclRw11Unit::RtclRw11Unit(const std::string& type, Rw11Cpu* pcpu)
: RtclProxyBase(type),
fpCpu(pcpu),
fGets(),
fSets()
fSets(),
fpVirt()
{
AddMeth("get", boost::bind(&RtclRw11Unit::M_get, this, _1));
AddMeth("set", boost::bind(&RtclRw11Unit::M_set, this, _1));
@@ -66,6 +69,17 @@ RtclRw11Unit::~RtclRw11Unit()
//------------------------------------------+-----------------------------------
//! FIXME_docs
void RtclRw11Unit::DetachCleanup()
{
if (!fpVirt) return;
DelMeth("virt");
fpVirt.reset();
return;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
int RtclRw11Unit::M_get(RtclArgs& args)
{
// synchronize with server thread
@@ -96,7 +110,10 @@ int RtclRw11Unit::M_attach(RtclArgs& args)
RerrMsg emsg;
// synchronize with server thread
boost::lock_guard<RlinkConnect> lock(fpCpu->Connect());
DetachCleanup();
if (!Obj().Attach(url, emsg)) return args.Quit(emsg);
AttachDone();
return kOK;
}
@@ -116,6 +133,19 @@ int RtclRw11Unit::M_detach(RtclArgs& args)
//------------------------------------------+-----------------------------------
//! FIXME_docs
int RtclRw11Unit::M_virt(RtclArgs& args)
{
if (!fpVirt) throw Rexception("RtclRw11Unit::M_virt:",
"Bad state: fpVirt == nullptr");
// synchronize with server thread
boost::lock_guard<RlinkConnect> lock(fpCpu->Connect());
return fpVirt->DispatchCmd(args);
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
int RtclRw11Unit::M_dump(RtclArgs& args)
{
if (!args.AllDone()) return kERR;

View File

@@ -1,6 +1,6 @@
// $Id: RtclRw11Unit.hpp 504 2013-04-13 15:37:24Z mueller $
// $Id: RtclRw11Unit.hpp 863 2017-04-02 11:43:15Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-04-02 863 1.1 add fpVirt,DetachCleanup(),AttachDone(),M_virt()
// 2013-03-03 494 1.0 Initial version
// 2013-02-16 488 0.1 First draft
// ---------------------------------------------------------------------------
@@ -20,7 +21,7 @@
/*!
\file
\version $Id: RtclRw11Unit.hpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: RtclRw11Unit.hpp 863 2017-04-02 11:43:15Z mueller $
\brief Declaration of class RtclRw11Unit.
*/
@@ -30,6 +31,8 @@
#include <cstddef>
#include <string>
#include "boost/scoped_ptr.hpp"
#include "librtcltools/RtclProxyBase.hpp"
#include "librtcltools/RtclGetList.hpp"
#include "librtcltools/RtclSetList.hpp"
@@ -37,6 +40,8 @@
#include "librw11/Rw11Cpu.hpp"
#include "librw11/Rw11Unit.hpp"
#include "RtclRw11Virt.hpp"
namespace Retro {
class RtclRw11Unit : public RtclProxyBase {
@@ -50,10 +55,13 @@ namespace Retro {
RtclSetList& SetList();
protected:
virtual void AttachDone() = 0;
void DetachCleanup();
int M_get(RtclArgs& args);
int M_set(RtclArgs& args);
int M_attach(RtclArgs& args);
int M_detach(RtclArgs& args);
int M_virt(RtclArgs& args);
int M_dump(RtclArgs& args);
int M_default(RtclArgs& args);
@@ -61,6 +69,7 @@ namespace Retro {
Rw11Cpu* fpCpu;
RtclGetList fGets;
RtclSetList fSets;
boost::scoped_ptr<RtclRw11Virt> fpVirt;
};
} // end namespace Retro

View File

@@ -1,4 +1,4 @@
// $Id: RtclRw11Unit.ipp 504 2013-04-13 15:37:24Z mueller $
// $Id: RtclRw11Unit.ipp 863 2017-04-02 11:43:15Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@@ -19,7 +19,7 @@
/*!
\file
\version $Id: RtclRw11Unit.ipp 504 2013-04-13 15:37:24Z mueller $
\version $Id: RtclRw11Unit.ipp 863 2017-04-02 11:43:15Z mueller $
\brief Implemenation (inline) of RtclRw11Unit.
*/

View File

@@ -1,6 +1,6 @@
// $Id: RtclRw11UnitBase.hpp 504 2013-04-13 15:37:24Z mueller $
// $Id: RtclRw11UnitBase.hpp 863 2017-04-02 11:43:15Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-04-02 863 1.1 add AttachDone()
// 2013-03-06 495 1.0 Initial version
// 2013-02-16 488 0.1 First draft
// ---------------------------------------------------------------------------
@@ -20,7 +21,7 @@
/*!
\file
\version $Id: RtclRw11UnitBase.hpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: RtclRw11UnitBase.hpp 863 2017-04-02 11:43:15Z mueller $
\brief Declaration of class RtclRw11UnitBase.
*/
@@ -44,6 +45,7 @@ namespace Retro {
const boost::shared_ptr<TO>& ObjSPtr();
protected:
virtual void AttachDone();
int M_stats(RtclArgs& args);
protected:

View File

@@ -1,6 +1,6 @@
// $Id: RtclRw11UnitBase.ipp 680 2015-05-14 13:29:46Z mueller $
// $Id: RtclRw11UnitBase.ipp 863 2017-04-02 11:43:15Z mueller $
//
// Copyright 2013-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-04-02 863 1.2 add AttachDone()
// 2015-05-14 680 1.1 fGets: add enabled (moved from RtclRw11UnitDisk)
// 2013-03-06 495 1.0 Initial version
// 2013-02-16 488 0.1 First draft
@@ -20,11 +21,12 @@
/*!
\file
\version $Id: RtclRw11UnitBase.ipp 680 2015-05-14 13:29:46Z mueller $
\version $Id: RtclRw11UnitBase.ipp 863 2017-04-02 11:43:15Z mueller $
\brief Implemenation (all inline) of RtclRw11UnitBase.
*/
#include "librtcltools/RtclStats.hpp"
#include "RtclRw11VirtFactory.hpp"
/*!
\class Retro::RtclRw11UnitBase
@@ -78,6 +80,20 @@ inline const boost::shared_ptr<TO>& RtclRw11UnitBase<TO>::ObjSPtr()
//------------------------------------------+-----------------------------------
//! FIXME_docs
template <class TO>
void RtclRw11UnitBase<TO>::AttachDone()
{
if (!Obj().Virt()) return;
RtclRw11Virt* pvirt=RtclRw11VirtFactory(Obj().Virt());
if (!pvirt) return;
fpVirt.reset(pvirt);
AddMeth("virt", boost::bind(&RtclRw11Unit::M_virt, this, _1));
return;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
template <class TO>
int RtclRw11UnitBase<TO>::M_stats(RtclArgs& args)
{

View File

@@ -1,4 +1,4 @@
// $Id: RtclRw11UnitDisk.cpp 680 2015-05-14 13:29:46Z mueller $
// $Id: RtclRw11UnitDisk.cpp 863 2017-04-02 11:43:15Z mueller $
//
// Copyright 2013-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@@ -21,7 +21,7 @@
/*!
\file
\version $Id: RtclRw11UnitDisk.cpp 680 2015-05-14 13:29:46Z mueller $
\version $Id: RtclRw11UnitDisk.cpp 863 2017-04-02 11:43:15Z mueller $
\brief Implemenation of RtclRw11UnitDisk.
*/

View File

@@ -1,4 +1,4 @@
// $Id: RtclRw11UnitDisk.hpp 509 2013-04-21 20:46:20Z mueller $
// $Id: RtclRw11UnitDisk.hpp 863 2017-04-02 11:43:15Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@@ -20,7 +20,7 @@
/*!
\file
\version $Id: RtclRw11UnitDisk.hpp 509 2013-04-21 20:46:20Z mueller $
\version $Id: RtclRw11UnitDisk.hpp 863 2017-04-02 11:43:15Z mueller $
\brief Declaration of class RtclRw11UnitDisk.
*/

View File

@@ -0,0 +1,105 @@
// $Id: RtclRw11Virt.cpp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2017-03-11 859 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: RtclRw11Virt.cpp 859 2017-03-11 22:36:45Z mueller $
\brief Implemenation of RtclRw11Virt.
*/
#include "librtcltools/RtclStats.hpp"
#include "RtclRw11Virt.hpp"
using namespace std;
/*!
\class Retro::RtclRw11Virt
\brief FIXME_docs
*/
// all method definitions in namespace Retro
namespace Retro {
//------------------------------------------+-----------------------------------
//! Constructor
RtclRw11Virt::RtclRw11Virt(Rw11Virt* pvirt)
: RtclCmdBase(),
fpVirt(pvirt),
fGets(),
fSets()
{
AddMeth("get", boost::bind(&RtclRw11Virt::M_get, this, _1));
AddMeth("set", boost::bind(&RtclRw11Virt::M_set, this, _1));
AddMeth("stats", boost::bind(&RtclRw11Virt::M_stats, this, _1));
AddMeth("dump", boost::bind(&RtclRw11Virt::M_dump, this, _1));
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
RtclRw11Virt::~RtclRw11Virt()
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs
int RtclRw11Virt::M_get(RtclArgs& args)
{
// synchronize with server thread
boost::lock_guard<RlinkConnect> lock(Virt()->Cpu().Connect());
return fGets.M_get(args);
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
int RtclRw11Virt::M_set(RtclArgs& args)
{
// synchronize with server thread
boost::lock_guard<RlinkConnect> lock(Virt()->Cpu().Connect());
return fSets.M_set(args);
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
int RtclRw11Virt::M_stats(RtclArgs& args)
{
RtclStats::Context cntx;
if (!RtclStats::GetArgs(args, cntx)) return kERR;
if (!RtclStats::Collect(args, cntx, Virt()->Stats())) return kERR;
return kOK;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
int RtclRw11Virt::M_dump(RtclArgs& args)
{
if (!args.AllDone()) return kERR;
std::ostringstream sos;
Virt()->Dump(sos, 0);
args.SetResult(sos);
return kOK;
}
} // end namespace Retro

View File

@@ -0,0 +1,61 @@
// $Id: RtclRw11Virt.hpp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2017-03-11 859 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: RtclRw11Virt.hpp 859 2017-03-11 22:36:45Z mueller $
\brief Declaration of class RtclRw11Virt.
*/
#ifndef included_Retro_RtclRw11Virt
#define included_Retro_RtclRw11Virt 1
#include "librw11/Rw11Virt.hpp"
#include "librtcltools/RtclGetList.hpp"
#include "librtcltools/RtclSetList.hpp"
#include "librtcltools/RtclCmdBase.hpp"
namespace Retro {
class RtclRw11Virt : public RtclCmdBase {
public:
RtclRw11Virt(Rw11Virt* pvirt);
~RtclRw11Virt();
Rw11Virt* Virt() const;
protected:
int M_get(RtclArgs& args);
int M_set(RtclArgs& args);
int M_stats(RtclArgs& args);
int M_dump(RtclArgs& args);
protected:
Rw11Virt* fpVirt;
RtclGetList fGets;
RtclSetList fSets;
};
} // end namespace Retro
#include "RtclRw11Virt.ipp"
#endif

View File

@@ -0,0 +1,36 @@
// $Id: RtclRw11Virt.ipp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2013-03-11 859 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: RtclRw11Virt.ipp 859 2017-03-11 22:36:45Z mueller $
\brief Implemenation (inline) of RtclRw11Virt.
*/
// all method definitions in namespace Retro
namespace Retro {
//------------------------------------------+-----------------------------------
//! FIXME_docs
inline Rw11Virt* RtclRw11Virt::Virt() const
{
return fpVirt;
}
} // end namespace Retro

View File

@@ -0,0 +1,50 @@
// $Id: RtclRw11VirtBase.hpp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2017-03-11 859 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: RtclRw11VirtBase.hpp 859 2017-03-11 22:36:45Z mueller $
\brief Declaration of class RtclRw11VirtBase.
*/
#ifndef included_Retro_RtclRw11VirtBase
#define included_Retro_RtclRw11VirtBase 1
#include "RtclRw11Virt.hpp"
namespace Retro {
template <class TO>
class RtclRw11VirtBase : public RtclRw11Virt {
public:
RtclRw11VirtBase(TO* pobj);
~RtclRw11VirtBase();
TO& Obj();
protected:
TO* fpObj; //!< ptr to object
};
} // end namespace Retro
// implementation is all inline
#include "RtclRw11VirtBase.ipp"
#endif

View File

@@ -0,0 +1,59 @@
// $Id: RtclRw11VirtBase.ipp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2017-03-11 859 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: RtclRw11VirtBase.ipp 859 2017-03-11 22:36:45Z mueller $
\brief Implemenation (all inline) of RtclRw11VirtBase.
*/
/*!
\class Retro::RtclRw11VirtBase
\brief FIXME_docs
*/
// all method definitions in namespace Retro
namespace Retro {
//------------------------------------------+-----------------------------------
//! Constructor
template <class TO>
inline RtclRw11VirtBase<TO>::RtclRw11VirtBase(TO* pobj)
: RtclRw11Virt(pobj),
fpObj(pobj)
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs
template <class TO>
inline RtclRw11VirtBase<TO>::~RtclRw11VirtBase()
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs
template <class TO>
inline TO& RtclRw11VirtBase<TO>::Obj()
{
return *fpObj;
}
} // end namespace Retro

View File

@@ -0,0 +1,82 @@
// $Id: RtclRw11VirtDiskOver.cpp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2017-03-11 859 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: RtclRw11VirtDiskOver.cpp 859 2017-03-11 22:36:45Z mueller $
\brief Implemenation of RtclRw11VirtDiskOver.
*/
#include "RtclRw11VirtDiskOver.hpp"
using namespace std;
/*!
\class Retro::RtclRw11VirtDiskOver
\brief FIXME_docs
*/
// all method definitions in namespace Retro
namespace Retro {
//------------------------------------------+-----------------------------------
//! Constructor
RtclRw11VirtDiskOver::RtclRw11VirtDiskOver(Rw11VirtDiskOver* pobj)
: RtclRw11VirtBase<Rw11VirtDiskOver>(pobj)
{
AddMeth("flush", boost::bind(&RtclRw11VirtDiskOver::M_flush, this, _1));
AddMeth("list", boost::bind(&RtclRw11VirtDiskOver::M_list, this, _1));
}
//------------------------------------------+-----------------------------------
//! Destructor
RtclRw11VirtDiskOver::~RtclRw11VirtDiskOver()
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs
int RtclRw11VirtDiskOver::M_flush(RtclArgs& args)
{
if (!args.AllDone()) return kERR;
// synchronize with server thread
boost::lock_guard<RlinkConnect> lock(Obj().Cpu().Connect());
RerrMsg emsg;
if (!Obj().Flush(emsg)) return args.Quit(emsg);
return kOK;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
int RtclRw11VirtDiskOver::M_list(RtclArgs& args)
{
if (!args.AllDone()) return kERR;
ostringstream sos;
// synchronize with server thread
boost::lock_guard<RlinkConnect> lock(Obj().Cpu().Connect());
Obj().List(sos);
args.SetResult(sos);
return kOK;
}
} // end namespace Retro

View File

@@ -0,0 +1,49 @@
// $Id: RtclRw11VirtDiskOver.hpp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2013-03-11 859 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: RtclRw11VirtDiskOver.hpp 859 2017-03-11 22:36:45Z mueller $
\brief Declaration of class RtclRw11VirtDiskOver.
*/
#ifndef included_Retro_RtclRw11VirtDiskOver
#define included_Retro_RtclRw11VirtDiskOver 1
#include "librw11/Rw11VirtDiskOver.hpp"
#include "RtclRw11VirtBase.hpp"
namespace Retro {
class RtclRw11VirtDiskOver : public RtclRw11VirtBase<Rw11VirtDiskOver> {
public:
RtclRw11VirtDiskOver(Rw11VirtDiskOver* pobj);
~RtclRw11VirtDiskOver();
protected:
int M_flush(RtclArgs& args);
int M_list(RtclArgs& args);
};
} // end namespace Retro
//#include "RtclRw11VirtDiskOver.ipp"
#endif

View File

@@ -0,0 +1,51 @@
// $Id: RtclRw11VirtFactory.cpp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2017-03-11 589 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: RtclRw11VirtFactory.cpp 859 2017-03-11 22:36:45Z mueller $
\brief Implemenation of global function RtclRw11VirtFactory.
*/
#include "librw11/Rw11VirtDiskOver.hpp"
#include "RtclRw11VirtDiskOver.hpp"
#include "RtclRw11VirtFactory.hpp"
using namespace std;
// all method definitions in namespace Retro (avoid using in includes...)
namespace Retro {
//------------------------------------------+-----------------------------------
//! FIXME_docs
RtclRw11Virt* RtclRw11VirtFactory(Rw11Virt* pobj)
{
// 'factory section', create concrete RtclRw11Virt objects
Rw11VirtDiskOver* pdiskover = dynamic_cast<Rw11VirtDiskOver*>(pobj);
if (pdiskover) {
return new RtclRw11VirtDiskOver(pdiskover);
}
return nullptr;
}
} // end namespace Retro

View File

@@ -0,0 +1,39 @@
// $Id: RtclRw11VirtFactory.hpp 859 2017-03-11 22:36:45Z mueller $
//
// Copyright 2017- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2017-03-11 859 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: RtclRw11VirtFactory.hpp 859 2017-03-11 22:36:45Z mueller $
\brief Declaration of global function RtclRw11VirtFactory.
*/
#ifndef included_Retro_RtclRw11VirtFactory
#define included_Retro_RtclRw11VirtFactory 1
#include "librw11/Rw11Virt.hpp"
#include "RtclRw11Virt.hpp"
namespace Retro {
RtclRw11Virt* RtclRw11VirtFactory(Rw11Virt* pobj);
} // end namespace Retro
#endif