1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/libc/include/fts.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,144 @@
1.4 +/*
1.5 + * Copyright (c) 1989, 1993
1.6 + * The Regents of the University of California. All rights reserved.
1.7 + *
1.8 + * Redistribution and use in source and binary forms, with or without
1.9 + * modification, are permitted provided that the following conditions
1.10 + * are met:
1.11 + * 1. Redistributions of source code must retain the above copyright
1.12 + * notice, this list of conditions and the following disclaimer.
1.13 + * 2. Redistributions in binary form must reproduce the above copyright
1.14 + * notice, this list of conditions and the following disclaimer in the
1.15 + * documentation and/or other materials provided with the distribution.
1.16 + * 4. Neither the name of the University nor the names of its contributors
1.17 + * may be used to endorse or promote products derived from this software
1.18 + * without specific prior written permission.
1.19 + *
1.20 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1.21 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.23 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1.24 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.25 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1.26 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.27 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1.28 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1.29 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1.30 + * SUCH DAMAGE.
1.31 + *
1.32 + * * Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
1.33 + * @(#)fts.h 8.3 (Berkeley) 8/14/94
1.34 + * $FreeBSD: src/include/fts.h,v 1.11 2005/01/07 00:06:20 pjd Exp $
1.35 + */
1.36 +
1.37 +#ifndef _FTS_H_
1.38 +#define _FTS_H_
1.39 +
1.40 +typedef struct {
1.41 + struct _ftsent *fts_cur; /* current node */
1.42 + struct _ftsent *fts_child; /* linked list of children */
1.43 + struct _ftsent **fts_array; /* sort array */
1.44 + dev_t fts_dev; /* starting device # */
1.45 + char *fts_path; /* path for this descent */
1.46 + int fts_rfd; /* fd for root */
1.47 + int fts_pathlen; /* sizeof(path) */
1.48 + int fts_nitems; /* elements in the sort array */
1.49 + int (*fts_compar) /* compare function */
1.50 + (const struct _ftsent * const *, const struct _ftsent * const *);
1.51 +
1.52 +#define FTS_COMFOLLOW 0x001 /* follow command line symlinks */
1.53 +#define FTS_LOGICAL 0x002 /* logical walk */
1.54 +#define FTS_NOCHDIR 0x004 /* don't change directories */
1.55 +#define FTS_NOSTAT 0x008 /* don't get stat info */
1.56 +#define FTS_PHYSICAL 0x010 /* physical walk */
1.57 +#define FTS_SEEDOT 0x020 /* return dot and dot-dot */
1.58 +#define FTS_XDEV 0x040 /* don't cross devices */
1.59 +#if (0)
1.60 +#define FTS_WHITEOUT 0x080 /* return whiteout information */
1.61 +#endif
1.62 +#define FTS_OPTIONMASK 0x0ff /* valid user option mask */
1.63 +
1.64 +#define FTS_NAMEONLY 0x100 /* (private) child names only */
1.65 +#define FTS_STOP 0x200 /* (private) unrecoverable error */
1.66 + int fts_options; /* fts_open options, global flags */
1.67 + void *fts_clientptr; /* thunk for sort function */
1.68 +} FTS;
1.69 +
1.70 +typedef struct _ftsent {
1.71 + struct _ftsent *fts_cycle; /* cycle node */
1.72 + struct _ftsent *fts_parent; /* parent directory */
1.73 + struct _ftsent *fts_link; /* next file in directory */
1.74 + union {
1.75 + struct {
1.76 + long __fts_number; /* local numeric value */
1.77 + void *__fts_pointer; /* local address value */
1.78 + } __struct_ftsent;
1.79 + int64_t __fts_bignum;
1.80 + } __union_ftsent;
1.81 +#define fts_number __union_ftsent.__struct_ftsent.__fts_number
1.82 +#define fts_pointer __union_ftsent.__struct_ftsent.__fts_pointer
1.83 +#define fts_bignum __union_ftsent.__fts_bignum
1.84 + char *fts_accpath; /* access path */
1.85 + char *fts_path; /* root path */
1.86 + int fts_errno; /* errno for this node */
1.87 + int fts_symfd; /* fd for symlink */
1.88 + u_short fts_pathlen; /* strlen(fts_path) */
1.89 + u_short fts_namelen; /* strlen(fts_name) */
1.90 +
1.91 + ino_t fts_ino; /* inode */
1.92 + dev_t fts_dev; /* device */
1.93 + nlink_t fts_nlink; /* link count */
1.94 +
1.95 +#define FTS_ROOTPARENTLEVEL -1
1.96 +#define FTS_ROOTLEVEL 0
1.97 + short fts_level; /* depth (-1 to N) */
1.98 +
1.99 +#define FTS_D 1 /* preorder directory */
1.100 +#define FTS_DC 2 /* directory that causes cycles */
1.101 +#define FTS_DEFAULT 3 /* none of the above */
1.102 +#define FTS_DNR 4 /* unreadable directory */
1.103 +#define FTS_DOT 5 /* dot or dot-dot */
1.104 +#define FTS_DP 6 /* postorder directory */
1.105 +#define FTS_ERR 7 /* error; errno is set */
1.106 +#define FTS_F 8 /* regular file */
1.107 +#define FTS_INIT 9 /* initialized only */
1.108 +#define FTS_NS 10 /* stat(2) failed */
1.109 +#define FTS_NSOK 11 /* no stat(2) requested */
1.110 +#define FTS_SL 12 /* symbolic link */
1.111 +#define FTS_SLNONE 13 /* symbolic link without target */
1.112 +#define FTS_W 14 /* whiteout object */
1.113 + u_short fts_info; /* user flags for FTSENT structure */
1.114 +
1.115 +#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */
1.116 +#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */
1.117 +#define FTS_ISW 0x04 /* this is a whiteout object */
1.118 + u_short fts_flags; /* private flags for FTSENT structure */
1.119 +
1.120 +#define FTS_AGAIN 1 /* read node again */
1.121 +#define FTS_FOLLOW 2 /* follow symbolic link */
1.122 +#define FTS_NOINSTR 3 /* no instructions */
1.123 +#define FTS_SKIP 4 /* discard node */
1.124 + u_short fts_instr; /* fts_set() instructions */
1.125 +
1.126 + struct stat *fts_statp; /* stat(2) information */
1.127 + char *fts_name; /* file name */
1.128 + FTS *fts_fts; /* back pointer to main FTS */
1.129 +} FTSENT;
1.130 +
1.131 +#include <sys/cdefs.h>
1.132 +
1.133 +__BEGIN_DECLS
1.134 +FTSENT *fts_children(FTS *, int);
1.135 +int fts_close(FTS *);
1.136 +void *fts_get_clientptr(FTS *);
1.137 +#define fts_get_clientptr(fts) ((fts)->fts_clientptr)
1.138 +FTS *fts_get_stream(FTSENT *);
1.139 +#define fts_get_stream(ftsent) ((ftsent)->fts_fts)
1.140 +FTS *fts_open(char * const *, int,
1.141 + int (*)(const FTSENT * const *, const FTSENT * const *));
1.142 +FTSENT *fts_read(FTS *);
1.143 +int fts_set(FTS *, FTSENT *, int);
1.144 +void fts_set_clientptr(FTS *, void *);
1.145 +__END_DECLS
1.146 +
1.147 +#endif /* !_FTS_H_ */