diff options
author | Benjamin Barenblat <bbaren@mit.edu> | 2016-02-13 22:14:04 -0500 |
---|---|---|
committer | Benjamin Barenblat <bbaren@mit.edu> | 2016-02-13 22:14:04 -0500 |
commit | fbcdf864613bfeb84edfa945304c065f6a29b44e (patch) | |
tree | 456f93eced1509f2517c767b536d5aa0d6aa2930 /src/operations.cc | |
parent | f4bd49c5bea13e574bb955864641d2b5adc99843 (diff) |
Save root file descriptor when starting up
Allow access to underlying file system by saving a file descriptor to
the underlying directory when starting. Close the FD during FUSE’s
destroy routine, though it won’t matter much.
Diffstat (limited to 'src/operations.cc')
-rw-r--r-- | src/operations.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/operations.cc b/src/operations.cc index abd2f0c..d22a1e2 100644 --- a/src/operations.cc +++ b/src/operations.cc @@ -33,10 +33,14 @@ #include <sys/types.h> #include <unistd.h> +#include "utility.h" + namespace scoville { namespace { +int root_fd_; + struct Directory { DIR* fd; dirent* entry; @@ -75,6 +79,8 @@ void* Initialize(fuse_conn_info*) { void Destroy(void*) { LOG(INFO) << "destroy"; + LOG_IF(ERROR, close(root_fd_) == -1) << "could not close root FD: " + << ErrnoText(); } int Getattr(const char* const path, struct stat* output) { @@ -153,7 +159,9 @@ int Releasedir(const char*, fuse_file_info* const file_info) { } // namespace -fuse_operations FuseOperations() { +fuse_operations FuseOperations(const int root_fd) { + root_fd_ = root_fd; + fuse_operations result; result.flag_nullpath_ok = true; |