cleanup function signatures and definitions

This commit is contained in:
Antonio SJ Musumeci 2020-08-16 18:22:25 -04:00
parent 6cc6524997
commit ec15872a1f
112 changed files with 743 additions and 820 deletions

View file

@ -38,9 +38,9 @@ namespace newest
static
int
create(const Branches &branches_,
const char *fusepath,
const uint64_t minfreespace,
vector<string> *paths)
const char *fusepath_,
const uint64_t minfreespace_,
vector<string> *paths_)
{
rwlock::ReadGuard guard(&branches_.lock);
@ -59,18 +59,18 @@ namespace newest
{
branch = &branches_[i];
if(!fs::exists(branch->path,fusepath,&st))
if(!fs::exists(branch->path,fusepath_,&st))
error_and_continue(error,ENOENT);
if(branch->ro_or_nc())
error_and_continue(error,EROFS);
if(st.st_mtime < newest)
continue;
rv = fs::info(&branch->path,&info);
rv = fs::info(branch->path,&info);
if(rv == -1)
error_and_continue(error,ENOENT);
if(info.readonly)
error_and_continue(error,EROFS);
if(info.spaceavail < minfreespace)
if(info.spaceavail < minfreespace_)
error_and_continue(error,ENOSPC);
newest = st.st_mtime;
@ -80,7 +80,7 @@ namespace newest
if(newestbasepath == NULL)
return (errno=error,-1);
paths->push_back(*newestbasepath);
paths_->push_back(*newestbasepath);
return 0;
}
@ -88,8 +88,8 @@ namespace newest
static
int
action(const Branches &branches_,
const char *fusepath,
vector<string> *paths)
const char *fusepath_,
vector<string> *paths_)
{
rwlock::ReadGuard guard(&branches_.lock);
@ -108,7 +108,7 @@ namespace newest
{
branch = &branches_[i];
if(!fs::exists(branch->path,fusepath,&st))
if(!fs::exists(branch->path,fusepath_,&st))
error_and_continue(error,ENOENT);
if(branch->ro())
error_and_continue(error,EROFS);
@ -127,7 +127,7 @@ namespace newest
if(newestbasepath == NULL)
return (errno=error,-1);
paths->push_back(*newestbasepath);
paths_->push_back(*newestbasepath);
return 0;
}
@ -135,8 +135,8 @@ namespace newest
static
int
search(const Branches &branches_,
const char *fusepath,
vector<string> *paths)
const char *fusepath_,
vector<string> *paths_)
{
rwlock::ReadGuard guard(&branches_.lock);
@ -151,7 +151,7 @@ namespace newest
{
branch = &branches_[i];
if(!fs::exists(branch->path,fusepath,&st))
if(!fs::exists(branch->path,fusepath_,&st))
continue;
if(st.st_mtime < newest)
continue;
@ -163,27 +163,27 @@ namespace newest
if(newestbasepath == NULL)
return (errno=ENOENT,-1);
paths->push_back(*newestbasepath);
paths_->push_back(*newestbasepath);
return 0;
}
}
int
Policy::Func::newest(const Category type,
Policy::Func::newest(const Category type_,
const Branches &branches_,
const char *fusepath,
const uint64_t minfreespace,
vector<string> *paths)
const char *fusepath_,
const uint64_t minfreespace_,
vector<string> *paths_)
{
switch(type)
switch(type_)
{
case Category::CREATE:
return newest::create(branches_,fusepath,minfreespace,paths);
return newest::create(branches_,fusepath_,minfreespace_,paths_);
case Category::ACTION:
return newest::action(branches_,fusepath,paths);
return newest::action(branches_,fusepath_,paths_);
case Category::SEARCH:
default:
return newest::search(branches_,fusepath,paths);
return newest::search(branches_,fusepath_,paths_);
}
}