Blame SOURCES/findutils-4.4.2-xautofs.patch

709426
From 17e470dc1acca4824b70328d733d5f99c12d0d65 Mon Sep 17 00:00:00 2001
709426
From: Kamil Dudka <kdudka@redhat.com>
709426
Date: Wed, 11 May 2011 16:46:45 +0200
709426
Subject: [PATCH 3/4] findutils-4.4.2-xautofs.patch
709426
709426
---
709426
 doc/find.texi  |    4 ++++
709426
 find/defs.h    |    3 +++
709426
 find/find.1    |    3 +++
709426
 find/ftsfind.c |    6 ++++++
709426
 find/parser.c  |   11 ++++++++++-
709426
 find/util.c    |    1 +
709426
 6 files changed, 27 insertions(+), 1 deletions(-)
709426
709426
diff --git a/doc/find.texi b/doc/find.texi
709426
index c584298..9731b71 100644
709426
--- a/doc/find.texi
709426
+++ b/doc/find.texi
709426
@@ -1439,6 +1439,10 @@ them.
709426
 There are two ways to avoid searching certain filesystems.  One way is
709426
 to tell @code{find} to only search one filesystem:
709426
 
709426
+@deffn Option -xautofs
709426
+Don't descend directories on autofs filesystems.
709426
+@end deffn
709426
+
709426
 @deffn Option -xdev
709426
 @deffnx Option -mount
709426
 Don't descend directories on other filesystems.  These options are
709426
diff --git a/find/defs.h b/find/defs.h
709426
index 11d1d00..f95ce72 100644
709426
--- a/find/defs.h
709426
+++ b/find/defs.h
709426
@@ -557,6 +557,9 @@ struct options
709426
   /* If true, don't cross filesystem boundaries. */
709426
   bool stay_on_filesystem;
709426
 
709426
+  /* If true, don't descend directories on autofs filesystems. */
709426
+  bool bypass_autofs;
709426
+
709426
   /* If true, we ignore the problem where we find that a directory entry
709426
    * no longer exists by the time we get around to processing it.
709426
    */
709426
diff --git a/find/find.1 b/find/find.1
709426
index e851f82..a4799ff 100644
709426
--- a/find/find.1
709426
+++ b/find/find.1
709426
@@ -460,6 +460,9 @@ if standard input is a tty, and to
709426
 .B \-nowarn
709426
 otherwise.
709426
 
709426
+.IP \-xautofs
709426
+Don't descend directories on autofs filesystems.
709426
+
709426
 .IP \-xdev
709426
 Don't descend directories on other filesystems.
709426
 
709426
diff --git a/find/ftsfind.c b/find/ftsfind.c
709426
index 9fdb8ef..bd7cc37 100644
709426
--- a/find/ftsfind.c
709426
+++ b/find/ftsfind.c
709426
@@ -485,6 +485,12 @@ consider_visiting (FTS *p, FTSENT *ent)
709426
 	}
709426
     }
709426
 
709426
+  if (options.bypass_autofs &&
709426
+      0 == strcmp ("autofs", filesystem_type (&statbuf, ent->fts_name)))
709426
+    {
709426
+      fts_set(p, ent, FTS_SKIP); /* descend no further */
709426
+    }
709426
+
709426
   if ( (ent->fts_info == FTS_D) && !options.do_dir_first )
709426
     {
709426
       /* this is the preorder visit, but user said -depth */
709426
diff --git a/find/parser.c b/find/parser.c
709426
index 52a1ef6..995aec3 100644
709426
--- a/find/parser.c
709426
+++ b/find/parser.c
709426
@@ -146,6 +146,7 @@ static bool parse_user          (const struct parser_table*, char *argv[], int *
709426
 static bool parse_version       (const struct parser_table*, char *argv[], int *arg_ptr);
709426
 static bool parse_wholename     (const struct parser_table*, char *argv[], int *arg_ptr);
709426
 static bool parse_xdev          (const struct parser_table*, char *argv[], int *arg_ptr);
709426
+static bool parse_xautofs       (const struct parser_table*, char *argv[], int *arg_ptr);
709426
 static bool parse_ignore_race   (const struct parser_table*, char *argv[], int *arg_ptr);
709426
 static bool parse_noignore_race (const struct parser_table*, char *argv[], int *arg_ptr);
709426
 static bool parse_warn          (const struct parser_table*, char *argv[], int *arg_ptr);
709426
@@ -306,6 +307,7 @@ static struct parser_table const parse_table[] =
709426
   PARSE_TEST_NP    ("wholename",             wholename), /* GNU, replaced -path, but anyway -path will soon be in POSIX */
709426
   {ARG_TEST,       "writable",               parse_accesscheck, pred_writable}, /* GNU, 4.3.0+ */
709426
   PARSE_OPTION     ("xdev",                  xdev), /* POSIX */
709426
+  PARSE_OPTION     ("xautofs",               xautofs),
709426
   PARSE_TEST       ("xtype",                 xtype),	     /* GNU */
709426
 #ifdef UNIMPLEMENTED_UNIX
709426
   /* It's pretty ugly for find to know about archive formats.
709426
@@ -1230,7 +1232,7 @@ operators (decreasing precedence; -and is implicit where no others are given):\n
709426
 positional options (always true): -daystart -follow -regextype\n\n\
709426
 normal options (always true, specified before other expressions):\n\
709426
       -depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf\n\
709426
-      --version -xdev -ignore_readdir_race -noignore_readdir_race\n"));
709426
+      --version -xautofs -xdev -ignore_readdir_race -noignore_readdir_race\n"));
709426
   puts (_("\
709426
 tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N\n\
709426
       -cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME\n\
709426
@@ -2799,6 +2801,13 @@ parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
709426
 }
709426
 
709426
 static bool
709426
+parse_xautofs (const struct parser_table* entry, char **argv, int *arg_ptr)
709426
+{
709426
+  options.bypass_autofs = true;
709426
+  return parse_noop (entry, argv, arg_ptr);
709426
+}
709426
+
709426
+static bool
709426
 parse_ignore_race (const struct parser_table* entry, char **argv, int *arg_ptr)
709426
 {
709426
   options.ignore_readdir_race = true;
709426
diff --git a/find/util.c b/find/util.c
709426
index 8577396..4d45f84 100644
709426
--- a/find/util.c
709426
+++ b/find/util.c
709426
@@ -1010,6 +1010,7 @@ set_option_defaults (struct options *p)
709426
 
709426
   p->full_days = false;
709426
   p->stay_on_filesystem = false;
709426
+  p->bypass_autofs = false;
709426
   p->ignore_readdir_race = false;
709426
 
709426
   if (p->posixly_correct)
709426
-- 
709426
1.7.4.4
709426