- of each entry until it actually processed. However, note that if you use
- this option and also specify a comparison function, that function may not
- examine any data via fts_statp. */
-# define FTS_DEFER_STAT 0x0400
-
-# define FTS_OPTIONMASK 0x07ff /* valid user option mask */
-
-# define FTS_NAMEONLY 0x1000 /* (private) child names only */
-# define FTS_STOP 0x2000 /* (private) unrecoverable error */
- int fts_options; /* fts_open options, global flags */
-
-# if !_LGPL_PACKAGE
- union {
- /* This data structure is used if FTS_TIGHT_CYCLE_CHECK is
- specified. It records the directories between a starting
- point and the current directory. I.e., a directory is
- recorded here IFF we have visited it once, but we have not
- yet completed processing of all its entries. Every time we
- visit a new directory, we add that directory to this set.
- When we finish with a directory (usually by visiting it a
- second time), we remove it from this set. Each entry in
- this data structure is a device/inode pair. This data
- structure is used to detect directory cycles efficiently and
- promptly even when the depth of a hierarchy is in the tens
- of thousands. */
- struct hash_table *ht;
-
- /* FIXME: rename these two members to have the fts_ prefix */
- /* This data structure uses a lazy cycle-detection algorithm,
- as done by rm via cycle-check.c. It's the default,
- but it's not appropriate for programs like du. */
- struct cycle_check_state *state;
- } fts_cycle;
-# endif
+ of each entry until it is actually processed. However, note that if you
+ use this option and also specify a comparison function, that function may
+ not examine any data via fts_statp. However, when fts_statp->st_mode is
+ nonzero, the S_IFMT type bits are valid, with mapped dirent.d_type data.
+ Of course, that happens only on file systems that provide useful
+ dirent.d_type data. */
+# define FTS_DEFER_STAT 0x0400
+
+# define FTS_OPTIONMASK 0x07ff /* valid user option mask */
+
+# define FTS_NAMEONLY 0x1000 /* (private) child names only */
+# define FTS_STOP 0x2000 /* (private) unrecoverable error */
+ int fts_options; /* fts_open options, global flags */
+
+ /* Map a directory's device number to a boolean. The boolean is
+ true if for that file system (type determined by a single fstatfs
+ call per FS) st_nlink can be used to calculate the number of
+ sub-directory entries in a directory.
+ Using this table is an optimization that permits us to look up
+ file system type on a per-inode basis at the minimal cost of
+ calling fstatfs only once per traversed device. */
+ struct hash_table *fts_leaf_optimization_works_ht;
+
+ union {
+ /* This data structure is used if FTS_TIGHT_CYCLE_CHECK is
+ specified. It records the directories between a starting
+ point and the current directory. I.e., a directory is
+ recorded here IFF we have visited it once, but we have not
+ yet completed processing of all its entries. Every time we
+ visit a new directory, we add that directory to this set.
+ When we finish with a directory (usually by visiting it a
+ second time), we remove it from this set. Each entry in
+ this data structure is a device/inode pair. This data
+ structure is used to detect directory cycles efficiently and
+ promptly even when the depth of a hierarchy is in the tens
+ of thousands. */
+ struct hash_table *ht;
+
+ /* FIXME: rename these two members to have the fts_ prefix */
+ /* This data structure uses a lazy cycle-detection algorithm,
+ as done by rm via cycle-check.c. It's the default,
+ but it's not appropriate for programs like du. */
+ struct cycle_check_state *state;
+ } fts_cycle;
+
+ /* A stack of the file descriptors corresponding to the
+ most-recently traversed parent directories.
+ Currently used only in FTS_CWDFD mode. */
+ I_ring fts_fd_ring;