Changeset View
Changeset View
Standalone View
Standalone View
swh/fuse/fuse.py
Show First 20 Lines • Show All 244 Lines • ▼ Show 20 Lines | class Fuse(pyfuse3.Operations): | ||||
async def open( | async def open( | ||||
self, inode: int, _flags: int, _ctx: pyfuse3.RequestContext | self, inode: int, _flags: int, _ctx: pyfuse3.RequestContext | ||||
) -> pyfuse3.FileInfo: | ) -> pyfuse3.FileInfo: | ||||
""" Open an inode and return a unique file handle """ | """ Open an inode and return a unique file handle """ | ||||
# Re-use inode as file handle | # Re-use inode as file handle | ||||
self.logger.debug("open(inode=%d)", inode) | self.logger.debug("open(inode=%d)", inode) | ||||
return pyfuse3.FileInfo(fh=inode, keep_cache=True) | entry = self.inode2entry(inode) | ||||
return pyfuse3.FileInfo(fh=inode, **entry.file_info_attrs) | |||||
async def read(self, fh: int, offset: int, length: int) -> bytes: | async def read(self, fh: int, offset: int, length: int) -> bytes: | ||||
""" Read `length` bytes from file handle `fh` at position `offset` """ | """ Read `length` bytes from file handle `fh` at position `offset` """ | ||||
# open() uses inode as file handle | # open() uses inode as file handle | ||||
inode = fh | inode = fh | ||||
entry = self.inode2entry(inode) | entry = self.inode2entry(inode) | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |