case false: if d, err := b.Get(name); err != nil { return err } else if d == nil { return fuse.ENOENT } if err := b.Delete(name); err != nil { return err } } return nil }) } var _ = fs.NodeRenamer(&Dir{}) func (d *Dir) Rename(c context.Context, req *fuse.RenameRequest, newDir fs.Node) error { return d.fs.backend.Update(c, func(ctx Context) error { b, err := ctx.Dir(d.path) if err != nil { return err } data, err := b.Get(req.OldName) if err != nil { return err } if data == nil { return fuse.ENOENT } targetDir := b
// each in-memory child, so we can return the same node on // multiple Lookups and know what to do on .save() // // each child also stores its own name; if the value in the child, // looked up in this map, does not equal the child, that means the // child has been unlinked active map[string]node } var _ = node(&dir{}) var _ = fs.Node(&dir{}) var _ = fs.NodeCreater(&dir{}) var _ = fs.NodeForgetter(&dir{}) var _ = fs.NodeMkdirer(&dir{}) var _ = fs.NodeRemover(&dir{}) var _ = fs.NodeRenamer(&dir{}) var _ = fs.NodeStringLookuper(&dir{}) var _ = fs.HandleReadDirer(&dir{}) func (d *dir) setName(name string) { d.mu.Lock() defer d.mu.Unlock() d.name = name } func (d *dir) Attr() fuse.Attr { return fuse.Attr{ Inode: d.inode, Mode: os.ModeDir | 0755, Nlink: 1, Uid: env.MyUID,