MiniProject: LFS FAQ

bug

I found bugs in Segment.py: the update_in_place() and blockwrite() functions do weird things..

Well, you are right to have noticed this but these weird behaviors do not introduce bugs to the implementation, as they are never used. Keep in mind that this is an unfinished (but not buggy) code, you may find functions that are added during implementation and never been used, and sadly Eleet Haxor couldn't have the chance to make his code look better.

rmdir

How should I handle the "rmdir" command? Should I allow deletion of non-empty directories?

In Unix non-empty directories cannot be removed with rmdir, so you can assume that it is the same case in your implementation (which would make life easier for you). But if you'd like to go on and implement recursive removal of contents of a directory, you are very welcome to do it (it would be even better if you add rm -r as a separate command).

sync

I have no idea how to do the sync? Can you give me some hints?

The best way to think about how sync should be handled is to understand how its reverse operation is done. In sync you are supposed to save the InodeMap and flush everything to Disk; how is the InodeMap retrieved from disk when the filesystem is started? How does LFS know where the datablocks of InodeMap are? What if InodeMap spans multiple datablocks?

filedir

I think I have the correct idea for implementing searchfiledir, but I keep getting stupid errors!

In general, you might be facing one of the following situations:

- Trying to read Inode for the root but getting None: If this is the case, it suggests that your write_to_newblock function is not working properly, thus your root Inode couldn't be created.

- Trying to get the entries under the root directory with the enumerate function, but getting an error as it is empty: If this is the case, you should keep in mind that the enumerate function is a generator and should better be used in a for loop.