pluto
pluto copied to clipboard
VFS directory listing
The virtual filesystem should support listing the children of directories. Slices may be useful for this.
Should this be a part of the FileSystem
struct or the DirNode
struct? What would make more sense?
Also, I don't know if slices are the best for this. I think some filesystems use linked-lists to specify directory entries, so maybe some sort of an iterator would be more convenient for this.
I think it should be part of DirNode
since it makes sense to have to open the dir in order to list its children. It's also nice to encapsulate operations on nodes within the node struct itself. With regards to slices vs lists, whatever makes for a cleaner implementation and uses least memory is what we should go for, IMO. Slices can be iterated upon and lists can be converted to a slice with toOwnedSlice
(last time I checked!).