Review Session 9 Ex1. FUSE (Filesystem in Userspace) If your FUSE driver code have bugs, will it crash the whole system? What if FUSE library has bugs? What if FUSE kernel module has bugs? Ex2. Super Block struct superblock { uint32_t s_magic; // Magic number: FS_MAGIC. uint32_t s_nblocks; // Total number of blocks on disk. uint32_t s_root; // Inum of the root directory inode. } __attribute__((packed)); Q: What if our file system crash and s_magic is wrong? What if s_nblocks is wrong? What if s_root is wrong? Ex3. Free Block Bitmap Suppose "uint32_t *bitmap;" is the pointer point to the head of bitmap. And we want to check whether blockno (int blockno = 202) is free or not. Q: write a line of valid C code to check: if ( ) { printf("block 202 is used\n"); } else { printf("block 202 is free\n"); } Ex4. Inode struct inode { uid_t i_owner; // Owner of inode. gid_t i_group; // Group membership of inode. mode_t i_mode; // Permissions and type of inode. dev_t i_rdev; // Device represented by inode, if any. uint16_t i_nlink; // The number of hard links. int64_t i_atime; // Access time (reads). int64_t i_ctime; // Change time (chmod, chown). int64_t i_mtime; // Modification time (writes). uint32_t i_size; // The size of the inode in bytes. // Block pointers. // A block is allocated iff its value is != 0. uint32_t i_direct[N_DIRECT]; // Direct blocks. uint32_t i_indirect; // Indirect block. uint32_t i_double; // Double-indirect block. } __attribute__((packed)); Q: When N_DIRECT is 10, what's the maximum number of blocks can one file in our filesystem have? Ex5. Directory struct dirent { uint32_t d_inum; // Block number of the referenced inode. char d_name[NAME_MAX]; // File name. } __attribute__((packed)); Q: When NAME_MAX is 124, how many files can one directory have? (based on the maximum file size on Ex4) Ex6. Path Walk If we want to open file "/home/cs202/hello", how many direcotries should we query?