Open zhouzilong2020 opened 1 year ago
Since each dinode has 64 bytes right now, and there are 13 blocks for inode on disk, xv6 chould at most have 208 inode.
To make the data type of inum consistent, I suggest:
Changing struct dirent as follows:
#define DIRSIZ 12
struct dirent {
uint inum;
char name[DIRSIZ];
};
Changing inum to ushort everywhere, which includes much more modifications to the code.
inum defined inside struct dirent is a ushort, suggesting the dirent can only reference up to 4 inode on disk. https://github.com/mit-pdos/xv6-riscv/blob/f5b93ef12f7159f74f80f94729ee4faabe42c360/kernel/fs.h#L56-L59 However, in function dirlink(), it tries to set inum with a unit. https://github.com/mit-pdos/xv6-riscv/blob/f5b93ef12f7159f74f80f94729ee4faabe42c360/kernel/fs.c#L601
I further checked all the usage of the user space function link(), and it turns out none tried to open a file via its linked name. Is this a delicate design or a bug?