139802Sbostic /* 261068Sbostic * Copyright (c) 1989, 1993 361068Sbostic * The Regents of the University of California. All rights reserved. 439802Sbostic * 542613Sbostic * %sccs.include.redist.c% 639802Sbostic * 7*67677Smckusick * @(#)fts.h 8.3 (Berkeley) 08/14/94 839802Sbostic */ 939802Sbostic 1047767Sbostic #ifndef _FTS_H_ 1147767Sbostic #define _FTS_H_ 1247767Sbostic 1345618Sbostic typedef struct { 1445618Sbostic struct _ftsent *fts_cur; /* current node */ 1545618Sbostic struct _ftsent *fts_child; /* linked list of children */ 1645618Sbostic struct _ftsent **fts_array; /* sort array */ 1752207Sbostic dev_t fts_dev; /* starting device # */ 1841941Sbostic char *fts_path; /* path for this descent */ 1947187Sbostic int fts_rfd; /* fd for root */ 2041941Sbostic int fts_pathlen; /* sizeof(path) */ 2141941Sbostic int fts_nitems; /* elements in the sort array */ 2241941Sbostic int (*fts_compar)(); /* compare function */ 2347187Sbostic 2452343Sbostic #define FTS_COMFOLLOW 0x001 /* follow command line symlinks */ 2552343Sbostic #define FTS_LOGICAL 0x002 /* logical walk */ 2652343Sbostic #define FTS_NOCHDIR 0x004 /* don't change directories */ 2752343Sbostic #define FTS_NOSTAT 0x008 /* don't get stat info */ 2852343Sbostic #define FTS_PHYSICAL 0x010 /* physical walk */ 2952343Sbostic #define FTS_SEEDOT 0x020 /* return dot and dot-dot */ 3052768Sbostic #define FTS_XDEV 0x040 /* don't cross devices */ 3167575Spendry #define FTS_WHITEOUT 0x080 /* return whiteout information */ 3267575Spendry #define FTS_OPTIONMASK 0x0ff /* valid user option mask */ 3352768Sbostic 3467575Spendry #define FTS_NAMEONLY 0x100 /* (private) child names only */ 3567575Spendry #define FTS_STOP 0x200 /* (private) unrecoverable error */ 3652768Sbostic int fts_options; /* fts_open options, global flags */ 3739802Sbostic } FTS; 3839802Sbostic 3945618Sbostic typedef struct _ftsent { 4052074Sbostic struct _ftsent *fts_cycle; /* cycle node */ 4145618Sbostic struct _ftsent *fts_parent; /* parent directory */ 4252074Sbostic struct _ftsent *fts_link; /* next file in directory */ 4352843Selan long fts_number; /* local numeric value */ 4452843Selan void *fts_pointer; /* local address value */ 4545618Sbostic char *fts_accpath; /* access path */ 4645618Sbostic char *fts_path; /* root path */ 4752159Sbostic int fts_errno; /* errno for this node */ 4852291Sbostic int fts_symfd; /* fd for symlink */ 4952207Sbostic u_short fts_pathlen; /* strlen(fts_path) */ 5052207Sbostic u_short fts_namelen; /* strlen(fts_name) */ 5147210Sbostic 5252207Sbostic ino_t fts_ino; /* inode */ 5352207Sbostic dev_t fts_dev; /* device */ 5452207Sbostic nlink_t fts_nlink; /* link count */ 5552207Sbostic 5647210Sbostic #define FTS_ROOTPARENTLEVEL -1 5747210Sbostic #define FTS_ROOTLEVEL 0 5841941Sbostic short fts_level; /* depth (-1 to N) */ 5947187Sbostic 6039802Sbostic #define FTS_D 1 /* preorder directory */ 6139802Sbostic #define FTS_DC 2 /* directory that causes cycles */ 6247187Sbostic #define FTS_DEFAULT 3 /* none of the above */ 6347187Sbostic #define FTS_DNR 4 /* unreadable directory */ 6452207Sbostic #define FTS_DOT 5 /* dot or dot-dot */ 6552207Sbostic #define FTS_DP 6 /* postorder directory */ 6652207Sbostic #define FTS_ERR 7 /* error; errno is set */ 6752207Sbostic #define FTS_F 8 /* regular file */ 6852207Sbostic #define FTS_INIT 9 /* initialized only */ 6952207Sbostic #define FTS_NS 10 /* stat(2) failed */ 7052207Sbostic #define FTS_NSOK 11 /* no stat(2) requested */ 7152207Sbostic #define FTS_SL 12 /* symbolic link */ 7252207Sbostic #define FTS_SLNONE 13 /* symbolic link without target */ 7367575Spendry #define FTS_W 14 /* whiteout object */ 7447187Sbostic u_short fts_info; /* user flags for FTSENT structure */ 7547187Sbostic 7652291Sbostic #define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */ 7753378Sbostic #define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */ 7867575Spendry #define FTS_ISW 0x04 /* this is a whiteout object */ 7952291Sbostic u_short fts_flags; /* private flags for FTSENT structure */ 8052291Sbostic 8147187Sbostic #define FTS_AGAIN 1 /* read node again */ 8247187Sbostic #define FTS_FOLLOW 2 /* follow symbolic link */ 8347187Sbostic #define FTS_NOINSTR 3 /* no instructions */ 8447187Sbostic #define FTS_SKIP 4 /* discard node */ 8547187Sbostic u_short fts_instr; /* fts_set() instructions */ 8647187Sbostic 8752207Sbostic struct stat *fts_statp; /* stat(2) information */ 8841941Sbostic char fts_name[1]; /* file name */ 8939802Sbostic } FTSENT; 9039802Sbostic 9146358Sbostic #include <sys/cdefs.h> 9246358Sbostic 9346358Sbostic __BEGIN_DECLS 9452768Sbostic FTSENT *fts_children __P((FTS *, int)); 9546358Sbostic int fts_close __P((FTS *)); 9651822Sbostic FTS *fts_open __P((char * const *, int, 9751822Sbostic int (*)(const FTSENT **, const FTSENT **))); 9846358Sbostic FTSENT *fts_read __P((FTS *)); 9946358Sbostic int fts_set __P((FTS *, FTSENT *, int)); 10046358Sbostic __END_DECLS 10147767Sbostic 10247767Sbostic #endif /* !_FTS_H_ */ 103