rpm 5.3.7
|
#include "system.h"
#include "fts.h"
#include <rpmio.h>
#include <rpmurl.h>
#include <rpmdir.h>
#include "debug.h"
Go to the source code of this file.
Defines | |
#define | _D_EXACT_NAMLEN(d) (strlen((d)->d_name)) |
#define | __set_errno(val) (*__errno_location ()) = (val) |
#define | __open open |
#define | __close close |
#define | __fchdir fchdir |
#define | USHRT_MAX 65535 |
#define | alignof(TYPE) ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2) |
#define | ALIGNBYTES (alignof(long double) - 1) |
#define | ALIGN(p) (((unsigned long int) (p) + ALIGNBYTES) & ~ALIGNBYTES) |
#define | ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '/' && !a[2]) || (a[1] == '.' && (!a[2] || (a[2] == '/' && !a[3]))))) |
#define | CLR(opt) (sp->fts_options &= ~(opt)) |
#define | ISSET(opt) (sp->fts_options & (opt)) |
#define | SET(opt) (sp->fts_options |= (opt)) |
#define | FCHDIR(sp, fd) (!ISSET(FTS_NOCHDIR) && __fchdir(fd)) |
#define | BCHILD 1 |
#define | BNAMES 2 |
#define | BREAD 3 |
#define | MAXPATHLEN 1024 |
#define | NAPPEND(p) |
#define | __opendir2(path, flag) (*sp->fts_opendir) (path) |
#define | ADJUST(p) |
Functions | |
static FTSENT * | fts_alloc (FTS *sp, const char *name, int namelen) |
static FTSENT * | fts_build (FTS *sp, int type) |
static void | fts_lfree (FTSENT *head) |
static void | fts_load (FTS *sp, FTSENT *p) |
static size_t | fts_maxarglen (char *const *argv) |
static void | fts_padjust (FTS *sp, FTSENT *head) |
static int | fts_palloc (FTS *sp, size_t more) |
static FTSENT * | fts_sort (FTS *sp, FTSENT *head, int nitems) |
static u_short | fts_stat (FTS *sp, FTSENT *p, int follow) |
static int | fts_safe_changedir (FTS *sp, FTSENT *p, int fd, const char *path) |
FTS * | Fts_open (char *const *argv, int options, int(*compar)(const FTSENT **, const FTSENT **)) |
Create a handle for file hierarchy traversal. | |
int | Fts_close (FTS *sp) |
Destroy a file hierarchy traversal handle. | |
static const char * | ftsInfoStr (int fts_info) |
FTSENT * | Fts_read (FTS *sp) |
Return next node in the file hierarchy traversal. | |
int | Fts_set (FTS *sp, FTSENT *p, int instr) |
Modify the traversal for a file set member. | |
FTSENT * | Fts_children (FTS *sp, int instr) |
Return list of children of the current node. | |
Variables | |
int | _fts_debug = 0 |
static int | indent = 2 |
static const char * | ftsInfoStrings [] |
#define __close close |
Definition at line 140 of file fts.c.
Referenced by Fts_children(), Fts_close(), Fts_read(), and fts_safe_changedir().
#define __fchdir fchdir |
Definition at line 141 of file fts.c.
Referenced by Fts_children(), Fts_close(), and fts_safe_changedir().
#define __open open |
Definition at line 139 of file fts.c.
Referenced by Fts_children(), Fts_open(), Fts_read(), and fts_safe_changedir().
#define __opendir2 | ( | path, | |
flag | |||
) | (*sp->fts_opendir) (path) |
Referenced by fts_build().
#define __set_errno | ( | val | ) | (*__errno_location ()) = (val) |
Definition at line 138 of file fts.c.
Referenced by fts_build(), Fts_children(), Fts_close(), Fts_open(), fts_palloc(), Fts_read(), fts_safe_changedir(), Fts_set(), and fts_stat().
#define _D_EXACT_NAMLEN | ( | d | ) | (strlen((d)->d_name)) |
Definition at line 128 of file fts.c.
Referenced by fts_build().
#define ADJUST | ( | p | ) |
do { \ if ((p)->fts_accpath != (p)->fts_name) { \ (p)->fts_accpath = \ (char *)addr + ((p)->fts_accpath - (p)->fts_path); \ } \ (p)->fts_path = addr; \ } while (0)
Referenced by fts_padjust().
#define ALIGN | ( | p | ) | (((unsigned long int) (p) + ALIGNBYTES) & ~ALIGNBYTES) |
Definition at line 161 of file fts.c.
Referenced by fts_alloc().
#define ALIGNBYTES (alignof(long double) - 1) |
Definition at line 157 of file fts.c.
Referenced by fts_alloc().
#define alignof | ( | TYPE | ) | ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2) |
#define BCHILD 1 |
Definition at line 202 of file fts.c.
Referenced by fts_build(), and Fts_children().
#define BNAMES 2 |
Definition at line 203 of file fts.c.
Referenced by fts_build(), and Fts_children().
#define BREAD 3 |
Definition at line 204 of file fts.c.
Referenced by fts_build(), and Fts_read().
#define CLR | ( | opt | ) | (sp->fts_options &= ~(opt)) |
Definition at line 195 of file fts.c.
Referenced by Fts_read().
#define FCHDIR | ( | sp, | |
fd | |||
) | (!ISSET(FTS_NOCHDIR) && __fchdir(fd)) |
Definition at line 199 of file fts.c.
Referenced by fts_build(), and Fts_read().
#define ISDOT | ( | a | ) | (a[0] == '.' && (!a[1] || (a[1] == '/' && !a[2]) || (a[1] == '.' && (!a[2] || (a[2] == '/' && !a[3]))))) |
Definition at line 193 of file fts.c.
Referenced by fts_build(), and fts_stat().
#define ISSET | ( | opt | ) | (sp->fts_options & (opt)) |
Definition at line 196 of file fts.c.
Referenced by fts_alloc(), fts_build(), Fts_children(), Fts_close(), Fts_open(), Fts_read(), fts_safe_changedir(), and fts_stat().
#define MAXPATHLEN 1024 |
Referenced by Fts_open(), main(), rlink(), rpmrepoInitPopt(), and rpmrepoRealpath().
#define NAPPEND | ( | p | ) |
(p->fts_path[p->fts_pathlen - 1] == '/' \
? p->fts_pathlen - 1 : p->fts_pathlen)
Definition at line 461 of file fts.c.
Referenced by fts_build(), and Fts_read().
#define SET | ( | opt | ) | (sp->fts_options |= (opt)) |
Definition at line 197 of file fts.c.
Referenced by fts_build(), Fts_children(), Fts_open(), and Fts_read().
#define USHRT_MAX 65535 |
Definition at line 145 of file fts.c.
Referenced by fts_build(), and fts_palloc().
Definition at line 1182 of file fts.c.
References ALIGN, ALIGNBYTES, _ftsent::fts_errno, _ftsent::fts_flags, _ftsent::fts_instr, _ftsent::fts_name, _ftsent::fts_namelen, FTS_NOINSTR, FTS_NOSTAT, _ftsent::fts_number, FTS::fts_path, _ftsent::fts_path, _ftsent::fts_pointer, _ftsent::fts_statp, _ftsent::fts_symfd, and ISSET.
Referenced by fts_build(), and Fts_open().
Definition at line 789 of file fts.c.
References __opendir2, __set_errno, _D_EXACT_NAMLEN, BCHILD, BNAMES, BREAD, dirent, errno, FCHDIR, _ftsent::fts_accpath, fts_alloc(), FTS::fts_closedir, FTS::fts_compar, FTS::fts_cur, FTS_D, FTS_DC, FTS_DNR, FTS_DONTCHDIR, FTS_DOT, FTS_DP, FTS_ERR, _ftsent::fts_errno, _ftsent::fts_flags, _ftsent::fts_info, _ftsent::fts_level, fts_lfree(), _ftsent::fts_link, _ftsent::fts_name, _ftsent::fts_namelen, _ftsent::fts_nlink, FTS_NOCHDIR, FTS_NOSTAT, FTS_NS, FTS_NSOK, fts_padjust(), fts_palloc(), _ftsent::fts_parent, _ftsent::fts_path, FTS::fts_path, _ftsent::fts_pathlen, FTS::fts_pathlen, FTS_PHYSICAL, FTS::fts_readdir, FTS::fts_rfd, FTS_ROOTLEVEL, fts_safe_changedir(), FTS_SEEDOT, fts_sort(), fts_stat(), FTS_STOP, FTS_WHITEOUT, ISDOT, ISSET, NAPPEND, nitems, SET, and USHRT_MAX.
Referenced by Fts_children(), and Fts_read().
Return list of children of the current node.
sp | file hierarchy state |
instr |
Definition at line 704 of file fts.c.
References __close, __fchdir, __open, __set_errno, _fts_debug, BCHILD, BNAMES, _ftsent::fts_accpath, fts_build(), FTS::fts_child, FTS::fts_cur, FTS_D, _ftsent::fts_info, FTS_INIT, _ftsent::fts_level, fts_lfree(), _ftsent::fts_link, FTS_NAMEONLY, FTS_NOCHDIR, FTS_ROOTLEVEL, FTS_STOP, ISSET, and SET.
Referenced by mtreeVisitD(), and rpmfts_Children().
int Fts_close | ( | FTS * | sp | ) |
Destroy a file hierarchy traversal handle.
sp | file hierarchy state |
Definition at line 379 of file fts.c.
References __close, __fchdir, __set_errno, _fts_debug, errno, FTS::fts_array, FTS::fts_child, FTS::fts_cur, _ftsent::fts_level, fts_lfree(), _ftsent::fts_link, FTS_NOCHDIR, _ftsent::fts_parent, FTS::fts_path, FTS::fts_rfd, FTS_ROOTLEVEL, and ISSET.
Referenced by mtreeCWalk(), mtreeVWalk(), recurseDir(), rpmcliWalkFirst(), rpmdcCWalk(), rpmfts_state(), rpmgiFini(), rpmgiNext(), rpmrepoDoFinalMove(), and rpmrepoGetFileList().
static void fts_lfree | ( | FTSENT * | head | ) | [static] |
Definition at line 1220 of file fts.c.
References _ftsent::fts_link.
Referenced by fts_build(), Fts_children(), Fts_close(), Fts_open(), and Fts_read().
Definition at line 355 of file fts.c.
References _ftsent::fts_accpath, _ftsent::fts_dev, FTS::fts_dev, _ftsent::fts_name, _ftsent::fts_namelen, _ftsent::fts_path, FTS::fts_path, and _ftsent::fts_pathlen.
Referenced by Fts_read().
static size_t fts_maxarglen | ( | char *const * | argv | ) | [static] |
Definition at line 1294 of file fts.c.
Referenced by Fts_open().
Create a handle for file hierarchy traversal.
argv | paths that compose a logical file hierarchy |
options | traversal options |
compar | traversal ordering (or NULL) |
Definition at line 207 of file fts.c.
References __open, __set_errno, _fts_debug, _ftsent::fts_accpath, fts_alloc(), FTS::fts_closedir, FTS_COMFOLLOW, FTS::fts_compar, FTS::fts_cur, FTS_D, FTS_DOT, _ftsent::fts_info, FTS_INIT, _ftsent::fts_level, fts_lfree(), _ftsent::fts_link, FTS_LOGICAL, FTS::fts_lstat, fts_maxarglen(), _ftsent::fts_name, FTS_NOCHDIR, FTS::fts_opendir, FTS_OPTIONMASK, FTS::fts_options, fts_palloc(), _ftsent::fts_parent, FTS::fts_path, FTS::fts_readdir, FTS::fts_rfd, FTS_ROOTLEVEL, FTS_ROOTPARENTLEVEL, fts_sort(), fts_stat(), FTS::fts_stat, ISSET, Lstat(), MAXPATHLEN, nitems, SET, Stat(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlIsURL().
Referenced by mtreeCWalk(), mtreeVWalk(), recurseDir(), rpmcliWalkFirst(), rpmdcCWalk(), rpmfts_state(), rpmgiNext(), rpmrepoDoFinalMove(), and rpmrepoGetFileList().
Definition at line 1270 of file fts.c.
References ADJUST, FTS::fts_child, _ftsent::fts_level, _ftsent::fts_link, _ftsent::fts_parent, FTS::fts_path, and FTS_ROOTLEVEL.
Referenced by fts_build().
static int fts_palloc | ( | FTS * | sp, |
size_t | more | ||
) | [static] |
Definition at line 1238 of file fts.c.
References __set_errno, FTS::fts_path, FTS::fts_pathlen, and USHRT_MAX.
Referenced by fts_build(), and Fts_open().
Return next node in the file hierarchy traversal.
sp | file hierarchy state |
Definition at line 466 of file fts.c.
References __close, __open, __set_errno, _fts_debug, BREAD, CLR, errno, FCHDIR, _ftsent::fts_accpath, FTS_AGAIN, fts_build(), FTS::fts_child, FTS::fts_cur, FTS_D, FTS::fts_dev, _ftsent::fts_dev, FTS_DONTCHDIR, FTS_DP, FTS_ERR, _ftsent::fts_errno, _ftsent::fts_flags, FTS_FOLLOW, _ftsent::fts_info, _ftsent::fts_instr, _ftsent::fts_level, fts_lfree(), _ftsent::fts_link, fts_load(), _ftsent::fts_name, _ftsent::fts_namelen, FTS_NAMEONLY, FTS_NOCHDIR, FTS_NOINSTR, _ftsent::fts_parent, _ftsent::fts_path, FTS::fts_path, _ftsent::fts_pathlen, FTS::fts_rfd, FTS_ROOTLEVEL, FTS_ROOTPARENTLEVEL, fts_safe_changedir(), FTS_SKIP, FTS_SL, FTS_SLNONE, fts_stat(), FTS_STOP, _ftsent::fts_symfd, FTS_SYMFOLLOW, FTS_XDEV, ftsInfoStr(), ISSET, name, NAPPEND, and SET.
Referenced by mtreeCWalk(), mtreeVWalk(), recurseDir(), rpmcliWalkFirst(), rpmdcCWalk(), rpmfts_step(), rpmgiWalkReadHeader(), rpmrepoDoFinalMove(), and rpmrepoGetFileList().
Definition at line 1310 of file fts.c.
References __close, __fchdir, __open, __set_errno, errno, _ftsent::fts_dev, _ftsent::fts_ino, FTS_NOCHDIR, ISSET, URL_IS_PATH, and urlPath().
Referenced by fts_build(), and Fts_read().
Modify the traversal for a file set member.
sp | file hierarchy state |
p | file set member |
instr | new disposition for file set member |
Definition at line 687 of file fts.c.
References __set_errno, _fts_debug, FTS_AGAIN, FTS_FOLLOW, _ftsent::fts_instr, FTS_NOINSTR, and FTS_SKIP.
Referenced by cacheWalkPathFilter(), mtreeCWalk(), mtreeVWalk(), rpmcliWalkFirst(), rpmdcCWalk(), and rpmfts_Set().
Definition at line 1146 of file fts.c.
References FTS::fts_array, FTS::fts_compar, _ftsent::fts_link, and FTS::fts_nitems.
Referenced by fts_build(), and Fts_open().
Definition at line 1066 of file fts.c.
References __set_errno, errno, _ftsent::fts_accpath, _ftsent::fts_cycle, FTS_D, FTS_DC, FTS_DEFAULT, _ftsent::fts_dev, FTS_DOT, _ftsent::fts_errno, FTS_F, _ftsent::fts_flags, _ftsent::fts_ino, _ftsent::fts_level, FTS_LOGICAL, FTS::fts_lstat, _ftsent::fts_name, _ftsent::fts_nlink, FTS_NOSTAT, FTS_NS, _ftsent::fts_parent, FTS_ROOTLEVEL, FTS_SL, FTS_SLNONE, FTS::fts_stat, _ftsent::fts_statp, FTS_W, ISDOT, ISSET, and S_ISLNK.
Referenced by fts_build(), Fts_open(), and Fts_read().
static const char* ftsInfoStr | ( | int | fts_info | ) | [static] |
Definition at line 450 of file fts.c.
Referenced by Fts_read().
int _fts_debug = 0 |
Definition at line 165 of file fts.c.
Referenced by Fts_children(), Fts_close(), Fts_open(), Fts_read(), and Fts_set().
const char* ftsInfoStrings[] [static] |