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