示例#1
0
func (fs *DeviceFs) trimUnused(todo int64, node *fuse.Inode) (done int64) {
	for _, ch := range node.Children() {
		if done > todo {
			break
		}

		if fn, ok := ch.FsNode().(*classicNode); ok {
			done += fn.trim()
		} else if ch.IsDir() {
			done += fs.trimUnused(todo-done, ch)
		}
	}
	return
}
示例#2
0
func toFileNode(n *fuse.Inode) *fileNode {
	switch f := n.FsNode().(type) {
	case *fileNode:
		return f
	case *folderNode:
		return f.fileNode
	}
	return nil
}
示例#3
0
文件: fs.go 项目: thomasf/go-mtpfs
func mtpFile(n *fuse.Inode) *File {
	switch f := n.FsNode().(type) {
	case *fileNode:
		return f.File()
	case *folderNode:
		return f.File()
	}
	return nil
}