1/*
2 *
3 *   Copyright (c) International Business Machines  Corp., 2002
4 *
5 *   This program is free software;  you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation; either version 2 of the License, or
8 *   (at your option) any later version.
9 *
10 *   This program is distributed in the hope that it will be useful,
11 *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13 *   the GNU General Public License for more details.
14 *
15 *   You should have received a copy of the GNU General Public License
16 *   along with this program;  if not, write to the Free Software
17 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20/* 10/31/2002   Port to LTP     robbiew@us.ibm.com */
21/* 06/30/2001   Port to Linux   nsharoff@us.ibm.com */
22
23
24/*
25 * NAME
26 *	nftw64.h - Header file for nftw64.c
27 */
28
29
30#ifndef _NFTW_H_
31#define _NFTW_H_
32
33#include <stdlib.h>
34#include <ftw.h>
35#include <unistd.h>
36#include <fcntl.h>
37#include <string.h>
38#include <dirent.h>
39#include <sys/stat.h>
40#include <sys/wait.h>
41#include <sys/types.h>
42#include <limits.h>
43#include <errno.h>
44#include <setjmp.h>
45#include <stdio.h>
46
47#include "test.h"
48
49#define STRLEN          512
50#define MAX_FD          20
51#define MAXOPENDIRS     1024    /* max opendirs to try to exhaust dir streams */
52#define NUM_2_VISIT     4
53#define RET_VAL         666
54#define NDIRLISTENTS    100
55#define ERR_BUF_SIZ     4096
56#define NFTW            "./tmp/data"
57#define NFTW2           "/tmp/data"
58#define LINK_CNT        13
59#define NO_LINK_CNT     7
60#define DIR             0
61#define REG             1
62#define SYM             2
63
64typedef struct pathdata {
65        char    name[PATH_MAX];
66        mode_t  mode;
67        int     type;
68        char    contents[STRLEN];
69} pathdata;
70
71struct list {
72	char	*s;
73	int	 i;
74};
75
76extern void fail_exit(void);
77
78/* These functions are found in test.c */
79extern void test1A(void);
80extern void test2A(void);
81extern void test3A(void);
82extern void test4A(void);
83extern void test5A(void);
84extern void test6A(void);
85extern void test7A(void);
86extern void test8A(void);
87extern void test9A(void);
88extern void test10A(void);
89extern void test11A(void);
90extern void test12A(void);
91extern void test13A(void);
92extern void test14A(void);
93extern void test15A(void);
94extern void test16A(void);
95extern void test17A(void);
96extern void test18A(void);
97extern void test19A(void);
98extern void test20A(void);
99extern void test21A(void);
100extern void test22A(void);
101extern void test23A(void);
102extern void test24A(void);
103extern void test25A(void);
104extern void test26A(void);
105extern void test27A(void);
106extern void test28A(void);
107extern void test29A(void);
108extern void test30A(void);
109
110/* These functions are found in test_func.c */
111extern int test_func1(const char *, const struct stat64 *, int, struct FTW *);
112extern int test_func3(const char *, const struct stat64 *, int, struct FTW *);
113extern int test_func4(const char *, const struct stat64 *, int, struct FTW *);
114extern int test_func5(const char *, const struct stat64 *, int, struct FTW *);
115extern int test_func7(const char *, const struct stat64 *, int, struct FTW *);
116extern int test_func8(const char *, const struct stat64 *, int, struct FTW *);
117extern int test_func9(const char *, const struct stat64 *, int, struct FTW *);
118extern int test_func10(const char *, const struct stat64 *, int, struct FTW *);
119extern int test_func11(const char *, const struct stat64 *, int, struct FTW *);
120extern int test_func12(const char *, const struct stat64 *, int, struct FTW *);
121extern int test_func13(const char *, const struct stat64 *, int, struct FTW *);
122extern int test_func14(const char *, const struct stat64 *, int, struct FTW *);
123extern int test_func15(const char *, const struct stat64 *, int, struct FTW *);
124extern int test_func16(const char *, const struct stat64 *, int, struct FTW *);
125extern int test_func17(const char *, const struct stat64 *, int, struct FTW *);
126extern int test_func18(const char *, const struct stat64 *, int, struct FTW *);
127extern int test_func19(const char *, const struct stat64 *, int, struct FTW *);
128extern int test_func20(const char *, const struct stat64 *, int, struct FTW *);
129extern int test_func21(const char *, const struct stat64 *, int, struct FTW *);
130extern int test_func22(const char *, const struct stat64 *, int, struct FTW *);
131extern int test_func23(const char *, const struct stat64 *, int, struct FTW *);
132
133/* These functions are found in tools.c */
134extern void cleanup_function(void);
135extern void setup_path(void);
136extern int nftw64_fn(const char *, const struct stat64 *, int, struct FTW *);
137extern char * ftw_mnemonic(int);
138extern int getbase(const char *);
139extern int getlev(const char *);
140extern void do_info(const char *);
141
142/* These functions are found in lib.c */
143extern void remove_test_ENOTDIR_files(void);
144extern void remove_test_ENOENT_files(void);
145extern void test_ENAMETOOLONG_path(char *, int (*)(const char *), int);
146extern void test_ENAMETOOLONG_name(char *, int (*)(const char *), int);
147extern void test_ENOENT_empty(char *, int (*)(const char *), int);
148extern void test_ENOTDIR(char *, int (*)(const char *), int);
149extern void test_ENOENT_nofile(char *, int (*)(const char *), int);
150
151
152#endif	/* _NFTW_H_ */
153