Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# support extended attributes at all. A test with btrfs mounted with
# -o noacl shows that the actual errno returned by setxattr() is
# EOPNOTSUPP. Also, some Python versions do not know about
# errno.ENOTSUPP and errno(3) says that on Linux, EOPNOTSUPP and ENOTSUP
# have the same value (despite this violating POSIX).
#
# All in all, the situation seems complicated, so we try to use
# EOPNOTSUPP with a fallback on ENOTSUP just in case.
if not hasattr(errno, 'EOPNOTSUPP'):
ACL_ERRNO = errno.ENOTSUP
else:
ACL_ERRNO = errno.EOPNOTSUPP
class Operations(pyfuse3.Operations):
"""A full-featured file system for online data storage
This class implements low-level FUSE operations and is meant to be passed to
pyfuse3.init().
The ``access`` method of this class always gives full access, independent of
file permissions. If the FUSE library is initialized with ``allow_other`` or
``allow_root``, the ``default_permissions`` option should therefore always
be passed as well.
Attributes:
-----------
:cache: Holds information about cached blocks
:inode_cache: A cache for the attributes of the currently opened inodes.
p = self.parent.make_path(sep)
if self.is_last:
return p if p else b""
if p:
return p + sep + self.translated
else:
return self.translated
return None
def __repr__(self):
return "" % (self.num, self.name, self.make_path())
def add_child(self, child):
self.children[child.name] = child
class BashFS(pyfuse3.Operations):
enable_writeback_cache = False
def __init__(self, argv_prefix=("bash", "-c"), separator=b"|"):
super(pyfuse3.Operations, self).__init__()
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
self.argv_prefix = list(argv_prefix)
self.separator = separator
self._inode_generator = count(start=10)
self._file_generator = count(start=10)
self._inode_map = {pyfuse3.ROOT_INODE: Node(None, None,
pyfuse3.ROOT_INODE,
is_root=True)}
self._proc_map = {}
def _make_child_node(self, node_p, name):
new_num = next(self._inode_generator)
def __init__(self, argv_prefix=("bash", "-c"), separator=b"|"):
super(pyfuse3.Operations, self).__init__()
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
self.argv_prefix = list(argv_prefix)
self.separator = separator
self._inode_generator = count(start=10)
self._file_generator = count(start=10)
self._inode_map = {pyfuse3.ROOT_INODE: Node(None, None,
pyfuse3.ROOT_INODE,
is_root=True)}
self._proc_map = {}