building the KPL filesystem Kees Cook (cook@cpoint.net) 9/25 think about how you want it to work make basic structures write skeleton linux VFS code (and structures) implement "read_super" to return the VFS superblock for the FS, including the super_operations read_super is given: a ptr to the VFS sb to fill in VFS sb contains: s_flags (for mount flags) s_covered (the inode being covered by the mount) read_super must: increment MOD count lock_super fill in the VFS sb: s_blocksize s_blocksize_bits s_magic s_dev s_op s_mounted // the VFS inode for the root dir s_dirt initialize everything it needs for it's data structures (can use s_generic_sbp in VFS sb) unlock_super filling in s_op gives the VFS the following abilities: umounting (with "put_super" func) accessing inodes (with "read_inode") to see the root directory, though, it needs the inode_operations for dir: readdir (with "readdir" func) read_inode is given: VFS inode to be read read_inode must: fill in the VFS inode: i_mode i_uid i_gid i_nlink i_size i_mtime i_atime i_ctime i_blocks i_blksize = PAGE_SIZE i_version = ++event (scheduler event count) i_op // depends on filetype! set rdev (for block & char filetypes) set any flags initialize any data readdir is given: VFS inode VFS file VFS dirent readdir must: wander through the directory find next after VFS file's position call dcache_add call filldir with dirent with as many dir entries as we like?? 9/27 put_super is given: VFS sb to umount put_super must: lock_super s_dev = 0 free any structures allocated mark super buffer dirty? brelse super buffer unlock_super decrement MOD count VFS call mappings ----------------- 9/25 iget s_op: read_inode iput s_op: write_inode namei i_op?: lookup Cool Stuffs ----------------- 9/25 event long (from sched.h) CURRENT_TIME (dunno) dcache_add(VFS ino*dir, char * name, int len, ino#) (for sys readdir)