How to use the ratarmount.StenciledFile function in ratarmount

To help you get started, we’ve selected a few ratarmount examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mxmlnkn / ratarmount / View on Github external
targetLink = '/' + fileInfo.linkname.lstrip( '/' )
            if targetLink != path:
                return targetLink, length, offset, fh )

        # Handle access to underlying non-empty folder
        if isinstance( mountSource, str ):
            f = open( mountSource, 'rb' )
   offset )
            return length )

        if fileInfo.issparse:
            # The TAR file format is very simple. It's just a concatenation of TAR blocks. There is not even a
            # global header, only the TAR block headers. That's why we can simpley cut out the TAR block for
            # the sparse file using StenciledFile and then use tarfile on it to expand the sparse file correctly.
            tarBlockSize = fileInfo.offset - fileInfo.offsetheader + fileInfo.size
            tarSubFile = StenciledFile( mountSource.tarFileObject, [ ( fileInfo.offsetheader, tarBlockSize ) ] )
            tmpTarFile = fileobj = tarSubFile, mode = 'r:' )
            tmpFileObject = tmpTarFile.extractfile( next( iter( tmpTarFile ) ) )
   offset, os.SEEK_SET )
            result = length )
            return result

   fileInfo.offset + offset, os.SEEK_SET )
            return length )
        except RuntimeError as e:
            print( "Caught exception when trying to read data from underlying TAR file! Returning errno.EIO." )
            raise fuse.FuseOSError( fuse.errno.EIO )