diff lib/fts_.h @ 15374:04a9f678e342

fts: introduce FTS_NOATIME This gives clients the option to try a non-invasive traversal, where merely visiting a directory does not update its timestamp, where such is supported by the kernel. Note that this is best-effort. FTS_NOATIME is silently ignored on systems that lack O_NOATIME support - it is up to the caller to decide whether to issue an error when the gnulib replacement <fcntl.h> defined O_NOATIME to 0, and/or detect older Linux kernels where O_NOATIME is defined to non-zero but has no effect. Note that whiteout support and O_NOATIME support are currently orthogonal: there is no way to get O_NOATIME behavior when using __opendir2 to visit whiteouts on BSD systems. So far, I don't know of any system with both __opendir2 and O_NOATIME; if such a system exists, then fts_build() needs a tweak (then again, such a system would probably add DTF_NOATIME for __opendir2). * lib/fts_.h (FTS_NOATIME): New bit flag. (FTS_OPTIONMASK): Adjust. * lib/fts.c (diropen, fts_open, fts_build): Honor it. (fd_ring_check): Debug code unconditionally uses O_NOATIME. Needed for findutils bug http://savannah.gnu.org/bugs/?33724 Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Thu, 07 Jul 2011 11:37:37 -0600
parents 97fc9a21a8fb
children 894e5e6ae541
line wrap: on
line diff
--- a/lib/fts_.h
+++ b/lib/fts_.h
@@ -142,7 +142,9 @@
      dirent.d_type data.  */
 # define FTS_DEFER_STAT         0x0400
 
-# define FTS_OPTIONMASK 0x07ff          /* valid user option mask */
+# define FTS_NOATIME    0x0800          /* use O_NOATIME during traversal */
+
+# define FTS_OPTIONMASK 0x0fff          /* valid user option mask */
 
 # define FTS_NAMEONLY   0x1000          /* (private) child names only */
 # define FTS_STOP       0x2000          /* (private) unrecoverable error */