Infinite Recursion

Jon S. Stumpf jss at eclipse.net
Tue Nov 3 05:27:32 CET 1998


Magnus Ahltorp wrote:

> > Actually, I'm wondering what DFS did in this case?  (Don't have
> > access to a system anymore).  But, I think it behaved correctly.

I doubt it behaved correctly.  AFS and DFS are represented by a single device
number in the UNIX filesystem table.  Volume/fileset mount points must be tested
using the AFS/DFS system call extensions via pioctl, I believe.  (It has been a
while since I touched this.)

Looking at ftp://ftp.transarc.com/pub/afs-contrib/tools/gnu-du/du.c, there is a
function that uses pioctl() to make the necessary test.

     #ifdef AFS
     int
     is_AFS_mtpt (ent, follow_symbolic_links)
          char *ent;
          int follow_symbolic_links;
     {
       /* Space into which the mount point contents will be written.
        *  The format is "#|% [<cellname> :] <volname> . \0"
        */
       char space[1+MAXCELLCHARS+1+VOLSER_OLDMAXVOLNAME+1+1];
       struct ViceIoctl blob;
       register long code;

       blob.in = ent;
       blob.in_size = strlen(ent) + 1;
       blob.out = space;
       blob.out_size = sizeof(space);

       code = pioctl("./", VIOC_AFS_STAT_MT_PT, &blob,
     follow_symbolic_links);

       if (code)
         if (errno == EINVAL)
           return 0;               /* Not a mount point */
         else
           error (errno, errno, "AFS pioctl failed");
       else
         return 1;                 /* Is a mount point */
     }
     #endif /* AFS */

The pioctl() command is VIOC_AFS_STAT_MT_PT.  This procedure is similar in DFS
but I don't have time to find an example.  I would suggest looking at some of
the work of Paul Henson for an example,
http://www.intranet.csupomona.edu/~henson/www/projects/ as I suspect some of his
excellent DFS tools (e.g., DFS-Perl) would perform a test such as this.

> I agree. It would be nice (volume boundaries are the way to go), I
> have no idea on how they have implemented this. It's possible to
> change device numbers at each volume boundary, but I don't know if
> that is a good solution (sounds like a hairy thing to do, besides,
> linux support would break).
>
> Ideas are welcome.

I don't believe changing device numbers is necessarily the right way to go.

An idea is to formally set a flag in the stat structure that indicates if this
entry is a mountpoint and require the stat() call to provide this information.
An application would check this bit for true to determine if this directory was
a mountpoint.  POSIX would be updated and each VFS-specific stat() call would
have to be modifed to provide this information correctly.  Essentially, I am
trying to propose a "standard" method of testing for a mountpoint rather than
relying on a change in st_dev to indicate it.  This suggestion would still force
application changes initially but would permit a "standard" way of passing this
special information up through standard calls.  The test should come out of the
stat() call, in my opinion.

Since this idea won't happen in a timeframe one would find practical, we have to
change the utilities.

Assuming that arla is targeting the FreeOS market, many of the GNU utilities
already include patches (and/or #ifdef conditionals) to become AFS-aware.  For
those utilities that are not currently aware, fix them once in the standard
distribution and answer "yes" to an autoconf question "Are you using AFS?".

- jss










More information about the Arla-drinkers mailing list