About mvdir and linking directories

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <Linux-activists@...>
Date: Monday, November 11, 1991 - 5:04 am

In  reply  to  your  discussion  about keeping track of parent
directories in the kernel; the answer is: DON'T.

The filesystem should work like this:  Directories may be lin--
ked and unlinked by the superuser only. The filesystem code in
the kernel should not check the correctness  of  these  opera--
tions, except for the root priviledge. The superuser is suppo--
sed to know what (s)he is doing.

The  file  "." is a link to the directory in which it resides,
and ".." is a link to the parent  directory.  This  should  at
least least be true after an mkdir operation.

When  you  issue  the mkdir() system call,  it should make the
directory and the "." and ".." before it returns.

The mvdir command must make a new link from ".." to the parent
directory,  this  is  not a kernel task.  The SVID manual also
states,  that neither the old or new directory may be a subset
of the other. This must be checked by mvdir. The kernel should
check that the link is possible,  i.e.  the files are  on  the
same filesystem.

And  by the way - yes you can have several links to a directo--
ry, though this is normally not wanted.

So  the  approximate  code  for the mvdir command is something
like this:

mvdir( old, new )
    check uid == 0
    check that old is not a part of new
    check that new is not a part of old
    link new to old - if this fails it's probably diffent
                      file systems
    link the ".." to the parent of new.
    unlink old.

Note also, that the rename() system call, should be able to
rename a directory, but not to move it.


I  guess  I  have said enough for now - and that it makes some
sense.  I do have one question though:  Is  there  a  reliable
ftp-mailserver out there?  I can't do ftp, and I would like to
join your effort to make a PD real operating system.


Kind regards

Kurt \/\/achmann, M.Sc. EE/SE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
About mvdir and linking directories, Kurt Wachmann, (Mon Nov 11, 5:04 am)