Delete a file

rm foo.txt
If we would like to delete a file then VFS (vfs_unlink()) calls the jffs2_unlink() function to delete the selected file. It gets the necessary information and calls jffs2_do_unlink(). It allocates memory for a new raw_dirent (which will be the deletion dirent) and space for it on flash. Then it composes the deletion dirent. Deletion dirent is a dirent the name of which is the same as the name of which we want to delete, the ino field is 0 and the version number is bigger. Then it writes the raw_dirent to the flash and free the raw_dirent. Then it adds the new full_dirent to the parent node's dents list, this obsolates the old fd.



Havasi Ferenc 2005-12-22