Rename file in JNode FS
Submitted by mickjordan on Wed, 09/30/2009 - 23:25.
So far as I can tell the JNode FS API has no concept of renaming (moving) a file or directory. It appears that UnixFileSystem.rename0 method is implemented in by VMFile.renameTo, which assumes that a file is being renamed, as opposed to a directory, and works by copy and delete. The lack of an FS level rename is surprising and I'm curious why?
The context of this question is my use of JNode Ext2 in Project GuestVM (http://research.sun.com/projects/guestvm). I am currently trying to get Hadoop working and it wants to rename a directory.
- Login to post comments
The lack of proper file
The lack of proper file renaming was most likely an oversight in the original file system API. This is why the file systems with write support created a couple of years ago do not provide such function. The VMFile.renameTo was added later as a generic solution but the underlying file system implementations haven't been extended yet. If JNode Ext2 was extended with proper file renaming then VMFile.renameTo could use it in certain cases. This applies to JFat (JNode FAT32 implementation) and other files systems too with write support.
BTW: I'm glad to read that your are using JNode Ext2 in GuestVM.