James Pearson wrote:

> > Roman Narinyan wrote:
> >
> > Hello colleagues !
> >
> > Sorry for disturbing, there is a question about autofs.
> > Is it possible to allow all of the potential mount points to be
> > visible, whether or not they are mounted ?
> > I tried to use '-browse' option in the auto.master : '/mnt
> > /etc/auto.mnt    -browse', like Solaris amd, but it doesn't seem
> > right.
> >
> >
> > Thank you in advance,
> > Roman.
>
> You could have a look at Ian Kent's 'ghost' patches to autofs v4 via:
>
> http://www.mail-archive.com/[email protected]/msg02284.html
>
> James Pearson

Norman,

You may also want to apply the attached patch. It fixes a race in
directory
handling that was discovered by James.

I haven't included it in the patch on the web page yet.

Also bear in mind that it is not complete. For example linked
mounts do not work properly.

I am hoping to get back to working on it soon.


--
   ,-._|\    Ian Kent
  /      \   Perth, Western Australia
  *_.--._/   E-mail: [EMAIL PROTECTED], [EMAIL PROTECTED]
        v    Web: http://pobox.com/~ian.kent
--- autofs-4.0.0pre10/daemon/automount.c        Sun Jun  9 17:26:33 2002
+++ autofs-4.0.0pre10.walk_tree/daemon/automount.c      Thu Jun 27 21:01:12 2002
@@ -220,24 +220,23 @@
        if (lstat(base, &st) != -1 &&
            (fn)(base, &st, 0, arg)) {
                if (S_ISDIR(st.st_mode)) {
-                       DIR *dir = opendir(base);
-                       struct dirent *de;
+                       struct dirent **de;
+                       int n;
 
-                       if (dir == NULL)
+                       n = scandir(base, &de, 0, alphasort);
+                       if (n < 0)
                                return -1;
 
-                       while((de = readdir(dir)) != NULL) {
-                               if (strcmp(de->d_name, ".") == 0 ||
-                                   strcmp(de->d_name, "..") == 0)
+                       while( n--) {
+                               if (strcmp(de[n]->d_name, ".") == 0 ||
+                                   strcmp(de[n]->d_name, "..") == 0)
                                        continue;
 
-                               sprintf(buf, "%s/%s", base, de->d_name);
-                               if (walk_tree(buf, fn, 1, arg)) {
-                                       closedir(dir);
-                                       return -1;
-                               }
+                               sprintf(buf, "%s/%s", base, de[n]->d_name);
+                               walk_tree(buf, fn, 1, arg);
+                               free(de[n]);
                        }
-                       closedir(dir);
+                       free(de);
                }
                if (incl)
                        (fn)(base, &st, 1, arg);
@@ -1527,7 +1526,6 @@
       break;
   }
   
-  syslog(LOG_INFO, "shutting down, path = %s", path);
   /* Mop up remaining kids */
   handle_child(1);
 
@@ -1627,6 +1625,6 @@
   } else {
     handle_mounts(path);
   }
-  syslog(LOG_INFO, "shutting down, path = %s", path);
+  syslog(LOG_INFO, "shut down path = %s", path);
   cleanup_exit(0);
 }

Reply via email to