revise patch

This commit is contained in:
openeuler-basic 2019-12-31 19:23:04 +08:00
parent d35a1caafb
commit 3a59024290

View File

@ -19,7 +19,7 @@ index c584298..9731b71 100644
@@ -1474,6 +1474,10 @@ them. @@ -1474,6 +1474,10 @@ them.
There are two ways to avoid searching certain filesystems. One way is There are two ways to avoid searching certain filesystems. One way is
to tell @code{find} to only search one filesystem: to tell @code{find} to only search one filesystem:
+@deffn Option -xautofs +@deffn Option -xautofs
+Don't descend directories on autofs filesystems. +Don't descend directories on autofs filesystems.
+@end deffn +@end deffn
@ -34,7 +34,7 @@ index 11d1d00..f95ce72 100644
@@ -574,6 +574,9 @@ struct options @@ -574,6 +574,9 @@ struct options
/* If true, don't cross filesystem boundaries. */ /* If true, don't cross filesystem boundaries. */
bool stay_on_filesystem; bool stay_on_filesystem;
+ /* If true, don't descend directories on autofs filesystems. */ + /* If true, don't descend directories on autofs filesystems. */
+ bool bypass_autofs; + bool bypass_autofs;
+ +
@ -48,21 +48,21 @@ index e851f82..a4799ff 100644
@@ -567,6 +567,9 @@ to stat them; this gives a significant increase in search speed. @@ -567,6 +567,9 @@ to stat them; this gives a significant increase in search speed.
.IP "\-version, \-\-version" .IP "\-version, \-\-version"
Print the \fBfind\fR version number and exit. Print the \fBfind\fR version number and exit.
+.IP \-xautofs +.IP \-xautofs
+Don't descend directories on autofs filesystems. +Don't descend directories on autofs filesystems.
+ +
.IP \-xdev .IP \-xdev
Don't descend directories on other filesystems. Don't descend directories on other filesystems.
diff --git a/find/ftsfind.c b/find/ftsfind.c diff --git a/find/ftsfind.c b/find/ftsfind.c
index 9fdb8ef..bd7cc37 100644 index 9fdb8ef..bd7cc37 100644
--- a/find/ftsfind.c --- a/find/ftsfind.c
+++ b/find/ftsfind.c +++ b/find/ftsfind.c
@@ -479,6 +479,12 @@ consider_visiting (FTS *p, FTSENT *ent) @@ -479,6 +479,12 @@ consider_visiting (FTS *p, FTSENT *ent)
} }
} }
+ if (options.bypass_autofs && + if (options.bypass_autofs &&
+ 0 == strcmp ("autofs", filesystem_type (&statbuf, ent->fts_name))) + 0 == strcmp ("autofs", filesystem_type (&statbuf, ent->fts_name)))
+ { + {
@ -89,13 +89,13 @@ index 52a1ef6..995aec3 100644
{ARG_TEST, "writable", parse_accesscheck, pred_writable}, /* GNU, 4.3.0+ */ {ARG_TEST, "writable", parse_accesscheck, pred_writable}, /* GNU, 4.3.0+ */
PARSE_OPTION ("xdev", xdev), /* POSIX */ PARSE_OPTION ("xdev", xdev), /* POSIX */
+ PARSE_OPTION ("xautofs", xautofs), + PARSE_OPTION ("xautofs", xautofs),
PARSE_TEST ("xtype", xtype), /* GNU */ PARSE_TEST ("xtype", xtype), /* GNU */
#ifdef UNIMPLEMENTED_UNIX #ifdef UNIMPLEMENTED_UNIX
/* It's pretty ugly for find to know about archive formats. /* It's pretty ugly for find to know about archive formats.
@@ -2603,6 +2605,13 @@ parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr) @@ -2603,6 +2605,13 @@ parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
return parse_noop (entry, argv, arg_ptr); return parse_noop (entry, argv, arg_ptr);
} }
+static bool +static bool
+parse_xautofs (const struct parser_table* entry, char **argv, int *arg_ptr) +parse_xautofs (const struct parser_table* entry, char **argv, int *arg_ptr)
+{ +{
@ -120,12 +120,13 @@ index 8577396..4d45f84 100644
tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N\n\ tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N\n\
-cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME\n\ -cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME\n\
@@ -1044,6 +1044,7 @@ set_option_defaults (struct options *p) @@ -1044,6 +1044,7 @@ set_option_defaults (struct options *p)
p->full_days = false; p->full_days = false;
p->stay_on_filesystem = false; p->stay_on_filesystem = false;
+ p->bypass_autofs = false; + p->bypass_autofs = false;
p->ignore_readdir_race = false; p->ignore_readdir_race = false;
if (p->posixly_correct) if (p->posixly_correct)
-- --
1.7.4.4 1.7.4.4