I am working on the FAT
file system code in Linux Kernel 3.3
.
For a project, I need to create a file at mount time, in the root directory of the mounted filesystem. I've figured out where to write the code to create it, but have a few questions about creating. (The function is vfat_mount
in linux/fs/fat/namei_vfat.c
).
The mount
function doesn't seem to have the mount point as a path, but I believe the dentry of the root directory is stored in the super block. I am not sure how to create a file using this available data. The open()
system call doesn't seem to be an option, so should I use the file system specific vfat_create
for this purpose? If so, can some one help me with more details or some examples.
Also, the file needs to span a few clusters, and I do not want the file system to search for and allocate free clusters to it. So is there a way to create the file that way directly, or should I use something like fat_add_cluster()
after creating the file?