From 0721b2cb0e63c6968c8bda00df1ff0018cad6e4f Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 20 Sep 2020 16:11:09 +0100 Subject: Move not template functions out of impl.h --- netfs/lib/entCache.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ netfs/lib/entCache.impl.h | 42 ------------------------------------------ 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/netfs/lib/entCache.cpp b/netfs/lib/entCache.cpp index e1a20a5..6f6d6eb 100644 --- a/netfs/lib/entCache.cpp +++ b/netfs/lib/entCache.cpp @@ -3,3 +3,45 @@ template class EntCache; template class EntCache; + +const int BUFLEN = 8196; + +void +UserEntCache::fillCache() const noexcept +{ + Lock(lock); + setpwent(); + idcache->clear(); + std::array buf {}; + struct passwd pwbuf { + }, *pwp; + while (getpwent_r(&pwbuf, buf.data(), buf.size(), &pwp) == 0) { + idcache->insert(std::make_shared(pwp->pw_uid, pwp->pw_name, pwp->pw_gid)); + } + endpwent(); + time(&fillTime); +} + +GroupEntCache::GroupEntCache(EntryResolverPtr u) : users(std::move(u)) { } + +void +GroupEntCache::fillCache() const noexcept +{ + Lock(lock); + setgrent(); + std::array buf {}; + idcache->clear(); + struct group grpbuf { + }, *grp; + while (getgrent_r(&grpbuf, buf.data(), buf.size(), &grp) == 0) { + auto g = std::make_shared(grp->gr_gid, grp->gr_name); + for (auto member = grp->gr_mem; *member; member++) { + if (auto ent = users->getEntry(*member)) { + g->members.insert(ent->id); + } + } + idcache->insert(std::move(g)); + } + endgrent(); + time(&fillTime); +} diff --git a/netfs/lib/entCache.impl.h b/netfs/lib/entCache.impl.h index 1d7bbc7..5e6289e 100644 --- a/netfs/lib/entCache.impl.h +++ b/netfs/lib/entCache.impl.h @@ -51,46 +51,4 @@ EntCache::getEntryNoFill(const key_t & key) const noexcept return nullptr; } -const int BUFLEN = 8196; - -void -UserEntCache::fillCache() const noexcept -{ - Lock(lock); - setpwent(); - idcache->clear(); - std::array buf {}; - struct passwd pwbuf { - }, *pwp; - while (getpwent_r(&pwbuf, buf.data(), buf.size(), &pwp) == 0) { - idcache->insert(std::make_shared(pwp->pw_uid, pwp->pw_name, pwp->pw_gid)); - } - endpwent(); - time(&fillTime); -} - -GroupEntCache::GroupEntCache(EntryResolverPtr u) : users(std::move(u)) { } - -void -GroupEntCache::fillCache() const noexcept -{ - Lock(lock); - setgrent(); - std::array buf {}; - idcache->clear(); - struct group grpbuf { - }, *grp; - while (getgrent_r(&grpbuf, buf.data(), buf.size(), &grp) == 0) { - auto g = std::make_shared(grp->gr_gid, grp->gr_name); - for (auto member = grp->gr_mem; *member; member++) { - if (auto ent = users->getEntry(*member)) { - g->members.insert(ent->id); - } - } - idcache->insert(std::move(g)); - } - endgrent(); - time(&fillTime); -} - #endif -- cgit v1.2.3