Fix04: Lab4 Errata
Below is a list of incorrect/inaccurate hints and their corrections. This page will be kept updated.
- [update 11/28] Exercise 1: an incorrect comment in fs5600.h
fs5600.h has
uint32_t ctime; // creation time
The comment is wrong: "ctime" means "change time", meaning: (see also "man 2 stat").
struct timespec st_ctim; /* Time of last status change */
- [update 11/28] Exercise 2: converting "uint32_t" to "struct timespec"
The hint of treating "struct timespec" as "uint32_t" is a wrong hint (might work on some of machines but not on others).
Instead, your code should read the time-related attributes from fs5600 inode
and write them to the "struct timespec" attributes of the "struct stat".
- to see "struct timespec" definition, read "man clock_gettime"
- to understand what is stored in "ctime/mtime" of fs5600 inode,
read the code of "fs_create" (which you will implement in Exercise 4)
and "man 2 time" (the return value of "time(NULL)" is what will be put into "ctime/mtime").
- [update 11/29] Exercise 3: a confusing rename unit test
test1.c has the following test cases:
struct rename_case err1[] = {
...
{"/dir2/file.4k", "/dir3/somefile", EINVAL},
...
};
You should update "/dir2/file.4k" (a non-existing file) to be "/dir2/file.4k+" (an existing file).
This is a typo.
For the original typoed test case, returning either "EINVAL" or "ENOENT" is fine
since the file "/dir2/file.4k" doesn't exist and it violates an fs5600
assumption (rename happens in the same directory).