From mboxrd@z Thu Jan 1 00:00:00 1970 From: presotto@closedmind.org To: 9fans@cse.psu.edu Subject: Re: [9fans] mv vs cp MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20011007124356.5F05B199B5@mail.cse.psu.edu> Date: Sun, 7 Oct 2001 08:43:53 -0400 Topicbox-Message-UUID: ff940b66-eac9-11e9-9e20-41e7f4b1d025 On Sun Oct 7 02:30:21 EDT 2001, lucio@proxima.alt.za wrote: > Am I being utterly obtuse, or does it really make sense to duplicate > then delete files when moving them to another directory? It could be done, it just depends on what you'ld like to pay for it, its just code after all. You'ld need to create a new file system message (Tmv) and a new system call (mv). The kernel would have to start by walking both paths and determine if they came from the same mount point, error if not. It would then send a Tmv message with 2 fids. The file system would determine if it could do it and return an error if not (might not be space, ...). The file system structure would also have to be changed to accomodate it, we don't have links, though the copy on write makes that not too terrible. We consciously traded simplicity for it. It hasn't bothered us enough to regret it, perhaps because a real file server is faster than kfs, perhaps because we don't do a lot of file moving. If you think otherwise, that's why the source is open. Have a look and see what you'ld need to change and then convince others that the change is worth it. Implementations are no big deals. New file system messages are since you have to change lots of file servers to go with it. > I had the distribution archives in /dist under "kfs" and decided to do > the following: > > % cd /dist > % mkdir plan9 > % mv *.9gz plan9 > > the machine is still busy copying plan9.9gz :-( > > In this case, a "rename" would have been appropriate. Is it not > possible to determine whether it would work and resort to cp+rm if > it doesn't? This is indeed what happened, mv determined it wouldn't work and did a cp+rm when it found it wouldn't.