Greetings... Background: ----------- I have an application which needs to transfer file between directories. There are three different methods which are required for different environments: 1) When the source and destination directories are on the same AFS volume, do a "rename" operation. 2) When the source and destination directories are on different AFS volumes, do a copy and remove type operation. 3) When the user does not have write authority to the destination, use a server application to move the files. There is a fair amount of set up and administration code involved in handling methods 2 and 3, as the code handles concurrancy and collision situations, server communications etc. In the past I have been able to distinquish the three situations via the nature of the call to move files. Thus, my code knew that whether it was a cross volume transfer to a server transfer. The three methods were thus designed as three different functions that are fairly well encapsulated, but assuming that the method of moving the files is valid. Problems -------- My problem is that my "call" distinction between the methods will no longer be valid. Therefore, I need a more accurate method (within c code) to determine if the source and destination directories are on the same AFS volume, and whether the user has write authority to the destination volume. Problem A - Cross Volume Determination: The statfs type of operations don't seem to distinquish between AFS volumes. I get the same information if I look at two directories on the same volume or across volumes. So my first question is: How do I distinquish between AFS volumes? Waiting for a rename operation to fail and then checking the error code is a pretty awful solution (from my point of view). I my be attempting to create directories and setting up other data. I am not thrilled at the prospect of having a lot of work done just to find that a rename operation fails, and I have to start over from a different tact. This code is run thousands of times a day, so I want it to perform well. In addtion having to expose a non-failing case of a rename function error would complicate fairly simple interfaces (from the callers point of view). It would also be nice to have a solution which works in AFS and NFS. Problem B - Write authority determination: It seems that the only way to detect Write authorization to an AFS directory is by performing an "access" function call on a file within the directory. Thus, when a file has both the read and write mode bits on, and the user has read, but not write authority, the "access" function will correctly return the access rights to the file. However, it does not seem to work on directories. Is some way to determine write authority without already having a file in the directory? In my case, the directory may not even exist yet, so I need to test an existing parent directory. I hate the prospect of maintaining a "writecheck" file in every directory. And, again, I am not thrilled at attempting to write and have it fail. It seem that I should be able to easily test the access rights to a directory, but I am unsure how in AFS. Any ideas? Thanks. Kris Davis ([EMAIL PROTECTED], krisd@rchland, krisd@rchvmw2) Microcode Development Environment Dept213 1-507-253-3707 IBM Rochester, MN
