Commit 9636c970 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

nodefs: add more comments in zipfs

parent d1c9d5a4
...@@ -109,7 +109,7 @@ func TestZipFS(t *testing.T) { ...@@ -109,7 +109,7 @@ func TestZipFS(t *testing.T) {
} }
} }
// zipFile is a file read from a zip file. // zipFile is a file read from a zip archive.
type zipFile struct { type zipFile struct {
DefaultOperations DefaultOperations
file *zip.File file *zip.File
...@@ -145,12 +145,12 @@ func (zf *zipFile) Open(ctx context.Context, flags uint32) (FileHandle, uint32, ...@@ -145,12 +145,12 @@ func (zf *zipFile) Open(ctx context.Context, flags uint32) (FileHandle, uint32,
} }
// We don't return a filehandle since we don't really need // We don't return a filehandle since we don't really need
// one. // one. The file content is immutable, so hint the kernel to
return nil, 0, fuse.OK // cache the data.
return nil, fuse.FOPEN_KEEP_CACHE, fuse.OK
} }
// Read sets the minimum, which is the size. A more full-featured // Read simply returns the data that was already unpacked in the Open call
// FS would also set timestamps and permissions.
func (zf *zipFile) Read(ctx context.Context, f FileHandle, dest []byte, off int64) (fuse.ReadResult, fuse.Status) { func (zf *zipFile) Read(ctx context.Context, f FileHandle, dest []byte, off int64) (fuse.ReadResult, fuse.Status) {
end := int(off) + len(dest) end := int(off) + len(dest)
if end > len(zf.data) { if end > len(zf.data) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment