func readLink(fs fuse.FileSystem, name string) *linkResponse { a, code := fs.Readlink(name, nil) return &linkResponse{ linkContent: a, Status: code, } }
func getAttr(fs fuse.FileSystem, name string) *attrResponse { a, code := fs.GetAttr(name, nil) return &attrResponse{ Attr: a, Status: code, } }
func getXAttr(fs fuse.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 fuse.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 fuse.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 }
func IsDir(fs fuse.FileSystem, name string) bool { a, code := fs.GetAttr(name, nil) return code.Ok() && a.IsDir() }