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