blob: c56886fc007328add24b8f664ed31d1321b42a97 [file] [edit]
Notes [made early on for initial design plan]
http://lxr.free-electrons.com/ident?v=4.4;i=sb_bread
----------
SUPERBLOCK
----------
WRITE
setup
sets up the operations to be used
if strict name checking then vfat_dentry_ops; otherwise vfat_ci_dentry_ops (which are case insensitive)
fat_fill_super
sets up all superblock data
kill_vfat_super
just kills the superblock (unmounts?)
READ
new_inode, new_inode_pseudo, alloc_inode
fat_msg
parse_options
fat_ent_access_init
dir_hash_init
fat_hash_init
fat_read_bpb, fat_read_static_bpb
fat_build_inode
calc_fat_clusters
[in headers]
sb_bread
sb_min_blocksize [WRITE]
sb_set_blocksize [WRITE]
R means read
W means write
D means done but no result yet (can be either read or write)
-------
INODES
-------
vfat_create, vfat_lookup, vfat_unlink, vfat_mkdir, vfat_rmdir, and vfat_rename all need to be separate functions and all need to be implemented
type R a b = < Success a | Error b >
1. W - vfat_create [7]
vfat_create (inode * dir, dentry * dentry, mode, bool excl)
excl doesn't seem to be used, nor does mode
Q: WHATS the point of the dentry here?
vfat_create: (Inode, Dentry) -> RR (Inode, Dentry) Inode U32
Creates an inode, returns the inode if successful or an error number if not
2. R - vfat_lookup [46]
vfat_lookup(inode, dentry, flags)
vfat_lookup: (Inode, Dentry)! -> RR (Inode, Dentry) (Dentry) U32 --?
3. W - vfat_unlink [46, 49]
vfat_unlink(dir, dentry)
vfat_unlink: (Inode, Dentry) -> R (Inode, Dentry) U32
4. W - vfat_mkdir [36, 50, 51, 52]
vfat_mkdir(inode, dentry)
vfat_mkdir: (Inode, Dentry) -> R (Inode, Dentry) U32
5. W - vfat_rmdir [46, 49, 53]
vfat_rmdir(inode, dentry)
vfat_rmdir: (Inode, Dentry) -> R (Inode, Dentry) U32
6. W - vfat_rename [9, 11, 12, 21, 46, 49, 51, 52, 53]
vfat_rename(old_dir, old_dentry, new_dir, new_dentry)
returns the new inode/dentry
vfat_rename: (Inode, Dentry, Inode, Dentry) -> R (Inode, Dentry) U32
1. W - vfat_create [7]
7. W - vfat_add_entry [8, 9, 10, 11, 12]
8. D - vfat_build_slots [13]
9. R? - IS_DIRSYNC
10. W - fat_add_entries [9, 17, 21, 33, 34, 35, 36, 37]
11. W - mark_inode_dirty > header fs.h
12. D - fat_sync_inode [32]
13. R - vfat_create_shortname [14]
14. R - vfat_find_form [15]
15. R - fat_scan [16]
16. R - fat_get_short_entry [17]
17. R - fat_get_entry [18]
18. R - fat__get_entry [19, 20]
19. R - fat_dir_readahead
20. R - fat_bmap [21, 22, 23]
21. R - MSDOS_I
22. R - i_size_read
23. R - fat_bmap_cluster [21, 24]
24. R - fat_get_cluster [21, 25, 26, 27]
25. R - fat_cache_lookup [21, 31]
26. R - fat_ent_read
27. R - fat_cache_add [21, 28, 29, 30, 31]
28. R - fat_cache_merge [21]
29. R - fat_max_cache
30. R? - fat_cache_alloc
31. R - fat_cache_update_lru [21]
32. D - __fat_write_inode [38, 21, 39, 40]
33. R - mark_buffer_dirty_inode > header
34. D - fat_add_new_entries [33, 36, 41, 42]
35. W - fat_chain_add [9, 11, 12, 21, 24, 43, 44, 45]
36. fat_free_clusters
37. __fat_remove_entries
38. fat_i_pos_read
39. fat_make_attrs
40. fat_time_unix2fat
41. fat_alloc_clusters
42. fat_zeroed_cluster
43. inode_needs_sync
44. R - fat_ent_write
45. fat_cache_inval_inode
2. R - vfat_lookup [46]
46. R - vfat_find [47]
47. R - fat_search_long [17, 48]
48. R - fat_parse_long [17]
3. W - vfat_unlink [46, 49]
49. W - fat_remove_entries [9, 11, 33, 37]
4. W - vfat_mkdir [36, 50, 51, 52]
50. fat_alloc_new_dir
51. vfat_add_entry
52. inc_nlink
5. W - vfat_rmdir [46, 49, 53]
53. drop_nlink
6. W - vfat_rename [9, 11, 12, 21, 46, 49, 51, 52, 53]
---
functions that work with data:
vfat_fill_super/fat_fill_super
vfat_mount
===============
Q: LOCKING IN COGENT!
should I have functions that lock? or keep these parts in C?
Implementing fat_fill_super:
new_sbi() - mallocs new superblock information struct
new_sbi: () -> R sbi U32
setup() - returns a set up superblock
setup: sb -> sb
SUPERBLOCK FUNCTIONS IN MODULE.C:
super_block is defined in linux/fs.h
FUNCTIONS THAT DIRECTLY TAKE IN THE SUPERBLOCK
setup
- defined in module.c
- used in vfat_fill_super to call fat_fill_super
- [CHECK] seems to set up which type of operations should be used by the filesystem
dir_ops are always vfat_dir_inode_operations
if the superblock's filesystem info's mount options don't specify a strict (s) name_check, then use vfat_ci_dentry_ops; otherwise use vfat_dentry_ops
So basically, if strict name checking is enabled, then use vfat_dentry_ops for the dentry operations (s_d_op); otherwise, use vfat_ci_dentry_ops
[CHECK] what does ci stand for?
vfat_fill_super
just calls fat_fill_super with the option that it is a vfat implementation
[IMPL_NOTE] - CONSIDER GETTING RID OF THE GENERICNESS OF THIS - msdos is not being used
kill_vfat_super
FUNCTIONS THAT USE THE SUPERBLOCK
vfat_lookup
vfat_create
vfat_rmdir
vfat_unlink
vfat_mkdir
vfat_rename
RELATED FUNCTIONS
MSDOS_SB
- defined in fat.h
- returns a superblock's s_fs_info, which is the filesystem private info
in vfat, it's of type msdos_sb_info* (though in fs.h it's void*)
msdos_sb_info is defined in fat.h
fat_fill_super
- defined in inode.c
- [CHECK] seems to set up all the superblock basic info
[IMPL_NOTE] - NECESSARY AND MAYBE WANT MOST OF THIS IN THE C CODE.
[IMPL_NOTE] - Get rid of MSDOS stuff
- calls:
parse_options [in inode.c]
[IMPL_NOTE] definitely need some C code for this one - uses lots of stuff from header - Q - maybe just call them
===============
Find out which functions read, which functions write, etc.
===============
module.c
NOTE: Baseline for everything. Everything defined here should be used.