xref: /freebsd/lib/libc/gen/fts-compat11.h (revision b0d29bc47dba79f6f38e67eabadfb4b32ffd9390)
1 /*
2  * Copyright (c) 1989, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the University nor the names of its contributors
14  *    may be used to endorse or promote products derived from this software
15  *    without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  *	@(#)fts.h	8.3 (Berkeley) 8/14/94
30  * $FreeBSD$
31  */
32 
33 #ifndef	_FTS_COPMAT11_H_
34 #define	_FTS_COPMAT11_H_
35 
36 typedef struct {
37 	struct _ftsent11 *fts_cur;	/* current node */
38 	struct _ftsent11 *fts_child;	/* linked list of children */
39 	struct _ftsent11 **fts_array;	/* sort array */
40 	uint32_t fts_dev;		/* starting device # */
41 	char *fts_path;			/* path for this descent */
42 	int fts_rfd;			/* fd for root */
43 	__size_t fts_pathlen;		/* sizeof(path) */
44 	__size_t fts_nitems;		/* elements in the sort array */
45 	int (*fts_compar)		/* compare function */
46 	    (const struct _ftsent11 * const *,
47 	    const struct _ftsent11 * const *);
48 	int fts_options;		/* fts_open options, global flags */
49 	void *fts_clientptr;		/* thunk for sort function */
50 } FTS11;
51 
52 typedef struct _ftsent11 {
53 	struct _ftsent11 *fts_cycle;	/* cycle node */
54 	struct _ftsent11 *fts_parent;	/* parent directory */
55 	struct _ftsent11 *fts_link;	/* next file in directory */
56 	long long fts_number;		/* local numeric value */
57 	void *fts_pointer;		/* local address value */
58 	char *fts_accpath;		/* access path */
59 	char *fts_path;			/* root path */
60 	int fts_errno;			/* errno for this node */
61 	int fts_symfd;			/* fd for symlink */
62 	__size_t fts_pathlen;		/* strlen(fts_path) */
63 	__size_t fts_namelen;		/* strlen(fts_name) */
64 
65 	uint32_t fts_ino;		/* inode */
66 	uint32_t fts_dev;		/* device */
67 	uint16_t fts_nlink;		/* link count */
68 
69 	long fts_level;			/* depth (-1 to N) */
70 
71 	int fts_info;			/* user status for FTSENT structure */
72 
73 	unsigned fts_flags;		/* private flags for FTSENT structure */
74 
75 	int fts_instr;			/* fts_set() instructions */
76 
77 	struct freebsd11_stat *fts_statp; /* stat(2) information */
78 	char *fts_name;			/* file name */
79 	FTS11 *fts_fts;			/* back pointer to main FTS */
80 } FTSENT11;
81 
82 FTSENT11	*freebsd11_fts_children(FTS11 *, int);
83 int		 freebsd11_fts_close(FTS11 *);
84 void		*freebsd11_fts_get_clientptr(FTS11 *);
85 #define	freebsd11_fts_get_clientptr(fts)	((fts)->fts_clientptr)
86 FTS11		*freebsd11_fts_get_stream(FTSENT11 *);
87 #define	freebsd11_fts_get_stream(ftsent)	((ftsent)->fts_fts)
88 FTS11		*freebsd11_fts_open(char * const *, int,
89 		    int (*)(const FTSENT11 * const *,
90 		    const FTSENT11 * const *));
91 FTSENT11	*freebsd11_fts_read(FTS11 *);
92 int		 freebsd11_fts_set(FTS11 *, FTSENT11 *, int);
93 void		 freebsd11_fts_set_clientptr(FTS11 *, void *);
94 
95 #endif /* !_FTS_COMPAT11_H_ */
96