summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mythfs/service/openDirectory.cpp12
-rw-r--r--mythfs/service/openDirectory.h3
-rw-r--r--mythfs/service/recordingsVolume.cpp2
-rw-r--r--mythfs/unittests/testMain.cpp8
4 files changed, 22 insertions, 3 deletions
diff --git a/mythfs/service/openDirectory.cpp b/mythfs/service/openDirectory.cpp
index 42a3e59..da6ffcf 100644
--- a/mythfs/service/openDirectory.cpp
+++ b/mythfs/service/openDirectory.cpp
@@ -13,10 +13,20 @@ namespace MythFS {
return directory->getContents();
}
+ ::NetFS::DirectoryContents
+ OpenDirectory::listdir(const Ice::Current &)
+ {
+ ::NetFS::DirectoryContents dc;
+ for (const auto & c : directory->getContents()) {
+ dc[c] = directory->getChild(c)->getattr();
+ }
+ return dc;
+ }
+
void
OpenDirectory::close(const Ice::Current & ic)
{
- ic.adapter->remove(ic.id);
+ ic.adapter->removeAllFacets(ic.id);
}
}
diff --git a/mythfs/service/openDirectory.h b/mythfs/service/openDirectory.h
index 40215f5..db0f1f6 100644
--- a/mythfs/service/openDirectory.h
+++ b/mythfs/service/openDirectory.h
@@ -5,11 +5,12 @@
#include "inodes/node.h"
namespace MythFS {
- class OpenDirectory : public ::NetFS::Directory {
+ class OpenDirectory : public ::NetFS::DirectoryV2 {
public:
OpenDirectory(Node::PointerType);
::NetFS::NameList readdir(const Ice::Current &) override;
+ ::NetFS::DirectoryContents listdir(const Ice::Current &) override;
void close(const Ice::Current &) override;
private:
Node::PointerType directory;
diff --git a/mythfs/service/recordingsVolume.cpp b/mythfs/service/recordingsVolume.cpp
index f8ba489..a476829 100644
--- a/mythfs/service/recordingsVolume.cpp
+++ b/mythfs/service/recordingsVolume.cpp
@@ -20,7 +20,7 @@ namespace MythFS {
NetFS::DirectoryPrx
RecordingsVolume::opendir(const NetFS::ReqEnv &, const std::string & p, const Ice::Current & ic)
{
- return ::NetFS::DirectoryPrx::uncheckedCast(ic.adapter->addWithUUID(new OpenDirectory(resolvePath(p))));
+ return ::NetFS::DirectoryPrx::uncheckedCast(ic.adapter->addFacetWithUUID(new OpenDirectory(resolvePath(p)), "v02"));
}
void RecordingsVolume::mkdir(const NetFS::ReqEnv &, const std::string &, Ice::Int, const Ice::Current&)
{
diff --git a/mythfs/unittests/testMain.cpp b/mythfs/unittests/testMain.cpp
index 46f2727..61d68b5 100644
--- a/mythfs/unittests/testMain.cpp
+++ b/mythfs/unittests/testMain.cpp
@@ -103,12 +103,20 @@ BOOST_AUTO_TEST_CASE( statRoot )
BOOST_AUTO_TEST_CASE( listRoot )
{
+ const auto defaultDirMode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
auto d = rv->opendir(re, "/");
auto ls = d->readdir();
BOOST_REQUIRE_EQUAL(3, ls.size());
BOOST_REQUIRE_EQUAL("all", ls[0]);
BOOST_REQUIRE_EQUAL("by date", ls[1]);
BOOST_REQUIRE_EQUAL("by title", ls[2]);
+
+ auto d2 = NetFS::DirectoryV2Prx::uncheckedCast(d);
+ auto ls2 = d2->listdir();
+ BOOST_REQUIRE_EQUAL(3, ls2.size());
+ BOOST_REQUIRE_EQUAL(defaultDirMode, ls2["all"].mode);
+ BOOST_REQUIRE_EQUAL(defaultDirMode, ls2["by date"].mode);
+ BOOST_REQUIRE_EQUAL(defaultDirMode, ls2["by title"].mode);
d->close();
}