Implement Kernel.unlink(path), which removes the directory entry for path and decrements nlink for the index node.
If nlink is decremented to zero, free all the blocks of the file. If the file is currently open by any process, mark the file so that the blocks will be freed when the file is closed by the last process.
Test: write a program rm.cc which accepts the names of files to be unlinked.
Actually, I think this is easier than kernel.link and might implement this one first. It only involves one path and is simpler overall than creating a hard link.
Implement
Kernel.unlink(path)
, which removes the directory entry forpath
and decrementsnlink
for the index node.If
nlink
is decremented to zero, free all the blocks of the file. If the file is currently open by any process, mark the file so that the blocks will be freed when the file is closed by the last process.Test: write a program rm.cc which accepts the names of files to be unlinked.
Unlinking a directory is not allowed.