netatalk: ftw.c File Reference

netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
ftw.c File Reference
`#include <alloca.h>`
`#include <dirent.h>`
`#include <errno.h>`
`#include <fcntl.h>`
`#include <limits.h>`
`#include <search.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <sys/param.h>`
`#include <sys/stat.h>`
`#include <unistd.h>`
`#include <atalk/util.h>`
`#include "ftw.h"`
`#include <assert.h>`

## Data Structures
struct | dir_data
struct | known_object
struct | ftw_data
struct | node_t

## Macros
#define | NAMLEN(dirent)
#define | mempcpy(D, S, N)
#define | NDEBUG 1
#define | __chdir chdir
#define | __closedir closedir
#define | __fchdir fchdir
#define | __getcwd(P, N)
#define | __mempcpy mempcpy
#define | __opendir opendir
#define | __readdir64 readdir
#define | __tdestroy tdestroy
#define | __tfind tfind
#define | __tsearch tsearch
#define | internal_function /* empty */
#define | dirent64 dirent
#define | __set_errno(Val)
#define | FTW_NAME ftw
#define | NFTW_NAME nftw
#define | NFTW_OLD_NAME __old_nftw
#define | NFTW_NEW_NAME __new_nftw
#define | STAT stat
#define | LXSTAT(V, f, sb)
#define | XSTAT(V, f, sb)
#define | FXSTATAT(V, d, f, sb, m)
#define | PATH_MAX 1024

## Typedefs
typedef void(* | __free_fn_t) (void *__nodep)
typedef struct node_t * | node

## Functions
static int | ftw_dir (struct ftw_data *data, struct STAT *st, struct dir_data *old_dir) internal_function
static void | tdestroy_recurse (node root, __free_fn_t freefct)
static void | mytdestroy (void *vroot, __free_fn_t freefct)
static char * | mystpcpy (char *dest, const char *src, size_t dest_size)
static char * | xgetcwd (void)
static int | object_compare (const void *p1, const void *p2)
static int | add_object (struct ftw_data *data, struct STAT *st)
static int | find_object (struct ftw_data *data, struct STAT *st)
static int | open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp)
static int | process_entry (struct ftw_data *data, struct dir_data *dir, const char *name, size_t namlen)
static int | ftw_startup (const char *dir, int is_nftw, nftw_func_t func, dir_notification_func_t up, int descriptors, int flags)
int | NFTW_NAME (const char *path, nftw_func_t func, dir_notification_func_t up, int descriptors, int flags)

## Variables
static const int | nftw_arr []
static const int | ftw_arr []
static dir_notification_func_t | upfunc

## Macro Definition Documentation

## ◆ __chdir

#define __chdir chdir

## ◆ __closedir

#define __closedir closedir

## ◆ __fchdir

#define __fchdir fchdir

## ◆ __getcwd

#define __getcwd | ( |  | P,
|  |  | N )

Value:
xgetcwd ()
xgetcwd
static char * xgetcwd(void)
Definition ftw.c:243

## ◆ __mempcpy

#define __mempcpy mempcpy

## ◆ __opendir

#define __opendir opendir

## ◆ __readdir64

#define __readdir64 readdir

## ◆ __set_errno

#define __set_errno | ( |  | Val | ) |

Value:
errno = (Val)

## ◆ __tdestroy

#define __tdestroy tdestroy

## ◆ __tfind

#define __tfind tfind

## ◆ __tsearch

#define __tsearch tsearch

## ◆ dirent64

#define dirent64 dirent

## ◆ FTW_NAME

#define FTW_NAME ftw

## ◆ FXSTATAT

#define FXSTATAT | ( |  | V,
|  |  | d,
|  |  | f,
|  |  | sb,
|  |  | m )

Value:
fstatat (d, f, sb, m)

## ◆ internal_function

#define internal_function /* empty */

## ◆ LXSTAT

#define LXSTAT | ( |  | V,
|  |  | f,
|  |  | sb )

Value:
lstat (f,sb)

## ◆ mempcpy

#define mempcpy | ( |  | D,
|  |  | S,
|  |  | N )

Value:
((void *) ((char *) memcpy (D, S, N) + (N)))

## ◆ NAMLEN

#define NAMLEN | ( |  | dirent | ) |

Value:
strlen ((dirent)->d_name)

## ◆ NDEBUG

#define NDEBUG 1

## ◆ NFTW_NAME

#define NFTW_NAME nftw

## ◆ NFTW_NEW_NAME

#define NFTW_NEW_NAME __new_nftw

## ◆ NFTW_OLD_NAME

#define NFTW_OLD_NAME __old_nftw

## ◆ PATH_MAX

#define PATH_MAX 1024

## ◆ STAT

#define STAT stat

## ◆ XSTAT

#define XSTAT | ( |  | V,
|  |  | f,
|  |  | sb )

Value:
stat (f,sb)

## Typedef Documentation

## ◆ __free_fn_t

typedef void(* __free_fn_t) (void *__nodep)

## ◆ node

typedef struct node_t * node

## Function Documentation

## ◆ add_object()

int add_object | ( | struct ftw_data * | data,
|  | struct STAT * | st )
| static

## ◆ find_object()

int find_object | ( | struct ftw_data * | data,
|  | struct STAT * | st )
| inlinestatic

## ◆ ftw_dir()

int ftw_dir | ( | struct ftw_data * | data,
|  | struct STAT * | st,
|  | struct dir_data * | old_dir )
| static

## ◆ ftw_startup()

int ftw_startup | ( | const char * | dir,
|  | int | is_nftw,
|  | nftw_func_t | func,
|  | dir_notification_func_t | up,
|  | int | descriptors,
|  | int | flags )
| static

## ◆ mystpcpy()

char * mystpcpy | ( | char * | dest,
|  | const char * | src,
|  | size_t | dest_size )
| static

## ◆ mytdestroy()

void mytdestroy | ( | void * | vroot,
|  | __free_fn_t | freefct )
| static

## ◆ NFTW_NAME()

int NFTW_NAME | ( | const char * | path,
|  | nftw_func_t | func,
|  | dir_notification_func_t | up,
|  | int | descriptors,
|  | int | flags )

## ◆ object_compare()

int object_compare | ( | const void * | p1,
|  | const void * | p2 )
| static

## ◆ open_dir_stream()

int open_dir_stream | ( | int * | dfdp,
|  | struct ftw_data * | data,
|  | struct dir_data * | dirp )
| inlinestatic

## ◆ process_entry()

int process_entry | ( | struct ftw_data * | data,
|  | struct dir_data * | dir,
|  | const char * | name,
|  | size_t | namlen )
| static

## ◆ tdestroy_recurse()

void tdestroy_recurse | ( | node | root,
|  | __free_fn_t | freefct )
| static

## ◆ xgetcwd()

char * xgetcwd | ( | void |  | ) |
| static

## Variable Documentation

## ◆ ftw_arr

const int ftw_arr[]
| static

Initial value:
= {
FTW_F, FTW_D, FTW_DNR, FTW_NS, FTW_F, FTW_D, FTW_NS
}
FTW_NS
#define FTW_NS
Definition ftw.h:36
FTW_F
#define FTW_F
Definition ftw.h:30
FTW_D
#define FTW_D
Definition ftw.h:32
FTW_DNR
#define FTW_DNR
Definition ftw.h:34

## ◆ nftw_arr

const int nftw_arr[]
| static

Initial value:
= {
FTW_F, FTW_D, FTW_DNR, FTW_NS, FTW_SL, FTW_DP, FTW_SLN
}
FTW_DP
#define FTW_DP
Definition ftw.h:42
FTW_SL
#define FTW_SL
Definition ftw.h:38
FTW_SLN
#define FTW_SLN
Definition ftw.h:44

## ◆ upfunc

dir_notification_func_t upfunc
| static