[Relfs-devel] the question of rename
Status: Pre-Alpha
Brought to you by:
applejack
|
From: Guido V. <gu...@vi...> - 2004-08-02 22:09:54
|
I want to share a question that came to my attention only a few days ago. This is unrelated from what you want do with the files, it is more related to the meaning that the renaming of a file has in filesystems that try to manage data somehow. I am not speaking of the trivial case of simply changing a file name, but of the more tricky one, when, by changing a file name, you delete another file. In this case, what has to happen to the metadata (whichever they are, entries in a database or sybolic links pointing to that file)? Maybe the user wants to change the file's content but not the metadata (as if "rename a b" would be interpreted as "cat a > b; unlink a"), maybe it's the contrary (as if "rename a b" would be interpreted as "unlink b; rename a b"). Maybe he would like to have the metadata from the files merged... What do you think? The straightforward way is to treat "rename a b" is "unlink b; rename a b", but are we sure it is the preferred meaning? Maybe, after choosing a meaning for rename, we could implement the other two in separate programs... BTW: while you implement renaming, please bear in mind that if the target exists no unlink system call is made, so you have to stat the target before renaming, and then manually manage its deletion side effects. It's a thing one might easily overlook. bye Guido |