Commit aedffc58 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

zipfs: godoc comments for tarfs

Change-Id: I36aea1eee9937fab4d33657ca4514866750ac55a
parent 1fa28282
...@@ -23,6 +23,7 @@ import ( ...@@ -23,6 +23,7 @@ import (
// TODO - handle symlinks. // TODO - handle symlinks.
// HeaderToFileInfo fills a fuse.Attr struct from a tar.Header.
func HeaderToFileInfo(out *fuse.Attr, h *tar.Header) { func HeaderToFileInfo(out *fuse.Attr, h *tar.Header) {
out.Mode = uint32(h.Mode) out.Mode = uint32(h.Mode)
out.Size = uint64(h.Size) out.Size = uint64(h.Size)
...@@ -36,6 +37,9 @@ type tarRoot struct { ...@@ -36,6 +37,9 @@ type tarRoot struct {
rc io.ReadCloser rc io.ReadCloser
} }
// tarRoot implements NodeOnAdder
var _ = (fs.NodeOnAdder)((*tarRoot)(nil))
func (r *tarRoot) OnAdd(ctx context.Context) { func (r *tarRoot) OnAdd(ctx context.Context) {
tr := tar.NewReader(r.rc) tr := tar.NewReader(r.rc)
defer r.rc.Close() defer r.rc.Close()
...@@ -134,6 +138,9 @@ func (rc *readCloser) Close() error { ...@@ -134,6 +138,9 @@ func (rc *readCloser) Close() error {
return rc.close() return rc.close()
} }
// NewTarCompressedTree creates the tree of a tar file as a FUSE
// InodeEmbedder. The inode can either be mounted as the root of a
// FUSE mount, or added as a child to some other FUSE tree.
func NewTarCompressedTree(name string, format string) (fs.InodeEmbedder, error) { func NewTarCompressedTree(name string, format string) (fs.InodeEmbedder, error) {
f, err := os.Open(name) f, err := os.Open(name)
if err != nil { if err != nil {
......
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