summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/blob.cpp38
-rw-r--r--src/blob.h21
-rw-r--r--src/dir.cpp33
-rw-r--r--src/dir.h10
-rw-r--r--src/git.cpp56
-rw-r--r--src/git.h30
-rw-r--r--src/main.cpp5
-rw-r--r--src/repo.cpp67
-rw-r--r--src/repo.h46
-rw-r--r--src/repoList.cpp7
-rw-r--r--src/repoList.h8
11 files changed, 169 insertions, 152 deletions
diff --git a/src/blob.cpp b/src/blob.cpp
index 2211736..285cd0b 100644
--- a/src/blob.cpp
+++ b/src/blob.cpp
@@ -2,17 +2,16 @@
#include "repo.h"
#include <Ice/Current.h>
#include <Ice/ObjectAdapter.h>
-#include <algorithm>
#include <cerrno>
#include <exceptions.h>
#include <file.h>
-#include <memory>
+#include <numeric.h>
#include <sys/stat.h>
#include <types.h>
-GitFS::Blob::Blob(const Repo * const r, std::string && path) :
- repo(r), entry(Git::TreeEntryByPath(repo->tree, path)), blob(getBlob()), blobSize(git_blob_rawsize(blob.get())),
- blobContent(static_cast<const char *>(git_blob_rawcontent(blob.get())))
+GitFS::Blob::Blob(const Repo * const repo, const std::string & path) :
+ repo(repo), entry(Git::treeEntryByPath(repo->tree, path)), blob(getBlob()),
+ blobContent(static_cast<const ::Ice::Byte *>(git_blob_rawcontent(blob.get())), git_blob_rawsize(blob.get()))
{
}
@@ -28,35 +27,36 @@ GitFS::Blob::getBlob() const
throw NetFS::SystemError(ELOOP);
}
- return Git::BlobLookup(repo->repo, *git_tree_entry_id(entry.get()));
+ return Git::blobLookup(repo->repo, *git_tree_entry_id(entry.get()));
}
void
-GitFS::Blob::close(const ::Ice::Current & current)
+GitFS::Blob::close(const ::Ice::Current & ice)
{
- current.adapter->remove(current.id);
+ ice.adapter->remove(ice.id);
}
NetFS::Attr
GitFS::Blob::fgetattr(const ::Ice::Current &)
{
- NetFS::Attr a;
- a << *blob << *entry << *repo->commit;
- a.gid = repo->gid;
- a.uid = repo->uid;
- return a;
+ NetFS::Attr attr;
+ attr << *blob << *entry << *repo->commit;
+ attr.gid = repo->gid;
+ attr.uid = repo->uid;
+ return attr;
}
NetFS::Buffer
-GitFS::Blob::read(long long int o, long long int s, const ::Ice::Current &)
+GitFS::Blob::read(long long int offsetSized, long long int sizeLong, const ::Ice::Current &)
{
- const auto offset {static_cast<BlobSize>(o)};
- const auto size {static_cast<BlobSize>(s)};
- if (offset > blobSize) {
+ const size_t offset = safe {offsetSized};
+ if (offset > blobContent.size()) {
return {};
}
- auto len = std::min(blobSize - offset, size);
- return {blobContent + offset, blobContent + offset + len};
+ const size_t size = safe {sizeLong};
+ const auto len = std::min(blobContent.size() - offset, size);
+ const auto range = blobContent.subspan(offset, len);
+ return {range.begin(), range.end()};
}
void
diff --git a/src/blob.h b/src/blob.h
index 0b2f6e7..3443e5d 100644
--- a/src/blob.h
+++ b/src/blob.h
@@ -4,8 +4,10 @@
#include "git.h"
#include <file.h>
#include <git2.h>
+#include <span>
#include <string>
#include <types.h>
+
namespace Ice {
struct Current;
}
@@ -13,27 +15,26 @@ namespace Ice {
namespace GitFS {
using namespace NetFS;
class Repo;
+
class Blob : public File {
public:
- Blob(const Repo * const r, std::string &&);
+ Blob(const Repo * repo, const std::string &);
- void close(const ::Ice::Current & current) override;
- Attr fgetattr(const ::Ice::Current & current) override;
- Buffer read(long long int offset, long long int size, const ::Ice::Current & current) override;
- void ftruncate(long long int size, const ::Ice::Current & current) override;
+ void close(const ::Ice::Current & ice) override;
+ Attr fgetattr(const ::Ice::Current & ice) override;
+ Buffer read(long long int offset, long long int size, const ::Ice::Current & ice) override;
+ void ftruncate(long long int size, const ::Ice::Current & ice) override;
void write(long long int offset, long long int size, std::pair<const Ice::Byte *, const Ice::Byte *> data,
- const ::Ice::Current & current) override;
+ const ::Ice::Current & ice) override;
long long int copyrange(
FilePrxPtr, long long int, long long int, long long int, int, const Ice::Current &) override;
private:
- Git::BlobPtr getBlob() const;
+ [[nodiscard]] Git::BlobPtr getBlob() const;
const Repo * const repo;
Git::TreeEntryPtr entry;
Git::BlobPtr blob;
- using BlobSize = decltype(git_blob_rawsize({}));
- const BlobSize blobSize;
- const char * const blobContent;
+ std::span<const ::Ice::Byte> blobContent;
};
}
diff --git a/src/dir.cpp b/src/dir.cpp
index f502c45..b2de780 100644
--- a/src/dir.cpp
+++ b/src/dir.cpp
@@ -12,7 +12,8 @@
#include <types.h>
#include <utility>
-GitFS::Directory::Directory(Repo * const r, std::string && p) : repo(r), path(std::move(p)), subTreeCacheRootId({})
+GitFS::Directory::Directory(Repo * const repo, std::string path) :
+ repo(repo), path(std::move(path)), subTreeCacheRootId({})
{
getSubtree();
}
@@ -26,11 +27,11 @@ GitFS::Directory::getSubtree() const
subTreeCache = repo->tree;
}
else {
- auto e = Git::TreeEntryByPath(repo->tree, path);
- if (!S_ISDIR(git_tree_entry_filemode(e.get()))) {
+ auto entry = Git::treeEntryByPath(repo->tree, path);
+ if (!S_ISDIR(git_tree_entry_filemode(entry.get()))) {
throw NetFS::SystemError(ENOTDIR);
}
- subTreeCache = Git::TreeLookup(repo->repo, *git_tree_entry_id(e.get()));
+ subTreeCache = Git::treeLookup(repo->repo, *git_tree_entry_id(entry.get()));
}
subTreeCacheRootId = *git_tree_id(repo->tree.get());
}
@@ -38,9 +39,9 @@ GitFS::Directory::getSubtree() const
}
void
-GitFS::Directory::close(const ::Ice::Current & current)
+GitFS::Directory::close(const ::Ice::Current & ice)
{
- current.adapter->remove(current.id);
+ ice.adapter->remove(ice.id);
}
NetFS::NameList
@@ -48,9 +49,11 @@ GitFS::Directory::readdir(const ::Ice::Current &)
{
const auto subTree = getSubtree();
NetFS::NameList list;
- for (auto idx = git_tree_entrycount(subTree.get()); idx--;) {
+ auto idx = git_tree_entrycount(subTree.get());
+ list.reserve(idx);
+ while (idx--) {
const auto entry = git_tree_entry_byindex(subTree.get(), idx);
- list.push_back(git_tree_entry_name(entry));
+ list.emplace_back(git_tree_entry_name(entry));
}
return list;
}
@@ -62,15 +65,15 @@ GitFS::Directory::listdir(const ::Ice::Current &)
NetFS::DirectoryContents list;
for (auto idx = git_tree_entrycount(subTree.get()); idx--;) {
const auto entry = git_tree_entry_byindex(subTree.get(), idx);
- NetFS::Attr a {};
- a << *entry << *repo->commit;
+ NetFS::Attr attr {};
+ attr << *entry << *repo->commit;
if (S_ISREG(git_tree_entry_filemode(entry))) {
- auto blob = Git::BlobLookup(repo->repo, *git_tree_entry_id(entry));
- a << *blob;
+ auto blob = Git::blobLookup(repo->repo, *git_tree_entry_id(entry));
+ attr << *blob;
}
- a.gid = repo->gid;
- a.uid = repo->uid;
- list.emplace(git_tree_entry_name(entry), a);
+ attr.gid = repo->gid;
+ attr.uid = repo->uid;
+ list.emplace(git_tree_entry_name(entry), std::move(attr));
}
return list;
}
diff --git a/src/dir.h b/src/dir.h
index 626d80f..1d5ee24 100644
--- a/src/dir.h
+++ b/src/dir.h
@@ -6,6 +6,7 @@
#include <git2.h>
#include <string>
#include <types.h>
+
namespace Ice {
struct Current;
}
@@ -13,13 +14,14 @@ namespace Ice {
namespace GitFS {
using namespace NetFS;
class Repo;
+
class Directory : public NetFS::Directory {
public:
- Directory(Repo * const r, std::string &&);
+ Directory(Repo * repo, std::string);
- void close(const ::Ice::Current & current) override;
- NameList readdir(const ::Ice::Current & current) override;
- DirectoryContents listdir(const ::Ice::Current & current) override;
+ void close(const ::Ice::Current & ice) override;
+ NameList readdir(const ::Ice::Current & ice) override;
+ DirectoryContents listdir(const ::Ice::Current & ice) override;
private:
Git::TreePtr getSubtree() const;
diff --git a/src/git.cpp b/src/git.cpp
index e6aed3f..b242545 100644
--- a/src/git.cpp
+++ b/src/git.cpp
@@ -2,6 +2,7 @@
#include <array>
#include <cerrno>
#include <exceptions.h>
+#include <numeric.h>
#include <sys/stat.h>
#include <types.h>
@@ -24,7 +25,7 @@ namespace GitFS::Git {
}
git_oid
- OidParse(const std::string_view & str)
+ oidParse(const std::string_view str)
{
git_oid oid;
gitSafe<NetFS::ConfigError>(git_oid_fromstrn, &oid, str.data(), str.length());
@@ -32,41 +33,44 @@ namespace GitFS::Git {
}
RepositoryPtr
- RepositoryOpenBare(const std::string & path)
+ repositoryOpenBare(const std::string & path)
{
return gitSafeGet<NetFS::ConfigError>(git_repository_open_bare, git_repository_free, path.c_str());
}
BlobPtr
- BlobLookup(const RepositoryPtr & repo, const git_oid & blob)
+ blobLookup(const RepositoryPtr & repo, const git_oid & blob)
{
return gitSafeGet<NetFS::SystemError>(git_blob_lookup, git_blob_free, repo.get(), &blob);
}
CommitPtr
- CommitLookup(const RepositoryPtr & repo, const git_oid & commitId)
+ commitLookup(const RepositoryPtr & repo, const git_oid & commitId)
{
return gitSafeGet<NetFS::ConfigError>(git_commit_lookup, git_commit_free, repo.get(), &commitId);
}
TreePtr
- TreeLookup(const RepositoryPtr & repo, const git_oid & treeId)
+ treeLookup(const RepositoryPtr & repo, const git_oid & treeId)
{
return gitSafeGet<NetFS::SystemError>(git_tree_lookup, git_tree_free, repo.get(), &treeId);
}
TreeEntryPtr
- TreeEntryByPath(const TreePtr & tree, const std::string & path)
+ treeEntryByPath(const TreePtr & tree, const std::string & path)
{
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) Skip leading / with C interface
return gitSafeGet<NetFS::SystemError>(git_tree_entry_bypath, git_tree_entry_free, tree.get(), path.c_str() + 1);
}
+
RefPtr
- Commitish(const RepositoryPtr & repo, const std::string & name)
+ commitish(const RepositoryPtr & repo, const std::string & name)
{
return gitSafeGet<NetFS::ConfigError>(git_reference_dwim, git_reference_free, repo.get(), name.c_str());
}
+
RefPtr
- Resolve(const RefPtr & ref)
+ resolve(const RefPtr & ref)
{
return gitSafeGet<NetFS::ConfigError>(git_reference_resolve, git_reference_free, ref.get());
}
@@ -74,44 +78,44 @@ namespace GitFS::Git {
namespace NetFS {
Attr &
- operator<<(Attr & a, const git_tree_entry & e)
+ operator<<(Attr & attr, const git_tree_entry & entry)
{
- a.mode = git_tree_entry_filemode(&e);
- if (S_ISDIR(a.mode)) {
- a.mode |= S_IXUSR | S_IXGRP | S_IXOTH | S_IRUSR | S_IRGRP | S_IROTH;
+ attr.mode = git_tree_entry_filemode(&entry);
+ if (S_ISDIR(attr.mode)) {
+ attr.mode |= S_IXUSR | S_IXGRP | S_IXOTH | S_IRUSR | S_IRGRP | S_IROTH;
}
- else if (S_ISLNK(a.mode)) {
- a.mode |= S_IRUSR | S_IRGRP | S_IROTH;
+ else if (S_ISLNK(attr.mode)) {
+ attr.mode |= S_IRUSR | S_IRGRP | S_IROTH;
}
else {
- a.mode ^= S_IWUSR;
+ attr.mode ^= S_IWUSR;
}
- return a;
+ return attr;
}
Attr &
- operator<<(Attr & a, const git_commit & c)
+ operator<<(Attr & attr, const git_commit & commit)
{
- a.ctime = a.atime = a.mtime = git_commit_time(&c);
- return a;
+ attr.ctime = attr.atime = attr.mtime = git_commit_time(&commit);
+ return attr;
}
Attr &
- operator<<(Attr & a, const git_blob & b)
+ operator<<(Attr & attr, const git_blob & blob)
{
- a.blockSize = 1;
- a.blocks = a.size = static_cast<decltype(Attr::blocks)>(git_blob_rawsize(&b));
- return a;
+ attr.blockSize = 1;
+ attr.blocks = attr.size = safe {git_blob_rawsize(&blob)};
+ return attr;
}
}
namespace std {
std::ostream &
- operator<<(std::ostream & s, const git_oid & oid)
+ operator<<(std::ostream & strm, const git_oid & oid)
{
std::array<char, GIT_OID_HEXSZ + 1> str {};
git_oid_tostr(str.data(), str.size(), &oid);
- s.write(str.data(), GIT_OID_HEXSZ);
- return s;
+ strm.write(str.data(), GIT_OID_HEXSZ);
+ return strm;
}
}
diff --git a/src/git.h b/src/git.h
index 1dce92e..bc82fef 100644
--- a/src/git.h
+++ b/src/git.h
@@ -12,10 +12,10 @@ namespace GitFS::Git {
template<typename E, typename... P, typename... A>
void
- gitSafe(int (*func)(P...), A... p)
+ gitSafe(int (*func)(P...), A... params)
{
- if (int _giterror = func(p...)) {
- throwError<E>(_giterror);
+ if (int giterror = func(params...)) {
+ throwError<E>(giterror);
}
}
@@ -23,33 +23,33 @@ namespace GitFS::Git {
template<typename E, typename R, typename... P, typename... A>
auto
- gitSafeGet(int (*get)(R **, P...), void (*release)(R *), A... p)
+ gitSafeGet(int (*get)(R **, P...), void (*release)(R *), A... params)
{
- R * r = nullptr;
- gitSafe<E>(get, &r, p...);
- return TPtr<R>(r, release);
+ R * rtn = nullptr;
+ gitSafe<E>(get, &rtn, params...);
+ return TPtr<R>(rtn, release);
}
- git_oid OidParse(const std::string_view & str);
+ git_oid oidParse(std::string_view str);
using RepositoryPtr = TPtr<git_repository>;
- RepositoryPtr RepositoryOpenBare(const std::string & path);
+ RepositoryPtr repositoryOpenBare(const std::string & path);
using BlobPtr = TPtr<const git_blob>;
- BlobPtr BlobLookup(const RepositoryPtr & repo, const git_oid & blob);
+ BlobPtr blobLookup(const RepositoryPtr & repo, const git_oid & blob);
using CommitPtr = TPtr<const git_commit>;
- CommitPtr CommitLookup(const RepositoryPtr & repo, const git_oid & commitId);
+ CommitPtr commitLookup(const RepositoryPtr & repo, const git_oid & commitId);
using TreePtr = TPtr<const git_tree>;
- TreePtr TreeLookup(const RepositoryPtr & repo, const git_oid & treeId);
+ TreePtr treeLookup(const RepositoryPtr & repo, const git_oid & treeId);
using TreeEntryPtr = TPtr<const git_tree_entry>;
- TreeEntryPtr TreeEntryByPath(const TreePtr & tree, const std::string & path);
+ TreeEntryPtr treeEntryByPath(const TreePtr & tree, const std::string & path);
using RefPtr = TPtr<const git_reference>;
- RefPtr Commitish(const RepositoryPtr & repo, const std::string & name);
- RefPtr Resolve(const RefPtr &);
+ RefPtr commitish(const RepositoryPtr & repo, const std::string & name);
+ RefPtr resolve(const RefPtr &);
}
namespace NetFS {
diff --git a/src/main.cpp b/src/main.cpp
index 7ee7dff..1314d12 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -6,7 +6,6 @@
#include <git2.h>
#include <icecube.h>
#include <icetrayService.h>
-#include <memory>
#include <service.h>
#include <string>
@@ -30,10 +29,10 @@ namespace GitFS {
Main & operator=(Main &&) = delete;
void
- addObjects(const std::string &, const Ice::CommunicatorPtr & ic, const Ice::StringSeq &,
+ addObjects(const std::string &, const Ice::CommunicatorPtr & com, const Ice::StringSeq &,
const Ice::ObjectAdapterPtr & adp) override
{
- IceTray::Cube::addObject<NetFS::Service, RepoList>(adp, "Service", ic->getProperties());
+ IceTray::Cube::addObject<NetFS::Service, RepoList>(adp, "Service", com->getProperties());
}
};
diff --git a/src/repo.cpp b/src/repo.cpp
index 2bced8a..6bf442f 100644
--- a/src/repo.cpp
+++ b/src/repo.cpp
@@ -15,21 +15,23 @@
#include <unistd.h>
#include <utility>
-std::string
-operator/(const std::string & a, const std::string & b)
-{
- return a.empty() ? b : a;
+namespace {
+ std::string
+ operator/(const std::string & value, const std::string & fallback)
+ {
+ return value.empty() ? fallback : value;
+ }
}
GitFS::Repo::Repo(const PropertyReader & properties) :
- repo(Git::RepositoryOpenBare(properties("gitdir"))), commitish(properties("commitish") / "main"), isBranch(false),
+ repo(Git::repositoryOpenBare(properties("gitdir"))), commitish(properties("commitish") / "main"), isBranch(false),
resolvedAt(0), gid(properties("gid") / "root"), uid(properties("uid") / "root")
{
if (commitish.length() == GIT_OID_HEXSZ) {
- commit = Git::CommitLookup(repo, Git::OidParse(commitish));
+ commit = Git::commitLookup(repo, Git::oidParse(commitish));
}
else {
- ref = Git::Commitish(repo, commitish);
+ ref = Git::commitish(repo, commitish);
isBranch = git_reference_is_branch(ref.get());
}
update();
@@ -38,17 +40,18 @@ GitFS::Repo::Repo(const PropertyReader & properties) :
void
GitFS::Repo::update()
{
- if (!commit || (isBranch && ref && resolvedAt < std::time(nullptr) - 30)) {
- commit = Git::CommitLookup(repo, *git_reference_target(Git::Resolve(ref).get()));
+ constexpr time_t MIN_CHECK_TIME = 30;
+ if (!commit || (isBranch && ref && resolvedAt < std::time(nullptr) - MIN_CHECK_TIME)) {
+ commit = Git::commitLookup(repo, *git_reference_target(Git::resolve(ref).get()));
resolvedAt = std::time(nullptr);
}
- tree = Git::TreeLookup(repo, *git_commit_tree_id(commit.get()));
+ tree = Git::treeLookup(repo, *git_commit_tree_id(commit.get()));
}
void
-GitFS::Repo::disconnect(const ::Ice::Current & current)
+GitFS::Repo::disconnect(const ::Ice::Current & ice)
{
- current.adapter->remove(current.id);
+ ice.adapter->remove(ice.id);
}
NetFS::DirectoryPrxPtr
@@ -73,7 +76,7 @@ GitFS::Repo::statfs(ReqEnv, ::std::string path, const ::Ice::Current &)
}
int
-GitFS::Repo::access(ReqEnv, ::std::string path, int mode, const ::Ice::Current &)
+GitFS::Repo::access(ReqEnv, const ::std::string path, const int mode, const ::Ice::Current &)
{
if (mode & W_OK) {
return EACCES;
@@ -87,8 +90,8 @@ GitFS::Repo::access(ReqEnv, ::std::string path, int mode, const ::Ice::Current &
try {
update();
- auto e = Git::TreeEntryByPath(tree, path);
- const auto emode = git_tree_entry_filemode(e.get());
+ auto entry = Git::treeEntryByPath(tree, path);
+ const auto emode = git_tree_entry_filemode(entry.get());
if (S_ISDIR(emode)) {
return 0;
@@ -111,46 +114,46 @@ GitFS::Repo::access(ReqEnv, ::std::string path, int mode, const ::Ice::Current &
}
NetFS::Attr
-GitFS::Repo::getattr(ReqEnv, ::std::string path, const ::Ice::Current &)
+GitFS::Repo::getattr(ReqEnv, const ::std::string path, const ::Ice::Current &)
{
if (path.empty()) {
throw NetFS::SystemError(EINVAL);
}
- NetFS::Attr a {};
+ NetFS::Attr attr {};
if (path == "/") {
- a.mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
+ attr.mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
}
else {
update();
- auto entry = Git::TreeEntryByPath(tree, path);
- a << *entry;
+ auto entry = Git::treeEntryByPath(tree, path);
+ attr << *entry;
if (S_ISREG(git_tree_entry_filemode(entry.get()))) {
- auto blob = Git::BlobLookup(repo, *git_tree_entry_id(entry.get()));
- a << *blob;
+ auto blob = Git::blobLookup(repo, *git_tree_entry_id(entry.get()));
+ attr << *blob;
}
}
- a << *commit;
- a.gid = gid;
- a.uid = uid;
- return a;
+ attr << *commit;
+ attr.gid = gid;
+ attr.uid = uid;
+ return attr;
}
::std::string
-GitFS::Repo::readlink(ReqEnv, ::std::string path, const ::Ice::Current &)
+GitFS::Repo::readlink(ReqEnv, const ::std::string path, const ::Ice::Current &)
{
if (path.empty() || path == "/") {
throw NetFS::SystemError(EINVAL);
}
update();
- auto e = Git::TreeEntryByPath(tree, path);
- if (!S_ISLNK(git_tree_entry_filemode(e.get()))) {
+ auto entry = Git::treeEntryByPath(tree, path);
+ if (!S_ISLNK(git_tree_entry_filemode(entry.get()))) {
throw NetFS::SystemError(EINVAL);
}
- auto blob = Git::BlobLookup(repo, *git_tree_entry_id(e.get()));
- auto n = static_cast<const ::std::string::value_type *>(git_blob_rawcontent(blob.get()));
- return {n, n + git_blob_rawsize(blob.get())};
+ auto blob = Git::blobLookup(repo, *git_tree_entry_id(entry.get()));
+ auto content = static_cast<const ::std::string::value_type *>(git_blob_rawcontent(blob.get()));
+ return {content, git_blob_rawsize(blob.get())};
}
NetFS::FilePrxPtr
diff --git a/src/repo.h b/src/repo.h
index 795dd87..0087a3f 100644
--- a/src/repo.h
+++ b/src/repo.h
@@ -12,38 +12,40 @@
#include <string_view>
#include <types.h>
#include <volume.h>
+
namespace Ice {
struct Current;
}
namespace GitFS {
using namespace NetFS;
- using PropertyReader = std::function<std::string(const std::string_view &)>;
+ using PropertyReader = std::function<std::string(const std::string_view)>;
+
class Repo : public Volume {
public:
- Repo(const PropertyReader &);
+ explicit Repo(const PropertyReader &);
- void disconnect(const ::Ice::Current & current) override;
- DirectoryPrxPtr opendir(ReqEnv env, ::std::string path, const ::Ice::Current & current) override;
- VFS statfs(ReqEnv env, ::std::string path, const ::Ice::Current & current) override;
- int access(ReqEnv env, ::std::string path, int mode, const ::Ice::Current & current) override;
- Attr getattr(ReqEnv env, ::std::string path, const ::Ice::Current & current) override;
- ::std::string readlink(ReqEnv env, ::std::string path, const ::Ice::Current & current) override;
- FilePrxPtr open(ReqEnv env, ::std::string path, int flags, const ::Ice::Current & current) override;
- FilePrxPtr create(ReqEnv env, ::std::string path, int flags, int mode, const ::Ice::Current & current) override;
- void truncate(ReqEnv env, ::std::string path, long long int size, const ::Ice::Current & current) override;
- void unlink(ReqEnv env, ::std::string path, const ::Ice::Current & current) override;
- void mkdir(ReqEnv env, ::std::string path, int mode, const ::Ice::Current & current) override;
- void rmdir(ReqEnv env, ::std::string path, const ::Ice::Current & current) override;
- void mknod(ReqEnv env, ::std::string path, int mode, int dev, const ::Ice::Current & current) override;
- void symlink(ReqEnv env, ::std::string path1, ::std::string path2, const ::Ice::Current & current) override;
- void link(ReqEnv env, ::std::string path1, ::std::string path2, const ::Ice::Current & current) override;
- void rename(ReqEnv env, ::std::string from, ::std::string to, const Ice::optional<Ice::Int>,
- const ::Ice::Current & current) override;
- void chmod(ReqEnv env, ::std::string path, int mode, const ::Ice::Current & current) override;
- void chown(ReqEnv env, ::std::string path, int uid, int gid, const ::Ice::Current & current) override;
+ void disconnect(const ::Ice::Current & ice) override;
+ DirectoryPrxPtr opendir(ReqEnv env, ::std::string path, const ::Ice::Current & ice) override;
+ VFS statfs(ReqEnv env, ::std::string path, const ::Ice::Current & ice) override;
+ int access(ReqEnv env, ::std::string path, int mode, const ::Ice::Current & ice) override;
+ Attr getattr(ReqEnv env, ::std::string path, const ::Ice::Current & ice) override;
+ ::std::string readlink(ReqEnv env, ::std::string path, const ::Ice::Current & ice) override;
+ FilePrxPtr open(ReqEnv env, ::std::string path, int flags, const ::Ice::Current & ice) override;
+ FilePrxPtr create(ReqEnv env, ::std::string path, int flags, int mode, const ::Ice::Current & ice) override;
+ void truncate(ReqEnv env, ::std::string path, long long int size, const ::Ice::Current & ice) override;
+ void unlink(ReqEnv env, ::std::string path, const ::Ice::Current & ice) override;
+ void mkdir(ReqEnv env, ::std::string path, int mode, const ::Ice::Current & ice) override;
+ void rmdir(ReqEnv env, ::std::string path, const ::Ice::Current & ice) override;
+ void mknod(ReqEnv env, ::std::string path, int mode, int dev, const ::Ice::Current & ice) override;
+ void symlink(ReqEnv env, ::std::string path1, ::std::string path2, const ::Ice::Current & ice) override;
+ void link(ReqEnv env, ::std::string path1, ::std::string path2, const ::Ice::Current & ice) override;
+ void rename(ReqEnv env, ::std::string pathFrom, ::std::string pathTo, Ice::optional<Ice::Int>,
+ const ::Ice::Current & ice) override;
+ void chmod(ReqEnv env, ::std::string path, int mode, const ::Ice::Current & ice) override;
+ void chown(ReqEnv env, ::std::string path, int uid, int gid, const ::Ice::Current & ice) override;
void utimens(ReqEnv env, ::std::string path, long long int atime, long long int atimens, long long int mtime,
- long long int mtimens, const ::Ice::Current & current) override;
+ long long int mtimens, const ::Ice::Current & ice) override;
private:
void update();
diff --git a/src/repoList.cpp b/src/repoList.cpp
index 7a69b78..8c5b8a9 100644
--- a/src/repoList.cpp
+++ b/src/repoList.cpp
@@ -7,11 +7,12 @@
#include <Ice/Proxy.h>
#include <compileTimeFormatter.h>
#include <exceptions.h>
+#include <iostream>
#include <memory>
#include <utility>
#include <volume.h>
-GitFS::RepoList::RepoList(Ice::PropertiesPtr && p) : properties(std::move(p)) { }
+GitFS::RepoList::RepoList(Ice::PropertiesPtr props) : properties(std::move(props)) { }
AdHocFormatter(RepoPropertyName, "GitFS.%?.%?");
@@ -38,6 +39,8 @@ GitFS::RepoList::connect(const ::std::string volume, const ::std::string auth, c
NetFS::SettingsPtr
GitFS::RepoList::getSettings(const ::Ice::Current & ice)
{
+ constexpr int DEFAULT_MAX_MESSAGE_SIZE = 1024;
const auto props = ice.adapter->getCommunicator()->getProperties();
- return std::make_shared<NetFS::Settings>(props->getPropertyAsIntWithDefault("Ice.MessageSizeMax", 1024));
+ return std::make_shared<NetFS::Settings>(
+ props->getPropertyAsIntWithDefault("Ice.MessageSizeMax", DEFAULT_MAX_MESSAGE_SIZE));
}
diff --git a/src/repoList.h b/src/repoList.h
index 7995136..9dab8b5 100644
--- a/src/repoList.h
+++ b/src/repoList.h
@@ -5,6 +5,7 @@
#include <service.h>
#include <string>
#include <volume.h>
+
namespace Ice {
struct Current;
}
@@ -12,11 +13,10 @@ namespace Ice {
namespace GitFS {
class RepoList : public NetFS::Service {
public:
- RepoList(Ice::PropertiesPtr &&);
+ explicit RepoList(Ice::PropertiesPtr);
- NetFS::VolumePrxPtr connect(
- const ::std::string volume, const ::std::string auth, const ::Ice::Current & current) override;
- NetFS::SettingsPtr getSettings(const ::Ice::Current & current) override;
+ NetFS::VolumePrxPtr connect(::std::string volume, ::std::string auth, const ::Ice::Current & ice) override;
+ NetFS::SettingsPtr getSettings(const ::Ice::Current & ice) override;
private:
const Ice::PropertiesPtr properties;