Rework policies to return branches rather than path strings

This commit is contained in:
trapexit 2025-05-17 16:35:18 -05:00 • committed by GitHub
parent 7e084ea7db
commit 86b50d2d4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
86 changed files with 1259 additions and 3088 deletions

View file

@ -31,15 +31,15 @@ namespace all
{
static
int
create(const Branches::CPtr &branches_,
StrVec *paths_)
create(const Branches::Ptr &ibranches_,
std::vector<Branch*> &obranches_)
{
int rv;
int error;
fs::info_t info;
error = ENOENT;
for(auto &branch : *branches_)
for(auto &branch : *ibranches_)
{
if(branch.ro_or_nc())
error_and_continue(error,EROFS);
@ -51,10 +51,10 @@ namespace all
if(info.spaceavail < branch.minfreespace())
error_and_continue(error,ENOSPC);
paths_->push_back(branch.path);
obranches_.push_back(&branch);
}
if(paths_->empty())
if(obranches_.empty())
return (errno=error,-1);
return 0;
@ -62,25 +62,25 @@ namespace all
}
int
Policy::All::Action::operator()(const Branches::CPtr &branches_,
Policy::All::Action::operator()(const Branches::Ptr &ibranches_,
const char *fusepath_,
StrVec *paths_) const
std::vector<Branch*> &obranches_) const
{
return Policies::Action::epall(branches_,fusepath_,paths_);
return Policies::Action::epall(ibranches_,fusepath_,obranches_);
}
int
Policy::All::Create::operator()(const Branches::CPtr &branches_,
Policy::All::Create::operator()(const Branches::Ptr &ibranches_,
const char *fusepath_,
StrVec *paths_) const
std::vector<Branch*> &obranches_) const
{
return ::all::create(branches_,paths_);
return ::all::create(ibranches_,obranches_);
}
int
Policy::All::Search::operator()(const Branches::CPtr &branches_,
Policy::All::Search::operator()(const Branches::Ptr &ibranches_,
const char *fusepath_,
StrVec *paths_) const
std::vector<Branch*> &obranches_) const
{
return Policies::Search::epall(branches_,fusepath_,paths_);
return Policies::Search::epall(ibranches_,fusepath_,obranches_);
}