xref: /titanic_44/usr/src/lib/libast/i386/include/ast/fts.h (revision 5ee6ac27d4fd4c9412183aa8cc1143f36ae04a8c)
1 
2 /* : : generated by proto : : */
3 /***********************************************************************
4 *                                                                      *
5 *               This software is part of the ast package               *
6 *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
7 *                      and is licensed under the                       *
8 *                  Common Public License, Version 1.0                  *
9 *                    by AT&T Intellectual Property                     *
10 *                                                                      *
11 *                A copy of the License is available at                 *
12 *            http://www.opensource.org/licenses/cpl1.0.txt             *
13 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
14 *                                                                      *
15 *              Information and Software Systems Research               *
16 *                            AT&T Research                             *
17 *                           Florham Park NJ                            *
18 *                                                                      *
19 *                 Glenn Fowler <gsf@research.att.com>                  *
20 *                  David Korn <dgk@research.att.com>                   *
21 *                   Phong Vo <kpv@research.att.com>                    *
22 *                                                                      *
23 ***********************************************************************/
24 
25 /*
26  * Glenn Fowler
27  * David Korn
28  * Phong Vo
29  * AT&T Research
30  *
31  * fts interface definitions
32  */
33 
34 #ifndef	_FTS_H
35 #if !defined(__PROTO__)
36 #include <prototyped.h>
37 #endif
38 #if !defined(__LINKAGE__)
39 #define __LINKAGE__		/* 2004-08-11 transition */
40 #endif
41 
42 #define _FTS_H
43 
44 #include <ast_std.h>
45 #include <ast_fs.h>
46 #include <ast_mode.h>
47 
48 /*
49  * fts_open flags
50  */
51 
52 #define FTS_LOGICAL	0	/* logical traversal, follow symlinks	*/
53 #define FTS_META	(1<<0)	/* follow top dir symlinks even if phys	*/
54 #define FTS_NOCHDIR	(1<<1)	/* don't chdir				*/
55 #define FTS_NOPOSTORDER	(1<<2)	/* no postorder visits			*/
56 #define FTS_NOPREORDER	(1<<3)	/* no preorder visits			*/
57 #define FTS_NOSEEDOTDIR	(1<<11)	/* never retain leading . dir		*/
58 #define FTS_NOSTAT	(1<<4)	/* don't stat children			*/
59 #define FTS_ONEPATH	(1<<5)	/* pathnames arg is one const char*	*/
60 #define FTS_PHYSICAL	(1<<6)	/* physical traversal, don't follow	*/
61 #define FTS_SEEDOT	(1<<7)	/* return . and ..			*/
62 #define FTS_SEEDOTDIR	(1<<10)	/* always retain leading . dir		*/
63 #define FTS_TOP		(1<<8)	/* don't traverse subdirectories	*/
64 #define FTS_XDEV	(1<<9)	/* don't cross mount points		*/
65 
66 #define FTS_USER	(1<<12)	/* first user flag bit			*/
67 
68 #define FTS_COMFOLLOW	FTS_META
69 
70 /*
71  * fts_info flags
72  */
73 
74 #define FTS_DEFAULT	0	/* ok, someone must have wanted this	*/
75 
76 #define FTS_NS		(1<<0)	/* stat failed				*/
77 #define FTS_F		(1<<1)	/* file - not directory or symbolic link*/
78 #define FTS_SL		(1<<2)	/* symbolic link			*/
79 #define FTS_D		(1<<3)	/* directory - pre-order visit		*/
80 
81 #define FTS_C		(1<<4)	/* causes cycle				*/
82 #define FTS_ERR		(1<<5)	/* some other error			*/
83 #define FTS_DD		(1<<6)	/* . or ..				*/
84 #define FTS_NR		(1<<7)	/* cannot read				*/
85 #define FTS_NX		(1<<8)	/* cannot search			*/
86 #define FTS_OK		(1<<9)	/* no info but otherwise ok		*/
87 #define FTS_P		(1<<10)	/* post-order visit			*/
88 
89 #define FTS_DC		(FTS_D|FTS_C)	/* dir - would cause cycle	*/
90 #define FTS_DNR		(FTS_D|FTS_NR)	/* dir - no read permission	*/
91 #define FTS_DNX		(FTS_D|FTS_NX)	/* dir - no search permission	*/
92 #define FTS_DOT		(FTS_D|FTS_DD)	/* . or ..			*/
93 #define FTS_DP		(FTS_D|FTS_P)	/* dir - post-order visit	*/
94 #define FTS_NSOK	(FTS_NS|FTS_OK)	/* no stat (because you asked)	*/
95 #define FTS_SLNONE	(FTS_SL|FTS_NS)	/* symlink - to nowhere		*/
96 
97 /*
98  * fts_set flags
99  */
100 
101 #define FTS_AGAIN	FTS_TOP		/* process entry again		*/
102 #define FTS_FOLLOW	FTS_META	/* follow FTS_SL symlink	*/
103 #define FTS_SKIP	FTS_NOSTAT	/* skip FTS_D directory		*/
104 #define FTS_STAT	FTS_PHYSICAL	/* stat() done by user		*/
105 
106 typedef struct Fts FTS;
107 typedef struct Ftsent FTSENT;
108 
109 struct Ftsent
110 {
111 	char*		fts_accpath;	/* path relative to .		*/
112 	char*		fts_name;	/* file name			*/
113 	char*		fts_path;	/* path relative to top dir	*/
114 	FTSENT*		fts_cycle;	/* offender if cycle		*/
115 	FTSENT*		fts_link;	/* next child			*/
116 	FTSENT*		fts_parent;	/* parent directory		*/
117 	struct stat*	fts_statp;	/* stat info			*/
118 #ifdef _FTSENT_LOCAL_PRIVATE_
119 	_FTSENT_LOCAL_PRIVATE_
120 #else
121 	__V_*		fts_pointer;	/* local pointer value		*/
122 #endif
123 	long		fts_number;	/* local numeric value		*/
124 	int		fts_errno;	/* errno for this entry		*/
125 	unsigned short	fts_info;	/* info flags			*/
126 
127 	unsigned short	_fts_namelen;	/* old fts_namelen		*/
128 	unsigned short	_fts_pathlen;	/* old fts_pathlen		*/
129 	short		_fts_level;	/* old fts_level		*/
130 
131 	short		_fts_status;	/* <ftwalk.h> compatibility	*/
132 	struct stat	_fts_statb;	/* <ftwalk.h> compatibility	*/
133 
134 	FTS*		fts;		/* fts_open() handle		*/
135 	size_t		fts_namelen;	/* strlen(fts_name)		*/
136 	size_t		fts_pathlen;	/* strlen(fts_path)		*/
137 	ssize_t		fts_level;	/* file tree depth, 0 at top	*/
138 
139 #ifdef _FTSENT_PRIVATE_
140 	_FTSENT_PRIVATE_
141 #endif
142 
143 };
144 
145 struct Fts
146 {
147 	int		fts_errno;	/* last errno			*/
148 	__V_*		fts_handle;	/* user defined handle		*/
149 
150 #ifdef _FTS_PRIVATE_
151 	_FTS_PRIVATE_
152 #endif
153 
154 };
155 
156 #if _BLD_ast && defined(__EXPORT__)
157 #undef __MANGLE__
158 #define __MANGLE__ __LINKAGE__		__EXPORT__
159 #endif
160 
161 extern __MANGLE__ FTSENT*	fts_children __PROTO__((FTS*, int));
162 extern __MANGLE__ int	fts_close __PROTO__((FTS*));
163 extern __MANGLE__ int	fts_flags __PROTO__((void));
164 extern __MANGLE__ int	fts_local __PROTO__((FTSENT*));
165 extern __MANGLE__ int	fts_notify __PROTO__((int(*)(FTS*, FTSENT*, __V_*), __V_*));
166 extern __MANGLE__ FTS*	fts_open __PROTO__((char* const*, int, int(*)(FTSENT* const*, FTSENT* const*)));
167 extern __MANGLE__ FTSENT*	fts_read __PROTO__((FTS*));
168 extern __MANGLE__ int	fts_set __PROTO__((FTS*, FTSENT*, int));
169 
170 #undef __MANGLE__
171 #define __MANGLE__ __LINKAGE__
172 
173 #endif
174