Exemple #1
0
 def getattr(self, path, fh=None):
     if path == '/' or path == "/." or path == "/..":
         return dict(
             st_mode=stat.S_IFDIR | 0555,
             st_nlink=2,
         )
     elif is_dir(path):
         return dict(
             st_mode=stat.S_IFDIR | 0555,
             st_nlink=3,
         )
     elif is_file(path):
         def _get_file_mode():
             if is_executable(path):
                 return 0555
             elif path == PATH_MODULES:
                 return 0666
             else:
                 return 0444
         return dict(
             st_mode=stat.S_IFREG | _get_file_mode(),
             st_nlink=1,
             st_size=len(get_content(path)),
         )
     else:
         raise fuse.FuseOSError(errno.ENOENT)
Exemple #2
0
 def getattr(self, path):
     log.debug("getattr(path={})".format(path))
     st = fuse.Stat()
     if path == '/' or path.endswith("/.") or path.endswith("/.."):
         st.st_mode = stat.S_IFDIR | 0555
         st.st_nlink = 2
     elif is_dir(path):
         st.st_mode = stat.S_IFDIR | 0555
         st.st_nlink = 3
     elif is_file(path):
         st.st_mode = stat.S_IFREG
         if is_executable(path):
             st.st_mode |= 0555
         elif path == PATH_MODULES:
             st.st_mode |= 0666
         else:
             st.st_mode |= 0444
         st.st_nlink = 1
         st.st_size = len(FileMapping(path, os.O_RDONLY).get_text())
     else:
         return -errno.ENOENT
     return st