Blame io/fts.h

Packit 6c4009
/* File tree traversal functions declarations.
Packit 6c4009
   Copyright (C) 1994-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Copyright (c) 1989, 1993
Packit 6c4009
 *	The Regents of the University of California.  All rights reserved.
Packit 6c4009
 *
Packit 6c4009
 * Redistribution and use in source and binary forms, with or without
Packit 6c4009
 * modification, are permitted provided that the following conditions
Packit 6c4009
 * are met:
Packit 6c4009
 * 1. Redistributions of source code must retain the above copyright
Packit 6c4009
 *    notice, this list of conditions and the following disclaimer.
Packit 6c4009
 * 2. Redistributions in binary form must reproduce the above copyright
Packit 6c4009
 *    notice, this list of conditions and the following disclaimer in the
Packit 6c4009
 *    documentation and/or other materials provided with the distribution.
Packit 6c4009
 * 4. Neither the name of the University nor the names of its contributors
Packit 6c4009
 *    may be used to endorse or promote products derived from this software
Packit 6c4009
 *    without specific prior written permission.
Packit 6c4009
 *
Packit 6c4009
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
Packit 6c4009
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 6c4009
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit 6c4009
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
Packit 6c4009
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 6c4009
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Packit 6c4009
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Packit 6c4009
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Packit 6c4009
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Packit 6c4009
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Packit 6c4009
 * SUCH DAMAGE.
Packit 6c4009
 *
Packit 6c4009
 *	@(#)fts.h	8.3 (Berkeley) 8/14/94
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifndef	_FTS_H
Packit 6c4009
#define	_FTS_H 1
Packit 6c4009
Packit 6c4009
#include <features.h>
Packit 6c4009
#include <sys/types.h>
Packit 6c4009
Packit 6c4009
Packit 6c4009
typedef struct {
Packit 6c4009
	struct _ftsent *fts_cur;	/* current node */
Packit 6c4009
	struct _ftsent *fts_child;	/* linked list of children */
Packit 6c4009
	struct _ftsent **fts_array;	/* sort array */
Packit 6c4009
	dev_t fts_dev;			/* starting device # */
Packit 6c4009
	char *fts_path;			/* path for this descent */
Packit 6c4009
	int fts_rfd;			/* fd for root */
Packit 6c4009
	int fts_pathlen;		/* sizeof(path) */
Packit 6c4009
	int fts_nitems;			/* elements in the sort array */
Packit 6c4009
	int (*fts_compar) (const void *, const void *); /* compare fn */
Packit 6c4009
Packit 6c4009
#define	FTS_COMFOLLOW	0x0001		/* follow command line symlinks */
Packit 6c4009
#define	FTS_LOGICAL	0x0002		/* logical walk */
Packit 6c4009
#define	FTS_NOCHDIR	0x0004		/* don't change directories */
Packit 6c4009
#define	FTS_NOSTAT	0x0008		/* don't get stat info */
Packit 6c4009
#define	FTS_PHYSICAL	0x0010		/* physical walk */
Packit 6c4009
#define	FTS_SEEDOT	0x0020		/* return dot and dot-dot */
Packit 6c4009
#define	FTS_XDEV	0x0040		/* don't cross devices */
Packit 6c4009
#define FTS_WHITEOUT	0x0080		/* return whiteout information */
Packit 6c4009
#define	FTS_OPTIONMASK	0x00ff		/* valid user option mask */
Packit 6c4009
Packit 6c4009
#define	FTS_NAMEONLY	0x0100		/* (private) child names only */
Packit 6c4009
#define	FTS_STOP	0x0200		/* (private) unrecoverable error */
Packit 6c4009
	int fts_options;		/* fts_open options, global flags */
Packit 6c4009
} FTS;
Packit 6c4009
Packit 6c4009
#ifdef __USE_LARGEFILE64
Packit 6c4009
typedef struct {
Packit 6c4009
	struct _ftsent64 *fts_cur;	/* current node */
Packit 6c4009
	struct _ftsent64 *fts_child;	/* linked list of children */
Packit 6c4009
	struct _ftsent64 **fts_array;	/* sort array */
Packit 6c4009
	dev_t fts_dev;			/* starting device # */
Packit 6c4009
	char *fts_path;			/* path for this descent */
Packit 6c4009
	int fts_rfd;			/* fd for root */
Packit 6c4009
	int fts_pathlen;		/* sizeof(path) */
Packit 6c4009
	int fts_nitems;			/* elements in the sort array */
Packit 6c4009
	int (*fts_compar) (const void *, const void *); /* compare fn */
Packit 6c4009
	int fts_options;		/* fts_open options, global flags */
Packit 6c4009
} FTS64;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
typedef struct _ftsent {
Packit 6c4009
	struct _ftsent *fts_cycle;	/* cycle node */
Packit 6c4009
	struct _ftsent *fts_parent;	/* parent directory */
Packit 6c4009
	struct _ftsent *fts_link;	/* next file in directory */
Packit 6c4009
	long fts_number;	        /* local numeric value */
Packit 6c4009
	void *fts_pointer;	        /* local address value */
Packit 6c4009
	char *fts_accpath;		/* access path */
Packit 6c4009
	char *fts_path;			/* root path */
Packit 6c4009
	int fts_errno;			/* errno for this node */
Packit 6c4009
	int fts_symfd;			/* fd for symlink */
Packit 6c4009
	unsigned short fts_pathlen;	/* strlen(fts_path) */
Packit 6c4009
	unsigned short fts_namelen;	/* strlen(fts_name) */
Packit 6c4009
Packit 6c4009
	ino_t fts_ino;			/* inode */
Packit 6c4009
	dev_t fts_dev;			/* device */
Packit 6c4009
	nlink_t fts_nlink;		/* link count */
Packit 6c4009
Packit 6c4009
#define	FTS_ROOTPARENTLEVEL	-1
Packit 6c4009
#define	FTS_ROOTLEVEL		 0
Packit 6c4009
	short fts_level;		/* depth (-1 to N) */
Packit 6c4009
Packit 6c4009
#define	FTS_D		 1		/* preorder directory */
Packit 6c4009
#define	FTS_DC		 2		/* directory that causes cycles */
Packit 6c4009
#define	FTS_DEFAULT	 3		/* none of the above */
Packit 6c4009
#define	FTS_DNR		 4		/* unreadable directory */
Packit 6c4009
#define	FTS_DOT		 5		/* dot or dot-dot */
Packit 6c4009
#define	FTS_DP		 6		/* postorder directory */
Packit 6c4009
#define	FTS_ERR		 7		/* error; errno is set */
Packit 6c4009
#define	FTS_F		 8		/* regular file */
Packit 6c4009
#define	FTS_INIT	 9		/* initialized only */
Packit 6c4009
#define	FTS_NS		10		/* stat(2) failed */
Packit 6c4009
#define	FTS_NSOK	11		/* no stat(2) requested */
Packit 6c4009
#define	FTS_SL		12		/* symbolic link */
Packit 6c4009
#define	FTS_SLNONE	13		/* symbolic link without target */
Packit 6c4009
#define FTS_W		14		/* whiteout object */
Packit 6c4009
	unsigned short fts_info;	/* user flags for FTSENT structure */
Packit 6c4009
Packit 6c4009
#define	FTS_DONTCHDIR	 0x01		/* don't chdir .. to the parent */
Packit 6c4009
#define	FTS_SYMFOLLOW	 0x02		/* followed a symlink to get here */
Packit 6c4009
	unsigned short fts_flags;	/* private flags for FTSENT structure */
Packit 6c4009
Packit 6c4009
#define	FTS_AGAIN	 1		/* read node again */
Packit 6c4009
#define	FTS_FOLLOW	 2		/* follow symbolic link */
Packit 6c4009
#define	FTS_NOINSTR	 3		/* no instructions */
Packit 6c4009
#define	FTS_SKIP	 4		/* discard node */
Packit 6c4009
	unsigned short fts_instr;	/* fts_set() instructions */
Packit 6c4009
Packit 6c4009
	struct stat *fts_statp;		/* stat(2) information */
Packit 6c4009
	char fts_name[1];		/* file name */
Packit 6c4009
} FTSENT;
Packit 6c4009
Packit 6c4009
#ifdef __USE_LARGEFILE64
Packit 6c4009
typedef struct _ftsent64 {
Packit 6c4009
	struct _ftsent64 *fts_cycle;	/* cycle node */
Packit 6c4009
	struct _ftsent64 *fts_parent;	/* parent directory */
Packit 6c4009
	struct _ftsent64 *fts_link;	/* next file in directory */
Packit 6c4009
	long fts_number;	        /* local numeric value */
Packit 6c4009
	void *fts_pointer;	        /* local address value */
Packit 6c4009
	char *fts_accpath;		/* access path */
Packit 6c4009
	char *fts_path;			/* root path */
Packit 6c4009
	int fts_errno;			/* errno for this node */
Packit 6c4009
	int fts_symfd;			/* fd for symlink */
Packit 6c4009
	unsigned short fts_pathlen;		/* strlen(fts_path) */
Packit 6c4009
	unsigned short fts_namelen;		/* strlen(fts_name) */
Packit 6c4009
Packit 6c4009
	ino64_t fts_ino;		/* inode */
Packit 6c4009
	dev_t fts_dev;			/* device */
Packit 6c4009
	nlink_t fts_nlink;		/* link count */
Packit 6c4009
Packit 6c4009
	short fts_level;		/* depth (-1 to N) */
Packit 6c4009
Packit 6c4009
	unsigned short fts_info;	/* user flags for FTSENT structure */
Packit 6c4009
Packit 6c4009
	unsigned short fts_flags;	/* private flags for FTSENT structure */
Packit 6c4009
Packit 6c4009
	unsigned short fts_instr;	/* fts_set() instructions */
Packit 6c4009
Packit 6c4009
	struct stat64 *fts_statp;	/* stat(2) information */
Packit 6c4009
	char fts_name[1];		/* file name */
Packit 6c4009
} FTSENT64;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
#ifndef __USE_FILE_OFFSET64
Packit 6c4009
FTSENT	*fts_children (FTS *, int);
Packit 6c4009
int	 fts_close (FTS *);
Packit 6c4009
FTS	*fts_open (char * const *, int,
Packit 6c4009
		   int (*)(const FTSENT **, const FTSENT **));
Packit 6c4009
FTSENT	*fts_read (FTS *);
Packit 6c4009
int	 fts_set (FTS *, FTSENT *, int) __THROW;
Packit 6c4009
#else
Packit 6c4009
# ifdef __REDIRECT
Packit 6c4009
FTSENT	*__REDIRECT (fts_children, (FTS *, int), fts64_children);
Packit 6c4009
int	 __REDIRECT (fts_close, (FTS *), fts64_close);
Packit 6c4009
FTS	*__REDIRECT (fts_open, (char * const *, int,
Packit 6c4009
				int (*)(const FTSENT **, const FTSENT **)),
Packit 6c4009
		     fts64_open);
Packit 6c4009
FTSENT	*__REDIRECT (fts_read, (FTS *), fts64_read);
Packit 6c4009
int	 __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), fts64_set);
Packit 6c4009
# else
Packit 6c4009
#  define fts_children fts64_children
Packit 6c4009
#  define fts_close fts64_close
Packit 6c4009
#  define fts_open fts64_open
Packit 6c4009
#  define fts_read fts64_read
Packit 6c4009
#  define fts_set fts64_set
Packit 6c4009
# endif
Packit 6c4009
#endif
Packit 6c4009
#ifdef __USE_LARGEFILE64
Packit 6c4009
FTSENT64 *fts64_children (FTS64 *, int);
Packit 6c4009
int	  fts64_close (FTS64 *);
Packit 6c4009
FTS64	 *fts64_open (char * const *, int,
Packit 6c4009
		      int (*)(const FTSENT64 **, const FTSENT64 **));
Packit 6c4009
FTSENT64 *fts64_read (FTS64 *);
Packit 6c4009
int	 fts64_set (FTS64 *, FTSENT64 *, int) __THROW;
Packit 6c4009
#endif
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif /* fts.h */