"Mark D. Roth" <[EMAIL PROTECTED]> writes:
| It seems that GNU df doesn't know how to figure out which mount table
| entries are the automount entries under AIX.  When you invoke df, it
| erroneously invokes statfs() for each of the automount entries, which
| results in the filesystem being automounted for no reason.
|
| I wrote and tested the attached patch on my desktop machine, an
| RS/6000 model 250 running AIX 4.2.1.  Although I don't have any
| machines left to test this on, I recall having this same problem under
| AIX 3.2.5 with older versions of GNU df.
|
| The patch is relative to the stock fileutils-4.0 distribution.  I'd
| like to see it included in the next release of GNU fileutils.
|
| Please let me know if you have any questions or comments.
|
| --
| Mark D. Roth <[EMAIL PROTECTED]>
| System Administrator, CCSO Workstation Services Group
| http://www.uiuc.edu/ph/www/roth
|
| diff -ur fileutils-4.0/lib/mountlist.c fileutils-4.0-df_patch/lib/mountlist.c
| --- fileutils-4.0/lib/mountlist.c     Fri Aug 14 21:57:35 1998
| +++ fileutils-4.0-df_patch/lib/mountlist.c    Tue Mar 23 21:28:19 1999
| @@ -604,6 +604,8 @@
|      int bufsize;
|      char *entries, *thisent;
|      struct vmount *vmp;
| +    char *ptr;
| +    int tmp;
|  
|      /* Ask how many bytes to allocate for the mounted filesystem info.  */
|      mntctl (MCTL_QUERY, sizeof bufsize, (struct vmount *) &bufsize);
| @@ -616,6 +618,16 @@
|        thisent += vmp->vmt_length)
|        {
|       vmp = (struct vmount *) thisent;
| +
| +        for (tmp = 0, ptr = strtok(thisent + vmp->vmt_data[VMT_ARGS].vmt_off,",");
| +             ptr; ptr = strtok(NULL,","))
| +          if (!strcmp(ptr,"ignore")) {
| +            tmp = 1;
| +            break;
| +          }
| +        if (tmp)
| +          continue;
| +
|       me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|       if (vmp->vmt_flags & MNT_REMOTE)
|         {

Thanks for the patch.
Could there be a method for checking this in one of AIX's header files?
If not, I'll do as you suggest -- but I'd rather use strstr than strtok.
Here's a bit of code that should be functionally equivalent to yours,
assuming the fields are guaranteed to be comma-separated, with no white
space.  Would you please test it?

Index: mountlist.c
===================================================================
RCS file: /fetish/fileutils/lib/mountlist.c,v
retrieving revision 1.28
diff -u -p -r1.28 mountlist.c
--- mountlist.c 2000/05/01 08:03:33     1.28
+++ mountlist.c 2000/05/29 15:21:51
@@ -725,7 +725,17 @@ read_filesystem_list (int need_fs_type)
     for (thisent = entries; thisent < entries + bufsize;
         thisent += vmp->vmt_length)
       {
+       char *options, *ignore;
        vmp = (struct vmount *) thisent;
+
+       options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off;
+       ignore = strstr (options, "ignore");
+       if (ignore
+           && (ignore == options || ignore[-1] == ',')
+           && (ignore[sizeof "ignore" - 1] == ','
+               || ignore[sizeof "ignore" - 1] == '\0'))
+         continue;
+
        me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
        if (vmp->vmt_flags & MNT_REMOTE)
          {

Reply via email to