1 /* @(#)fetchdir.h	1.10 19/11/28 Copyright 2002-2019 J. Schilling */
2 /*
3  *	Copyright (c) 2002-2019 J. Schilling
4  */
5 /*
6  * The contents of this file are subject to the terms of the
7  * Common Development and Distribution License, Version 1.0 only
8  * (the "License").  You may not use this file except in compliance
9  * with the License.
10  *
11  * See the file CDDL.Schily.txt in this distribution for details.
12  * A copy of the CDDL is also available via the Internet at
13  * http://www.opensource.org/licenses/cddl1.txt
14  *
15  * When distributing Covered Code, include this CDDL HEADER in each
16  * file and include the License file CDDL.Schily.txt from this distribution.
17  */
18 
19 #ifndef _SCHILY_FETCHDIR_H
20 #define	_SCHILY_FETCHDIR_H
21 
22 #ifndef	_SCHILY_TYPES_H
23 #include <schily/types.h>
24 #endif
25 #ifndef	_SCHILY_DIRENT_H
26 #include <schily/dirent.h>		/* Includes mconfig.h if needed */
27 #endif
28 
29 /*
30  * The original value used to fill the info byte before each name was ^A (1).
31  * We thus need to make this value the "unknown" type value and this finally
32  * results in the FDT_* values be 1 + the UNIX file type value.
33  */
34 #define	FDT_UNKN	 1	/* Unknown, e.g dirent d_type is missing */
35 #define	FDT_FIFO	 2	/* A FIFO special named pipe		*/
36 #define	FDT_CHR		 3	/* A character special device node	*/
37 #define	FDT_DIR		 5	/* A directory				*/
38 #define	FDT_BLK		 7	/* A block special device node		*/
39 #define	FDT_REG		 9	/* A regular file			*/
40 #define	FDT_LNK		11	/* A symbolic link			*/
41 #define	FDT_SOCK	13	/* A socket special			*/
42 #define	FDT_WHT		15	/* A whiteout directory entry		*/
43 
44 #ifdef	__cplusplus
45 extern "C" {
46 #endif
47 
48 extern	char	*fetchdir	__PR((char *dir, size_t *entp, size_t *lenp,
49 					ino_t **inop));
50 extern	char	*dfetchdir	__PR((DIR *dir, char *__dirname, size_t *entp,
51 					size_t *lenp, ino_t **inop));
52 extern	int	fdircomp	__PR((const void *p1, const void *p2));
53 extern	char	**sortdir	__PR((char *dir, size_t *entp));
54 extern	int	cmpdir		__PR((size_t ents1, size_t ents2,
55 					char **ep1, char **ep2,
56 					char **oa, char **od,
57 					size_t *alenp, size_t *dlenp));
58 
59 #ifdef	__cplusplus
60 }
61 #endif
62 
63 #endif	/* _SCHILY_FETCHDIR_H */
64