FileSystem, "." and "..", rmdir

From: unDEFER
Date: Sun Nov 06 2005 - 10:04:02 EST


Hello,

I'm newbie in kernel programming and try to write filesystem, and have two problems.

1) There are not "<mount-point>/.", "<mount-point>/..", and "<mount-point>/<any_dir>/.." entries,
for example:
# ls -a
dir link text_file
# ls -a dir/
. level_2
# ls -a dir/level_2/
. ..

I make
filldir(dirent, ".", 1, i, ino, DT_DIR) and
filldir(dirent, "..", 2, i, parent_ino(filp->f_dentry))
in readdir() for all directories.

2) Problem with removing not empty directories:
# ls -l
total 135
drwxr-xr-x 3 root root 0 Nov 6 17:48 dir
lr-xr-xr-x 1 root root 1024 Nov 2 11:13 link -> /home/undefer
-r-xr-xr-x 1 root root 274944 Nov 2 11:13 text_file

# rmdir dir
rmdir: `dir': Directory not empty

# ls -l
total 135
?--------- 0 root root 0 Jan 1 1970 dir
lr-xr-xr-x 1 root root 1024 Nov 2 11:13 link -> /home/undefer
-r-xr-xr-x 1 root root 274944 Nov 2 11:13 text_file

So anything call "delete_inode" for directory and it's entries but it is not empty! What is? Why? What I could made not so?

Thanks,
Sorry for bad english.

--
registered Linux user #360474
Don't worry, I can read OpenOffice.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/