rework config management

* Add standard way to do str2val and val2str conversion
* Add support for a config file
* Add support for reading and writing settings via ioctl
This commit is contained in:
Antonio SJ Musumeci 2019-09-24 10:27:46 -04:00
parent 8d989777f8
commit 54c41c4994
90 changed files with 3292 additions and 2619 deletions

View file

@ -14,6 +14,7 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "config.hpp"
#include "errno.hpp"
#include "fileinfo.hpp"
#include "fs_base_stat.hpp"
@ -43,13 +44,22 @@ namespace l
namespace FUSE
{
int
fgetattr(const char *fusepath_,
struct stat *st_,
fuse_file_info *ffi_)
fgetattr(const char *fusepath_,
struct stat *st_,
fuse_file_info *ffi_,
fuse_timeouts_t *timeout_)
{
int rv;
const Config &config = Config::ro();
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
return l::fgetattr(fi->fd,st_);
rv = l::fgetattr(fi->fd,st_);
timeout_->entry = ((rv >= 0) ?
config.cache_entry :
config.cache_negative_entry);
timeout_->attr = config.cache_attr;
return rv;
}
}