[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Findutils-patches] [PATCH] find: properly support -noleaf in ftsfin

From: Kamil Dudka
Subject: Re: [Findutils-patches] [PATCH] find: properly support -noleaf in ftsfind.
Date: Tue, 05 Sep 2017 12:11:03 +0200

On Saturday, September 2, 2017 5:35:31 PM CEST James Youngman wrote:
> * gnulib-local/lib/fts.c.diff: incorporated from a patch by Kamil
> Dudka <address@hidden>.  This patch introduces an FTS_NOLEAF option
> to fts.
> * gnulib-local/lib/fts_.h.diff: Likewise.
> * find/ftsfind.c (ftsoptions): point out that is_fts_enabled
> reflects the settings made in the initialization of ftsoptions,
> not the modifications made later to it (e.g. FTS_NOLEAF).
> (find): Set fts_options |= FTS_NOLEAF when the -noleaf option was
> specified.  With -D search, the debugging output now shows the
> options passed to fts_open.
> (is_fts_enabled): Point out that the result doesn't reflect any
> dynamic changes to ftsoptions (e.g.  FTS_NOLEAF).
> * (EXTRA_DIST): Distribute fts.c.diff and fts_.h.diff in
> gnulib-local/lib.  These diffs will be applied to the gnulib sources
> by gnulib-tool (hence, the gnulib code shipped in the source tarball
> will already include these patches).
> * find/parser.c (parse_version): For the FTS feature, indicate
> whether FTS_NOLEAF is available (but not whether it was used; for
> that you have to use the command-line flag -D search).

Looks good.  Thank you for working on this!  I have verified on a reiserfs 
file system that it works as expected.  Please consider applying the following 
fixup to make the patch apply better on up2date gnulib code:

--- a/gnulib-local/lib/fts.c.diff
+++ b/gnulib-local/lib/fts.c.diff
@@ -10,14 +10,14 @@ diff --git a/lib/fts.c b/lib/fts.c
 index ea73675..76bbc06 100644
 --- a/lib/fts.c
 +++ b/lib/fts.c
-@@ -781,6 +781,10 @@ link_count_optimize_ok (FTSENT const *p)
-   bool opt_ok;
-   struct LCO_ent *t2;
+@@ -738,6 +738,10 @@ filesystem_type (FTSENT const *p)
+   struct dev_type *ent;
+   struct statfs fs_buf;

 +    /* leaf optimization explicitly disabled by the FTS_NOLEAF flag */
-+    return false;
++    return 0;
    /* If we're not in CWDFD mode, don't bother with this optimization,
-      since the caller is not serious about performance. */
-   if (!ISSET(FTS_CWDFD))
+      since the caller is not serious about performance.  */
+   if (!ISSET (FTS_CWDFD))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]