func readLink(fs pathfs.FileSystem, name string) *linkResponse { a, code := fs.Readlink(name, nil) return &linkResponse{ linkContent: a, Status: code, } }
func getAttr(fs pathfs.FileSystem, name string) *attrResponse { a, code := fs.GetAttr(name, nil) return &attrResponse{ Attr: a, Status: code, } }
func getXAttr(fs pathfs.FileSystem, nameAttr string) *xattrResponse { ns := strings.SplitN(nameAttr, _XATTRSEP, 2) a, code := fs.GetXAttr(ns[0], ns[1], nil) return &xattrResponse{ data: a, Status: code, } }
func readDir(fs pathfs.FileSystem, name string) *dirResponse { origStream, code := fs.OpenDir(name, nil) r := &dirResponse{nil, code} if !code.Ok() { return r } r.entries = origStream return r }
// newDirnameMap reads the contents of the given directory. On error, // returns a nil map. This forces reloads in the dirCache until we // succeed. func newDirnameMap(fs pathfs.FileSystem, dir string) map[string]bool { stream, code := fs.OpenDir(dir, nil) if code == fuse.ENOENT { // The directory not existing is not an error. return map[string]bool{} } if !code.Ok() { log.Printf("newDirnameMap(%v): %v %v", fs, dir, code) return nil } result := make(map[string]bool) for _, e := range stream { if e.Mode&fuse.S_IFREG != 0 { result[e.Name] = true } } return result }