another nail in the coffin

Just found another problem with IOFS. There’s no really good way to determine if two files are on the same filesystem, which you need to know to safely rename files and create hard links.

Under packets, every mounted filesystem has its own handler task, and so has its own message port. You just get the port pointers for the source and target files and compare.

With IOFS, two filesystems of the same type will have the same device pointer, even if they’re different filesystems. Internally the device will usually have a seperate task for each, but there’s no way for DOS to get that information. If you have handles for the files, then their unit pointers will be different, of course, but these are context for the file, not the filesystem and so they’ll be different even on the same filesystem.

The only way I can think to do it is to use NameFromLock() to on each file (and actually lock the passed names first if they’re all thats available), then compare the volume names in the returned string. NameFromLock causes many calls into the filesystem, which would make these operations hopelessly inefficient. Admittedly renaming and/or linking is not something you do often, but thats doesn’t remove the fact that this interface is broken.