xref: /freebsd/lib/libc/gen/fts-compat11.h (revision db33c6f3ae9d1231087710068ee4ea5398aacca7)
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 
30 #ifndef	_FTS_COPMAT11_H_
31 #define	_FTS_COPMAT11_H_
32 
33 typedef struct {
34 	struct _ftsent11 *fts_cur;	/* current node */
35 	struct _ftsent11 *fts_child;	/* linked list of children */
36 	struct _ftsent11 **fts_array;	/* sort array */
37 	uint32_t fts_dev;		/* starting device # */
38 	char *fts_path;			/* path for this descent */
39 	int fts_rfd;			/* fd for root */
40 	__size_t fts_pathlen;		/* sizeof(path) */
41 	__size_t fts_nitems;		/* elements in the sort array */
42 	int (*fts_compar)		/* compare function */
43 	    (const struct _ftsent11 * const *,
44 	    const struct _ftsent11 * const *);
45 	int fts_options;		/* fts_open options, global flags */
46 	void *fts_clientptr;		/* thunk for sort function */
47 } FTS11;
48 
49 typedef struct _ftsent11 {
50 	struct _ftsent11 *fts_cycle;	/* cycle node */
51 	struct _ftsent11 *fts_parent;	/* parent directory */
52 	struct _ftsent11 *fts_link;	/* next file in directory */
53 	long long fts_number;		/* local numeric value */
54 	void *fts_pointer;		/* local address value */
55 	char *fts_accpath;		/* access path */
56 	char *fts_path;			/* root path */
57 	int fts_errno;			/* errno for this node */
58 	int fts_symfd;			/* fd for symlink */
59 	__size_t fts_pathlen;		/* strlen(fts_path) */
60 	__size_t fts_namelen;		/* strlen(fts_name) */
61 
62 	uint32_t fts_ino;		/* inode */
63 	uint32_t fts_dev;		/* device */
64 	uint16_t fts_nlink;		/* link count */
65 
66 	long fts_level;			/* depth (-1 to N) */
67 
68 	int fts_info;			/* user status for FTSENT structure */
69 
70 	unsigned fts_flags;		/* private flags for FTSENT structure */
71 
72 	int fts_instr;			/* fts_set() instructions */
73 
74 	struct freebsd11_stat *fts_statp; /* stat(2) information */
75 	char *fts_name;			/* file name */
76 	FTS11 *fts_fts;			/* back pointer to main FTS */
77 } FTSENT11;
78 
79 FTSENT11	*freebsd11_fts_children(FTS11 *, int);
80 int		 freebsd11_fts_close(FTS11 *);
81 void		*freebsd11_fts_get_clientptr(FTS11 *);
82 #define	freebsd11_fts_get_clientptr(fts)	((fts)->fts_clientptr)
83 FTS11		*freebsd11_fts_get_stream(FTSENT11 *);
84 #define	freebsd11_fts_get_stream(ftsent)	((ftsent)->fts_fts)
85 FTS11		*freebsd11_fts_open(char * const *, int,
86 		    int (*)(const FTSENT11 * const *,
87 		    const FTSENT11 * const *));
88 FTSENT11	*freebsd11_fts_read(FTS11 *);
89 int		 freebsd11_fts_set(FTS11 *, FTSENT11 *, int);
90 void		 freebsd11_fts_set_clientptr(FTS11 *, void *);
91 
92 #endif /* !_FTS_COMPAT11_H_ */
93