示例#1
0
func (me *memNode) Link(name string, existing fuse.FsNode, context *fuse.Context) (fi *fuse.Attr, newNode fuse.FsNode, code fuse.Status) {
	me.Inode().AddChild(name, existing.Inode())
	fi, code = existing.GetAttr(nil, context)

	me.mutex.Lock()
	defer me.mutex.Unlock()
	me.touch()
	return fi, existing, code
}
示例#2
0
func (me *memNode) Rename(oldName string, newParent fuse.FsNode, newName string, context *fuse.Context) (code fuse.Status) {
	me.mutex.Lock()
	defer me.mutex.Unlock()
	ch := me.Inode().RmChild(oldName)
	if ch == nil {
		return fuse.ENOENT
	}

	if me.original != "" || me == me.fs.root {
		me.fs.deleted[filepath.Join(me.original, oldName)] = true
	}

	childNode := ch.FsNode().(*memNode)
	if childNode.original != "" || childNode == me.fs.root {
		childNode.materialize()
		childNode.markChanged()
	}

	newParent.Inode().RmChild(newName)
	newParent.Inode().AddChild(newName, ch)
	me.touch()
	return fuse.OK
}