summaryrefslogtreecommitdiff
path: root/mythfs/service/recordingsVolume.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mythfs/service/recordingsVolume.cpp')
-rw-r--r--mythfs/service/recordingsVolume.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/mythfs/service/recordingsVolume.cpp b/mythfs/service/recordingsVolume.cpp
index cfebe46..f5bf07b 100644
--- a/mythfs/service/recordingsVolume.cpp
+++ b/mythfs/service/recordingsVolume.cpp
@@ -1,10 +1,21 @@
#include "recordingsVolume.h"
+#include <myth-models.h>
+#include <boost/filesystem/path.hpp>
+
+#include <Ice/ObjectAdapter.h>
+#include "inodes/allDirectory.h"
+#include "openDirectory.h"
namespace MythFS {
+ RecordingsVolume::RecordingsVolume(DBPrx db)
+ {
+ contents.insert({ "all", new AllDirectory(db) });
+ }
+
NetFS::DirectoryPrx
- RecordingsVolume::opendir(const NetFS::ReqEnv &, const std::string &, const Ice::Current&)
+ RecordingsVolume::opendir(const NetFS::ReqEnv &, const std::string & p, const Ice::Current & ic)
{
- return NULL;
+ return ::NetFS::DirectoryPrx::uncheckedCast(ic.adapter->addWithUUID(new OpenDirectory(resolvePath(p))));
}
void RecordingsVolume::mkdir(const NetFS::ReqEnv &, const std::string &, Ice::Int, const Ice::Current&)
{
@@ -48,12 +59,12 @@ namespace MythFS {
Ice::Int RecordingsVolume::access(const NetFS::ReqEnv &, const std::string &, Ice::Int, const Ice::Current&)
{
- throw ::NetFS::SystemError(ENOSYS);
+ return 0;
}
- NetFS::Attr RecordingsVolume::getattr(const NetFS::ReqEnv &, const std::string &, const Ice::Current&)
+ NetFS::Attr RecordingsVolume::getattr(const NetFS::ReqEnv &, const std::string & path, const Ice::Current&)
{
- throw ::NetFS::SystemError(ENOSYS);
+ return resolvePath(path)->getattr();
}
void RecordingsVolume::mknod(const NetFS::ReqEnv &, const std::string &, Ice::Int, Ice::Int, const Ice::Current&)
@@ -76,9 +87,9 @@ namespace MythFS {
throw ::NetFS::SystemError(ENOSYS);
}
- std::string RecordingsVolume::readlink(const NetFS::ReqEnv &, const std::string &, const Ice::Current&)
+ std::string RecordingsVolume::readlink(const NetFS::ReqEnv &, const std::string & path, const Ice::Current&)
{
- throw ::NetFS::SystemError(ENOSYS);
+ return resolvePath(path)->readlink();
}
void RecordingsVolume::chmod(const NetFS::ReqEnv &, const std::string &, Ice::Int, const Ice::Current&)
@@ -99,5 +110,16 @@ namespace MythFS {
void RecordingsVolume::disconnect(const Ice::Current&)
{
}
+
+ Node::PointerType
+ RecordingsVolume::resolvePath(const std::string & p)
+ {
+ Node::PointerType d = this;
+ boost::filesystem::path path(p.substr(1));
+ for (const auto & e : path) {
+ d = d->getChild(e.string());
+ }
+ return d;
+ }
}