- Main Page
- Related Pages
- Modules
- Data Structures
- Files

# rpmio/fts.h

Go to the documentation of this file.

    00001 /*
    00002  * Copyright (c) 1989, 1993
    00003  *      The Regents of the University of California.  All rights reserved.
    00004  *
    00005  * Redistribution and use in source and binary forms, with or without
    00006  * modification, are permitted provided that the following conditions
    00007  * are met:
    00008  * 1. Redistributions of source code must retain the above copyright
    00009  *    notice, this list of conditions and the following disclaimer.
    00010  * 2. Redistributions in binary form must reproduce the above copyright
    00011  *    notice, this list of conditions and the following disclaimer in the
    00012  *    documentation and/or other materials provided with the distribution.
    00013  * 4. Neither the name of the University nor the names of its contributors
    00014  *    may be used to endorse or promote products derived from this software
    00015  *    without specific prior written permission.
    00016  *
    00017  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    00018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    00021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    00023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    00025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    00027  * SUCH DAMAGE.
    00028  *
    00029  *      @(#)fts.h       8.3 (Berkeley) 8/14/94
    00030  */
    00031
    00032 #ifndef _FTS_H
    00033 #define _FTS_H 1
    00034
    00035 #if defined(__GLIBC__)
    00036 #include <features.h>
    00037 #else
    00038 #   define __THROW
    00039 #if defined(hpux) || defined(__hpux)
    00040 # define        _INCLUDE_POSIX_SOURCE
    00041 # define        _LARGEFILE64_SOURCE
    00042 #endif
    00043 #endif
    00044
    00045 #include <sys/types.h>
    00046 #include <sys/stat.h>
    00047 #include <dirent.h>
    00048
    00049 typedef struct {
    00050 /*@owned@*/ /*@relnull@*/
    00051         struct _ftsent *fts_cur;
    00052 /*@owned@*/ /*@null@*/
    00053         struct _ftsent *fts_child;
    00054 /*@owned@*/ /*@null@*/
    00055         struct _ftsent **fts_array;
    00056         dev_t fts_dev;
    00057 /*@owned@*/ /*@relnull@*/
    00058         char *fts_path;
    00059         int fts_rfd;
    00060         int fts_pathlen;
    00061         int fts_nitems;
    00062 /*@null@*/
    00063         int (*fts_compar) (const void *, const void *)
    00064                 /*@*/;
    00066         DIR * (*fts_opendir) (const char * path)
    00067                 /*@globals fileSystem @*/
    00068                 /*@modifies fileSystem @*/;
    00069         struct dirent * (*fts_readdir) (DIR * dir)
    00070                 /*@globals fileSystem @*/
    00071                 /*@modifies *dir, fileSystem @*/;
    00072         int (*fts_closedir) (/*@only@*/ DIR * dir)
    00073                 /*@globals fileSystem @*/
    00074                 /*@modifies *dir, fileSystem @*/;
    00075         int (*fts_stat) (const char * path, /*@out@*/ struct stat * st)
    00076                 /*@globals fileSystem @*/
    00077                 /*@modifies *st, fileSystem @*/;
    00078         int (*fts_lstat) (const char * path, /*@out@*/ struct stat * st)
    00079                 /*@globals fileSystem @*/
    00080                 /*@modifies *st, fileSystem @*/;
    00081
    00082 #define FTS_COMFOLLOW   0x0001          /* follow command line symlinks */
    00083 #define FTS_LOGICAL     0x0002          /* logical walk */
    00084 #define FTS_NOCHDIR     0x0004          /* don't change directories */
    00085 #define FTS_NOSTAT      0x0008          /* don't get stat info */
    00086 #define FTS_PHYSICAL    0x0010          /* physical walk */
    00087 #define FTS_SEEDOT      0x0020          /* return dot and dot-dot */
    00088 #define FTS_XDEV        0x0040          /* don't cross devices */
    00089 #define FTS_WHITEOUT    0x0080          /* return whiteout information */
    00090 #define FTS_OPTIONMASK  0x00ff          /* valid user option mask */
    00091
    00092 #define FTS_NAMEONLY    0x0100          /* (private) child names only */
    00093 #define FTS_STOP        0x0200          /* (private) unrecoverable error */
    00094         int fts_options;
    00095 } FTS;
    00096
    00097 typedef struct _ftsent {
    00098 /*@dependent@*/
    00099         struct _ftsent *fts_cycle;
    00100 /*@dependent@*/ /*@relnull@*/
    00101         struct _ftsent *fts_parent;
    00102 /*@dependent@*/ /*@null@*/
    00103         struct _ftsent *fts_link;
    00104         long fts_number;
    00105 /*@null@*/
    00106         void *fts_pointer;
    00107 /*@dependent@*/
    00108         char *fts_accpath;
    00109 /*@dependent@*/
    00110         char *fts_path;
    00111         int fts_errno;
    00112         int fts_symfd;
    00113         u_short fts_pathlen;
    00114         u_short fts_namelen;
    00116         ino_t fts_ino;
    00117         dev_t fts_dev;
    00118         nlink_t fts_nlink;
    00120 #define FTS_ROOTPARENTLEVEL     -1
    00121 #define FTS_ROOTLEVEL            0
    00122         short fts_level;
    00124 #define FTS_D            1              /* preorder directory */
    00125 #define FTS_DC           2              /* directory that causes cycles */
    00126 #define FTS_DEFAULT      3              /* none of the above */
    00127 #define FTS_DNR          4              /* unreadable directory */
    00128 #define FTS_DOT          5              /* dot or dot-dot */
    00129 #define FTS_DP           6              /* postorder directory */
    00130 #define FTS_ERR          7              /* error; errno is set */
    00131 #define FTS_F            8              /* regular file */
    00132 #define FTS_INIT         9              /* initialized only */
    00133 #define FTS_NS          10              /* stat(2) failed */
    00134 #define FTS_NSOK        11              /* no stat(2) requested */
    00135 #define FTS_SL          12              /* symbolic link */
    00136 #define FTS_SLNONE      13              /* symbolic link without target */
    00137 #define FTS_W           14              /* whiteout object */
    00138         u_short fts_info;
    00140 #define FTS_DONTCHDIR    0x01           /* don't chdir .. to the parent */
    00141 #define FTS_SYMFOLLOW    0x02           /* followed a symlink to get here */
    00142         u_short fts_flags;
    00144 #define FTS_AGAIN        1              /* read node again */
    00145 #define FTS_FOLLOW       2              /* follow symbolic link */
    00146 #define FTS_NOINSTR      3              /* no instructions */
    00147 #define FTS_SKIP         4              /* discard node */
    00148         u_short fts_instr;
    00150 /*@dependent@*/
    00151         struct stat *fts_statp;
    00152         char fts_name[1];
    00153 } FTSENT;
    00154
    00155 #ifdef __cplusplus
    00156 extern "C" {
    00157 #endif
    00158
    00165 /*@dependent@*/ /*@null@*/
    00166 FTSENT  *Fts_children (FTS * sp, int instr) __THROW
    00167         /*@globals fileSystem, internalState @*/
    00168         /*@modifies *sp, fileSystem, internalState @*/;
    00169
    00175 int      Fts_close (/*@only@*/ /*@null@*/ FTS * sp) __THROW
    00176         /*@globals fileSystem, internalState @*/
    00177         /*@modifies *sp, fileSystem, internalState @*/;
    00178
    00186 /*@only@*/ /*@null@*/
    00187 FTS     *Fts_open (char * const * argv, int options,
    00188                    /*@null@*/
    00189                    int (*compar) (const FTSENT **, const FTSENT **)) __THROW
    00190         /*@*/;
    00191
    00197 /*@null@*/
    00198 FTSENT  *Fts_read (/*@null@*/ FTS * sp) __THROW
    00199         /*@globals fileSystem, internalState @*/
    00200         /*@modifies *sp, fileSystem, internalState @*/;
    00201
    00209 int      Fts_set (FTS * sp, FTSENT * p, int instr) __THROW
    00210         /*@modifies *p @*/;
    00211
    00212 #ifdef __cplusplus
    00213 }
    00214 #endif
    00215
    00216 #endif /* fts.h */