Makes sense since mount points should be "removed" with umount.

rm on a mount point should work.  rm does not necessarily remove it.  It maps to unlink which removes the name from mount point, or file.  Logic in the VFS will detect detect the open count.  The entity will exist nameless until all references are closed, then it will finally delete the mountpoint.

That is why on a POSIX system you can unlink (rm) a file open by another task.  The file will still persist (without a name) until that other task closes it.

About removing "." I think Linux is even more restrictive:

$ mkdir /tmp/test
$ cd /tmp/test
$ echo "T1" > test1
$ echo "T2" > test2
$ echo "T3" > test3

$ rm -r .
rm: refusing to remove '.' or '..' directory: skipping '.'

Same behavior, just a better error message.  Another difference is that fat does not have "." or ".." but does have some lame logic to make fat behave similarly when they are used.

The logic that implements rm -r * is part of apps/, not the NuttX vfs.  It is function unlink_recursive in nsh_fscmds.c.   It doesn't look like it handles the "*" expansion at all.   May 'rm -r'  would work

Does 'ls -r *' work?  The logic is very similar.


Reply via email to