The example walkthrough above hinted at a few of the directory management features; we need to have the contents of the directories stored somewhere where we can search them, and we need to have the individual directory entries point to the attributes structures that contain information for that entry.
The extended attributes structure shown in the diagram earlier implies that all of the directory entries are stored within the attributes structure itself, in some kind of an array. The actual storage method (array, linked list, hash table, balanced tree, whatever) is entirely up to your imagination; I just showed a simple one for discussion. The two examples in this book, the RAM disk and the .tar filesystem, use the array method; again, purely for simplicity.
You must be able to search in a directory, and you also need to be able to add, remove, and move (rename) entries. An entry is added when a file or directory is created; an entry is removed when the file or directory is deleted; and an entry is moved (renamed) when the name of the entry is changed. Depending on the complexity of your filesystem, you may allow or disallow moving directory entries from one directory entry to another. A simple rename, like mv spud.txt abc.txt, is supported by almost all filesystems. A more complex rename, like mv spud.txt tmp/ may or may not be supported. The RAM-disk filesystem supports complex renames.
Finally, the last aspect of directory management that your filesystem must support is the ability to return information about the contents of directories. This is accomplished in your io_read() handler (when the client calls readdir()), and is discussed thoroughly in the RAM-disk Filesystem chapter.